/* CSS Variables & Reset */
:root {
    /* HSL Colors */
    --hue: 220;
    --sat: 90%;
    color-scheme: dark;

    --bg-dark: hsl(220, 20%, 10%);
    --bg-card: hsl(220, 20%, 14%);
    --bg-hover: hsl(220, 20%, 18%);

    --primary: hsl(210, 100%, 60%);
    --primary-glow: hsl(210, 100%, 60%, 0.3);

    --text-main: hsl(0, 0%, 95%);
    --text-muted: hsl(220, 10%, 70%);

    --border: hsl(220, 20%, 25%);
    --border-light: hsl(220, 20%, 35%);

    --glass: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg-dark: hsl(210, 40%, 97%);
    --bg-card: #ffffff;
    --bg-hover: hsl(210, 40%, 94%);
    --primary: hsl(210, 80%, 45%);
    --primary-glow: hsla(210, 80%, 45%, 0.3);
    --text-main: hsl(220, 20%, 15%);
    --text-muted: hsl(220, 10%, 45%);
    --border: hsl(220, 15%, 85%);
    --border-light: hsl(220, 15%, 90%);
    --glass: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(15, 23, 42, 0.1);
}

.nav-icon-themeable {
    filter: invert(1);
}

:root[data-theme="light"] .nav-icon-themeable {
    filter: none;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.app-header {
    height: 64px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.header-title {
    height: 64px;
    display: flex;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.logo {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.api-key-container input {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    width: 240px;
    transition: var(--transition);
}

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

/* Main Content */
.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 20%);
}

/* Drop Zone */
.drop-zone {
    position: absolute;
    inset: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.drop-content {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 64px;
    border-radius: var(--radius-lg);
    text-align: center;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.drop-zone.drag-active .drop-content {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    transform: scale(1.02);
}

.icon-circle {
    width: 80px;
    height: 80px;
    background: var(--bg-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    color: var(--primary);
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    font-weight: 600;
}

p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.file-hint {
    font-size: 0.85rem;
    margin-bottom: 0;
    margin-top: 16px;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

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

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary-sm {
    padding: 4px 10px;
    font-size: 0.75rem;
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-hover);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* Split View */
.split-view {
    display: flex;
    height: 100%;
    width: 100%;
    padding: 16px 24px 16px 16px;
    gap: 0;
}

.split-view .left-panel.hidden,
.split-view .right-panel.hidden {
    display: none !important;
}

.column-resizer {
    flex: 0 0 10px;
    margin: 0 8px;
    border-radius: 999px;
    cursor: col-resize;
    position: relative;
    background: transparent;
    touch-action: none;
    transition: background 120ms ease;
}

.column-resizer::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: var(--border);
    opacity: 0.5;
    border-radius: 999px;
    transition: opacity 120ms ease;
}

.column-resizer:hover,
.column-resizer:focus-visible {
    background: var(--bg-hover);
}

.column-resizer:hover::before,
.column-resizer:focus-visible::before {
    opacity: 1;
}

body.is-resizing-columns,
body.is-resizing-columns * {
    cursor: col-resize !important;
    user-select: none !important;
}

.split-view.has-marks .left-panel {
    flex: 1.1;
}

.split-view.has-marks .right-panel {
    flex: 1.2;
}

.split-view.has-marks .mark-panel {
    flex: 0.7;
}

.split-view.folder-marks-view .column-resizer {
    display: none;
}

.split-view.folder-marks-view .folder-marks-panel {
    flex: 1;
    min-width: 0;
}

.panel {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.panel-header {
    height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--bg-dark);
}

.panel-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.panel-header-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.panel-header-action-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

.panel-header-zoom {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.panel-header-zoom-label {
    min-width: 52px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.pdf-container {
    flex: 1;
    background: #333;
    /* Dark background for PDF viewer contrast */
}

#transcription-content {
    flex: 1;
    padding: 24px;
    padding-bottom: calc(24px + 32px + env(safe-area-inset-bottom));
    overflow-y: auto;
    font-size: 1rem;
    color: var(--text-main);
    line-height: 1.7;
}

.mark-content {
    flex: 1;
    padding: 16px;
    padding-bottom: calc(16px + 24px + env(safe-area-inset-bottom));
    overflow-y: auto;
}

.mark-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.mark-results {
    flex: 1;
    min-height: 120px;
}

.mark-results.markdown-body[contenteditable="true"] {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    line-height: 1.7;
    outline: none;
}

.mark-results.markdown-body[contenteditable="true"]:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.7);
}

.mark-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.mark-actions .btn-secondary {
    padding: 10px 14px;
}

.folder-marks-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.folder-marks-actions .btn-secondary {
    padding: 8px 12px;
}

.mark-scheme-select {
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    width: 100%;
}

.mark-scheme-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.7);
}

.mark-teacher-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.mark-teacher-feedback {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: #0f172a;
    font: inherit;
    resize: vertical;
    min-height: 96px;
}

.mark-teacher-feedback:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.7);
}

.mark-schemes-page {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 12px;
    overflow: hidden;
}

.mark-schemes-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.mark-scheme-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.mark-scheme-panel .context-list {
    flex: 1;
}

.mark-scheme-tile {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-main);
}

.mark-scheme-tile:hover {
    background: var(--bg-hover);
}

.mark-scheme-tile.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.mark-scheme-tile-title {
    font-weight: 600;
    font-size: 0.9rem;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mark-scheme-tile-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.mark-scheme-split {
    flex: 1;
    padding: 0;
    height: auto;
    min-height: 0;
}

.mark-scheme-layout {
    flex: 1;
    height: auto;
    min-height: 0;
    padding: 0;
    width: 100%;
    display: flex;
    gap: 16px;
}

.mark-scheme-layout .left-panel {
    flex: 0 0 25%;
    min-width: 220px;
}

.mark-scheme-layout .right-panel {
    flex: 1 1 75%;
    min-width: 320px;
}

.context-builder-layout {
    flex: 1;
    height: auto;
    min-height: 0;
    padding: 0;
    width: 100%;
    display: flex;
    gap: 16px;
}

.context-builder-layout .left-panel {
    flex: 0 0 25%;
    min-width: 220px;
}

.context-builder-layout .right-panel {
    flex: 1 1 75%;
    min-width: 320px;
}

.context-upload {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.context-preview {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.context-preview-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.context-preview-frame {
    width: 100%;
    height: 200px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-muted);
}

.context-preview-filename {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-muted);
    border: 1px solid var(--border);
    word-break: break-all;
}

.context-builder-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 12px;
}

.context-save-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.context-title-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 220px;
}

.context-title-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.context-title-input {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

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

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

.context-action-buttons .btn-secondary {
    height: 42px;
}

.context-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.context-toolbar-btn {
    border: 1px solid var(--border);
    background: var(--bg-muted);
    color: var(--text-main);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.context-toolbar-btn:hover {
    background: var(--bg-hover);
}

.context-toolbar-select {
    height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-muted);
    color: var(--text-main);
    font-size: 0.85rem;
}

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

.context-editor {
    width: 100%;
    min-height: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-muted);
    color: var(--text-main);
    padding: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    flex: 1;
    overflow: auto;
}

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

.context-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
}

.context-list {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    overflow-y: auto;
}

.context-list-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

.context-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-muted);
    color: var(--text-main);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.context-pill:hover {
    background: var(--bg-hover);
}

.context-pill.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.context-builder-resizer {
    width: 12px;
    cursor: col-resize;
    position: relative;
    background: var(--bg-muted);
    border-radius: 999px;
    margin: 0 6px;
}

.context-builder-resizer::before {
    content: '';
    position: absolute;
    inset: 10px 4px;
    border-radius: 999px;
    background: var(--border);
    opacity: 0.6;
}

.context-builder-resizer:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.mark-prompt-meta {
    padding: 12px 16px 0 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mark-prompt-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.mark-prompt-title {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.mark-prompt-title:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.mark-prompt-editor {
    flex: 1;
    width: 100%;
    resize: none;
    padding: 16px;
    margin-top: 12px;
    border: 0;
    border-top: 1px solid var(--border);
    background: transparent;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 0;
    outline: none;
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9rem;
}

.mark-prompt-editor::placeholder {
    color: var(--text-muted);
}

.mark-empty {
    color: var(--text-muted);
    margin-bottom: 0;
}

.mark-fields {
    display: grid;
    gap: 16px;
}

.mark-field {
    display: grid;
    gap: 8px;
}

.mark-field-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.mark-field-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: #ffffff;
    color: #0f172a;
    font: inherit;
    resize: vertical;
}

.mark-field-input:focus {
    outline: 2px solid rgba(56, 189, 248, 0.45);
    border-color: transparent;
}

.mark-field-list {
    display: grid;
    gap: 8px;
}

/* Markdown Styling */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    margin-top: 24px;
    margin-bottom: 16px;
    color: var(--text-main);
}

.markdown-body p {
    margin-bottom: 16px;
    color: var(--text-main);
    /* Ensure readability */
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.markdown-body code {
    background: var(--bg-dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

/* Landing Overlay */
.landing-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    z-index: 999;
}

.landing-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.45) saturate(1.1);
}

.landing-content {
    position: relative;
    z-index: 1;
    text-align: center;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(28px, 8vh, 90px);
    padding: 36px 16px 24px;
}

.landing-auth-card {
    margin: 0 auto;
    width: min(420px, 92vw);
    background: rgba(10, 10, 12, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 20px 22px;
    text-align: left;
    backdrop-filter: blur(12px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.landing-label {
    display: block;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
    margin: 10px 0 6px;
}

.landing-input {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(15, 15, 18, 0.8);
    color: #fff;
    padding: 12px 14px;
    font-size: 1rem;
}

.landing-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

.landing-auth-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
}

.landing-cta {
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    padding: 16px 36px;
    font-size: clamp(1rem, 2vw, 1.3rem);
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.landing-secondary {
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    padding: 16px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #f8fafc;
    background: transparent;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.landing-secondary:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.45);
}

.landing-cta:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.26);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.4);
}

.landing-cta:active {
    transform: translateY(0);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.3);
}

.landing-title {
    font-size: clamp(2.8rem, 9vw, 5.5rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 0 18px rgba(255, 255, 255, 0.35);
    margin: clamp(12px, 4vh, 36px) 0 0;
}

.landing-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 12px;
}

.landing-message {
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.9rem;
    min-height: 1.2em;
}

@media (min-width: 640px) {
    .landing-auth-actions {
        flex-direction: row;
    }

    .landing-cta,
    .landing-secondary {
        flex: 1;
    }
}

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

/* CTA Area */
.transcribe-cta {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.cta-content p {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--text-main);
}

/* Sidebar & Workspace Layout */
.app-container {
    flex-direction: row;
    /* Change from col to row */
}

/* Sidebar Styling */
.app-sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    will-change: width;
}

.sidebar-header {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.sidebar-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary);
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-datetime {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    text-align: right;
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-theme-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
}

.header-theme-option {
    position: relative;
    display: inline-flex;
}

.header-theme-option input {
    position: absolute;
    opacity: 0;
}

.header-theme-option span {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    transition: var(--transition);
}

.header-theme-option img {
    width: 16px;
    height: 16px;
    opacity: 0.75;
}

:root:not([data-theme="light"]) .header-theme-option img {
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

.header-theme-option:hover span {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.header-theme-option input:checked + span {
    background: var(--bg-hover);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.header-theme-option input:focus-visible + span {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.app-sidebar.collapsed .sidebar-title {
    display: none;
}

/* Header panel toggles */
.viewer-toggles {
    display: flex;
    align-items: center;
    gap: 10px;
}

.viewer-toggles .btn-secondary {
    padding: 8px 14px;
}

.viewer-toggles .btn-secondary.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}



.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    padding-bottom: calc(12px + 24px + env(safe-area-inset-bottom));
}

.responses-history-list {
    max-height: 60vh;
}

.responses-files-header {
    padding: 0;
}

.responses-folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    padding-top: 16px;
    padding-left: 0;
    padding-right: 0;
}

#responses-unassigned-folder-grid,
#responses-class-folders-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

#responses-class-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 24px;
}

.responses-section {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.responses-section-top {
    border-top: none;
    padding-top: 0;
}

.responses-page {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 28px;
    gap: 22px;
    overflow: hidden;
}

.responses-page.is-class-detail {
    padding-top: 12px;
}

.responses-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.responses-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.responses-header-title h2 {
    font-size: 1.4rem;
    margin: 0;
}

.responses-section-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}

.responses-section-title {
    display: flex;
    flex-direction: column;
}

.responses-section-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    margin-top: 2px;
}

.folder-tile {
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
}

#responses-unassigned-folder-grid .folder-tile,
#responses-class-folders-grid .folder-tile {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    padding: 16px 12px;
    min-height: 140px;
    border: none;
    background: transparent;
}

.folder-tile-new {
    border: none;
    background: transparent;
}

.folder-tile-new:hover {
    background: var(--bg-hover);
}

.folder-tile-new .folder-icon-new {
    background: linear-gradient(135deg, #7dd3fc 0%, #38bdf8 45%, #2563eb 100%);
    color: #ffffff;
}

.folder-tile-new .folder-tile-meta {
    font-weight: 600;
}

.class-tile {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    padding: 29px 21px;
    min-height: 254px;
    border: none;
    background: transparent;
}

.root-folder-tile {
    display: flex;
}

.folder-tile:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

#responses-class-grid .folder-tile:hover,
#responses-unassigned-folder-grid .folder-tile:hover,
#responses-class-folders-grid .folder-tile:hover,
#responses-unassigned-list .history-item:hover,
#responses-class-files-list .history-item:hover {
    background: transparent;
    border-color: transparent;
}

.folder-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(56, 189, 248, 0.12);
    color: var(--primary);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    position: relative;
}

#responses-unassigned-folder-grid .folder-icon,
#responses-class-folders-grid .folder-icon {
    width: 150px;
    height: 100px;
    border-radius: 20px;
}

#responses-unassigned-folder-grid .folder-icon svg,
#responses-class-folders-grid .folder-icon svg {
    width: 40px;
    height: 40px;
}

#responses-unassigned-folder-grid .folder-icon:not(.folder-icon-new) svg,
#responses-class-folders-grid .folder-icon:not(.folder-icon-new) svg {
    display: none;
}

.folder-icon-label {
    display: none;
}

#responses-unassigned-folder-grid .folder-icon-label,
#responses-class-folders-grid .folder-icon-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
    text-align: center;
    line-height: 1.2;
    white-space: normal;
}

.class-folder-icon {
    width: 254px;
    height: 173px;
    border-radius: 20px;
    background: var(--class-gradient, var(--bg-hover));
    color: var(--text-main);
    position: relative;
    box-shadow: none;
    overflow: hidden;
}

.class-tile-new {
    border: none;
}

.class-tile-new .class-folder-icon-new {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #7dd3fc 0%, #38bdf8 45%, #2563eb 100%);
    color: #ffffff;
    box-shadow: none;
}

.class-tile-new .class-folder-icon-new,
.folder-tile-new .folder-icon-new,
#responses-unassigned-list .history-item-new .history-item-icon,
#responses-class-files-list .history-item-new .history-item-icon {
    box-shadow: 0 18px 30px rgba(37, 99, 235, 0.35);
    transform: translateY(-3px);
}

.class-tile-new .folder-tile-meta {
    color: var(--primary);
    font-weight: 700;
}

.folder-tile-new .folder-tile-meta {
    color: var(--primary);
    font-weight: 700;
}

.class-tile-new .class-folder-icon-new img,
.folder-tile-new .folder-icon-new img,
#responses-unassigned-list .history-item-new .history-item-icon img,
#responses-class-files-list .history-item-new .history-item-icon img {
    filter: invert(1) brightness(1.2);
}

.class-folder-icon svg {
    display: none;
}

.class-folder-label {
    position: absolute;
    inset: 0;
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-main);
    text-align: center;
    line-height: 1.15;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    z-index: 2;
}

.class-color-blue {
    --class-gradient: linear-gradient(135deg, #4dc4ff 0%, #2f8cff 55%, #1b63ff 100%);
}

.class-color-sky {
    --class-gradient: linear-gradient(135deg, #78e3ff 0%, #4fb8ff 60%, #2c7dff 100%);
}

.class-color-teal {
    --class-gradient: linear-gradient(135deg, #4efbd7 0%, #21c4b8 55%, #0b8e9b 100%);
}

.class-color-green {
    --class-gradient: linear-gradient(135deg, #6ef7a8 0%, #30d57f 55%, #18a865 100%);
}

.class-color-amber {
    --class-gradient: linear-gradient(135deg, #ffd66a 0%, #ffb64a 55%, #f2892e 100%);
}

.class-color-orange {
    --class-gradient: linear-gradient(135deg, #ffb474 0%, #ff914a 55%, #e96a2c 100%);
}

.class-color-pink {
    --class-gradient: linear-gradient(135deg, #ff9bdd 0%, #ff6bbb 55%, #e0469a 100%);
}

.class-tile .folder-tile-meta {
    font-size: 0.75rem;
}

.class-tile.opening .class-folder-icon {
    animation: folder-open 220ms ease-out;
}

.class-tile.opening .class-folder-icon svg {
    animation: folder-open-icon 220ms ease-out;
}

@keyframes folder-open {
    0% { transform: translateY(0); filter: brightness(1); }
    55% { transform: translateY(-4px) scale(1.02); filter: brightness(1.08); }
    100% { transform: translateY(0); filter: brightness(1); }
}

@keyframes folder-open-icon {
    0% { transform: translateY(-8px) scale(1); }
    55% { transform: translateY(-14px) scale(1.03); }
    100% { transform: translateY(-8px) scale(1); }
}

.folder-tile-name {
    font-weight: 600;
    color: var(--text-main);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.folder-tile-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.responses-drawer {
    flex: 0 0 260px;
    max-width: 260px;
    transition: flex-basis 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), max-width 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: flex-basis, max-width;
}

.responses-drawer.collapsed {
    flex-basis: 56px;
    max-width: 56px;
}

.responses-drawer.collapsed .panel-header {
    justify-content: center;
    padding: 0 8px;
}

.responses-drawer.collapsed .panel-title {
    opacity: 0;
    transform: translateX(-8px);
    pointer-events: none;
}

.responses-drawer.collapsed .responses-drawer-list {
    opacity: 0;
    transform: translateX(-6px);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}

.responses-drawer.collapsed #responses-drawer-toggle svg {
    transform: rotate(180deg);
}

.responses-drawer-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    opacity: 1;
    transform: translateX(0);
    max-height: 999px;
    transition: opacity 0.22s ease, transform 0.22s ease, max-height 0.32s ease, padding 0.22s ease;
}

.responses-drawer-list .status-icon {
    display: none;
}

.responses-drawer .panel-title {
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.responses-drawer .panel-header {
    transition: padding 0.22s ease, justify-content 0.22s ease;
}

.responses-drawer #responses-drawer-toggle svg {
    transition: transform 0.22s ease;
}

.responses-drawer.collapsed #responses-drawer-marks-btn {
    display: none;
}

.responses-drawer-controls {
    padding: 0 12px 8px;
}

.responses-drawer-controls .btn-secondary {
    width: 100%;
    justify-content: center;
}

.responses-folder-banner {
    margin: 16px 16px 0 16px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-weight: 600;
    max-width: max-content;
}

.folder-mark-entry {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.folder-marks-header {
    margin-bottom: 8px;
}

.folder-marks-header h3 {
    margin: 0;
    font-size: 1rem;
}

.folder-mark-entry h4 {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
}

.folder-mark-entry .mark-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.folder-mark-entry .mark-output {
    border-top: 1px dashed var(--border);
    padding-top: 10px;
}

.responses-unassigned {
    margin-top: 18px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.responses-class-detail {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.responses-class-detail-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}

.responses-class-title {
    font-size: 2.6rem;
    margin: 0;
}

.responses-class-subsection-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.responses-page.is-class-detail .responses-actions,
.responses-page.is-class-detail .responses-section,
.responses-page.is-class-detail .responses-unassigned {
    display: none;
}

.responses-page.is-class-detail .responses-class-detail {
    border-top: none;
    padding-top: 0;
}

.responses-page.is-class-detail .responses-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.responses-page.is-class-detail #responses-page-title {
    display: none;
}


.responses-page.is-class-detail #new-class-btn {
    display: none;
}

.responses-class-subsection h4 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-main);
}

.responses-class-subsection {
    padding-bottom: 10px;
}

.responses-class-subsection-header .btn-secondary.btn-icon-only {
    padding: 10px 14px;
}

.responses-section-header h3 {
    margin: 0;
    font-size: 1.4rem;
}

.responses-section-header p {
    margin: 4px 0 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-secondary.btn-accent {
    border: 1px solid transparent;
    color: #0b1625;
    font-weight: 600;
}

.btn-secondary.btn-icon-only {
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary.btn-icon-only svg {
    display: block;
}

.btn-secondary.btn-accent:hover {
    filter: brightness(1.05);
}

.btn-secondary.btn-accent-class {
    background: linear-gradient(135deg, hsl(210, 95%, 62%), hsl(200, 90%, 52%));
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.25);
}

.btn-secondary.btn-accent-folder {
    background: linear-gradient(135deg, hsl(168, 70%, 54%), hsl(162, 68%, 44%));
    box-shadow: 0 10px 18px rgba(16, 185, 129, 0.22);
}

.btn-secondary.btn-accent-upload {
    background: linear-gradient(135deg, hsl(38, 95%, 62%), hsl(30, 90%, 54%));
    box-shadow: 0 10px 18px rgba(245, 158, 11, 0.2);
}

:root[data-theme="light"] .btn-secondary.btn-accent {
    color: #ffffff;
}

.responses-unassigned-list {
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 120px;
}

#responses-unassigned-list,
#responses-class-files-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding: 16px 0;
    overflow-y: visible;
    border: none;
    background: transparent;
    min-height: 0;
}

.responses-empty {
    padding: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

#responses-unassigned-list .responses-empty,
#responses-class-files-list .responses-empty {
    grid-column: 1 / -1;
}

.history-item {
    background: var(--bg-dark);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
}

#responses-unassigned-list .history-item,
#responses-class-files-list .history-item {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    padding: 16px 12px;
    min-height: 140px;
    background: transparent;
    border: none;
    margin-bottom: 0;
}

#responses-class-grid .folder-tile,
#responses-unassigned-folder-grid .folder-tile,
#responses-class-folders-grid .folder-tile,
#responses-unassigned-list .history-item,
#responses-class-files-list .history-item {
    perspective: 900px;
}

#responses-class-grid .class-folder-icon,
#responses-unassigned-folder-grid .folder-icon,
#responses-class-folders-grid .folder-icon,
#responses-unassigned-list .status-icon,
#responses-class-files-list .status-icon,
#responses-unassigned-list .history-item-icon,
#responses-class-files-list .history-item-icon,
#responses-class-grid .class-folder-icon-new {
    transition: transform 180ms ease, box-shadow 180ms ease;
    transform: translateZ(0);
}

#responses-class-grid .folder-tile:hover .class-folder-icon,
#responses-unassigned-folder-grid .folder-tile:hover .folder-icon,
#responses-class-folders-grid .folder-tile:hover .folder-icon,
#responses-unassigned-list .history-item:hover .status-icon,
#responses-class-files-list .history-item:hover .status-icon,
#responses-unassigned-list .history-item:hover .history-item-icon,
#responses-class-files-list .history-item:hover .history-item-icon,
#responses-class-grid .folder-tile:hover .class-folder-icon-new {
    transform: translateY(-4px) rotateX(6deg) rotateY(-6deg);
    box-shadow: 0 16px 26px rgba(18, 74, 140, 0.18);
}

#responses-unassigned-list .history-item:hover,
#responses-class-files-list .history-item:hover {
    background: transparent;
}

#responses-unassigned-list .status-icon,
#responses-class-files-list .status-icon {
    width: 150px;
    height: 100px;
    border-radius: 20px;
    background: rgba(56, 189, 248, 0.12);
    color: var(--primary);
    display: grid;
    place-items: center;
    order: -1;
    position: relative;
}

#responses-unassigned-list .status-icon svg,
#responses-class-files-list .status-icon svg {
    width: 40px;
    height: 40px;
}

#responses-unassigned-list .history-item:not(.history-item-new) .status-icon svg,
#responses-class-files-list .history-item:not(.history-item-new) .status-icon svg,
#responses-unassigned-list .history-item:not(.history-item-new) .status-emoji,
#responses-class-files-list .history-item:not(.history-item-new) .status-emoji {
    display: none;
}

#responses-unassigned-list .status-transcribing,
#responses-class-files-list .status-transcribing {
    font-size: 28px;
}

.file-icon-label {
    display: none;
}

#responses-unassigned-list .file-icon-label,
#responses-class-files-list .file-icon-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    text-align: center;
    line-height: 1.2;
    white-space: normal;
    flex-direction: column;
    gap: 6px;
}

.file-label-line {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.file-label-text {
    max-width: 100%;
    word-break: break-word;
}

.history-item-new {
    border-style: dashed;
    background: transparent;
    justify-content: center;
}

#responses-unassigned-list .history-item-new,
#responses-class-files-list .history-item-new {
    border-style: none;
    background: transparent;
}

#responses-unassigned-list .history-item-icon,
#responses-class-files-list .history-item-icon {
    width: 150px;
    height: 100px;
    border-radius: 20px;
    background: rgba(56, 189, 248, 0.12);
    color: var(--primary);
    position: relative;
}

#responses-unassigned-list .history-item-new .history-item-icon,
#responses-class-files-list .history-item-new .history-item-icon {
    background: linear-gradient(135deg, #7dd3fc 0%, #38bdf8 45%, #2563eb 100%);
    color: #ffffff;
}

#responses-unassigned-list .history-item-icon img,
#responses-class-files-list .history-item-icon img {
    width: 40px;
    height: 40px;
}

.history-item-new:hover {
    background: transparent;
}

.history-item-new .history-name {
    flex: 0 0 auto;
}

.history-item-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.history-item:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.history-item.active {
    border-color: var(--primary);
    background: rgba(56, 189, 248, 0.1);
}

.history-name {
    font-size: 0.95rem;
    /* Slightly larger text */
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Flex grow to take up space between icons */
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-name-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-status-indicators {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.file-status {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid #cbd5f5;
    background: #e2e8f0;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.file-status.is-complete {
    background: #22c55e;
    border-color: #16a34a;
    color: #000000;
}

#responses-unassigned-list .history-name,
#responses-class-files-list .history-name {
    display: none;
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Workspace wrapper to replace old main flex */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0;
    /* Prevent flex overflow */
}

/* Localized Loading State */
.panel {
    position: relative;
    /* Ensure panel can contain absolute loader */
}

/* Override existing fixed loader if needed, but the HTML move handles most */
.right-panel .loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    /* Above content but below modals if any */
    background: rgba(10, 10, 10, 0.9);
    /* Slightly darker for panel */
    border-radius: var(--radius-md);
    /* Match panel radius */
}

/* Matrix Loader Specifics */
#matrix-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* Behind text */
    opacity: 0.8;
}

.loading-text {
    position: relative;
    z-index: 2;
    /* Above canvas */
    background: rgba(10, 10, 10, 0.7);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--primary-glow);
    display: flex;
    align-items: center;
    gap: 4px;
}

.loading-text p {
    margin: 0;
    color: var(--primary);
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 600;
}

.blink {
    animation: blink 1s step-end infinite;
    color: var(--primary);
    font-weight: bold;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* Hide fallback spinner styles if no longer needed, or keep for safety */
.spinner {
    display: none;
}

/* Particle Loader Overrides */
.loading-text p {
    color: #fff;
    /* White text for better contrast against space */
    text-shadow: 0 0 10px var(--primary);
}

.blink {
    color: #fff;
}

/* Disabled Button Style */
.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Status Indicators in Sidebar */
.status-icon {
    margin-left: auto;
    font-size: 1.2rem;
}

.status-pending {
    color: #888;
}

.status-transcribing {
    animation: spin 2s linear infinite;
}

.status-completed {
    color: #4CAF50;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Collapsible Sidebar */
.app-sidebar {
    transition: width 0.3s ease;
    overflow: hidden;
    /* Hide text when shrinking */
}

.app-sidebar.collapsed {
    width: 90px;
}



.app-sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 1rem 0;
}

.app-sidebar.collapsed .history-name {
    display: none;
}

.app-sidebar.collapsed .history-list {
    display: none;
}

.app-sidebar.collapsed .history-item {
    justify-content: center;
    padding: 0.75rem;
}

.app-sidebar.collapsed .status-icon {
    margin-left: 0;
    font-size: 1.4rem;
}

/* Tooltip for collapsed state */
.app-sidebar.collapsed .history-item:hover::after {
    content: attr(data-filename);
    /* We need to add this attribute in JS */
    position: absolute;
    left: 70px;
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

.btn-icon-sm {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Sidebar Navigation */
.sidebar-nav {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px;
    border-top: 1px solid var(--border);
}

.app-sidebar.collapsed .sidebar-footer {
    padding: 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    text-align: left;
}

.nav-item .nav-icon {
    width: 18px;
    height: 18px;
    display: block;
    flex-shrink: 0;
}

:root:not([data-theme="light"]) .nav-item .nav-icon,
:root:not([data-theme="light"]) .nav-item .nav-icon svg {
    color: #ffffff;
    fill: currentColor;
    stroke: currentColor;
}

:root:not([data-theme="light"]) .sidebar-nav .nav-icon {
    filter: brightness(0) invert(1);
}

:root:not([data-theme="light"]) #sidebar-toggle img {
    filter: brightness(0) invert(1);
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-main);
    transform: translateX(2px);
}

.nav-item.active {
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary);
}

.files-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    padding-bottom: 8px;
}

.history-divider {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.files-header .history-divider {
    flex: 1;
}

/* Collapsed Nav Overrides */
.app-sidebar.collapsed .nav-item span {
    display: none;
}

.app-sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
}

.app-sidebar.collapsed .nav-item svg {
    width: 24px;
    height: 24px;
}

.app-sidebar.collapsed .nav-item .nav-icon {
    width: 24px;
    height: 24px;
}

/* Smoother collapse/expand */
.app-sidebar .nav-item span {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.app-sidebar.collapsed .nav-item span {
    opacity: 0;
    transform: translateX(-6px);
}

.app-sidebar.collapsed .files-header {
    display: none;
}

.app-sidebar.collapsed .history-divider {
    display: none;
}

/* View Sections */
.view-section {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Home View */
#view-home {
    padding: 40px;
    overflow: auto;
}

.home-page {
    flex: 1;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.home-welcome {
    padding: 24px 24px 0;
}

.home-welcome h2 {
    margin: 0;
    font-size: 2rem;
    color: var(--text-main);
}

.home-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    grid-template-rows: repeat(3, minmax(180px, 1fr));
    gap: 16px;
    padding: 24px;
    flex: 1;
    min-height: 0;
}

.home-tile {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-dark);
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 240ms ease, box-shadow 240ms ease, border-color 240ms ease;
}

.home-tile::after {
    content: "";
    position: absolute;
    inset: -120% -60%;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.08) 50%, transparent 70%);
    transform: translateX(-60%);
    transition: transform 460ms ease;
    pointer-events: none;
}

.home-tile:hover {
    transform: translate3d(0, -6px, 0);
    box-shadow: 0 22px 44px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.home-tile:hover::after {
    transform: translateX(60%);
}

.home-tile[draggable='true'] {
    cursor: grab;
}

.home-tile.is-dragging {
    cursor: grabbing;
    opacity: 1;
    z-index: 2;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
    border-style: dashed;
}

.home-tile-stats {
    display: flex;
    align-items: stretch;
}

.home-dashboard {
    padding: clamp(14px, 2vw, 24px);
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 1.6vw, 16px);
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.home-dashboard-header h2 {
    font-size: clamp(1.3rem, 2.2vw, 2rem);
    margin-bottom: 8px;
    color: var(--text-main);
}

.home-dashboard-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: clamp(0.85rem, 1.6vw, 1rem);
}

.home-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: clamp(8px, 1.6vw, 12px);
    flex: 1;
    min-height: 0;
    align-content: stretch;
}

.home-dashboard-card {
    border: 1px solid var(--border);
    background: var(--bg-dark);
    border-radius: var(--radius-md);
    padding: clamp(10px, 1.4vw, 14px) clamp(12px, 1.6vw, 16px);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: clamp(10px, 2vw, 16px);
    min-height: 0;
    position: relative;
    overflow: hidden;
    transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.home-dashboard-card::after {
    content: "";
    position: absolute;
    inset: -120% -60%;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.12) 50%, transparent 70%);
    transform: translateX(-60%);
    transition: transform 420ms ease;
    pointer-events: none;
}

.home-dashboard-card:hover {
    transform: translate3d(0, -4px, 0);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.18);
}

.home-dashboard-card:hover::after {
    transform: translateX(60%);
}

.home-tile-stats .home-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.home-dashboard-card-time {
    grid-column: 2;
    grid-row: 2;
}

.home-dashboard-label {
    margin: 0;
    font-size: clamp(0.68rem, 1.2vw, 0.82rem);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.home-dashboard-word {
    display: block;
}

.home-dashboard-value {
    font-size: clamp(1.1rem, 2.1vw, 1.8rem);
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    min-width: 3ch;
}

.home-tile-usage .home-dashboard-card {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: clamp(8px, 1.4vw, 10px);
}

.home-tile-usage .home-dashboard-label {
    align-items: center;
}

.home-tile-usage .home-dashboard-value {
    font-size: clamp(0.95rem, 2vw, 1.4rem);
    white-space: nowrap;
}

.home-tile-todo .home-dashboard {
    gap: clamp(10px, 1.8vw, 18px);
}

.home-todo-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.home-todo-count {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.04);
    white-space: nowrap;
}

.home-todo-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: auto;
    padding-right: 6px;
    min-height: 0;
}

.home-todo-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}

.home-todo-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-todo-more {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.home-todo-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}


/* File Organiser View */
#view-pdf-organiser {
    padding: 28px;
    overflow-y: auto;
}

.pdf-organiser-page {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex: 1;
}

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

.pdf-organiser-header h2 {
    font-size: 2rem;
    margin: 0;
    color: var(--text-main);
}

.pdf-organiser-subtitle {
    color: var(--text-muted);
    margin: 0;
}

.pdf-organiser-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: var(--radius-md);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pdf-organiser-setup-card {
    height: auto;
}

.pdf-organiser-columns {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 12px minmax(320px, 2fr);
    gap: 20px;
    flex: 1;
    align-items: stretch;
    --pdf-organiser-resizer: 12px;
}

.pdf-organiser-left-rail {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pdf-organiser-section-title {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.pdf-organiser-section-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pdf-organiser-section-text h3 {
    margin: 0;
    line-height: 1.15;
}

.pdf-organiser-section-text .pdf-organiser-hint {
    margin: 0;
}

.pdf-organiser-icon-btn {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.pdf-organiser-icon-btn img {
    width: 32px;
    height: 32px;
    filter: invert(1);
}

.root[data-theme="light"] .pdf-organiser-icon-btn img,
:root[data-theme="light"] .pdf-organiser-icon-btn img {
    filter: none;
}

.pdf-organiser-icon-btn:hover {
    background: var(--bg-hover);
}

.pdf-organiser-left-rail #responses-unassigned-folder-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 12px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 6px;
}

.pdf-organiser-left-rail #responses-unassigned-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 0;
    border: none;
    background: transparent;
    min-height: 0;
}

.pdf-organiser-left-rail #responses-unassigned-folder-grid .folder-tile {
    flex-direction: row;
    align-items: center;
    text-align: left;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    min-height: 0;
    justify-content: space-between;
    height: 56px;
}

.pdf-organiser-left-rail #responses-unassigned-folder-grid .folder-tile-new {
    display: none;
}

.pdf-organiser-left-rail #responses-unassigned-folder-grid .folder-icon {
    display: flex;
    align-items: center;
    gap: 0;
    width: auto;
    height: auto;
    background: transparent;
}

.pdf-organiser-left-rail #responses-unassigned-folder-grid .folder-icon-label {
    position: static;
    display: block;
    font-weight: 600;
    padding: 0;
}

.pdf-organiser-left-rail #responses-unassigned-folder-grid .folder-tile-meta {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.pdf-organiser-left-rail #responses-unassigned-list .history-item {
    margin: 0;
    align-items: center;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    height: 56px;
    display: flex;
    justify-content: space-between;
    flex-direction: row;
    text-align: left;
    min-height: 0;
}

.pdf-organiser-left-rail #responses-unassigned-list .history-item-icon,
.pdf-organiser-left-rail #responses-unassigned-list .status-icon {
    display: none;
}

.pdf-organiser-left-rail #responses-unassigned-list .history-name {
    margin: 0;
    display: flex;
    font-weight: 600;
    color: var(--text-main);
}

.pdf-organiser-resizer {
    width: var(--pdf-organiser-resizer);
    cursor: col-resize;
    background: var(--border);
    border-radius: 999px;
    margin: 0 auto;
    touch-action: none;
}

.pdf-organiser-resizer:focus {
    outline: 2px solid var(--text-muted);
    outline-offset: 2px;
}

.pdf-organiser-card h3 {
    margin: 0 0 12px;
    font-size: 1.1rem;
}

.pdf-organiser-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.pdf-organiser-upload-btn {
    width: 100%;
    justify-content: center;
}

.pdf-organiser-preview {
    position: relative;
    flex: 1;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    overflow: auto;
    align-items: center;
}

.pdf-organiser-preview-header {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.pdf-organiser-page-indicator {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: none;
}

#pdf-organiser-canvas {
    display: none;
    width: auto;
    height: auto;
    max-width: none;
    flex: 0 0 auto;
    border-radius: var(--radius-sm);
    background: #fff;
}

.pdf-organiser-empty {
    color: var(--text-muted);
    margin: 0;
}

.pdf-organiser-card p {
    margin: 0;
    color: var(--text-muted);
}

.pdf-organiser-range {
    margin-top: 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
}

.pdf-organiser-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.pdf-organiser-input {
    width: 100%;
    justify-self: stretch;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-main);
}

#pdf-organiser-save-range-btn {
    grid-column: 1 / -1;
    justify-self: start;
}

.pdf-organiser-save-btn {
    width: 100%;
    background: hsl(210, 90%, 40%);
    color: #fff;
    border-color: hsl(210, 90%, 32%);
    padding: 12px 24px;
    font-size: 1rem;
}

.pdf-organiser-save-btn:hover {
    filter: brightness(1.05);
}

.pdf-organiser-hint {
    grid-column: 1 / -1;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}

.pdf-organiser-saved-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.pdf-organiser-add-all-btn {
    width: 100%;
    margin-top: 16px;
    opacity: 0.6;
    cursor: not-allowed;
}

.pdf-organiser-add-all-btn.is-active {
    opacity: 1;
    cursor: pointer;
    background: hsl(210, 85%, 45%);
    color: #fff;
    border-color: hsl(210, 90%, 32%);
}

.pdf-organiser-add-all-btn.is-active:hover {
    filter: brightness(1.05);
}

.pdf-organiser-saved-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    cursor: context-menu;
}

.pdf-organiser-saved-item a {
    color: var(--text-main);
    text-decoration: none;
}

.pdf-organiser-saved-item a:hover {
    text-decoration: underline;
}

.pdf-organiser-empty-saved {
    color: var(--text-muted);
    margin: 0;
}

.pdf-organiser-context-menu {
    position: fixed;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    z-index: 20;
}

.pdf-organiser-context-menu.hidden {
    display: none;
}

.pdf-organiser-context-menu button {
    background: transparent;
    border: 0;
    padding: 8px 10px;
    text-align: left;
    color: var(--text-main);
    border-radius: var(--radius-sm);
}

.pdf-organiser-context-menu button:hover {
    background: var(--bg);
}

/* Model Answer Writer View */
#view-model-answer-writer {
    padding: 40px;
    overflow-y: auto;
}

.model-answer-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    min-height: 100%;
}

.model-answer-coming {
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
    text-align: center;
}

/* Settings View */
#view-settings {
    padding: 40px;
    overflow-y: auto;
}

.settings-container {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.settings-container h2 {
    font-size: 2rem;
    margin-bottom: 32px;
    color: var(--text-main);
}

.settings-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.settings-group-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.settings-group h3 {
    margin: 0 0 12px;
    font-size: 1.2rem;
}

.settings-group-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-field label {
    font-weight: 600;
    color: var(--text-main);
}

.settings-input {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: inherit;
    transition: var(--transition);
}

.settings-input:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-color: var(--primary);
}

.theme-toggle {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.theme-option {
    position: relative;
    flex: 1 1 120px;
}

.theme-option input {
    position: absolute;
    opacity: 0;
}

.theme-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-dark);
    color: var(--text-main);
    font-weight: 500;
    transition: var(--transition);
}

.theme-option:hover span {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.theme-option input:checked + span {
    border-color: var(--primary);
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary-glow);
}

.theme-option input:focus-visible + span {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

.btn-sidebar-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.btn-sidebar-action:hover {
    background: var(--border);
}

/* Folder Styling */
.folder-item {
    margin-bottom: 4px;
}

.folder-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.folder-header:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.folder-header svg {
    color: var(--text-muted);
    transition: transform 0.2s;
}

.folder-header.open svg {
    transform: rotate(90deg);
    /* Right to Down */
}

.folder-content {
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
    display: none;
    /* Hidden by default */
}

.folder-content.open {
    display: block;
}

/* Rich Text Editor Styles */
.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background-color: #f3f4f6;
    /* Outer gray bg */
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #374151;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
}

.toolbar-btn:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background-color: #e5e7eb;
    margin: 0 0.5rem;
}

.toolbar-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: #374151;
    outline: none;
}

.editor-content {
    flex: 1;
    width: 100%;
    /* Max width for readability "Paper" mode */
    max-width: 800px;
    margin: 0 auto;
    background-color: #ffffff;
    color: #000000 !important;
    /* Strict Black on White */
    padding: 3rem;
    overflow-y: auto;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    line-height: 1.7;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.editor-content p {
    margin-bottom: 1em;
    color: #000000 !important;
}

.editor-content h1,
.editor-content h2,
.editor-content h3 {
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #000000 !important;
}

/* Context Menu for Move */
.context-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-sm);
    padding: 4px;
    z-index: 9999;
    min-width: 150px;
}

.context-menu-item {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-main);
    font-size: 0.9rem;
    border-radius: 4px;
}

.context-menu-item:hover {
    background: var(--primary);
    color: white;
}

.context-menu-label {
    cursor: default;
    color: var(--text-muted);
}

.context-menu-label:hover {
    background: transparent;
    color: var(--text-muted);
}

.context-menu-color {
    display: flex;
    align-items: center;
    gap: 8px;
}

.context-menu-color .color-swatch {
    width: 16px;
    height: 16px;
    border-radius: 6px;
    background: var(--class-gradient, var(--bg-muted));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.context-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}
