/* ===========================
   Nexus Theme System
   =========================== */

/* Dark Theme (Default) */
.theme-dark {
    --nx-bg-primary: #0a0a0f;
    --nx-bg-secondary: #12121a;
    --nx-bg-tertiary: #1a1a24;
    --nx-bg-card: #14141e;
    --nx-border: rgba(255, 255, 255, 0.08);
    --nx-border-hover: rgba(255, 255, 255, 0.15);
    --nx-text-primary: #ffffff;
    --nx-text-secondary: rgba(255, 255, 255, 0.7);
    --nx-text-muted: rgba(255, 255, 255, 0.45);
    --nx-accent: #6366f1;
    --nx-accent-light: #818cf8;
    --nx-success: #10b981;
    --nx-warning: #f59e0b;
    --nx-danger: #ef4444;
    --nx-info: #3b82f6;
    --nx-sidebar-bg: linear-gradient(180deg, #12121a 0%, #0d0d14 100%);
    --nx-header-bg: rgba(18, 18, 26, 0.8);
    --nx-scrollbar-thumb: rgba(255, 255, 255, 0.1);
    --nx-scrollbar-thumb-hover: rgba(255, 255, 255, 0.2);
}

/* Light Theme */
.theme-light {
    --nx-bg-primary: #f8fafc;
    --nx-bg-secondary: #ffffff;
    --nx-bg-tertiary: #f1f5f9;
    --nx-bg-card: #ffffff;
    --nx-border: rgba(0, 0, 0, 0.1);
    --nx-border-hover: rgba(0, 0, 0, 0.2);
    --nx-text-primary: #1e293b;
    --nx-text-secondary: #475569;
    --nx-text-muted: #94a3b8;
    --nx-accent: #4f46e5;
    --nx-accent-light: #6366f1;
    --nx-success: #059669;
    --nx-warning: #d97706;
    --nx-danger: #dc2626;
    --nx-info: #2563eb;
    --nx-sidebar-bg: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    --nx-header-bg: rgba(255, 255, 255, 0.9);
    --nx-scrollbar-thumb: rgba(0, 0, 0, 0.15);
    --nx-scrollbar-thumb-hover: rgba(0, 0, 0, 0.25);
}

/* ===========================
   Base Styles
   =========================== */

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--nx-bg-primary);
    color: var(--nx-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--nx-text-primary);
    font-weight: 600;
}

h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.text-muted {
    color: var(--nx-text-muted) !important;
}

a {
    color: var(--nx-accent-light);
    text-decoration: none;
}

a:hover {
    color: var(--nx-accent);
}

/* Cards */
.card {
    background: var(--nx-bg-card);
    border: 1px solid var(--nx-border);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

.card:hover {
    border-color: var(--nx-border-hover);
}

.card-header {
    background: rgba(128, 128, 128, 0.05);
    border-bottom: 1px solid var(--nx-border);
    padding: 16px 20px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-footer {
    background: rgba(128, 128, 128, 0.05);
    border-top: 1px solid var(--nx-border);
    padding: 16px 20px;
}

.card-title {
    color: var(--nx-text-primary);
    margin-bottom: 8px;
}

.card-text {
    color: var(--nx-text-secondary);
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.15s ease;
    border: none;
}

.btn-primary {
    background: var(--nx-accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--nx-accent-light);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-success {
    background: var(--nx-success);
    color: #fff;
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-warning {
    background: var(--nx-warning);
    color: #000;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--nx-danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--nx-accent);
    color: var(--nx-accent-light);
}

.btn-outline-primary:hover {
    background: var(--nx-accent);
    color: #fff;
}

.btn-outline-secondary {
    background: transparent;
    border: 1px solid var(--nx-border);
    color: var(--nx-text-secondary);
}

.btn-outline-secondary:hover {
    background: rgba(128, 128, 128, 0.1);
    border-color: var(--nx-border-hover);
    color: var(--nx-text-primary);
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--nx-danger);
    color: var(--nx-danger);
}

.btn-outline-danger:hover {
    background: var(--nx-danger);
    color: #fff;
}

.btn-link {
    color: var(--nx-accent-light);
}

.btn:focus, .btn:active:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

/* Forms */
.form-control, .form-select {
    background: var(--nx-bg-tertiary);
    border: 1px solid var(--nx-border);
    border-radius: 8px;
    color: var(--nx-text-primary);
    padding: 10px 14px;
    transition: background-color 0.3s ease, border-color 0.2s ease;
}

.form-control:focus, .form-select:focus {
    background: var(--nx-bg-tertiary);
    border-color: var(--nx-accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    color: var(--nx-text-primary);
}

.form-control::placeholder {
    color: var(--nx-text-muted);
}

.form-label {
    color: var(--nx-text-secondary);
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 6px;
}

.form-check-input {
    background-color: var(--nx-bg-tertiary);
    border-color: var(--nx-border);
}

.form-check-input:checked {
    background-color: var(--nx-accent);
    border-color: var(--nx-accent);
}

/* Tables */
.table {
    color: var(--nx-text-primary);
}

.table > :not(caption) > * > * {
    background: transparent;
    border-color: var(--nx-border);
    padding: 14px 16px;
}

.table-hover > tbody > tr:hover > * {
    background: rgba(128, 128, 128, 0.05);
}

.table-light {
    background: rgba(128, 128, 128, 0.05) !important;
}

.table-light th {
    color: var(--nx-text-secondary);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-active {
    background: rgba(99, 102, 241, 0.1) !important;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
}

.bg-primary { background: var(--nx-accent) !important; }
.bg-success { background: var(--nx-success) !important; }
.bg-warning { background: var(--nx-warning) !important; color: #000 !important; }
.bg-danger { background: var(--nx-danger) !important; }
.bg-info { background: var(--nx-info) !important; }
.bg-secondary { background: rgba(128, 128, 128, 0.2) !important; color: var(--nx-text-secondary) !important; }
.bg-dark { background: rgba(0, 0, 0, 0.4) !important; }

.text-dark { color: #000 !important; }

/* Alerts */
.alert {
    border-radius: 10px;
    border: none;
    padding: 16px 20px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--nx-success);
    border-left: 4px solid var(--nx-success);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--nx-warning);
    border-left: 4px solid var(--nx-warning);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--nx-danger);
    border-left: 4px solid var(--nx-danger);
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--nx-info);
    border-left: 4px solid var(--nx-info);
}

/* List Groups */
.list-group {
    border-radius: 10px;
    overflow: hidden;
}

.list-group-item {
    background: var(--nx-bg-card);
    border-color: var(--nx-border);
    color: var(--nx-text-primary);
    padding: 16px 20px;
    transition: background-color 0.15s ease;
}

.list-group-item:hover {
    background: rgba(128, 128, 128, 0.05);
}

.list-group-flush > .list-group-item {
    border-radius: 0;
}

/* Modals */
.modal-content {
    background: var(--nx-bg-secondary);
    border: 1px solid var(--nx-border);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
    border-bottom: 1px solid var(--nx-border);
    padding: 20px 24px;
}

.modal-title {
    font-weight: 600;
    color: var(--nx-text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid var(--nx-border);
    padding: 16px 24px;
}

.theme-dark .btn-close {
    filter: invert(1);
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 1;
}

/* Breadcrumbs */
.breadcrumb {
    background: transparent;
    margin-bottom: 16px;
}

.breadcrumb-item a {
    color: var(--nx-text-muted);
}

.breadcrumb-item.active {
    color: var(--nx-text-primary);
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--nx-text-muted);
}

/* Progress Bars */
.progress {
    background: rgba(128, 128, 128, 0.15);
    border-radius: 6px;
    height: 8px;
}

.progress-bar {
    border-radius: 6px;
}

/* Spinners */
.spinner-border {
    color: var(--nx-accent);
}

/* Containers */
.container, .container-fluid {
    padding-left: 0;
    padding-right: 0;
}

/* Side Panels (shared style) */
.side-panel-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1040;
}

.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 500px;
    max-width: 90vw;
    height: 100vh;
    z-index: 1050;
    overflow-y: auto;
    background: var(--nx-bg-secondary);
    border-left: 1px solid var(--nx-border);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.2);
}

/* Gap utilities */
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }

/* Priority Colors */
.priority-critical { border-color: var(--nx-danger); }
.priority-high { border-color: var(--nx-warning); }
.priority-medium { border-color: var(--nx-info); }
.priority-low { border-color: var(--nx-text-muted); }

/* Living Card Animations */
.living-card {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.living-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Active shimmer progress */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.active-progress-bar {
    background: linear-gradient(to right, var(--nx-accent) 4%, var(--nx-accent-light) 25%, var(--nx-accent) 36%);
    background-size: 1000px 100%;
    animation: shimmer 3s infinite linear;
}

/* Pulse animation for critical items */
@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.pulse-active.priority-critical {
    animation: pulse-red 2s infinite;
}

/* Validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--nx-success);
}

.invalid {
    outline: 1px solid var(--nx-danger);
}

.validation-message {
    color: var(--nx-danger);
    font-size: 13px;
    margin-top: 4px;
}

/* Blazor error boundary */
.blazor-error-boundary {
    background: var(--nx-danger);
    padding: 16px 20px;
    color: white;
    border-radius: 8px;
    margin: 16px 0;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--nx-scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--nx-scrollbar-thumb-hover);
}

/* Code blocks */
pre, code {
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
}

pre {
    background: var(--nx-bg-tertiary);
    border: 1px solid var(--nx-border);
    border-radius: 8px;
    padding: 16px;
    color: var(--nx-text-primary);
    font-size: 13px;
    overflow-x: auto;
}

/* Stat displays */
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
    font-weight: 700;
    color: var(--nx-text-primary);
}

.text-primary { color: var(--nx-accent-light) !important; }
.text-success { color: var(--nx-success) !important; }
.text-warning { color: var(--nx-warning) !important; }
.text-danger { color: var(--nx-danger) !important; }
.text-info { color: var(--nx-info) !important; }

/* Background light override */
.bg-light {
    background: var(--nx-bg-tertiary) !important;
}

/* Rounded corners */
.rounded { border-radius: 8px !important; }
.rounded-lg { border-radius: 12px !important; }

/* Shadow utilities */
.shadow-sm { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important; }
.shadow { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important; }
.shadow-lg { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important; }

/* Purple badge for AI */
.bg-purple {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%) !important;
    color: #fff !important;
}

/* Theme toggle button */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--nx-border);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.theme-toggle:hover {
    background: rgba(128, 128, 128, 0.1);
    border-color: var(--nx-border-hover);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    color: var(--nx-text-secondary);
}

.theme-toggle:hover svg {
    color: var(--nx-text-primary);
}

/* ===========================
   Results Dashboard Layout
   =========================== */

.results-dashboard {
    display: flex;
    min-height: calc(100vh - 60px);
    gap: 0;
}

.results-sidebar-container {
    width: 280px;
    min-width: 280px;
    background: var(--nx-bg-secondary);
    border-right: 1px solid var(--nx-border);
    overflow-y: auto;
    height: calc(100vh - 60px);
    position: sticky;
    top: 60px;
}

.results-main-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    max-width: 1200px;
}

/* Mobile sidebar toggle */
.mobile-sidebar-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--nx-accent);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    z-index: 1000;
    display: none;
}

@media (max-width: 991px) {
    .results-sidebar-container {
        position: fixed;
        left: -280px;
        top: 60px;
        z-index: 1001;
        transition: left 0.3s ease;
    }

    .results-sidebar-container.mobile-open {
        left: 0;
    }

    .mobile-sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .results-main-content {
        padding: 16px;
    }
}

/* ===========================
   Results Sidebar Component
   =========================== */

.results-sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--nx-border);
}

.sidebar-loading,
.sidebar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    gap: 12px;
}

.sidebar-list {
    flex: 1;
    overflow-y: auto;
}

.sidebar-section {
    padding: 8px 0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--nx-text-muted);
}

.sidebar-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}

.sidebar-item:hover {
    background: rgba(128, 128, 128, 0.05);
}

.sidebar-item.selected {
    background: rgba(99, 102, 241, 0.1);
    border-left-color: var(--nx-accent);
}

.sidebar-item.newly-completed {
    animation: sidebarGlow 2s ease-in-out;
}

@keyframes sidebarGlow {
    0%, 100% { background: transparent; }
    50% { background: rgba(16, 185, 129, 0.15); }
}

.item-indicator {
    width: 4px;
    height: 32px;
    border-radius: 2px;
    flex-shrink: 0;
}

.indicator-directive { background: var(--nx-accent); }
.indicator-scheduled { background: var(--nx-info); }
.indicator-manual { background: var(--nx-text-muted); }

.item-content {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--nx-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--nx-text-muted);
}

.execution-badge {
    background: var(--nx-info);
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
}

.findings-count {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===========================
   Result Hero Section
   =========================== */

.result-hero {
    background: var(--nx-bg-card);
    border: 1px solid var(--nx-border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.result-hero.newly-completed {
    animation: heroGlow 3s ease-in-out;
}

@keyframes heroGlow {
    0%, 100% { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
    50% { box-shadow: 0 0 30px rgba(16, 185, 129, 0.3); }
}

.hero-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.hero-badges {
    display: flex;
    gap: 8px;
}

.hero-actions {
    display: flex;
    gap: 8px;
}

.hero-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--nx-text-primary);
    margin-bottom: 8px;
}

.hero-description {
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--nx-border);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--nx-text-secondary);
}

/* ===========================
   Executive Summary Component
   =========================== */

.executive-summary-section {
    background: var(--nx-bg-card);
    border: 1px solid var(--nx-border);
    border-radius: 12px;
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
}

.executive-summary-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.executive-summary-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--nx-border);
}

.executive-summary-section .header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--nx-text-primary);
}

.summary-content {
    padding: 20px;
    line-height: 1.7;
    color: var(--nx-text-secondary);
}

.summary-content.collapsed {
    max-height: 200px;
    overflow: hidden;
    position: relative;
}

.summary-content.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(transparent, var(--nx-bg-card));
}

.summary-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px;
    color: var(--nx-text-muted);
}

.summary-text p {
    margin-bottom: 16px;
}

.summary-text .highlight-number {
    color: var(--nx-accent-light);
    font-weight: 600;
}

.summary-text .highlight-quote {
    font-style: italic;
    color: var(--nx-text-primary);
}

.summary-text .bullet-point {
    display: block;
    padding-left: 16px;
    position: relative;
}

.summary-text .bullet-point::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    background: var(--nx-accent);
    border-radius: 50%;
}

.expand-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: transparent;
    border: none;
    border-top: 1px solid var(--nx-border);
    color: var(--nx-accent-light);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.expand-toggle:hover {
    background: rgba(99, 102, 241, 0.05);
}

/* ===========================
   Key Highlights Component
   =========================== */

.key-highlights-section {
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
}

.key-highlights-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.key-highlights-section .section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.key-highlights-section .header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--nx-text-primary);
}

.highlights-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px;
    background: var(--nx-bg-card);
    border: 1px solid var(--nx-border);
    border-radius: 12px;
}

.highlights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.highlight-card {
    background: var(--nx-bg-card);
    border: 1px solid var(--nx-border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.4s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.highlight-card.card-warning {
    border-left: 3px solid var(--nx-warning);
}

.highlight-card.card-insight {
    border-left: 3px solid var(--nx-accent);
}

.highlight-card.card-news {
    border-left: 3px solid var(--nx-info);
}

.highlight-card.card-data {
    border-left: 3px solid var(--nx-success);
}

.highlight-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
    color: var(--nx-accent-light);
}

.highlight-text {
    font-size: 14px;
    color: var(--nx-text-primary);
    line-height: 1.5;
}

.highlight-category {
    font-size: 12px;
    color: var(--nx-text-muted);
    text-transform: uppercase;
}

.highlight-importance {
    display: flex;
    gap: 2px;
    color: var(--nx-warning);
}

.highlight-importance.importance-1 { opacity: 0.5; }
.highlight-importance.importance-2 { opacity: 0.75; }
.highlight-importance.importance-3 { opacity: 1; }

/* ===========================
   Image Gallery Component
   =========================== */

.image-gallery-section {
    background: var(--nx-bg-card);
    border: 1px solid var(--nx-border);
    border-radius: 12px;
    margin-bottom: 24px;
}

.image-gallery-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--nx-border);
}

.gallery-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 24px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    padding: 16px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: var(--nx-bg-tertiary);
}

.gallery-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-thumbnail {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 50%, rgba(0, 0, 0, 0.7));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.image-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-start;
}

.badge-screenshot { background: var(--nx-info); color: #fff; }
.badge-extracted { background: var(--nx-accent); color: #fff; }

.zoom-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 24px;
}

/* Lightbox */
.lightbox-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    background: var(--nx-bg-secondary);
    border-radius: 12px;
    overflow: hidden;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.lightbox-content {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .lightbox-content {
        flex-direction: row;
    }
}

.lightbox-image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    min-height: 300px;
}

.lightbox-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.lightbox-info {
    width: 280px;
    padding: 20px;
    background: var(--nx-bg-secondary);
}

.lightbox-info .info-header {
    margin-bottom: 16px;
}

.lightbox-info .info-row {
    margin-bottom: 12px;
}

.lightbox-info .info-label {
    display: block;
    font-size: 12px;
    color: var(--nx-text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.lightbox-info .info-value {
    color: var(--nx-text-primary);
    font-size: 14px;
}

.lightbox-info .source-link {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--nx-accent-light);
    word-break: break-all;
}

.lightbox-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--nx-border);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-nav.nav-prev { left: 16px; }
.lightbox-nav.nav-next { right: 16px; }

.lightbox-counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
}

/* ===========================
   Findings Explorer Component
   =========================== */

.findings-explorer-section {
    background: var(--nx-bg-card);
    border: 1px solid var(--nx-border);
    border-radius: 12px;
}

.findings-explorer-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--nx-border);
}

.findings-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--nx-border);
    background: rgba(128, 128, 128, 0.03);
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--nx-text-muted);
}

.search-box input {
    padding-left: 40px;
}

.search-box .clear-search {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--nx-text-muted);
    cursor: pointer;
}

.filter-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-group select {
    width: auto;
    min-width: 140px;
}

.findings-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 24px;
}

.findings-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    padding: 16px;
}

.finding-card {
    background: var(--nx-bg-tertiary);
    border: 1px solid var(--nx-border);
    border-radius: 10px;
    padding: 16px;
    transition: all 0.2s ease;
}

.finding-card:hover {
    border-color: var(--nx-border-hover);
}

.finding-card.reviewed {
    opacity: 0.7;
}

.finding-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.relevance-indicator {
    font-size: 14px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
}

.relevance-indicator.relevance-high {
    background: rgba(16, 185, 129, 0.15);
    color: var(--nx-success);
}

.relevance-indicator.relevance-medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--nx-warning);
}

.relevance-indicator.relevance-low {
    background: rgba(128, 128, 128, 0.15);
    color: var(--nx-text-muted);
}

.relevance-indicator.relevance-unknown {
    background: rgba(128, 128, 128, 0.1);
    color: var(--nx-text-muted);
}

.finding-summary {
    font-size: 14px;
    color: var(--nx-text-primary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.finding-source {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--nx-accent-light);
    margin-bottom: 8px;
}

.finding-workitem {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--nx-text-muted);
    margin-bottom: 8px;
}

.finding-images {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.finding-thumbnail {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--nx-border);
}

.more-images {
    width: 60px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--nx-bg-secondary);
    border-radius: 4px;
    font-size: 12px;
    color: var(--nx-text-muted);
}

.expand-raw-data {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--nx-text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 8px 0;
}

.finding-raw-data {
    margin-top: 8px;
    padding: 12px;
    background: var(--nx-bg-secondary);
    border-radius: 6px;
    overflow-x: auto;
}

.finding-raw-data pre {
    margin: 0;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.finding-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--nx-border);
}

.discovered-time {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--nx-text-muted);
}

.findings-table-container {
    overflow-x: auto;
}

.findings-table {
    margin: 0;
}

.findings-table .summary-cell {
    max-width: 400px;
}

.findings-table .source-link {
    color: var(--nx-accent-light);
}

.relevance-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* ===========================
   Execution Timeline Component
   =========================== */

.execution-timeline-section {
    background: var(--nx-bg-card);
    border: 1px solid var(--nx-border);
    border-radius: 12px;
}

.execution-timeline-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--nx-border);
}

.total-duration {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--nx-text-muted);
}

.timeline-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 24px;
}

.timeline-container {
    padding: 24px 20px;
}

.timeline-item {
    display: flex;
    gap: 16px;
}

.timeline-item:last-child .timeline-connector {
    display: none;
}

.timeline-line {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timeline-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--nx-bg-tertiary);
    border: 2px solid var(--nx-border);
    color: var(--nx-text-muted);
    flex-shrink: 0;
}

.timeline-dot.dot-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--nx-success);
    color: var(--nx-success);
}

.timeline-dot.dot-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--nx-info);
    color: var(--nx-info);
}

.timeline-dot.dot-accent {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--nx-accent);
    color: var(--nx-accent);
}

.timeline-dot.dot-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--nx-warning);
    color: var(--nx-warning);
}

.timeline-dot.dot-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--nx-danger);
    color: var(--nx-danger);
}

.timeline-dot.dot-highlight {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(168, 85, 247, 0.1));
    border-color: #a855f7;
    color: #a855f7;
}

.timeline-connector {
    width: 2px;
    flex: 1;
    min-height: 40px;
    background: var(--nx-border);
    margin: 8px 0;
}

.timeline-content {
    flex: 1;
    padding-bottom: 24px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.event-title {
    font-weight: 500;
    color: var(--nx-text-primary);
}

.event-time {
    font-size: 12px;
    color: var(--nx-text-muted);
}

.event-description {
    font-size: 14px;
    color: var(--nx-text-secondary);
    margin-top: 4px;
}

.event-duration {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 4px 8px;
    background: var(--nx-bg-tertiary);
    border-radius: 4px;
    font-size: 12px;
    color: var(--nx-text-muted);
}

/* ===========================
   Follow-Up Chat Component
   =========================== */

.followup-chat-section {
    background: var(--nx-bg-card);
    border: 1px solid var(--nx-border);
    border-radius: 12px;
    overflow: hidden;
}

.followup-chat-section.collapsed {
    background: transparent;
    border: none;
}

.chat-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(168, 85, 247, 0.1));
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 12px;
    color: var(--nx-accent-light);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-expand-btn:hover {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(168, 85, 247, 0.15));
    border-color: var(--nx-accent);
}

.chat-expand-btn .expand-icon {
    margin-left: auto;
}

.chat-panel {
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--nx-border);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.05), rgba(168, 85, 247, 0.05));
}

.chat-header .header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--nx-text-primary);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--nx-text-muted);
    cursor: pointer;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px;
    color: var(--nx-text-muted);
}

.chat-welcome p {
    margin: 16px 0;
    max-width: 400px;
}

.suggested-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 400px;
}

.suggestions-label {
    font-size: 12px;
    color: var(--nx-text-muted);
    margin-bottom: 8px;
}

.suggestion-btn {
    padding: 10px 16px;
    background: var(--nx-bg-tertiary);
    border: 1px solid var(--nx-border);
    border-radius: 8px;
    color: var(--nx-text-primary);
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.suggestion-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--nx-accent);
}

.suggestion-btn.small {
    padding: 6px 12px;
    font-size: 12px;
}

.chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-message.user .message-avatar {
    background: var(--nx-accent);
    color: #fff;
}

.chat-message.assistant .message-avatar {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message.user .message-content {
    background: var(--nx-accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-content {
    background: var(--nx-bg-tertiary);
    color: var(--nx-text-primary);
    border-bottom-left-radius: 4px;
}

.message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--nx-text-muted);
}

.loading-indicator {
    display: flex;
    gap: 4px;
}

.loading-indicator .dot {
    width: 8px;
    height: 8px;
    background: var(--nx-text-muted);
    border-radius: 50%;
    animation: dotPulse 1.5s infinite;
}

.loading-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.loading-indicator .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

.error-message {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--nx-danger);
}

.followup-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 44px;
    margin-bottom: 16px;
}

.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--nx-border);
    background: var(--nx-bg-tertiary);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--nx-border);
    border-radius: 12px;
    background: var(--nx-bg-secondary);
    color: var(--nx-text-primary);
    font-size: 14px;
    resize: none;
    outline: none;
}

.chat-input:focus {
    border-color: var(--nx-accent);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-unavailable {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 24px;
    text-align: center;
}

/* ===========================
   Content Tabs
   =========================== */

.content-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--nx-border);
    padding-bottom: 0;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--nx-text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: var(--nx-text-primary);
}

.tab-btn.active {
    color: var(--nx-accent-light);
    border-bottom-color: var(--nx-accent);
}

.tab-badge {
    background: var(--nx-accent);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

.tab-content {
    min-height: 300px;
}

/* ===========================
   Content Loading/Empty States
   =========================== */

.content-loading,
.content-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}
