:root {
    /* Medical/Professional Palette */
    --color-bg: #0a0e1a;
    --color-primary: #4a9eff;
    /* Medical Blue */
    --color-primary-glow: rgba(74, 158, 255, 0.3);
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-text: #e5e7eb;
    --color-text-muted: #9ca3af;
    --color-glass: rgba(255, 255, 255, 0.04);
    --color-glass-border: rgba(255, 255, 255, 0.1);
    --color-glass-hover: rgba(255, 255, 255, 0.08);
    --color-card-bg: rgba(15, 23, 42, 0.6);

    /* Typography */
    --font-display: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Animation */
    --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
    --transition-fast: 0.2s;
    --transition-normal: 0.3s;

    /* AI Modal Variables (mapped to existing dark theme) */
    --primary-color: #4a9eff;
    --secondary-color: #8b5cf6;
    --primary-hover: #5ba4ff;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --bg-primary: rgba(15, 23, 42, 0.95);
    --bg-secondary: rgba(10, 14, 26, 0.9);
    --bg-tertiary: rgba(30, 41, 59, 0.8);
    --bg-hover: rgba(255, 255, 255, 0.08);
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-disabled: #6b7280;
    --border-color: rgba(255, 255, 255, 0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
}

html {
    background: #0a0e1a;
}

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

body {
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1f2e 50%, #0f1419 100%);
    color: var(--color-text);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(74, 158, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(74, 158, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
    animation: subtle-shift 15s ease-in-out infinite;
}

@keyframes subtle-shift {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(74, 158, 255, 0.02) 2px, rgba(74, 158, 255, 0.02) 4px);
    pointer-events: none;
    z-index: 1;
}

/* Background Effects */
#canvas-container {
    position: fixed;
    inset: 0;
    z-index: 1;
}

.vignette {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle, transparent 40%, black 120%);
    z-index: 2;
    pointer-events: none;
}

/* Main Layout */
#app-container {
    position: relative;
    z-index: 5;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
}

section {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s var(--ease-out);
}

section.active-section {
    opacity: 1;
    pointer-events: auto;
}

/* Intro Section */
.brand-title {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 700;
    color: var(--color-primary);
    text-shadow: 0 0 30px var(--color-primary-glow);
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
    opacity: 0;
    transform: translateY(-20px);
    animation: fadeDown 1s var(--ease-out) forwards 0.5s;
}

.brand-subtitle {
    font-size: 1.2rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-2xl);
    opacity: 0;
    animation: fadeDown 1s var(--ease-out) forwards 0.7s;
}

.primary-btn {
    background: var(--color-primary);
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 12px;
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: all var(--transition-normal);
    opacity: 0;
    animation: fadeDown 1s var(--ease-out) forwards 0.9s;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--color-primary-glow);
}

/* Folder Selection Section */
.folder-glass-container {
    background: rgba(15, 23, 42, 0.15);
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-glass-border);
    border-radius: 24px;
    padding: var(--space-2xl) var(--space-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
}

.section-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
    text-shadow: 0 0 20px var(--color-primary-glow);
    margin-bottom: var(--space-sm);
    letter-spacing: -0.02em;
}

.section-subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-2xl);
}

.folder-input-container {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
    width: 100%;
}

.folder-input {
    flex: 1;
    background: var(--color-glass);
    border: 2px solid var(--color-glass-border);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all var(--transition-normal);
}

.folder-input::placeholder {
    color: var(--color-text-muted);
}

.folder-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-glow);
}

.icon-btn {
    background: var(--color-primary);
    border: none;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.icon-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 30px var(--color-primary-glow);
}

.icon-btn svg {
    color: #fff;
}

.recent-folders {
    width: 100%;
    max-width: 800px;
}

.recent-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-lg);
}

.folder-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-width: 800px;
    margin: 0 auto;
}

.empty-folder-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--color-text-muted);
    text-align: center;
}

.empty-folder-state svg {
    opacity: 0.3;
    margin-bottom: var(--space-md);
}

.folder-card {
    background: var(--color-glass);
    border: 2px solid var(--color-glass-border);
    border-radius: 12px;
    padding: var(--space-lg) var(--space-xl);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    min-height: 70px;
}

.folder-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: var(--color-primary);
    transform: scaleY(0);
    transition: transform var(--transition-normal);
}

.folder-card:hover {
    background: var(--color-glass-hover);
    border-color: var(--color-primary);
    transform: translateX(4px);
}

.folder-card:hover::before {
    transform: scaleY(1);
}

.folder-card-left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.folder-card-name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-card-date {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.folder-card-date svg {
    width: 13px;
    height: 13px;
    opacity: 0.7;
}


/* App Section */
#app-section {
    padding: 0;
    justify-content: flex-start;
    align-items: stretch;
}

.app-header {
    width: 100%;
    padding: var(--space-sm) var(--space-lg);
    background: rgba(10, 14, 26, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
}

.app-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-primary);
}

.app-subtitle {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.upload-trigger-btn {
    background: var(--color-primary);
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.9rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    transition: all var(--transition-normal);
}

.upload-trigger-btn svg {
    width: 18px;
    height: 18px;
}

.upload-trigger-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--color-primary-glow);
}

/* App Content - Two Column Layout */
.app-content {
    display: flex;
    height: calc(100vh - 60px);
    overflow: hidden;
    width: 100%;
}

/* Document List Panel (Left) - Wider for better visibility */
.document-list-panel {
    width: 400px;
    min-width: 400px;
    background: var(--color-card-bg);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--color-glass-border);
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: var(--space-md) var(--space-md);
    border-bottom: 1px solid var(--color-glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
}

.doc-count {
    background: var(--color-primary);
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

.document-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--color-text-muted);
    padding: var(--space-md);
}

.empty-state svg {
    opacity: 0.3;
    margin-bottom: var(--space-md);
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
}

.empty-state small {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Document Card - Compact for narrow list */
.document-card {
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    border-radius: 10px;
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
}

.document-card:hover {
    background: var(--color-glass-hover);
    border-color: var(--color-primary);
    transform: translateX(4px);
}

.document-card.active {
    background: var(--color-glass-hover);
    border-color: var(--color-primary);
}

.document-card.processing {
    opacity: 0.6;
    pointer-events: none;
}

.doc-card-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
}

.doc-icon {
    flex-shrink: 0;
    color: var(--color-primary);
    width: 16px;
    height: 16px;
}

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.doc-delete-btn {
    background: transparent;
    border: 1px solid var(--color-glass-border);
    color: var(--color-text-muted);
    border-radius: 8px;
    padding: 0.35rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.doc-delete-btn:hover {
    color: #fff;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.doc-delete-btn svg {
    display: block;
}

.doc-name {
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.2rem;
}

.doc-meta {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.doc-status {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.75rem;
    margin-top: var(--space-xs);
}

.doc-status.processing {
    color: var(--color-warning);
}

.doc-status.classified {
    color: var(--color-success);
}

.status-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--color-glass-border);
    border-top-color: var(--color-warning);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Right Panel - Classification + PDF Viewer */
.right-panel {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Classification Section - Compact and positioned higher */
.classification-section {
    flex: 0 0 auto;
    padding: var(--space-sm) var(--space-lg);
    background: var(--color-card-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--color-glass-border);
}

.classification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.classification-header h3 {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
}

/* Row 1: Three category dropdowns (Dossier, Groupe, Sous Groupe) */
.classification-row-categories {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

/* Row 2: Conclusions (reduced height) */
.classification-row-conclusions {
    margin-bottom: var(--space-sm);
}

.classification-row-conclusions .classification-field-conclusions {
    display: flex;
    flex-direction: column;
}

.classification-row-conclusions .field-wrapper {
    display: flex;
    flex-direction: column;
}

.classification-row-conclusions .inline-field-textarea {
    min-height: 50px;
    max-height: 70px;
    resize: vertical;
}

/* Bottom row: Exam Date + Doc Title + Speciality + Save */
.classification-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: var(--space-sm);
    align-items: end;
}

.classification-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.classification-field label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.3rem;
    letter-spacing: 0.02em;
}

.field-label-clickable {
    cursor: pointer;
    transition: color var(--transition-fast);
}

.field-label-clickable:hover {
    color: var(--color-primary);
}

.classification-field .field-format {
    font-size: 0.65rem;
    opacity: 0.7;
}

.classification-field-wide {
    flex: 1;
}

/* Field Wrapper for inline inputs */
.field-wrapper {
    position: relative;
    display: block;
}

/* Inline Field Input Styles - Match .classification-select exactly */
.inline-field-input {
    width: 100%;
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    padding: 0.6rem;
    border-radius: 8px;
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: all var(--transition-normal);
    box-sizing: border-box;
    height: auto;
    line-height: 1.2;
}

/* Inline Textarea base styles */
.inline-field-textarea {
    resize: none;
    font-family: inherit;
    line-height: 1.2;
    overflow-y: auto;
}

.inline-field-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-glow);
}

.inline-field-input.edited {
    border-color: var(--color-warning);
}

.inline-field-input::placeholder {
    color: var(--color-text-muted);
    opacity: 0.6;
}

/* EDITED Indicator Badge - positioned next to label */
.inline-field-indicator {
    display: inline-block;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    background: var(--color-warning);
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
    vertical-align: middle;
}

.inline-field-indicator.show {
    opacity: 1;
}

.inline-field-indicator::before {
    content: 'EDITED';
}

/* Classification Actions (Save button area - column 4) */
.classification-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
    padding-top: 1.1rem; /* Align with input fields (matches label height) */
}

.inline-save-error {
    font-size: 0.7rem;
    color: #ef4444;
    flex: 1;
}

.inline-save-btn {
    background: var(--color-primary);
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    color: #fff;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    white-space: nowrap;
    height: auto;
    line-height: 1.2;
}

.inline-save-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--color-primary-glow);
}

.inline-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Legacy support for .classification-level if still used */
.classification-level label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-bottom: 0.3rem;
}

.classification-select {
    width: 100%;
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    padding: 0.6rem;
    border-radius: 8px;
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.classification-select option {
    background: #1a1f2e;
    color: var(--color-text);
    padding: 0.5rem;
}

.classification-select:hover:not(:disabled) {
    border-color: var(--color-primary);
}

.classification-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.classification-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.classification-status {
    padding: var(--space-sm) var(--space-md);
    border-radius: 8px;
    font-size: 0.9rem;
    display: none;
}

.classification-status.success {
    display: block;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--color-success);
}

.classification-status.processing {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--color-warning);
}

/* AI READY Button */
.ai-ready-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    animation: ai-ready-pulse 2s ease-in-out infinite;
}

.ai-ready-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.ai-ready-btn:active {
    transform: translateY(0);
}

.ai-ready-btn.hidden {
    display: none;
}

.ai-ready-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.ai-ready-text {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Breathing/Pulsing Animation */
@keyframes ai-ready-pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3),
                    0 0 0 0 rgba(139, 92, 246, 0.7);
    }
    50% {
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3),
                    0 0 0 10px rgba(139, 92, 246, 0);
    }
}

/* Document Viewer Panel - Below Classification */
.document-viewer-panel {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    height: 80vh;
}

.viewer-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-muted);
}

.viewer-empty-state svg {
    opacity: 0.2;
    margin-bottom: var(--space-lg);
}

.viewer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* PDF Viewer - Maximum space */
.pdf-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.pdf-canvas-container {
    flex: 1;
    overflow: auto;
    padding: var(--space-md);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: rgba(0, 0, 0, 0.2);
}

#pdf-canvas {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
}

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

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

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-glass-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-glass-hover);
}

/* Back Button */
.back-btn {
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    border-radius: 8px;
    padding: 0.5rem;
    margin-right: var(--space-sm);
    cursor: pointer;
    color: var(--color-text);
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
}

.back-btn:hover {
    background: var(--color-glass-hover);
    border-color: var(--color-primary);
    transform: translateX(-2px);
}

/* Folder Card Actions */
.folder-card-actions {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.folder-action-btn {
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    color: var(--color-text-muted);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.folder-action-btn:hover {
    color: var(--color-text);
    border-color: var(--color-primary);
    background: var(--color-glass-hover);
    transform: scale(1.05);
}

.folder-action-btn.delete:hover {
    color: #fff;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
}

.folder-action-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* Rename Dialog */
.rename-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.rename-dialog-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.rename-dialog {
    background: var(--color-card-bg);
    border: 2px solid var(--color-glass-border);
    border-radius: 16px;
    padding: var(--space-xl);
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.rename-dialog-overlay.active .rename-dialog {
    transform: scale(1);
}

.rename-dialog h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--color-primary);
    margin-bottom: var(--space-md);
}

.rename-dialog-input {
    width: 100%;
    background: var(--color-glass);
    border: 2px solid var(--color-glass-border);
    padding: 0.8rem;
    border-radius: 8px;
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 1rem;
    margin-bottom: var(--space-md);
}

.rename-dialog-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.rename-dialog-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
}

.dialog-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-normal);
    border: none;
}

.dialog-btn.cancel {
    background: var(--color-glass);
    color: var(--color-text);
    border: 1px solid var(--color-glass-border);
}

.dialog-btn.cancel:hover {
    background: var(--color-glass-hover);
}

.dialog-btn.confirm {
    background: var(--color-primary);
    color: #fff;
}

.dialog-btn.confirm:hover {
    background: #5ba4ff;
}

.dialog-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rename-error {
    color: #ef4444;
    font-size: 0.85rem;
    margin-bottom: var(--space-sm);
    min-height: 1.2rem;
}

/* =============================================================================
   AI Features Modal Styles
   ============================================================================= */

/* AI Features Modal Overlay */
.ai-features-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(3px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.ai-features-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Modal Card */
.ai-features-modal {
    background: var(--bg-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
    width: 95vw;
    height: 95vh;  /* Increased from 92vh for more PDF space */
    max-width: 1500px;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.ai-features-overlay.active .ai-features-modal {
    transform: scale(1);
}

/* Modal Header */
.ai-features-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-xl);  /* Reduced vertical padding */
    border-bottom: 1px solid var(--border-color);
}

.ai-features-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.ai-features-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-features-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Modal Content: Split Layout */
.ai-features-content {
    display: flex;
    gap: var(--space-xl);
    flex: 1;
    overflow: hidden;
    padding: var(--space-md) var(--space-xl);  /* Reduced vertical padding for more PDF space */
}

/* Left Panel: Fields (35%) - Reduced to give more space to PDF */
.ai-features-fields {
    flex: 0 0 35%;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);  /* Reduced gap to save vertical space */
    overflow-y: auto;
    padding-right: var(--space-sm);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    padding: var(--space-md);  /* Reduced padding */
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-features-fields h3 {
    margin: 0 0 var(--space-md) 0;  /* Reduced margin */
    font-size: 1.2rem;  /* Slightly smaller */
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: var(--space-sm);  /* Reduced padding */
    letter-spacing: 0.025em;
}

/* Field Groups */
.ai-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: var(--space-sm) 0;
}

.ai-field-label {
    font-size: 0.95rem;  /* Larger for better readability */
    font-weight: 700;    /* Bolder for better visibility */
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;  /* More space between label and input */
    letter-spacing: 0.02em;  /* Better readability */
}

.ai-field-format {
    font-size: 0.8rem;   /* Slightly larger */
    color: var(--text-secondary);
    font-weight: 400;
}

.ai-field-wrapper {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.ai-field-input {
    flex: 1;
    padding: 0.875rem 1rem;  /* More padding for better readability */
    background: rgba(255, 255, 255, 0.03);  /* Subtle background for better visibility */
    border: 2px solid rgba(255, 255, 255, 0.1);  /* More visible border */
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;  /* Larger text for better readability */
    line-height: 1.5;    /* Better line spacing */
    transition: all var(--transition-fast);
}

.ai-field-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.ai-field-input.edited {
    border-color: var(--warning-color);
}

.ai-field-textarea {
    resize: vertical;
    min-height: 100px;  /* Reduced to save vertical space */
    font-family: inherit;
    line-height: 1.6;   /* Better line spacing for readability */
}

/* Field Indicator (shows EDITED badge) */
.ai-field-indicator {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--warning-color);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0;
    transition: opacity var(--transition-fast);
    white-space: nowrap;
    align-self: center;
}

.ai-field-indicator.show {
    opacity: 1;
}

.ai-field-indicator::before {
    content: 'EDITED';
}

/* Save Actions */
.ai-features-actions {
    margin-top: auto;
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-color);
}

.ai-save-error {
    font-size: 0.875rem;
    color: var(--error-color);
    margin-bottom: var(--space-sm);
    min-height: 1.5rem;
}

.ai-save-btn {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ai-save-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.ai-save-btn:active:not(:disabled) {
    transform: translateY(0);
}

.ai-save-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-disabled);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Right Panel: PDF (65%) - Increased from 60% for larger PDF viewer */
.ai-features-pdf {
    flex: 0 0 65%;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);  /* Minimal gap for more PDF space */
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-sm);  /* Minimal padding for more PDF space */
    overflow: hidden;
}

.ai-features-pdf h3 {
    margin: 0;
    font-size: 0.95rem;  /* Smaller title to maximize PDF space */
    color: var(--text-primary);
    font-weight: 600;
}

.ai-pdf-container {
    flex: 1;
    min-height: 0;  /* Ensure proper flex shrinking */
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-pdf-container embed {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-md);
}

.ai-pdf-placeholder {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
}

/* Compact Modal - For Conclusions Only */
.ai-features-modal-compact {
    width: 600px;
    height: auto;
    max-height: 80vh;
}

.ai-features-content-compact {
    padding: var(--space-md) var(--space-lg);
}

.ai-features-fields-full {
    flex: 1;
    width: 100%;
}

.ai-features-modal-compact .ai-field-textarea {
    min-height: 200px;
    resize: vertical;
}

.ai-features-modal-compact .ai-features-actions {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .ai-features-content {
        flex-direction: column;
    }

    .ai-features-fields,
    .ai-features-pdf {
        flex: 1 1 auto;
    }

    .ai-features-modal {
        width: 98vw;
        height: 95vh;
    }

    .ai-features-modal-compact {
        width: 95vw;
        max-width: 600px;
    }
}

/* Responsive Design for Classification Section */
@media (max-width: 900px) {
    .classification-row-main {
        grid-template-columns: 1fr 1fr;
    }
}
