/* BG Archive - Modern Scandinavian Styles */

:root {
    /* Light Theme (warm sepia / archival — matches the app + logo) */
    --bg-body: #f6f1ea; /* Cream */
    --bg-surface: #fbf8f4; /* Off-white */
    --bg-surface-secondary: #efe7dc;

    --text-primary: #2a211b; /* Dark brown */
    --text-secondary: #6e5d50; /* Muted brown */
    --text-tertiary: #9c8b7d;

    --accent-color: #6d4c41; /* Warm brown */
    --accent-hover: #573b32;
    --accent-subtle: #f0e7dd;

    --border-color: #e3d8c9;
    --border-hover: #d2c3b0;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.dark-mode {
    /* Dark Theme (warm sepia / archival) */
    --bg-body: #0a0a0f; /* Near-black */
    --bg-surface: #15131a;
    --bg-surface-secondary: #1e1b24;

    --text-primary: #ece6df; /* Warm off-white */
    --text-secondary: #b5aba0;
    --text-tertiary: #8a8079;

    --accent-color: #b98b6e; /* Lighter warm brown for dark mode */
    --accent-hover: #c99e82;
    --accent-subtle: #241c17;

    --border-color: #2a2731;
    --border-hover: #3a3744;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    height: 100vh; /* Fix for full height layout */
    display: flex;
    flex-direction: column;
}

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

/* Button Resets & Defaults */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    transition: all 0.2s ease;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-hover);
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* BG Archive - Index/App Layout */

/* Top Navigation */
.top-nav {
    height: 64px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
    /* Glassmorphism hint */
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.nav-logo {
    height: 32px;
    width: auto;
    border-radius: 4px;
}

/* Invert logo colors in dark mode */
body.dark-mode .nav-logo {
    filter: invert(1);
}

.nav-title {
    font-weight: 600;
    font-size: 18px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

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

/* Search Bar - Integrated in Nav */
.search-container-nav {
    flex: 1;
    max-width: 600px;
    margin: 0 20px;
}

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

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-tertiary);
    font-size: 14px;
    pointer-events: none;
}

.search-input-minimal {
    width: 100%;
    padding: 10px 40px 10px 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-secondary);
    border-radius: 99px;
    /* Pill shape */
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-input-minimal:focus {
    outline: none;
    background: var(--bg-surface);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.clear-search-btn-minimal {
    position: absolute;
    right: 12px;
    color: var(--text-tertiary);
    font-size: 14px;
}

.clear-search-btn-minimal:hover {
    color: var(--text-primary);
}

/* Minimal Buttons (Theme, Favs) */
.theme-toggle-minimal,
.favorites-toggle-minimal {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-secondary);
    position: relative;
}

.theme-toggle-minimal:hover,
.favorites-toggle-minimal:hover {
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
}

/* Support Button */
.support-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 99px;
    background: linear-gradient(135deg, #6d4c41, #573b32);
    color: white;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.support-btn:hover {
    background: linear-gradient(135deg, #573b32, #573b32);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(109, 76, 65, 0.35);
}

.support-btn i {
    font-size: 13px;
}

@media (max-width: 768px) {
    .support-btn .support-text {
        display: none;
    }
    .support-btn {
        width: 40px;
        height: 40px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }
}

.count-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--accent-color);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

/* App Layout */
.app-container {
    padding-top: 64px;
    /* Space for fixed header */
    min-height: 100vh;
    overflow: auto;
}

.main-layout {
    display: flex;
    height: 100%;
}

/* Image-only mode (for image type documents) */
/* Image document placeholder */
.image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 24px;
    min-height: 300px;
}
.image-placeholder-icon {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--bg-surface-secondary);
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
    color: var(--text-tertiary);
    margin-bottom: 20px;
}
.image-placeholder h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.image-placeholder p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 320px;
}
.view-original-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #6d4c41, #573b32);
    color: white;
    border-radius: 10px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
}
.view-original-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(109, 76, 65, 0.3);
    color: white;
}

.text-column.image-mode-hidden {
    display: none !important;
}

.main-layout.image-only-mode {
    flex-direction: row;
    min-height: calc(100vh - 64px - 80px); /* viewport - nav - footer */
}

.main-layout.image-only-mode .context-column {
    flex: 1;
    max-width: none;
    width: 100%;
    border-left: none;
    padding: 24px;
}

.main-layout.image-only-mode .context-scroll-wrapper {
    display: flex;
    flex-direction: row;
    gap: 24px;
    width: 100%;
    overflow: visible;
    padding: 0;
}

.main-layout.image-only-mode .image-card {
    flex: 2;
    order: 1;
    max-width: none;
    min-width: 0;
}

.main-layout.image-only-mode .meta-card {
    flex: 1;
    order: 2;
    min-width: 320px;
    max-width: 420px;
    height: fit-content;
    position: sticky;
    top: 24px;
    display: block !important; /* Override mobile hiding */
}

.main-layout.image-only-mode .image-container {
    max-height: none;
    height: auto;
    min-height: 400px;
}

.main-layout.image-only-mode .image-container img {
    max-height: 75vh;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    margin: 0 auto;
    display: block;
}

/* Hide mobile header in image mode since we show metadata in side panel */
.main-layout.image-only-mode ~ .mobile-doc-header,
body.image-mode-active .mobile-doc-header {
    display: none !important;
}

/* Mobile: stack vertically in image mode */
@media (max-width: 900px) {
    .main-layout.image-only-mode {
        flex-direction: column;
    }

    .main-layout.image-only-mode .context-column {
        padding: 16px;
    }

    .main-layout.image-only-mode .context-scroll-wrapper {
        flex-direction: column;
    }

    .main-layout.image-only-mode .meta-card {
        min-width: auto;
        max-width: none;
        order: 1;
        position: static;
    }

    .main-layout.image-only-mode .image-card {
        order: 2;
    }

    .main-layout.image-only-mode .image-container img {
        max-height: none;
    }
}

/* Text Column (Primary) */
.text-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-surface);
    position: relative;
    z-index: 1;
}

.text-panel-header {
    height: 60px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
}


.text-controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.font-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    border-left: 1px solid var(--border-color);
    padding-left: 15px;
}

.icon-btn,
.font-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
}

.icon-btn:hover,
.font-btn:hover {
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
}

.tts-btn.speaking {
    color: var(--accent-color);
    animation: pulse 2s infinite;
}

.text-content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 40px 60px;
    /* Generous padding for reading */
    display: flex;
    justify-content: center;
}

.text-content {
    max-width: 800px;
    /* Optimal reading width */
    width: 100%;
    font-size: 18px;
    /* Large legible font */
    line-height: 1.8;
    color: var(--text-primary);
    /* Removed white-space: pre-wrap; in favor of explicit p tags */
}

/* New Text Structure Styles */
.text-page-block {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--border-color);
}

.text-page-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.page-separator {
    display: inline-block;
    background: var(--bg-surface-secondary);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 20px 0;
    user-select: none;
}

.doc-paragraph {
    margin-bottom: 1.5em;
}

@media (min-width: 1025px) {
    .doc-paragraph {
        text-align: justify;
    }
}

.doc-paragraph mark {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 0;
    border-radius: 2px;
}

.doc-table-wrapper {
    overflow-x: auto;
    margin-bottom: 1.5em;
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.doc-table th,
.doc-table td {
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    text-align: left;
    vertical-align: top;
}

.doc-table th {
    background: var(--bg-surface-secondary);
    font-weight: 600;
}

.doc-table tr:nth-child(even) td {
    background: var(--bg-surface);
}

.doc-table mark {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 0;
    border-radius: 2px;
}

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

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Context Column (Secondary) */
.context-column {
    width: 400px;
    background: var(--bg-surface-secondary);
    border-left: 1px solid var(--border-color);
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.context-scroll-wrapper {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    flex: 1;
}

.meta-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.meta-header {
    margin-bottom: 4px;
}

.doc-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
}

.meta-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.action-btn:hover {
    background: var(--bg-surface-secondary);
    border-color: var(--text-secondary);
}

.doc-date {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.doc-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.image-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.image-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.external-link {
    font-size: 16px;
}

.image-container {
    background: var(--bg-surface-secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 12px;
    cursor: zoom-in;
    position: relative;
}

.image-container img {
    width: 100%;
    height: auto;
    display: block;
}

/* Archive Link Container (replaces image display) */
.image-link-container {
    background: var(--bg-surface-secondary);
    border-radius: var(--radius-md);
    padding: 32px 24px;
    text-align: center;
    margin-bottom: 12px;
}


.image-placeholder {
    color: var(--text-tertiary);
    font-size: 13px;
}

.image-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
}

.nav-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    font-size: 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.nav-btn:hover {
    background: var(--bg-surface-secondary);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-1px);
}

.image-id-display {
    font-size: 12px;
    font-family: monospace;
    color: var(--text-tertiary);
}

/* Donor Wall */
.donor-wall {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 20px 8px;
    text-align: center;
}
.donor-wall-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}
.donor-wall-title i { color: #6d4c41; margin-right: 6px; }
.donor-group { margin-bottom: 14px; }
.donor-group-label {
    font-size: 12px;
    font-weight: 600;
    color: #6d4c41;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}
.donor-group-label i { margin-right: 4px; }
.donor-group-names {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 12px;
}
.donor-name {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 2px 10px;
    background: var(--bg-surface-secondary, rgba(255,255,255,0.05));
    border-radius: 12px;
}

/* Site Footer */
.site-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 24px;
    text-align: center;
    margin-top: auto;
}

.site-footer p {
    color: var(--text-tertiary);
    font-size: 13px;
    margin-bottom: 8px;
}

.site-footer .footer-links {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.site-footer .footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 4px 12px;
    font-size: 13px;
    transition: color 0.2s;
}

.site-footer .footer-links a:hover {
    color: var(--accent-color);
}

.site-footer .footer-links a i {
    margin-right: 4px;
}

.footer-disclaimer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-tertiary);
    line-height: 1.6;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}
.footer-disclaimer i { margin-right: 4px; }
.footer-disclaimer a {
    color: var(--text-secondary);
    text-decoration: underline;
}
.footer-disclaimer a:hover { color: var(--accent-color); }

/* Cookie Consent Banner */
.cookie-banner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 10001;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.cookie-banner-text { max-width: 600px; }
.cookie-banner-text a { color: var(--accent-color); text-decoration: underline; }
.cookie-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }
.cookie-accept-btn {
    padding: 8px 20px;
    background: var(--accent-color, #6d4c41);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.cookie-accept-btn:hover { opacity: 0.9; }
.cookie-decline-btn {
    padding: 8px 16px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}
.cookie-decline-btn:hover { border-color: var(--text-tertiary); }

@media (max-width: 768px) {
    .cookie-banner { flex-direction: column; text-align: center; padding: 16px; }
    .cookie-banner-actions { width: 100%; justify-content: center; }
}

/* Search Results Overlay */
.search-results-overlay {
    position: fixed;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    max-height: 60vh;
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    z-index: 40;
    padding: 0;
}

.search-result-item {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--bg-surface-secondary);
}

.search-result-item:last-child {
    border-bottom: none;
}

.result-context {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
}

/* Fullscreen Viewer */
.fullscreen-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.fullscreen-viewer.active {
    display: flex;
}

.fullscreen-viewer img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    cursor: zoom-in;
    transition: all 0.3s ease;
}

.fullscreen-viewer img.zoomed {
    max-width: 100%;
    max-height: none;
    width: 100%;
    height: auto;
    cursor: zoom-out;
    object-fit: contain;
}

.fullscreen-viewer.zoomed-mode {
    overflow-y: auto;
    align-items: flex-start;
    padding: 20px 0;
}

.fullscreen-close {
    position: fixed;
    z-index: 110;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 32px;
    background: rgba(0, 0, 0, 0.3);
    /* Semi-transparent background */
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s;
}

.fullscreen-close:hover {
    background: rgba(0, 0, 0, 0.6);
}

.fullscreen-nav {
    position: fixed;
    z-index: 110;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 48px;
    background: rgba(0, 0, 0, 0.3);
    /* Semi-transparent background */
    padding: 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s;
}

.fullscreen-nav:hover {
    background: rgba(0, 0, 0, 0.6);
}

.fullscreen-prev {
    left: 20px;
}

.fullscreen-next {
    right: 20px;
}

/* Default hidden state for mobile header */
.mobile-doc-header {
    display: none;
}

/* Mobile Responsiveness */


@media (max-width: 1024px) {
    .top-nav {
        padding: 0 16px;
    }

    .nav-title {
        display: none;
        /* Hide title on mobile to save space */
    }

    .search-container-nav {
        margin: 0 10px;
    }

    .main-layout {
        flex-direction: column;
        overflow-y: auto;
        /* Main scroll on mobile */
    }

    .text-column {
        flex: none;
        /* Don't take full height fixed */
        height: auto;
        min-height: 50vh;
        overflow: visible;
        /* Let page scroll */
    }

    .text-content-wrapper {
        overflow: visible;
        padding: 20px;
    }

    .context-column {
        width: 100%;
        height: auto;
        min-height: 300px;
        /* Ensure it has height */
        border-left: none;
        border-top: 1px solid var(--border-color);
        order: 3;
        display: flex;
        flex-direction: column;
        padding-bottom: 40px;
        /* Add padding at bottom */
    }

    .text-panel-header {
        padding: 0 16px;
    }

    .search-results-overlay {
        width: 100%;
        left: 0;
        transform: none;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .meta-card,
    .image-card {
        border-radius: var(--radius-md);
    }

    /* Hide desktop meta card on mobile to avoid duplication */
    .meta-card {
        display: none;
    }

    .image-container {
        width: 100%;
        height: auto;
        min-height: 200px;
        display: flex;
    }

    .image-card {
        display: block !important;
        /* Force visibility */
        width: 100%;
    }

    /* Mobile Document Header */
    .mobile-doc-header {
        display: block;
        background: var(--bg-surface);
        padding: 20px 24px;
        border-bottom: 1px solid var(--border-color);
        width: 100%;
        order: 1;
        /* Ensure it's first */
    }

    .text-column {
        order: 2;
    }

    .context-column {
        order: 3;
    }

    /* Mobile Header Actions */
    .mobile-actions {
        display: flex;
        gap: 10px;
        margin-bottom: 8px;
    }

    .mobile-action-btn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        cursor: pointer;
    }

    .mobile-title {
        font-size: 20px;
        font-weight: 700;
        color: var(--text-primary);
        margin-bottom: 8px;
        line-height: 1.3;
    }

    .mobile-date {
        font-size: 13px;
        color: var(--text-tertiary);
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 16px;
    }

    .mobile-description-container {
        background: var(--bg-surface-secondary);
        border-radius: var(--radius-md);
        padding: 12px;
    }

    .mobile-description {
        font-size: 14px;
        color: var(--text-secondary);
        line-height: 1.6;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .mobile-description.collapsed {
        max-height: 60px;
        /* Show ~3 lines */
        position: relative;
        mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
        -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    }

    .mobile-desc-toggle {
        width: 100%;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border-color);
        color: var(--accent-color);
        font-size: 13px;
        font-weight: 500;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    .mobile-desc-toggle:hover {
        color: var(--accent-hover);
    }

    .mobile-desc-toggle i {
        transition: transform 0.3s ease;
    }

    .mobile-desc-toggle.expanded i {
        transform: rotate(180deg);
    }

    /* Fix Context Column Visibility */
    .context-scroll-wrapper {
        overflow: visible;
        /* Allow full height on mobile */
        flex: none;
        height: auto;
    }
}



/* Favorites Modal */
.favorites-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.favorites-modal.active {
    display: flex;
}

.favorites-content {
    background: var(--bg-surface);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

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

.favorites-header h2 {
    font-size: 18px;
    margin: 0;
}

.favorites-list {
    padding: 20px;
    overflow-y: auto;
}

.favorite-item {
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--bg-surface-secondary);
    margin-bottom: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.favorite-item:hover {
    background: var(--border-color);
}

.favorite-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.favorite-item-info {
    font-size: 12px;
    color: var(--text-secondary);
}

.favorite-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.favorite-action-btn {
    color: var(--text-secondary);
    font-size: 14px;
    padding: 4px 8px;
    background: var(--bg-surface);
    border-radius: 4px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.favorite-action-btn:hover {
    background: var(--accent-color);
    color: white;
}

.favorite-remove-btn:hover {
    background: #ef4444 !important;
    color: white !important;
}

.favorite-item-title {
    font-weight: 500;
    word-break: break-word;
    line-height: 1.4;
}

.favorite-item-note {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    padding: 6px 8px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    border-left: 2px solid var(--accent-color);
    word-break: break-word;
}

.favorites-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding-top: 15px;
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
}

.pagination-info {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==================== */
/* Subject Tags         */
/* ==================== */

.subject-tags-section {
    margin: 12px 0;
    padding: 12px;
    background: var(--surface-secondary);
    border-radius: 8px;
    overflow: hidden;
    box-sizing: border-box;
    width: 100%;
}

.subject-tags-section .section-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.subject-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    max-height: 200px;
    overflow-y: auto;
}

.subject-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    transition: all 0.15s ease;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.subject-tag i { flex-shrink: 0; }

.subject-tag:hover {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

.subject-tag i { font-size: 10px; }

.subject-tag-person { border-color: #e67e22; color: #e67e22; }
.subject-tag-place { border-color: #27ae60; color: #27ae60; }
.subject-tag-organization { border-color: #3498db; color: #3498db; }
.subject-tag-event { border-color: #9b59b6; color: #9b59b6; }
.subject-tag-topic { border-color: #95a5a6; color: #95a5a6; }

.subject-tag-person:hover { background: #e67e22; color: #fff; border-color: #e67e22; }
.subject-tag-place:hover { background: #27ae60; color: #fff; border-color: #27ae60; }
.subject-tag-organization:hover { background: #3498db; color: #fff; border-color: #3498db; }
.subject-tag-event:hover { background: #9b59b6; color: #fff; border-color: #9b59b6; }
.subject-tag-topic:hover { background: #95a5a6; color: #fff; border-color: #95a5a6; }

/* Subject Filter Banner */
.subject-filter-banner {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    z-index: 45;
    background: var(--accent-primary);
    color: #fff;
    padding: 8px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
}

.clear-filter-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s;
}

.clear-filter-btn:hover {
    background: rgba(255,255,255,0.35);
}

.filter-nav-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.15s;
}

.filter-nav-btn:hover {
    background: rgba(255,255,255,0.35);
}

.filter-doc-counter {
    font-size: 13px;
    opacity: 0.8;
    font-variant-numeric: tabular-nums;
    min-width: 60px;
    text-align: center;
}

/* Filtered Documents List */
.filtered-docs-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 50;
    background: var(--bg-body);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.filtered-docs-overlay.visible { opacity: 1; }

.filtered-docs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
    flex-shrink: 0;
}
.filtered-docs-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}
.filtered-docs-title i { color: var(--accent-color, #6d4c41); }
.filtered-docs-count {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-tertiary);
}
.filtered-docs-close {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    background: none; border: none;
    transition: background 0.15s;
}
.filtered-docs-close:hover { background: var(--bg-surface-secondary); }

.filtered-docs-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filtered-doc-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 10px);
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}
.filtered-doc-card:hover {
    border-color: var(--accent-color, #6d4c41);
    transform: translateY(-1px);
}

.filtered-doc-icon {
    width: 40px; height: 40px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-surface-secondary);
    border-radius: 8px;
    color: var(--text-tertiary);
    font-size: 16px;
}

.filtered-doc-info { flex: 1; min-width: 0; }
.filtered-doc-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.filtered-doc-date {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}
.filtered-doc-date i { margin-right: 4px; }
.filtered-doc-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.5;
}
.filtered-doc-meta {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
}
.filtered-doc-meta i { margin-right: 3px; }

@media (max-width: 768px) {
    .filtered-docs-list { padding: 12px; }
    .filtered-doc-card { padding: 12px; gap: 12px; }
    .filtered-doc-icon { display: none; }
}

/* Subjects Browse Modal */
.subjects-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.subjects-modal.visible {
    display: flex;
}

.subjects-content {
    background: var(--bg-surface);
    border-radius: 16px;
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.subjects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 12px;
}

.subjects-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.subjects-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
}

.subjects-filter-bar {
    display: flex;
    gap: 6px;
    padding: 0 24px 12px;
    flex-wrap: wrap;
}

.subject-filter-btn {
    padding: 5px 12px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.subject-filter-btn:hover,
.subject-filter-btn.active {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

.subjects-list {
    overflow-y: auto;
    padding: 0 24px 20px;
    flex: 1;
}

.subject-browse-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-color);
}

.subject-browse-item:last-child {
    border-bottom: none;
}

.subject-browse-item:hover {
    background: var(--surface-secondary);
}

.subject-browse-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
}

.subject-browse-name i {
    width: 20px;
    text-align: center;
}

.subject-browse-count {
    font-size: 12px;
    color: var(--text-tertiary);
    background: var(--surface-secondary);
    padding: 2px 8px;
    border-radius: 10px;
}

.loading-text {
    text-align: center;
    color: var(--text-tertiary);
    padding: 40px 0;
}

.subject-type-header {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    padding: 12px 0 6px;
    margin-top: 8px;
    border-top: 1px solid var(--border-color);
}

.subject-type-header:first-child {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

/* ============================================
   FEATURE GATING
   ============================================ */
.feature-locked {
    opacity: 0.4;
    cursor: not-allowed !important;
    position: relative;
}

.feature-locked::after {
    content: '\f023';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    font-size: 10px;
    top: 2px;
    right: 2px;
    color: var(--accent-color, #6d4c41);
    background: var(--bg-surface, #fff);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

input.feature-locked::after { display: none; }
input.feature-locked {
    opacity: 0.5;
    cursor: pointer;
    background: var(--bg-surface-secondary) !important;
    pointer-events: none;
}
.search-wrapper:has(input.feature-locked) {
    cursor: pointer;
}

.subject-tag.feature-locked::after { display: none; }
.subject-tag.feature-locked { cursor: pointer; }

.admin-logout-btn {
    color: #6d4c41 !important;
    text-decoration: none;
}
.admin-logout-btn:hover {
    background: rgba(109, 76, 65, 0.1) !important;
}

.support-btn.support-active {
    background: linear-gradient(135deg, #27ae60, #219a52);
}
.support-btn.support-active:hover {
    background: linear-gradient(135deg, #219a52, #1e8449);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.35);
}

/* ============================================
   SUPPORT MODAL
   ============================================ */
.support-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
}

.support-modal-overlay.visible { opacity: 1; }

.support-modal {
    background: var(--bg-surface, #16161e);
    border: 1px solid var(--border-color, #2a2a3a);
    border-radius: 16px;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.support-modal-overlay.visible .support-modal { transform: translateY(0); }

.support-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    background: none;
    border: none;
}
.support-modal-close:hover { background: var(--bg-surface-secondary); color: var(--text-primary); }

.support-header { text-align: center; margin-bottom: 24px; }
.support-icon {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, #6d4c41, #573b32);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px; color: white;
}
.support-header h2 { font-size: 24px; color: var(--text-primary); margin-bottom: 4px; }
.support-subtitle { color: var(--text-tertiary); font-size: 14px; }

.support-story { margin-bottom: 20px; font-size: 14px; line-height: 1.7; color: var(--text-secondary); }
.support-story p { margin-bottom: 12px; }
.support-story strong { color: var(--text-primary); }
.support-cta { text-align: center; font-size: 15px; color: var(--text-primary); }

/* Progress bar */
.support-progress-section {
    background: var(--bg-surface-secondary, #1a1a2a);
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
}
.support-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.support-progress-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.support-progress-title i { margin-right: 6px; color: #6d4c41; }
.support-progress-percent {
    font-size: 18px;
    font-weight: 700;
    color: #6d4c41;
}
.support-progress-bar-track {
    width: 100%;
    height: 14px;
    background: rgba(255,255,255,0.08);
    border-radius: 7px;
    overflow: hidden;
    position: relative;
}
.support-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6d4c41, #573b32);
    border-radius: 7px;
    transition: width 1s ease-out;
    position: relative;
}
.support-progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
    animation: progressShimmer 2s infinite;
}
@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.support-progress-details {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
}
.support-progress-cost {
    text-align: center;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-tertiary);
}

.support-stats {
    display: flex; gap: 16px; justify-content: center;
    margin: 16px 0;
    padding: 16px;
    background: var(--bg-surface-secondary, #1a1a2a);
    border-radius: 12px;
}
.support-stat { text-align: center; flex: 1; }
.support-stat-number { display: block; font-size: 24px; font-weight: 700; color: #6d4c41; }
.support-stat-label { display: block; font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

.support-current {
    background: rgba(39, 174, 96, 0.1);
    border: 1px solid rgba(39, 174, 96, 0.3);
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 13px;
    color: #27ae60;
    margin-bottom: 16px;
    text-align: center;
}
.support-code-active {
    background: var(--bg-surface-secondary);
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.support-deactivate-btn {
    background: none; border: 1px solid var(--border-color);
    color: var(--text-tertiary); font-size: 12px;
    padding: 4px 10px; border-radius: 4px; cursor: pointer;
}
.support-deactivate-btn:hover { border-color: #6d4c41; color: #6d4c41; }

/* Support Tabs */
.support-tabs {
    display: flex; gap: 4px;
    background: var(--bg-surface-secondary);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
}
.support-tab {
    flex: 1; padding: 10px;
    border-radius: 8px; border: none;
    background: none; color: var(--text-secondary);
    font-size: 14px; font-weight: 500;
    cursor: pointer; transition: all 0.2s;
}
.support-tab.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.support-tab:hover:not(.active) { color: var(--text-primary); }

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

/* Tier Cards */
.support-tiers { display: flex; flex-direction: column; gap: 10px; }
.support-tier {
    display: block;
    padding: 16px 20px;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.support-tier:visited,
.support-tier:active,
.support-tier:focus {
    color: var(--text-primary);
}
.support-tier:hover {
    border-color: #6d4c41;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(109, 76, 65, 0.15);
    color: var(--text-primary);
}
.support-tier.highlighted {
    border-color: #6d4c41;
    background: rgba(109, 76, 65, 0.05);
}

.tier-price { font-size: 24px; font-weight: 700; color: #6d4c41; }
.tier-period { font-size: 14px; font-weight: 400; color: var(--text-tertiary); }
.tier-name { font-size: 16px; font-weight: 600; margin: 4px 0; }
.tier-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.tier-features { font-size: 12px; color: var(--text-tertiary); }
.tier-features i { margin-right: 4px; color: #6d4c41; }

.tier-badge {
    position: absolute;
    top: 12px; right: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px; font-weight: 600;
    color: var(--text-secondary);
}
.tier-badge.popular { background: #6d4c41; color: white; border-color: #6d4c41; }
.tier-badge.premium { background: #f39c12; color: white; border-color: #f39c12; }

/* Code Entry */
.code-entry-section { padding: 8px 0; }
.code-entry-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }
.code-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    text-align: center;
    letter-spacing: 2px;
    background: var(--bg-surface-secondary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    transition: border-color 0.2s;
}
.code-input:focus { outline: none; border-color: #6d4c41; }

.code-email-row { margin-top: 10px; }
.code-email-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
}
.code-email-input:focus { outline: none; border-color: #6d4c41; }

.code-activate-btn {
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    background: linear-gradient(135deg, #6d4c41, #573b32);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.code-activate-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(109, 76, 65, 0.3); }

.code-result { margin-top: 12px; font-size: 14px; text-align: center; }
.code-success { color: #27ae60; }
.code-error { color: #6d4c41; }
.code-loading { color: var(--text-tertiary); }

.code-recover-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}
.code-recover-title { font-size: 14px; color: var(--text-secondary); margin-bottom: 10px; }
.code-recover-row { display: flex; gap: 8px; }
.code-recover-btn {
    padding: 10px 16px;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.code-recover-btn:hover { border-color: #6d4c41; }

.recovered-codes { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.recovered-code {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-surface-secondary);
    border-radius: 8px;
    font-size: 13px;
}
.code-use-btn {
    padding: 4px 12px;
    background: #6d4c41;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

/* Free access for researchers */
.support-free-access {
    margin-top: 24px;
    padding: 16px 20px;
    background: rgba(52, 152, 219, 0.08);
    border: 1px solid rgba(52, 152, 219, 0.2);
    border-radius: 10px;
    text-align: center;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.support-free-access > i {
    font-size: 20px;
    color: #3498db;
    margin-bottom: 8px;
    display: block;
}
.support-free-access p { margin-bottom: 10px; }
.free-access-contact {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(52, 152, 219, 0.15);
    border: 1px solid rgba(52, 152, 219, 0.3);
    border-radius: 6px;
    color: #3498db;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}
.free-access-contact:hover {
    background: rgba(52, 152, 219, 0.25);
    border-color: #3498db;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .support-modal { padding: 20px; margin: 10px; }
    .support-stats { flex-direction: column; gap: 8px; }
    .support-stat { display: flex; align-items: center; justify-content: center; gap: 8px; }
    .support-stat-number { display: inline; font-size: 20px; }
    .support-stat-label { display: inline; }
    .tier-price { font-size: 20px; }
    .code-recover-row { flex-direction: column; }
}