/* ==========================================================================
   2D Engineering Drawing AI Analyzer - Professional Dark Slate Design System
   ========================================================================== */

:root {
    --bg-main: #0A0F1D;
    --bg-surface: #131D31;
    --bg-surface-elevated: #1E293B;
    --bg-card-hover: #27354E;
    
    --border-subtle: #24344D;
    --border-focus: #3B82F6;
    
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    --primary: #3B82F6;
    --primary-hover: #2563EB;
    --primary-glow: rgba(59, 130, 246, 0.25);
    
    --success: #10B981;
    --success-bg: rgba(16, 185, 129, 0.12);
    
    --warning: #F59E0B;
    --danger: #EF4444;
    
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ==========================================================================
   Header & Navbar
   ========================================================================== */
.navbar {
    background-color: rgba(19, 29, 49, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), #1D4ED8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFF;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-ai {
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(59, 130, 246, 0.18);
    color: var(--primary);
    border: 1px solid rgba(59, 130, 246, 0.35);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.brand-subtitle {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: var(--bg-surface-elevated);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

/* ==========================================================================
   Buttons & Badges
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-main);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #2563EB);
    color: #FFF;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    box-shadow: 0 6px 18px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background-color: var(--bg-card-hover);
    border-color: #3B82F6;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: inline-flex;
}

.btn-icon:hover {
    color: var(--text-primary);
    background-color: var(--bg-card-hover);
}

/* ==========================================================================
   Main Layout
   ========================================================================== */
.main-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
}

/* ==========================================================================
   Upload & Dropzone Section
   ========================================================================== */
.upload-section {
    margin-bottom: 24px;
}

.dropzone {
    background: linear-gradient(180deg, var(--bg-surface), var(--bg-main));
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.04);
    box-shadow: 0 8px 30px var(--primary-glow);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.drop-icon-wrapper {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.dropzone h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.drop-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.browse-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.drop-tags {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.75rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 12px;
}

/* Processing Progress Card */
.processing-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 16px;
    box-shadow: var(--shadow-md);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.progress-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.progress-info h4 {
    font-size: 1rem;
    font-weight: 600;
}

.progress-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.progress-pct {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.progress-bar-bg {
    height: 8px;
    background-color: var(--bg-surface-elevated);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #60A5FA);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Results Action Bar & Metadata Card
   ========================================================================== */
.results-action-bar {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.document-metadata-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.meta-pill {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    border: 1px solid rgba(59, 130, 246, 0.3);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.meta-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.meta-sub {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.action-buttons {
    display: flex;
    gap: 10px;
}

/* ==========================================================================
   Telemetry Banner
   ========================================================================== */
.telemetry-banner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.telem-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.telem-icon {
    font-size: 1.3rem;
}

.telem-content {
    display: flex;
    flex-direction: column;
}

.telem-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.telem-val {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary);
    font-family: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   Navigation Tabs
   ========================================================================== */

.tabs-nav {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 24px;
}

.tab-btn {
    background: none;
    border: none;
    font-family: var(--font-main);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Diagram Pipeline Workspace & Viewer
   ========================================================================== */
.diagram-workspace {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Stepper Bar */
.stepper-bar {
    display: flex;
    gap: 8px;
    background: var(--bg-surface);
    padding: 10px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    overflow-x: auto;
}

.step-item {
    flex: 1;
    min-width: 140px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.step-item:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.step-item.active {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.12);
    box-shadow: 0 0 12px var(--primary-glow);
}

.step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-main);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.step-item.active .step-num {
    background: var(--primary);
    color: #FFF;
}

.step-label {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Viewer Card */
.viewer-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.viewer-header {
    padding: 16px 24px;
    background: var(--bg-surface-elevated);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.viewer-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stage-tag {
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--primary);
    color: #FFF;
    padding: 3px 8px;
    border-radius: 4px;
}

.viewer-title-group h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-ctrl {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ctrl:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.btn-play {
    width: auto;
    padding: 0 14px;
    gap: 6px;
    font-family: var(--font-main);
    font-size: 0.82rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary), #2563EB);
    color: #FFF;
    border: none;
}

.btn-play:hover {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
}

.view-mode-toggle {
    display: flex;
    background: var(--bg-main);
    padding: 3px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    margin-left: 12px;
}

.mode-btn {
    background: none;
    border: none;
    font-family: var(--font-main);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.mode-btn.active {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
}

/* Canvas Viewport */
.canvas-viewport {
    background-color: #05070D;
    min-height: 520px;
    max-height: 700px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 16px;
}

.image-stage-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-drawing-img {
    max-width: 100%;
    max-height: 660px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
    cursor: zoom-in;
    transition: opacity 0.3s ease;
}

/* Before / After Split Slider */
.comparison-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-height: 660px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.comparison-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 640px;
    display: inline-block;
    user-select: none;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.6);
}

.comparison-before-img {
    display: block;
    max-width: 100%;
    max-height: 640px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.comparison-after-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
    border-radius: var(--radius-sm);
    pointer-events: none;
}

.comparison-divider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: var(--primary);
    box-shadow: 0 0 12px var(--primary);
    pointer-events: none;
    z-index: 5;
    transform: translateX(-50%);
}

.comparison-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    background: var(--primary);
    border: 2px solid #FFF;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFF;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.comp-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: ew-resize;
    z-index: 10;
    margin: 0;
}

.comp-label {
    position: absolute;
    top: 16px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 6;
    pointer-events: none;
}

.before-label {
    left: 16px;
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.after-label {
    right: 16px;
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.viewer-footer {
    padding: 14px 24px;
    background: var(--bg-surface-elevated);

    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stage-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 80%;
}

/* ==========================================================================
   Isolated Detail Views Gallery
   ========================================================================== */
.details-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.details-header h4 {
    font-size: 1rem;
    font-weight: 600;
}

.badge-count {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 3px 10px;
    border-radius: 12px;
}

.gallery-tabs {
    display: flex;
    gap: 6px;
    background: var(--bg-surface);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    margin-bottom: 16px;
    overflow-x: auto;
}

.gallery-tab {
    background: none;
    border: none;
    font-family: var(--font-main);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.gallery-tab:hover {
    color: var(--text-primary);
}

.gallery-tab.active {
    background: var(--primary);
    color: #FFF;
}

.gallery-tab.active .badge-count {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.25);
    color: #FFF;
}

.gallery-pane {
    display: none;
}

.gallery-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.detail-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s ease;
}

.detail-card .detail-thumb-wrapper {
    cursor: pointer;
}

.detail-card.featured {
    grid-column: span 2;
    border-color: rgba(59, 130, 246, 0.4);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), var(--bg-surface-elevated));
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15);
}

.detail-card.featured .detail-thumb-wrapper {
    height: 220px;
}

.detail-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
}

.detail-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.detail-card.featured .detail-badge {
    background: var(--primary);
    color: #FFF;
    border: none;
}


.detail-thumb-wrapper {
    height: 160px;
    background-color: #05070D;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.detail-thumb-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.detail-info {
    padding: 10px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: normal;
}

.detail-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}

.detail-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #E2E8F0;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 6px;
    padding: 6px 10px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.detail-download-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.45);
    color: #93C5FD;
}

.detail-download-btn-header {
    flex-shrink: 0;
    padding: 4px 8px;
    font-size: 10px;
}

/* ==========================================================================
   Technical Datasheet & Excel View
   ========================================================================== */
.datasheet-workspace {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sheet-tabs {
    display: flex;
    gap: 6px;
    background: var(--bg-surface);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    overflow-x: auto;
}

.sheet-tab {
    background: none;
    border: none;
    font-family: var(--font-main);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.sheet-tab:hover {
    color: var(--text-primary);
}

.sheet-tab.active {
    background: var(--primary);
    color: #FFF;
}

.sheet-pane {
    display: none;
}

.sheet-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.data-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
    gap: 20px;
}

.data-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    background: var(--bg-surface-elevated);
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.card-header h5 {
    font-size: 0.92rem;
    font-weight: 600;
}

.card-body {
    padding: 16px 20px;
}

/* Data Tables */
.table-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}

.data-table, .grid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.data-table th {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.data-table tr:hover td {
    background-color: rgba(59, 130, 246, 0.04);
    color: var(--text-primary);
}

.grid-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.grid-table td:first-child {
    font-weight: 600;
    color: var(--text-primary);
    width: 40%;
}

.grid-table td:last-child {
    color: var(--text-secondary);
}

.note-item {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 10px;
    font-size: 0.82rem;
}

.note-tag {
    font-weight: 700;
    color: var(--primary);
    margin-right: 8px;
}

/* ==========================================================================
   Agent Thinking Terminal
   ========================================================================== */
.terminal-card {
    background: #0D1117;
    border: 1px solid #30363D;
    border-radius: var(--radius-lg);
    overflow: hidden;
    font-family: var(--font-mono);
}

.terminal-header {
    background: #161B22;
    padding: 10px 16px;
    border-bottom: 1px solid #30363D;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.terminal-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.red { background: #FF5F56; }
.dot.yellow { background: #FFBD2E; }
.dot.green { background: #27C93F; }

.terminal-title {
    font-size: 0.78rem;
    color: #8B949E;
}

.terminal-body {
    padding: 16px;
    max-height: 480px;
    overflow-y: auto;
    font-size: 0.8rem;
    line-height: 1.7;
}

.log-entry {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    animation: fadeIn 0.2s ease;
}

.log-time {
    color: #6E7681;
}

.log-phase {
    color: var(--primary);
    font-weight: 600;
}

.log-msg {
    color: #C9D1D9;
}

.log-msg.done {
    color: #3FB950;
}

.log-msg.running {
    color: #D29922;
}

/* ==========================================================================
   Image Modal View
   ========================================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    z-index: 10;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    max-width: 90vw;
    max-height: 90vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    font-size: 1.6rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.modal-image-wrapper {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #05070D;
    border-radius: var(--radius-sm);
    padding: 10px;
}

.modal-image-wrapper img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
}

/* ==========================================================================
   Utilities
   ========================================================================== */
.hidden {
    display: none !important;
}

@media (max-width: 900px) {
    .data-cards-grid {
        grid-template-columns: 1fr;
    }
    .viewer-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
