/* ─────────────────────────────────────────────────────────────
   Qwen3-ASR Web Transcriber - Core Premium Design System
   Theme: Neon Glassmorphism Dark Mode
   ───────────────────────────────────────────────────────────── */

:root {
    /* Color Palette */
    --bg-main: #06050a;
    --bg-gradient: radial-gradient(circle at 50% 50%, #0f0d1b 0%, #06050a 100%);
    --panel-border: rgba(255, 255, 255, 0.08);
    --glass-card-bg: rgba(20, 18, 35, 0.45);
    --glass-card-hover: rgba(28, 25, 48, 0.55);
    --glass-card-active: rgba(36, 32, 60, 0.65);
    
    --text-primary: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #6b7280;
    
    /* Neon Colors */
    --purple: #8b5cf6;
    --purple-glow: rgba(139, 92, 246, 0.35);
    --cyan: #06b6d4;
    --cyan-glow: rgba(6, 182, 212, 0.35);
    --emerald: #10b981;
    --emerald-glow: rgba(16, 185, 129, 0.35);
    --rose: #f43f5e;
    --rose-glow: rgba(244, 63, 94, 0.35);
    --amber: #f59e0b;
    --amber-glow: rgba(245, 158, 11, 0.35);
    
    /* Fonts & Radii */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-title: 'Outfit', sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 48px 0 rgba(0, 0, 0, 0.5);
    
    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─────────────────────────────────────────────────────────────
   1. Global Base Styles
   ───────────────────────────────────────────────────────────── */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-main);
    background-image: var(--bg-gradient);
    color: var(--text-primary);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Ambient glow blobs in background */
body::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    top: -200px;
    left: -100px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, rgba(0,0,0,0) 70%);
    z-index: 0;
    pointer-events: none;
}

body::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    bottom: -200px;
    right: -100px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.1) 0%, rgba(0,0,0,0) 70%);
    z-index: 0;
    pointer-events: none;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ─────────────────────────────────────────────────────────────
   2. Layout Architecture (3-Column SPA Dashboard)
   ───────────────────────────────────────────────────────────── */

.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    position: relative;
    z-index: 1;
}

/* Sidebars (Left & Right) */
.sidebar-panel, .library-panel {
    width: 340px;
    flex-shrink: 0;
    background: rgba(10, 8, 18, 0.6);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    border-right: 1px solid var(--panel-border);
}

.library-panel {
    border-right: none;
    border-left: 1px solid var(--panel-border);
}

/* Center Workspace Workspace */
.workspace-panel {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: rgba(5, 4, 8, 0.3);
}

/* ─────────────────────────────────────────────────────────────
   3. Reusable UI Blocks (Glass Cards, Buttons, Form Inputs)
   ───────────────────────────────────────────────────────────── */

.glass-card {
    background: var(--glass-card-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-md);
    transition: background var(--transition-fast), border var(--transition-fast), transform var(--transition-fast);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Buttons */
button {
    font-family: var(--font-sans);
    font-weight: 500;
    cursor: pointer;
    border: none;
    outline: none;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--purple);
    color: white;
    box-shadow: 0 0 16px var(--purple-glow);
}

.btn-primary:hover {
    background: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 0 24px var(--purple-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-link {
    background: transparent;
    color: var(--text-muted);
}

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

.btn-icon-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border-radius: 50%;
    width: 32px;
    height: 32px;
}

.btn-icon-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.btn-icon-danger {
    background: rgba(244, 63, 94, 0.1);
    color: var(--rose);
    border-radius: var(--radius-sm);
    width: 32px;
    height: 32px;
}

.btn-icon-danger:hover {
    background: var(--rose);
    color: white;
}

.btn-sm {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 6px;
}

.btn-action-primary {
    background: linear-gradient(135deg, var(--purple) 0%, var(--cyan) 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
    padding: 14px 20px;
    border-radius: var(--radius-sm);
}

.btn-action-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(139, 92, 246, 0.5), 0 0 12px var(--cyan-glow);
}

.btn-action-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-block {
    width: 100%;
}

/* Forms & Inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.label-help-icon {
    width: 14px;
    height: 14px;
    color: var(--text-dark);
    cursor: help;
}

.form-input {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 14px;
    font-family: var(--font-sans);
    font-size: 14px;
    outline: none;
    transition: all var(--transition-fast);
}

.form-input:focus {
    border-color: var(--purple);
    box-shadow: 0 0 10px var(--purple-glow);
    background: rgba(0, 0, 0, 0.5);
}

.form-range {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    outline: none;
    margin: 8px 0;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--purple);
    cursor: pointer;
    box-shadow: 0 0 8px var(--purple-glow);
    transition: transform var(--transition-fast);
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--cyan);
    box-shadow: 0 0 8px var(--cyan-glow);
}

.range-hint {
    font-size: 11px;
    color: var(--text-dark);
}

.form-tip {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--amber);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge.danger {
    background: rgba(244, 63, 94, 0.1);
    color: var(--rose);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--emerald);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-pulse {
    background: rgba(139, 92, 246, 0.15);
    color: var(--purple);
    border: 1px solid rgba(139, 92, 246, 0.3);
    animation: badge-pulse-anim 2s infinite ease-in-out;
}

@keyframes badge-pulse-anim {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4);
    }
    50% {
        box-shadow: 0 0 8px 4px rgba(139, 92, 246, 0);
    }
}

/* ─────────────────────────────────────────────────────────────
   4. Sidebar Details (Left & Right Panel Items)
   ───────────────────────────────────────────────────────────── */

/* Brand Header */
.brand-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--panel-border);
}

.logo-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--purple) 0%, var(--cyan) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.logo-icon i {
    width: 22px;
    height: 22px;
}

.brand-text h1 {
    font-family: var(--font-title);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 30%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text .sub-brand {
    font-size: 11px;
    color: var(--text-dark);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* API Key Guard */
.guard-card {
    margin: 16px 20px 8px 20px;
    border-radius: var(--radius-sm);
    padding: 14px;
}

.guard-card.warning {
    background: rgba(244, 63, 94, 0.08);
    border-color: rgba(244, 63, 94, 0.2);
}

.guard-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--rose);
    margin-bottom: 6px;
    font-size: 14px;
}

.guard-header i {
    width: 16px;
    height: 16px;
}

.guard-card p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.4;
}

/* Upload & Config sections */
.sidebar-panel section {
    margin: 10px 20px;
    padding: 16px;
}

.sidebar-panel section h2 {
    font-size: 14px;
    font-family: var(--font-title);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    margin-bottom: 14px;
    border-left: 3px solid var(--purple);
    padding-left: 8px;
}

/* Dropzone styling */
.upload-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    padding: 24px 16px;
    text-align: center;
    background: rgba(255, 255, 255, 0.01);
    transition: all var(--transition-normal);
    position: relative;
    cursor: pointer;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--purple);
    background: rgba(139, 92, 246, 0.04);
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dropzone-icon {
    color: var(--text-dark);
    margin-bottom: 12px;
    transition: color var(--transition-fast);
}

.upload-dropzone:hover .dropzone-icon, .upload-dropzone.dragover .dropzone-icon {
    color: var(--cyan);
}

.dropzone-icon i {
    width: 32px;
    height: 32px;
}

.dropzone-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.dropzone-sub {
    font-size: 11px;
    color: var(--text-dark);
    margin-bottom: 14px;
}

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

/* Selected File Info Card */
.selected-file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-top: 12px;
}

.selected-file-info .file-icon {
    color: var(--cyan);
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.file-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.file-details .filename {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-details .filesize {
    font-size: 11px;
    color: var(--text-muted);
}

.hidden {
    display: none !important;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.version-tag {
    font-size: 11px;
    color: var(--text-dark);
    font-family: var(--font-mono);
}

/* Right Panel: History Panel */
.library-panel .library-header {
    padding: 24px 20px 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.library-panel h2 {
    font-family: var(--font-title);
    font-size: 16px;
    font-weight: 600;
}

.library-search-container {
    padding: 0 20px 16px 20px;
    border-bottom: 1px solid var(--panel-border);
}

.search-input-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-input-group .search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-dark);
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.search-input-group .form-input {
    width: 100%;
    padding-left: 36px;
}

.history-list {
    flex: 1;
    overflow-y: auto;
}

.history-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--panel-border);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.history-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: transparent;
    transition: background var(--transition-fast);
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.history-item.active {
    background: rgba(139, 92, 246, 0.04);
}

.history-item.active::before {
    background: var(--purple);
}

.history-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.history-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.history-delete-btn {
    opacity: 0;
    background: transparent;
    color: var(--text-dark);
    transition: all var(--transition-fast);
    padding: 2px;
}

.history-item:hover .history-delete-btn {
    opacity: 1;
}

.history-delete-btn:hover {
    color: var(--rose);
}

.history-delete-btn i {
    width: 14px;
    height: 14px;
}

.history-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.history-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.history-meta i {
    width: 11px;
    height: 11px;
}

.history-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    gap: 12px;
    font-size: 13px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.05);
    border-top-color: var(--purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.history-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.history-empty i {
    width: 32px;
    height: 32px;
    color: rgba(255,255,255,0.05);
}

/* ─────────────────────────────────────────────────────────────
   5. Center Workspace Details (Dashboards & Document Viewer)
   ───────────────────────────────────────────────────────────── */

/* Initial Empty State */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    padding: 40px;
}

.empty-illustration {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--purple);
    margin-bottom: 24px;
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.05);
}

.empty-illustration i {
    width: 40px;
    height: 40px;
}

.empty-state h2 {
    font-family: var(--font-title);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ffffff 40%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Live ASR Dashboard */
.live-dashboard {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.task-title-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.task-title-group h2 {
    font-family: var(--font-title);
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.time-meta-grid {
    display: flex;
    gap: 24px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.meta-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.meta-val {
    font-size: 18px;
    font-family: var(--font-title);
    font-weight: 700;
    color: var(--cyan);
}

/* Process Timeline (4-Step Visualizer) */
.steps-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    margin-bottom: 24px;
    padding: 0 10px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    width: 80px;
}

.step-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.08);
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    transition: all var(--transition-normal);
}

.step-icon i {
    width: 18px;
    height: 18px;
}

.step-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.step-status {
    font-size: 10px;
    color: var(--text-dark);
}

/* Active & Complete States for Pipeline Steps */
.step-item.active .step-icon {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--purple);
    color: var(--purple);
    box-shadow: 0 0 12px var(--purple-glow);
    transform: scale(1.08);
}

.step-item.active .step-title {
    color: var(--text-primary);
}

.step-item.active .step-status {
    color: var(--purple);
}

.step-item.complete .step-icon {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--emerald);
    color: var(--emerald);
    box-shadow: 0 0 12px var(--emerald-glow);
}

.step-item.complete .step-status {
    color: var(--emerald);
}

.step-connector {
    flex: 1;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    margin-top: -34px; /* Align with circular icons */
    z-index: 1;
}

.step-connector.complete {
    background: linear-gradient(90deg, var(--purple) 0%, var(--cyan) 100%);
}

.progress-bar-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--purple) 0%, var(--cyan) 100%);
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
}

/* Console Container */
.console-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
}

.console-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.console-card h3 {
    font-family: var(--font-title);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.console-logs {
    background: #040306;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    height: 140px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-line {
    color: var(--text-muted);
}

.log-line.system {
    color: var(--purple);
}

.log-line.success {
    color: var(--emerald);
}

.log-line.warning {
    color: var(--amber);
}

.log-line.error {
    color: var(--rose);
}

/* Dynamic Segments Grid */
.segments-card h3 {
    font-family: var(--font-title);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 14px;
}

.segments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    max-height: 300px;
    overflow-y: auto;
}

/* Segment Progress Card */
.segment-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.segment-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--text-dark);
}

.segment-card.queued::before {
    background: var(--text-dark);
}

.segment-card.processing::before {
    background: var(--purple);
    animation: segment-pulse 1.5s infinite alternate;
}

@keyframes segment-pulse {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

.segment-card.success::before {
    background: var(--emerald);
}

.segment-card.failed::before {
    background: var(--rose);
}

.segment-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.segment-card-title {
    font-size: 12px;
    font-weight: 600;
}

.segment-card-size {
    font-size: 10px;
    color: var(--text-muted);
}

.segment-preview {
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    padding: 6px;
    min-height: 36px;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* ─────────────────────────────────────────────────────────────
   6. Document Details Viewer Panel
   ───────────────────────────────────────────────────────────── */

.document-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: fade-in 0.25s ease-out;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.doc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.doc-title-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.doc-title-group h2 {
    font-family: var(--font-title);
    font-size: 20px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.doc-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.doc-meta i {
    width: 14px;
    height: 14px;
}

.doc-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* In-page Document Search Highlight */
.search-filter-card {
    padding: 12px 16px;
}

.search-badge {
    background: rgba(6, 182, 212, 0.15);
    color: var(--cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 6px;
    font-size: 12px;
    padding: 4px 10px;
    margin-left: 12px;
    flex-shrink: 0;
}

/* Tabs widgets */
.doc-tabs-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0; /* Important for scroll container inside flex */
}

.tabs-header {
    padding: 6px;
    display: flex;
    gap: 8px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: none;
    min-height: 300px;
}

.tab-content.active {
    display: block;
}

/* Full Text Style */
.doc-content-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
    letter-spacing: 0.2px;
}

/* Highlight Search Text Matches */
mark.search-highlight {
    background-color: rgba(245, 158, 11, 0.35);
    color: #ffffff;
    border-bottom: 2px solid var(--amber);
    border-radius: 2px;
    padding: 0 2px;
}

mark.search-highlight.active {
    background-color: rgba(6, 182, 212, 0.5);
    border-bottom-color: var(--cyan);
}

/* Segment Breakdown Timeline Style */
.doc-segments-timeline {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline-segment-item {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border var(--transition-fast);
}

.timeline-segment-item:hover {
    border-color: rgba(255, 255, 255, 0.08);
}

.timeline-segment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.timeline-segment-badge {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
}

.timeline-segment-duration {
    font-size: 11px;
    color: var(--text-dark);
}

.timeline-segment-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
}

/* ─────────────────────────────────────────────────────────────
   7. Modals / Settings Center
   ───────────────────────────────────────────────────────────── */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fade-in 0.2s ease-out;
}

.modal-content {
    width: 480px;
    max-width: 90%;
    animation: scale-up 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scale-up {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

.modal-header h2 {
    font-family: var(--font-title);
    font-size: 18px;
    font-weight: 700;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.api-key-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-footer button {
    padding: 10px 18px;
}
