/* ==========================================================================
   PHILIPPINE SUPREME COURT SEARCH ENGINE - MODERN DESIGN SYSTEM
   ========================================================================== */

/* 1. Design Tokens & Root Custom Properties */
:root {
    /* Color Palette */
    --bg-obsidian: hsl(222, 25%, 10%);
    --bg-slate-dark: hsl(222, 20%, 15%);
    --bg-glass-card: hsla(222, 20%, 18%, 0.65);
    --border-glass: hsla(222, 20%, 30%, 0.35);
    
    --accent-purple: hsl(190, 95%, 55%); /* Brilliant Cyan (kept variable name for compatibility) */
    --accent-purple-glow: hsla(190, 95%, 55%, 0.35);
    --accent-purple-hover: hsl(190, 100%, 75%);
    
    --accent-gold: hsl(45, 100%, 55%);
    --accent-gold-glow: hsla(45, 100%, 55%, 0.25);
    
    --text-primary: hsl(0, 0%, 100%); /* Pure white */
    --text-secondary: hsl(210, 60%, 85%); /* Light ice blue instead of gray */
    --text-muted: hsl(210, 50%, 75%); /* Bright blue-tinted instead of dark gray */
    
    /* System Colors */
    --color-success: hsl(142, 70%, 45%);
    --color-warning: hsl(38, 90%, 55%);
    --color-danger: hsl(350, 80%, 55%);
    
    /* Layout & Shadow constants */
    --shadow-premium: 0 12px 30px -10px hsla(222, 30%, 5%, 0.8), 0 0 1px 1px var(--border-glass);
    --shadow-purple: 0 8px 30px -4px var(--accent-purple-glow);
    --radius-large: 16px;
    --radius-medium: 10px;
    --radius-small: 6px;
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* US Bar Reviewer Inspired Dashboard Colors */
    --admin-bg-sidebar: hsl(222, 30%, 8%);
    --admin-teal: hsl(171, 100%, 41%);
    --admin-teal-glow: hsla(171, 100%, 41%, 0.2);
    --admin-orange: hsl(27, 98%, 54%);
    --admin-orange-glow: hsla(27, 98%, 54%, 0.2);
    --admin-blue: hsl(207, 90%, 54%);
    --admin-blue-glow: hsla(207, 90%, 54%, 0.2);
}

/* 2. Global Resets & Theme Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

body {
    background-color: var(--bg-obsidian);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-purple);
}

/* 3. Header Styling */
.app-header {
    background-color: var(--bg-slate-dark);
    border-bottom: 1px solid var(--border-glass);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.4);
    z-index: 50;
}

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

.logo-icon {
    font-size: 26px;
}

.logo-text h1 {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.1;
}

.logo-text .tagline {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* DB Status indicator badge */
.db-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: hsla(222, 20%, 8%, 0.5);
    border: 1px solid var(--border-glass);
    border-radius: 30px;
    font-size: 12px;
    font-weight: 500;
}

.db-status.free-tier {
    color: var(--color-warning);
    border-color: hsla(38, 90%, 55%, 0.2);
}

.db-status.premium-tier {
    color: var(--color-success);
    border-color: hsla(142, 70%, 45%, 0.2);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    box-shadow: 0 0 10px 1px currentColor;
}

/* 4. Split-Pane Workspace Layout */
.app-workspace {
    flex: 1;
    display: flex;
    height: calc(100vh - 64px);
    overflow: hidden;
}

/* Column 1: Sidebar pane */
.sidebar-pane {
    width: 320px;
    background-color: var(--bg-slate-dark);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
    flex-shrink: 0;
}

/* Column 2: Results pane */
.results-pane {
    width: 380px;
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    background-color: var(--bg-obsidian);
    flex-shrink: 0;
}

/* Column 3: Reader pane */
.reader-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-obsidian);
    overflow: auto;
}

/* Pane Header standard styling */
.pane-header {
    height: 56px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-glass);
    background-color: var(--bg-slate-dark);
    flex-shrink: 0;
}

.pane-header h2 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
}

/* 5. Inputs & Filter Sections in Sidebar */
.search-container {
    margin-bottom: 24px;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

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

.search-bar input {
    width: 100%;
    padding: 12px 12px 12px 38px;
    background-color: hsl(222, 20%, 10%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-medium);
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition-smooth);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

.clear-btn {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 2px;
}

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

.filter-section {
    margin-bottom: 24px;
}

.filter-section h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Grid of year toggle buttons */
.year-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.year-btn {
    padding: 8px 4px;
    background-color: hsl(222, 20%, 10%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-small);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: var(--transition-smooth);
}

.year-btn:hover {
    border-color: var(--accent-purple);
    color: var(--text-primary);
}

.year-btn.active {
    background-color: var(--accent-purple);
    border-color: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: var(--shadow-purple);
}

.year-btn.locked {
    position: relative;
    opacity: 0.65;
    background-image: linear-gradient(45deg, var(--border-glass) 25%, transparent 25%, transparent 50%, var(--border-glass) 50%, var(--border-glass) 75%, transparent 75%, transparent);
    background-size: 10px 10px;
}

.year-btn.locked::after {
    content: "🔒";
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 8px;
}

/* Scrollable Ponente (Justice) List */
.ponente-search-bar input {
    width: 100%;
    padding: 8px 12px;
    background-color: hsl(222, 20%, 10%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-small);
    color: var(--text-primary);
    font-size: 12px;
    margin-bottom: 8px;
}

.ponente-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-small);
    background-color: hsl(222, 20%, 10%);
    padding: 4px;
}

.ponente-item {
    padding: 8px 10px;
    border-radius: var(--radius-small);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: var(--transition-smooth);
}

.ponente-item:hover {
    background-color: hsla(262, 70%, 60%, 0.1);
    color: var(--text-primary);
}

.ponente-item.active {
    background-color: var(--accent-purple);
    color: var(--text-primary);
}

/* 6. Results Feed Card List */
.results-feed-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feed-welcome-state, .reader-empty-state, .loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    margin: auto;
    color: var(--text-muted);
}

.welcome-icon, .empty-icon {
    font-size: 40px;
    margin-bottom: 16px;
    opacity: 0.65;
}

.feed-welcome-state h3, .reader-empty-state h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.feed-welcome-state p, .reader-empty-state p {
    font-size: 13px;
    max-width: 280px;
    line-height: 1.5;
}

/* ============================================
   PAYWALL — TEASER TEXT + LOCKED PDF STYLES
   ============================================ */
.preview-text-wrapper {
    position: relative;
    max-height: 280px;
    overflow: hidden;
}

.preview-text-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to bottom, transparent, var(--bg-primary, #0b0f19));
    pointer-events: none;
}

.premium-cta-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 24px auto 32px;
    padding: 28px 32px;
    max-width: 520px;
    background: linear-gradient(135deg, rgba(250, 189, 47, 0.06), rgba(250, 189, 47, 0.02));
    border: 1px solid rgba(250, 189, 47, 0.3);
    border-radius: 16px;
    text-align: center;
}

.premium-cta-block .cta-icon {
    font-size: 36px;
}

.premium-cta-block h3 {
    font-size: 17px;
    font-weight: 700;
    color: #fabd2f;
    margin: 0;
    letter-spacing: 0.01em;
}

.premium-cta-block p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
    margin: 0;
    line-height: 1.6;
    max-width: 360px;
}

.premium-unlock-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(135deg, #fabd2f, #f59e0b);
    color: #1a1200;
    font-weight: 700;
    font-size: 14px;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 20px rgba(250, 189, 47, 0.35);
    letter-spacing: 0.02em;
}

.premium-unlock-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(250, 189, 47, 0.5);
    background: linear-gradient(135deg, #fcc837, #f59e0b);
}

/* Locked PDF toolbar button */
#view-original-pdf-btn.locked-pdf-btn {
    background: linear-gradient(135deg, rgba(250, 189, 47, 0.15), rgba(250, 189, 47, 0.08)) !important;
    border-color: rgba(250, 189, 47, 0.5) !important;
    color: #fabd2f !important;
    animation: pulse-gold 2.5s ease-in-out infinite;
}

@keyframes pulse-gold {
    0%, 100% { box-shadow: 0 0 0 0 rgba(250, 189, 47, 0); }
    50% { box-shadow: 0 0 0 6px rgba(250, 189, 47, 0.12); }
}

/* Standard Result Card */
.result-card {
    background-color: var(--bg-glass-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-medium);
    padding: 16px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    transition: var(--transition-smooth);
}

.result-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background-color: var(--accent-purple);
    transition: var(--transition-smooth);
}

.result-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-purple);
    box-shadow: var(--shadow-purple);
}

.result-card:hover::before {
    width: 4px;
}

.result-card.active {
    background-color: hsla(262, 70%, 60%, 0.1);
    border-color: var(--accent-purple);
}

.result-card.active::before {
    width: 4px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--accent-purple-hover);
    font-weight: 600;
    margin-bottom: 8px;
}

.card-date {
    color: var(--text-muted);
    font-weight: 400;
}

.result-card h4 {
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 8px;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-ponente {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.card-snippet {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    background-color: hsla(222, 20%, 8%, 0.4);
    padding: 8px;
    border-radius: var(--radius-small);
    border-left: 2px solid var(--border-glass);
}

/* ── Unified Card Template ─────────────────────────────────────────────────
   All 12 categories share these classes for consistent size & typography.
   ─────────────────────────────────────────────────────────────────────── */
.uc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 7px;
}

.uc-category {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-primary);
    letter-spacing: 0.02em;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uc-date {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.uc-title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
    color: var(--text-primary);
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uc-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uc-snippet {
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--text-secondary);
    background-color: hsla(222, 20%, 8%, 0.4);
    padding: 7px 9px;
    border-radius: var(--radius-small);
    border-left: 2px solid var(--border-glass);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.uc-snippet mark {
    background: transparent;
    color: var(--accent-gold);
    border-bottom: none;
    padding: 0;
    font-weight: 600;
}


/* 7. Full-Text Legal Reader Views */
.reader-document-view {
    flex: 1;
    overflow: auto;
    background-color: hsl(222, 25%, 8%);
}

.case-header {
    padding: 40px 40px 24px 40px;
    border-bottom: 1px solid var(--border-glass);
    margin-bottom: 30px;
}

.case-document-header {
    border-bottom: 1px solid var(--border-glass);
    padding: 40px 40px 24px 40px;
    margin-bottom: 30px;
}

.case-citation {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    color: var(--accent-purple-hover);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.case-document-header h2 {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 16px;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.case-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    background-color: var(--bg-slate-dark);
    padding: 12px 16px;
    border-radius: var(--radius-medium);
    border: 1px solid var(--border-glass);
}

.meta-item {
    font-size: 12px;
}

.meta-item .label {
    display: block;
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.meta-item .value {
    color: var(--text-secondary);
    font-weight: 500;
}

.case-document-body,
.case-body {
    font-size: 14.5px;
    line-height: 1.8;
    color: hsl(210, 15%, 88%);
    margin: 0 auto;
    padding: 0 40px 40px 40px;
}

/* When case-body contains a PDF or iframe viewer, remove padding so it fills fully */
.case-body:has(.pdf-view) {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

.case-document-body { max-width: 720px; }

.case-document-body p,
.case-body p {
    margin-bottom: 24px;
    text-align: justify;
}

.case-document-body h3,
.case-body h3 {
    font-size: 16px;
    margin: 32px 0 16px;
    border-left: 3px solid var(--accent-purple);
    padding-left: 12px;
    color: var(--text-primary);
}

mark {
    background-color: var(--accent-gold-glow);
    color: var(--accent-gold);
    padding: 2px 4px;
    border-radius: 3px;
    border-bottom: 1px solid var(--accent-gold);
}

mark.highlight {
    background-color: var(--accent-gold);
    color: hsl(222, 25%, 10%);
    box-shadow: 0 0 10px 1px var(--accent-gold-glow);
    border-bottom: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

mark.highlight:hover {
    background-color: #ff5252;
    color: white;
    box-shadow: 0 0 10px 1px rgba(255, 82, 82, 0.4);
    text-decoration: line-through;
}

mark.highlight:hover::after {
    content: "✕";
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #ff5252;
    color: white;
    font-size: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    text-decoration: none;
}

/* ==========================================================================
   8. REDESIGNED ADMIN DASHBOARD SHELL (US BAR REVIEWER ALIGNED)
   ========================================================================== */
.admin-panel-overlay {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    height: 100vh;
    background-color: hsl(222, 25%, 8%);
    box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.6);
    z-index: 100;
    transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   9. GOOGLE-STYLE LANDING HERO
   ========================================================================== */
.landing-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 64px);
    background-color: var(--bg-obsidian);
    padding: 20px 20px 15vh 20px; /* added 15vh bottom padding to push content higher */
    animation: fadeIn 0.5s ease-out;
}

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

.hero-logo-large {
    text-align: center;
    margin-bottom: 40px;
}

.hero-logo-large .hero-icon {
    font-size: 72px;
    display: block;
    margin-bottom: 16px;
    background: -webkit-linear-gradient(45deg, var(--accent-primary), var(--accent-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-logo-large h1 {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.hero-logo-large p {
    color: var(--text-muted);
    font-size: 16px;
}

.hero-search-container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
}

.hero-search-bar {
    display: flex;
    align-items: center;
    background-color: hsl(222, 20%, 12%);
    border: 1px solid var(--border-glass);
    border-radius: 30px;
    padding: 6px 8px;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
    transition: var(--transition-smooth);
}

.hero-search-bar:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow), 0 10px 30px -10px rgba(0,0,0,0.5);
}

.search-type-select {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    border-right: 1px solid var(--border-glass);
}

.search-type-select option {
    background-color: var(--bg-slate-dark);
    color: var(--text-primary);
}

.hero-search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 16px 20px;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    text-align: left;
}

.hero-search-btn {
    background-color: var(--accent-primary);
    color: var(--bg-obsidian);
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.hero-search-btn:hover {
    background-color: var(--accent-primary-hover);
    transform: scale(1.05);
}

.hero-quick-filters {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.filter-hint {
    font-size: 13px;
    color: var(--text-muted);
}

.hero-pill-btn {
    background-color: hsla(210, 20%, 98%, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.hero-pill-btn:hover {
    background-color: hsla(210, 20%, 98%, 0.1);
    color: var(--text-primary);
}

.admin-panel-overlay.active {
    bottom: 0;
}

/* The structural framework shell */
.admin-dashboard-shell {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Column 1: Command Sidebar */
.admin-sidebar {
    width: 280px;
    background-color: var(--admin-bg-sidebar);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 10px 0 30px rgba(0,0,0,0.3);
}

.admin-sidebar-logo {
    height: 90px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border-glass);
}

.logo-icon-glowing {
    font-size: 28px;
    background-color: var(--admin-teal-glow);
    padding: 8px;
    border-radius: 12px;
    color: var(--admin-teal);
    box-shadow: 0 0 15px 1px var(--admin-teal-glow);
}

.admin-sidebar-logo h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.admin-sidebar-logo p {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Navigation items inside sidebar */
.admin-nav-menu {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    padding: 16px 28px 8px;
    text-transform: uppercase;
}

.admin-nav-item {
    background: transparent;
    border: none;
    padding: 14px 28px;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    text-align: left;
    position: relative;
    border-left: 4px solid transparent;
    transition: var(--transition-smooth);
}

.admin-nav-item:hover {
    background-color: hsla(210, 20%, 98%, 0.03);
    color: var(--text-primary);
}

/* Dynamic active selection indicator */
.admin-nav-item.active {
    background-color: hsla(210, 20%, 98%, 0.05);
    color: var(--text-primary);
    border-left-color: var(--admin-teal);
    font-weight: 600;
}

.admin-nav-item .nav-icon {
    font-size: 16px;
    opacity: 0.8;
}

/* Profile Card at bottom of sidebar */
.admin-sidebar-profile {
    margin: 24px;
    padding: 16px;
    background-color: hsla(210, 20%, 98%, 0.04);
    border-radius: var(--radius-large);
    border: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--admin-teal);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.profile-info {
    flex: 1;
    overflow: hidden;
}

.profile-info h4 {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-info p {
    font-size: 10px;
    color: var(--text-muted);
}

.admin-exit-btn {
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition-smooth);
}

.admin-exit-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Column 2: Dashboard Viewport Screen Panels */
.admin-main-viewport {
    flex: 1;
    background-color: hsl(222, 25%, 6%);
    overflow-y: auto;
    padding: 40px;
    display: flex;
    flex-direction: column;
}

.admin-tab-content {
    display: none;
    flex-direction: column;
    height: 100%;
}

.admin-tab-content.active {
    display: flex;
}

.view-header {
    margin-bottom: 32px;
}

.view-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.view-header p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Immersive Card wrapper */
.admin-card-immersive {
    background-color: var(--bg-glass-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-large);
    padding: 30px;
    box-shadow: var(--shadow-premium);
    margin-bottom: 24px;
}

.flex-grow {
    flex: 1;
}

/* ==========================================================================
   📊 US BAR REVIEWER STYLE METRICS & WIDGETS
   ========================================================================== */

/* Metrics cards grid */
.stats-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background-color: var(--bg-glass-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-large);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-purple);
}

.stat-icon {
    font-size: 26px;
    padding: 12px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Glowing colors for stats badges */
.stats-teal .stat-icon { background-color: var(--admin-teal-glow); color: var(--admin-teal); }
.stats-orange .stat-icon { background-color: var(--admin-orange-glow); color: var(--admin-orange); }
.stats-purple .stat-icon { background-color: var(--accent-purple-glow); color: var(--accent-purple-hover); }
.stats-blue .stat-icon { background-color: var(--admin-blue-glow); color: var(--admin-blue); }

.stat-info h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Dashboard sub-panels grids */
.overview-subgrid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 24px;
}

.overview-card {
    background-color: var(--bg-glass-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-large);
    padding: 24px;
    box-shadow: var(--shadow-premium);
}

.overview-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 24px;
    border-left: 3px solid var(--admin-teal);
    padding-left: 12px;
}

/* Horizontal progress distribution bars */
.distribution-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dist-bar-item {
    font-size: 12.5px;
}

.dist-bar-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.dist-bar-meta .count {
    font-weight: 600;
    color: var(--admin-teal);
}

.dist-progress-track {
    height: 8px;
    width: 100%;
    background-color: hsl(222, 20%, 10%);
    border-radius: 4px;
    overflow: hidden;
}

.dist-progress-bar {
    height: 100%;
    background-color: var(--admin-teal);
    border-radius: 4px;
    box-shadow: 0 0 10px var(--admin-teal-glow);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Vertical Activity Timeline Feed */
.activity-timeline-feed {
    display: flex;
    flex-direction: column;
    position: relative;
    padding-left: 20px;
}

.activity-timeline-feed::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 6px;
    bottom: 6px;
    width: 1px;
    background-color: var(--border-glass);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -20px;
    top: 5px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: var(--text-muted);
    border: 2px solid hsl(222, 25%, 6%);
}

.timeline-dot.success { background-color: var(--color-success); box-shadow: 0 0 8px var(--color-success); }
.timeline-dot.warning { background-color: var(--color-warning); box-shadow: 0 0 8px var(--color-warning); }

.timeline-content h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.timeline-content p {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
}

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

/* ==========================================================================
   💻 COMMAND PIPELINE & TERMINAL LOGS
   ========================================================================== */
.pipeline-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 24px;
    margin-bottom: 24px;
}

.action-description h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.action-description p {
    font-size: 12px;
    color: var(--text-muted);
}

.action-btns {
    display: flex;
    gap: 12px;
}

/* Terminal Log panel */
.terminal-container {
    flex: 1;
    background-color: hsl(222, 30%, 3%);
    border-radius: var(--radius-medium);
    border: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 400px;
}

.terminal-header {
    background-color: hsl(222, 20%, 8%);
    border-bottom: 1px solid var(--border-glass);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.terminal-dot.red { background-color: var(--color-danger); }
.terminal-dot.yellow { background-color: var(--color-warning); }
.terminal-dot.green { background-color: var(--color-success); }

.terminal-title {
    font-family: monospace;
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 8px;
}

.terminal-screen {
    flex: 1;
    padding: 18px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    line-height: 1.6;
    color: var(--color-success);
    overflow-y: auto;
    white-space: pre-wrap;
    text-shadow: 0 0 2px rgba(34, 197, 94, 0.4);
}

.terminal-welcome {
    color: var(--text-muted);
    text-shadow: none;
}

/* ==========================================================================
   ⚙️ SETTINGS, PAYWALLS, AND DATA TABLES
   ========================================================================== */
.settings-form-group {
    margin-bottom: 24px;
}

.settings-form-group label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.settings-form-group .label-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.admin-checklist-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    background-color: hsl(222, 20%, 8%);
    padding: 16px;
    border-radius: var(--radius-medium);
    border: 1px solid var(--border-glass);
    max-height: 200px;
    overflow-y: auto;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input {
    accent-color: var(--admin-teal);
}

.flex-row {
    display: flex;
    gap: 16px;
}

.form-input-box {
    flex: 1;
}

.form-input-box input {
    width: 100%;
    padding: 12px;
    background-color: hsl(222, 20%, 8%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-small);
    color: var(--text-primary);
    font-size: 13px;
    margin-top: 6px;
    transition: var(--transition-smooth);
}

.form-input-box input:focus {
    outline: none;
    border-color: var(--admin-teal);
}

/* Accounts Table styling details */
.table-search-row {
    margin-bottom: 20px;
}

.table-search-row input {
    width: 320px;
    padding: 10px 14px;
    background-color: hsl(222, 20%, 8%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-small);
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition-smooth);
}

.table-search-row input:focus {
    outline: none;
    border-color: var(--admin-teal);
}

.admin-table-container {
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-medium);
    background-color: hsl(222, 20%, 8%);
    overflow-y: auto;
    max-height: 400px;
}

.admin-user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.admin-user-table th {
    background-color: hsl(222, 20%, 10%);
    padding: 12px 16px;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-glass);
}

.admin-user-table td {
    padding: 12px 16px;
    color: var(--text-secondary);
    border-bottom: 1px solid hsla(222, 20%, 30%, 0.15);
}

/* ==========================================================================
   9. UPGRADE PREMIUM PAYWALL MODAL
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

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

.modal-content {
    background-color: var(--bg-glass-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-large);
    max-width: 680px;
    width: 100%;
    position: relative;
    padding: 40px;
    box-shadow: var(--shadow-premium);
    max-height: 95vh;
    overflow-y: auto;
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

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

.paywall-header {
    text-align: center;
    margin-bottom: 30px;
}

.paywall-icon {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
}

.paywall-header h2 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.paywall-header p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 480px;
    margin: 0 auto;
}

/* Upgrade plan cards grid layout */
.pricing-cards-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.pricing-card {
    background-color: hsl(222, 20%, 12%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-large);
    padding: 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: var(--transition-smooth);
}

.pricing-card:hover {
    border-color: var(--accent-purple);
    transform: translateY(-2px);
}

.card-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 9px;
    background-color: var(--accent-purple);
    color: var(--text-primary);
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.pricing-card h3 {
    font-size: 15px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.price-box {
    display: flex;
    align-items: baseline;
    margin-bottom: 16px;
}

.price-box .currency {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-right: 2px;
}

.price-box .price-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
}

.price-box .period {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 4px;
}

.features-list {
    list-style: none;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.features-list li {
    display: flex;
    gap: 8px;
    align-items: start;
}

.features-list li::before {
    content: "✓";
    color: var(--accent-purple-hover);
    font-weight: bold;
}

.paywall-footer {
    text-align: center;
}

.payment-badges {
    font-size: 11px;
    color: var(--text-muted);
}

/* ==========================================================================
   10. BUTTONS & METADATA BADGES
   ========================================================================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-medium);
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn-primary {
    background-color: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: var(--shadow-purple);
}

.btn-primary:hover {
    background-color: var(--accent-purple-hover);
}

.btn-secondary {
    background-color: hsl(222, 20%, 8%);
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
    border-color: var(--accent-purple);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 6px 12px;
    font-size: 11px;
    border-radius: var(--radius-small);
}

.btn-danger {
    background-color: var(--color-danger);
    color: var(--text-primary);
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-icon-only {
    background: transparent;
    border: none;
    font-size: 16px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-small);
    transition: var(--transition-smooth);
}

.btn-icon-only:hover {
    background-color: var(--border-glass);
    color: var(--text-primary);
}

.badge {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background-color: var(--border-glass);
    color: var(--text-secondary);
}

.badge-success {
    background-color: hsla(142, 70%, 45%, 0.15);
    color: var(--color-success);
    border: 1px solid hsla(142, 70%, 45%, 0.2);
}

.badge-secondary {
    background-color: hsla(222, 20%, 30%, 0.15);
    color: var(--text-muted);
    border: 1px solid var(--border-glass);
}

.margin-top-large {
    margin-top: 24px;
}

/* Tablet Fallback Layering rules */
.reader-pane.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background-color: var(--bg-obsidian);
    animation: fadeIn 0.3s ease-out forwards;
}

@media (max-width: 1200px) {
    .app-workspace {
        flex-direction: column;
        overflow-y: auto;
    }
    
    .sidebar-pane {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-glass);
        flex-direction: row;
        gap: 16px;
        overflow-x: auto;
        overflow-y: hidden;
    }
    
    .filter-section {
        margin-bottom: 0;
        min-width: 260px;
    }
    
    .results-pane {
        width: 100%;
        height: 45vh;
        min-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--border-glass);
        flex-shrink: 0;
    }
    
    .reader-pane {
        min-height: 60vh;
        flex: 1;
    }
    
    .admin-dashboard-shell {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-glass);
    }
    
    .admin-nav-menu {
        flex-direction: row;
        overflow-x: auto;
        padding: 10px;
    }
    
    .nav-section-title {
        display: none;
    }
    
    .admin-nav-item {
        padding: 10px 16px;
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
    }
    
    .admin-nav-item.active {
        border-left-color: transparent;
        border-bottom-color: var(--admin-teal);
    }
    
    .admin-sidebar-profile {
        display: none;
    }
}

/* ==========================================================================
   FEATURE STYLES: 5 POWER-USER FEATURES
   ========================================================================== */

/* --- FEATURE 1: Citation Cross-Referencing Links --- */
.citation-link {
    color: var(--accent-purple);
    text-decoration: none;
    border-bottom: 1px dashed var(--accent-purple);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-smooth);
    position: relative;
}

.citation-link:hover {
    color: var(--accent-purple-hover);
    border-bottom-color: var(--accent-purple-hover);
    text-shadow: 0 0 12px var(--accent-purple-glow);
}

.citation-link::after {
    content: "🔗";
    font-size: 10px;
    margin-left: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.citation-link:hover::after {
    opacity: 1;
}

/* --- FEATURE 2: Syllabus Mode Banner --- */
.syllabus-mode-banner {
    background: linear-gradient(135deg, hsla(190, 95%, 55%, 0.1), hsla(45, 100%, 55%, 0.08));
    border: 1px solid hsla(190, 95%, 55%, 0.3);
    border-radius: var(--radius-medium);
    padding: 12px 20px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--accent-purple-hover);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.3s ease-out;
}

.syllabus-mode-banner a {
    color: var(--accent-gold);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
    margin-left: 4px;
    transition: var(--transition-smooth);
}

.syllabus-mode-banner a:hover {
    color: var(--text-primary);
    text-shadow: 0 0 10px var(--accent-gold-glow);
}

/* --- FEATURE 3: Search Tips Modal Activation --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: hsla(222, 30%, 5%, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

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

.search-tips-btn {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition-smooth);
}

.search-tips-btn:hover {
    color: var(--accent-purple);
    border-color: var(--accent-purple);
    box-shadow: 0 0 12px var(--accent-purple-glow);
}

.search-tips-modal-content {
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.search-tips-header {
    text-align: center;
    margin-bottom: 24px;
}

.tips-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

.search-tips-header h2 {
    font-size: 22px;
    margin-bottom: 8px;
}

.search-tips-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.search-tips-body {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.tip-card {
    background-color: hsla(222, 20%, 12%, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-medium);
    padding: 16px;
    transition: var(--transition-smooth);
}

.tip-card:hover {
    border-color: var(--accent-purple);
    transform: translateY(-2px);
}

.tip-card h4 {
    font-size: 13px;
    color: var(--accent-purple-hover);
    margin-bottom: 6px;
}

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

.tip-example {
    display: block;
    background-color: hsla(222, 20%, 8%, 0.8);
    color: var(--accent-gold);
    padding: 8px 12px;
    border-radius: var(--radius-small);
    font-size: 12px;
    font-family: 'Fira Code', 'Consolas', monospace;
    border-left: 2px solid var(--accent-gold);
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    z-index: 10;
}

.modal-close-btn:hover {
    color: var(--color-danger);
    border-color: var(--color-danger);
    background-color: hsla(350, 80%, 55%, 0.1);
}

.glassmorphism-card {
    background: var(--bg-glass-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-large);
    padding: 32px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-premium);
    position: relative;
    animation: modalSlideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- FEATURE 4: Bookmarks UI --- */
.bookmarks-section {
    margin-bottom: 16px !important;
}

.bookmarks-toggle-btn {
    width: 100%;
    background: linear-gradient(135deg, hsla(45, 100%, 55%, 0.08), hsla(45, 100%, 55%, 0.03));
    border: 1px solid hsla(45, 100%, 55%, 0.2);
    color: var(--accent-gold);
    padding: 12px 16px;
    border-radius: var(--radius-medium);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-smooth);
}

.bookmarks-toggle-btn:hover {
    background: linear-gradient(135deg, hsla(45, 100%, 55%, 0.15), hsla(45, 100%, 55%, 0.06));
    border-color: var(--accent-gold);
    box-shadow: 0 0 16px hsla(45, 100%, 55%, 0.15);
    transform: translateY(-1px);
}

.badge {
    background-color: var(--accent-purple);
    color: var(--bg-obsidian);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

.badge-small {
    font-size: 10px;
    padding: 1px 6px;
    min-width: 16px;
    background-color: var(--accent-gold);
}

.bookmarks-header-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, hsla(45, 100%, 55%, 0.1), hsla(45, 100%, 55%, 0.03));
    border: 1px solid hsla(45, 100%, 55%, 0.25);
    border-radius: var(--radius-medium);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-gold);
}

.clear-bookmarks-btn {
    background: transparent;
    border: 1px solid hsla(350, 80%, 55%, 0.3);
    color: var(--color-danger);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.clear-bookmarks-btn:hover {
    background-color: hsla(350, 80%, 55%, 0.15);
    border-color: var(--color-danger);
}

.bookmark-indicator {
    border-left-color: var(--accent-gold) !important;
    color: var(--accent-gold) !important;
    background-color: hsla(45, 100%, 55%, 0.05) !important;
}

/* Reader toolbar active button states */
.btn-icon-only {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-small);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-smooth);
}

.btn-icon-only:hover {
    color: var(--text-primary);
    border-color: var(--accent-purple);
    background-color: hsla(190, 95%, 55%, 0.08);
}

.btn-icon-only.active {
    color: var(--accent-gold);
    border-color: var(--accent-gold);
    background-color: hsla(45, 100%, 55%, 0.1);
    box-shadow: 0 0 10px hsla(45, 100%, 55%, 0.15);
}

.reader-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* --- FEATURE 5: Export (no extra CSS needed, reuses btn-icon-only) --- */

/* --- TOAST NOTIFICATION SYSTEM --- */
.toast-notification {
    position: fixed;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--bg-glass-card), hsla(222, 20%, 22%, 0.95));
    border: 1px solid var(--accent-purple);
    color: var(--text-primary);
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    z-index: 300;
    box-shadow: 0 8px 30px -4px hsla(222, 30%, 5%, 0.6), 0 0 20px var(--accent-purple-glow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    white-space: nowrap;
    pointer-events: none;
}

.toast-notification.show {
    bottom: 32px;
    opacity: 1;
}

.toast-notification.hide {
    bottom: -80px;
    opacity: 0;
}

/* --- Paywall Modal Styles --- */
.paywall-header {
    text-align: center;
    margin-bottom: 24px;
}

.paywall-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.paywall-header h2 {
    font-size: 22px;
    margin-bottom: 8px;
}

.paywall-header p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
}

.pricing-cards-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.pricing-card {
    background-color: hsla(222, 20%, 12%, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-large);
    padding: 24px;
    text-align: center;
    position: relative;
    transition: var(--transition-smooth);
}

.pricing-card:hover {
    border-color: var(--accent-purple);
    transform: translateY(-2px);
}

.card-tag {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-gold));
    color: var(--bg-obsidian);
    font-size: 10px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 12px;
    letter-spacing: 0.05em;
}

.price-box {
    margin: 16px 0;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
}

.currency {
    font-size: 18px;
    color: var(--text-muted);
}

.price-value {
    font-family: 'Outfit', sans-serif;
    font-size: 36px;
    font-weight: 800;
    color: var(--text-primary);
}

.period {
    font-size: 13px;
    color: var(--text-muted);
}

.features-list {
    list-style: none;
    text-align: left;
    margin-bottom: 20px;
}

.features-list li {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 6px 0;
    border-bottom: 1px solid hsla(222, 20%, 30%, 0.15);
}

.features-list li::before {
    content: "✓ ";
    color: var(--color-success);
    font-weight: 700;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-medium);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-purple), hsl(200, 95%, 45%));
    color: var(--bg-obsidian);
}

.btn-primary:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-purple);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
}

.btn-secondary:hover {
    background-color: hsla(45, 100%, 55%, 0.1);
    transform: scale(1.03);
}

.paywall-footer {
    text-align: center;
}

.payment-badges {
    font-size: 12px;
    color: var(--text-muted);
}

/* Responsive adjustments for search tips modal */
@media (max-width: 600px) {
    .search-tips-body {
        grid-template-columns: 1fr;
    }
    
    .pricing-cards-container {
        grid-template-columns: 1fr;
    }
}

/* Premium Pagination Styling */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--bg-slate-dark);
    border-top: 1px solid var(--border-glass);
    flex-shrink: 0;
    z-index: 10;
    box-shadow: 0 -4px 10px -5px rgba(0, 0, 0, 0.4);
}

.pagination-btn {
    padding: 8px 16px;
    background-color: hsla(222, 20%, 10%, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-medium);
    color: var(--accent-purple);
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--accent-purple-glow);
    border-color: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: 0 0 10px 1px var(--accent-purple-glow);
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    color: var(--text-muted);
    border-color: var(--border-glass);
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    background-color: hsla(222, 20%, 10%, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-small);
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pagination-page-btn:hover:not(.active) {
    background-color: var(--accent-purple-glow);
    border-color: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: 0 0 10px 1px var(--accent-purple-glow);
}

.pagination-page-btn.active {
    background: linear-gradient(135deg, var(--accent-purple), hsl(200, 95%, 45%));
    border-color: var(--accent-purple);
    color: var(--bg-obsidian);
    font-weight: 700;
    box-shadow: var(--shadow-purple);
    cursor: default;
}

.pagination-ellipsis {
    color: var(--text-muted);
    font-size: 13px;
    padding: 0 2px;
    user-select: none;
}

/* Premium Sort Controls Layout (2x2 Grid) */
.sort-controls-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 14px 16px;
    background-color: var(--bg-slate-dark);
    border-bottom: 1px solid var(--border-glass);
    flex-shrink: 0;
    z-index: 10;
    box-shadow: 0 4px 10px -4px rgba(0, 0, 0, 0.4);
}

.sort-btn {
    padding: 11px 12px;
    background-color: hsla(222, 20%, 10%, 0.65);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-medium);
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    user-select: none;
}

.sort-btn:hover:not(:disabled) {
    background-color: var(--accent-purple-glow);
    border-color: var(--accent-purple);
    color: var(--text-primary);
    transform: translateY(-1.5px);
    box-shadow: 0 4px 15px -3px var(--accent-purple-glow);
}

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

.sort-btn.active:not(:disabled) {
    background-color: var(--accent-purple) !important;
    border-color: var(--accent-purple) !important;
    color: var(--bg-obsidian) !important;
    font-weight: 700;
    transform: translateY(0);
    box-shadow: var(--shadow-purple) !important;
}

.sort-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background-color: hsla(222, 20%, 10%, 0.2) !important;
    border-color: var(--border-glass) !important;
    color: var(--text-muted) !important;
    transform: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   🏛️ PREMIUM ROADMAP STYLES: COMPARATIVE SPLIT-PANE & OVERRULED CITATIONS
   ========================================================================== */

.reader-split-container {
    display: flex;
    flex: 1;
    width: 100%;
    height: calc(100% - 56px);
    overflow: hidden;
    position: relative;
}

.secondary-pane {
    width: 0;
    opacity: 0;
    height: 100%;
    overflow-y: auto;
    border-left: 1px solid var(--border-glass);
    background-color: hsl(222, 25%, 6%);
    display: flex;
    flex-direction: column;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    padding: 0;
    flex-shrink: 0;
}

.secondary-pane.active {
    width: 50%;
    opacity: 1;
}

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

.secondary-pane-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-purple-hover);
    margin: 0;
}

.secondary-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: var(--transition-smooth);
}

.secondary-close-btn:hover {
    color: var(--color-danger);
    transform: scale(1.1);
}

.secondary-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

/* Dynamic Citation Links Styling */
.legal-link {
    color: var(--accent-purple);
    text-decoration: none;
    border-bottom: 1px dashed var(--accent-purple);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-smooth);
    position: relative;
    padding: 0 2px;
}

.legal-link:hover {
    color: var(--accent-purple-hover);
    border-bottom-color: var(--accent-purple-hover);
    background-color: var(--accent-purple-glow);
    text-shadow: 0 0 12px var(--accent-purple-glow);
    border-radius: 4px;
}

.legal-link::after {
    content: " 🔗";
    font-size: 9px;
    opacity: 0.7;
}

/* Overruled Landmark Danger Banner */
.precedent-warning-banner {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: var(--radius-medium);
    padding: 16px 20px;
    margin-bottom: 24px;
    color: hsl(0, 100%, 75%);
    font-size: 13.5px;
    line-height: 1.6;
    border-left: 5px solid var(--color-danger);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
    animation: pulseGlow 3s infinite alternate;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 10px rgba(239, 68, 68, 0.1);
    }
    100% {
        box-shadow: 0 0 25px rgba(239, 68, 68, 0.25);
    }
}

/* "Cited In" Subsequent Citation Analytics UI */
.citing-cases-drawer {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border-glass);
}

.citing-cases-drawer h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-gold);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.citing-cases-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    list-style: none;
    padding: 0;
}

.citing-case-item {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-medium);
    font-size: 12.5px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.citing-case-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-purple);
    transform: translateX(4px);
    box-shadow: 0 4px 15px -3px var(--accent-purple-glow);
}

.citing-case-title {
    font-weight: 600;
    color: var(--text-primary);
}

.citing-case-date {
    font-size: 11px;
    color: var(--text-muted);
}

/* ==========================================================================
   🚦 TRAFFIC LIGHT CASE STATUS SYSTEM
   ========================================================================== */

.traffic-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 8px;
    cursor: help;
    transition: var(--transition-smooth);
}

.traffic-badge-green {
    background: hsla(120, 60%, 35%, 0.15);
    border: 1px solid hsla(120, 60%, 40%, 0.35);
    color: hsl(120, 70%, 60%);
}

.traffic-badge-green:hover {
    background: hsla(120, 60%, 35%, 0.28);
    box-shadow: 0 0 10px hsla(120, 60%, 40%, 0.2);
}

.traffic-badge-red {
    background: hsla(0, 80%, 50%, 0.15);
    border: 1px solid hsla(0, 80%, 55%, 0.35);
    color: hsl(0, 80%, 70%);
}

.traffic-badge-red:hover {
    background: hsla(0, 80%, 50%, 0.28);
    box-shadow: 0 0 10px hsla(0, 80%, 55%, 0.2);
}

.traffic-badge-yellow {
    background: hsla(45, 100%, 50%, 0.12);
    border: 1px solid hsla(45, 100%, 55%, 0.3);
    color: hsl(45, 100%, 65%);
}

/* Result cards with overruled status get a subtle red left border */
.card-overruled {
    border-left: 3px solid hsla(0, 80%, 55%, 0.5) !important;
}

.card-overruled:hover {
    border-left-color: hsl(0, 80%, 60%) !important;
}

/* ==========================================================================
   📓 RESEARCH FOLDERS & NOTEPAD STYLES
   ========================================================================== */

.folders-section h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.folder-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    transition: var(--transition-smooth);
    padding: 6px 8px !important;
    border-radius: 6px !important;
}

.folder-btn:hover {
    background: hsla(190, 95%, 55%, 0.08) !important;
    color: var(--accent-purple-hover) !important;
}

/* ==========================================================================
   📑 TABLE OF CONTENTS (TOC) IN READER
   ========================================================================== */

.toc-container {
    background: rgba(20, 25, 35, 0.5);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-medium);
    padding: 16px;
    margin: 16px 0 24px 0;
}

.toc-container h4 {
    color: var(--accent-gold);
    font-size: 14px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toc-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition-smooth);
    display: block;
    border-left: 2px solid transparent;
}

.toc-link:hover {
    color: var(--accent-purple-hover);
    background: hsla(190, 95%, 55%, 0.1);
    border-left-color: var(--accent-purple);
}

.heading-anchor {
    scroll-margin-top: 80px;
}

/* ==========================================================================
   🖍️ IN-TEXT MULTI-COLOR HIGHLIGHTING
   ========================================================================== */

.highlight-yellow {
    background-color: hsla(60, 100%, 50%, 0.25);
    border-bottom: 2px solid hsl(60, 100%, 60%);
    color: #fff;
    padding: 0 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.highlight-green {
    background-color: hsla(120, 60%, 40%, 0.25);
    border-bottom: 2px solid hsl(120, 60%, 50%);
    color: #fff;
    padding: 0 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.highlight-red {
    background-color: hsla(0, 80%, 50%, 0.25);
    border-bottom: 2px solid hsl(0, 80%, 60%);
    color: #fff;
    padding: 0 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.highlight-yellow:hover, .highlight-green:hover, .highlight-red:hover {
    filter: brightness(1.2);
}

/* ==========================================================================
   📖 LEGAL TERM GLOSSARY TOOLTIPS
   ========================================================================== */

.glossary-term {
    border-bottom: 1px dotted var(--accent-gold);
    color: var(--accent-gold);
    cursor: help;
    transition: var(--transition-smooth);
    padding: 0 2px;
}

.glossary-term:hover {
    background-color: hsla(45, 100%, 55%, 0.15);
    border-radius: 2px;
}

.glossary-tooltip {
    position: fixed;
    z-index: 9999;
    background: var(--bg-slate-dark);
    border: 1px solid var(--accent-gold);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-medium);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 10px hsla(45, 100%, 55%, 0.15);
    max-width: 300px;
    font-size: 13px;
    line-height: 1.5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(10px);
}

.glossary-tooltip.visible {
    opacity: 1;
}

.glossary-tooltip-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--accent-gold);
    margin-bottom: 4px;
    font-size: 14px;
    border-bottom: 1px solid hsla(45, 100%, 55%, 0.2);
    padding-bottom: 4px;
}

.glossary-term {
    border-bottom: 1px dashed #c49a45;
    cursor: help;
    transition: all 0.2s ease;
}
.glossary-term:hover {
    background-color: rgba(196, 154, 69, 0.1);
}

#highlight-menu {
    position: absolute;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 6px;
    display: none;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    z-index: 10000;
}
.hl-color { width: 20px; height: 20px; border-radius: 50%; cursor: pointer; transition: transform 0.1s; }
.hl-color:hover { transform: scale(1.2); }
.hl-yellow { background: #ffeaa7; }
.hl-green { background: #55efc4; }
.hl-red { background: #ff7675; }
.hl-blue { background: #74b9ff; }
.hl-btn { color: white; cursor: pointer; font-size: 12px; padding: 4px 8px; border-left: 1px solid #444; }
.hl-btn:hover { color: #c49a45; }

.custom-highlight { padding: 2px 0; border-radius: 2px; color: #000; }
.hl-bg-yellow { background: rgba(255, 234, 167, 0.7); }
.hl-bg-green { background: rgba(85, 239, 196, 0.7); }
.hl-bg-red { background: rgba(255, 118, 117, 0.7); }
.hl-bg-blue { background: rgba(116, 185, 255, 0.7); }
.dark-theme .custom-highlight { color: #fff; }

/* === MOBILE FIRST UI FIXES === */
@media (max-width: 768px) {
    .app-body {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 250px;
        overflow-y: auto;
    }
    .results-pane {
        width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .reader-pane {
        width: 100%;
        flex: 1;
    }
    #secondary-reader-pane {
        border-top: 1px solid var(--border-color);
        border-left: none;
    }
    .app-header {
        padding: 0 10px;
    }
}

/* ==========================================================================
   SERVER WAKE-UP SPINNER OVERLAY
   ========================================================================== */

#server-wakeup-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: hsla(222, 25%, 6%, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlayFadeIn 0.3s ease;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.wakeup-card {
    background: var(--bg-glass-card);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 48px 56px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: 0 24px 60px -10px hsla(222, 30%, 5%, 0.9);
    animation: cardSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Concentric spinning rings --- */
.wakeup-spinner {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 28px;
}

.spinner-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--accent-purple);
    animation: spin 1.1s linear infinite;
}

.spinner-ring--2 {
    inset: 10px;
    border-top-color: var(--accent-gold);
    animation-duration: 1.5s;
    animation-direction: reverse;
}

.spinner-ring--3 {
    inset: 22px;
    border-top-color: hsl(280, 90%, 70%);
    animation-duration: 0.9s;
}

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

.spinner-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    animation: iconPulse 1.8s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%       { transform: scale(1.15); opacity: 0.75; }
}

/* --- Text --- */
.wakeup-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px;
    letter-spacing: -0.01em;
}

.wakeup-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0 0 24px;
}

.wakeup-subtitle strong {
    color: var(--accent-gold);
}

/* --- Progress bar --- */
.wakeup-progress {
    width: 100%;
    height: 4px;
    background: hsla(222, 20%, 30%, 0.5);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 12px;
}

.wakeup-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-gold));
    border-radius: 99px;
    transition: width 1s linear;
}

/* --- Timer text --- */
.wakeup-timer {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    margin: 0;
    letter-spacing: 0.02em;
}

/* ==========================================================================
   PRINT STYLES - Suppress username / auth controls from print footer
   ========================================================================== */


/* ==========================================================================
   DOC SEARCH BAR - Fix spacing between border and text
   ========================================================================== */
.doc-search-bar {
    padding: 10px 16px;
    gap: 10px;
}

.doc-search-bar input#doc-search-input {
    padding: 8px 14px;
    min-width: 0;
}

#doc-search-counter {
    padding: 0 4px;
    white-space: nowrap;
}

/* ==========================================================================
   TYPOGRAPHY FIXES - Footnotes & Superscripts
   ========================================================================== */
sup, .footnote-ref {
    font-size: 0.9em !important;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
    top: -0.25em;
    color: var(--accent-gold, #ffd700);
    font-weight: 700;
}

/* ==========================================================================
   MOBILE WARNING OVERLAY
   ========================================================================== */
.mobile-warning-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.mobile-warning-card {
    background-color: var(--bg-slate-dark);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-large);
    padding: 30px 24px;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-premium);
    animation: fadeIn 0.4s ease-out;
}

.mobile-warning-card .warning-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

.mobile-warning-card h2 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.mobile-warning-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.mobile-warning-card p:last-of-type {
    margin-bottom: 24px;
    color: var(--text-muted);
}

.mobile-warning-card button {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

@media screen and (max-width: 768px) {
    .mobile-warning-overlay {
        display: flex;
        pointer-events: all;
    }
}

.mobile-warning-footer {
    margin-top: 8px;
}

.mobile-coming-soon-badge {
    display: inline-block;
    padding: 8px 20px;
    background: linear-gradient(135deg, hsl(190, 95%, 20%), hsl(262, 70%, 25%));
    border: 1px solid hsl(190, 95%, 40%);
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    color: hsl(190, 95%, 75%);
    letter-spacing: 0.03em;
}


/* Ensure embedded iframes stretch properly */
.case-body iframe {
    width: 100% !important;
    min-height: 80vh !important;
    border-radius: 8px;
    border: 1px solid var(--border-glass) !important;
}

/* PDF iframe inside pdf-view must fill the full pane height */
.pdf-view {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
}

.pdf-view iframe {
    width: 100% !important;
    height: 100% !important;
    flex: 1;
    min-height: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    display: block;
}



@media print {
    /* Hide UI Chrome */
    .app-header,
    .sidebar-pane,
    .results-pane,
    #search-panel,
    .hero-section,
    #paywall-modal,
    #auth-modal,
    .toast-container,
    #mobile-warning-overlay {
        display: none !important;
    }

    /* Reset Body and Container Constraints */
    html, body, #app, .app-main, .app-workspace, #user-workspace {
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
    }

    /* Expand Reader Panel */
    .reader-pane {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        border: none !important;
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #reader-document, .case-body, .ocr-view, #document-view, .reader-split-container {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        flex: none !important;
    }

    /* Force Colors for Readability */
    .reader-pane, .reader-pane *, #reader-document * {
        color: black !important;
        background-color: transparent !important;
        text-shadow: none !important;
        box-shadow: none !important;
    }

    /* Hide internal reader buttons and hints */
    .reader-header,
    .reader-controls,
    .ocr-hint-banner,
    .source-toggle-btn,
    .doc-search-bar,
    #view-original-pdf-btn,
    .floating-action-btn,
    .bookmark-btn,
    button,
    .btn,
    .pdf-view,
    #reader-secondary,
    .pane-header {
        display: none !important;
    }

    /* Ensure OCR view shows instead of PDF iframe when printing */
    .ocr-view {
        display: block !important;
        font-size: 11pt !important;
        line-height: 1.5 !important;
        font-family: serif !important;
    }
    
    .case-header {
        border-bottom: 2px solid black !important;
        padding-bottom: 15px !important;
        margin-bottom: 25px !important;
        display: block !important;
    }
    
    .case-header h2 {
        font-size: 18pt !important;
        margin-bottom: 10px !important;
        color: black !important;
    }

    .meta-item {
        display: flex !important;
        flex-direction: row !important;
        margin-bottom: 5px !important;
    }
    
    .meta-label {
        font-weight: bold !important;
        margin-right: 10px !important;
    }
    
    /* Page Breaks */
    .case-header {
        page-break-after: avoid !important;
    }
    
    .ocr-view p, .ocr-view div {
        page-break-inside: avoid !important;
    }
}

/* --- TERMS AND DISCLAIMER MODAL --- */

/* Heartbeat animation — 2 pulses then stops */
@keyframes termsHeartbeat {
    0%   { transform: scale(1); box-shadow: none; }
    14%  { transform: scale(1.04); box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.35); }
    28%  { transform: scale(1); box-shadow: none; }
    42%  { transform: scale(1.04); box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.35); }
    70%  { transform: scale(1); box-shadow: none; }
    100% { transform: scale(1); box-shadow: none; }
}
.terms-reading-box-header.heartbeat {
    animation: termsHeartbeat 1.4s ease forwards;
    border-radius: 0;
}

.terms-modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    z-index: 999999; display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 16px;
}
.terms-modal-overlay.active { opacity: 1; visibility: visible; }

.terms-small-modal {
    background: #1a1f2e;
    border: 1.5px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    width: 100%; max-width: 480px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.04);
    transform: translateY(16px) scale(0.98);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    display: flex; flex-direction: column;
    max-height: 90vh;
}
.terms-modal-overlay.active .terms-small-modal { transform: translateY(0) scale(1); }

/* Header */
.terms-modal-header {
    padding: 28px 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
    background: #1e2435;
}
.terms-modal-logo {
    height: 80px; width: auto;
    margin-bottom: 14px;
    display: block; margin-left: auto; margin-right: auto;
}
.terms-modal-header h2 {
    margin: 0 0 6px 0; font-size: 1.2rem; color: #f1f5f9; font-weight: 700;
}
.terms-modal-header p {
    margin: 0; font-size: 0.85rem; color: #94a3b8; line-height: 1.4;
}

/* Body */
.terms-modal-body {
    padding: 20px 24px 0;
    overflow-y: auto; flex-shrink: 1;
}

/* THE MAIN BORDERED BOX */
.terms-content-box {
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    overflow: hidden;
    background: #141824;
}

/* Accordion toggle row */
.terms-reading-box-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 16px; cursor: pointer; user-select: none;
    background: #1c2133;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    transition: background 0.2s;
}
.terms-reading-box-header:hover { background: #202639; }
.terms-reading-box-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 0.9rem; font-weight: 600; color: #e2e8f0;
}
.terms-reading-box-title i { color: #60a5fa; }
.terms-reading-box-arrow {
    font-size: 0.75rem; color: #94a3b8;
    transition: transform 0.3s ease;
}
.terms-content-box.open .terms-reading-box-arrow { transform: rotate(180deg); }

/* Expandable content */
.terms-reading-box-content {
    max-height: 0; overflow: hidden;
    transition: max-height 0.4s ease;
    background: #141824;
}
.terms-content-box.open .terms-reading-box-content {
    max-height: 220px;
    overflow-y: auto;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.terms-reading-box-content-inner {
    padding: 16px; font-size: 0.83rem;
    color: #94a3b8; line-height: 1.55;
}
.terms-reading-box-content-inner h4 {
    color: #e2e8f0; margin: 16px 0 6px; font-size: 0.88rem;
}
.terms-reading-box-content-inner h4:first-child { margin-top: 0; }
.terms-reading-box-content-inner ol { padding-left: 18px; margin: 0; }
.terms-reading-box-content-inner li { margin-bottom: 6px; }

.terms-disclaimer-inner {
    background: rgba(220, 38, 38, 0.08);
    border-left: 3px solid #ef4444;
    padding: 10px 12px; border-radius: 0 6px 6px 0; margin-bottom: 14px;
}
.terms-disclaimer-inner strong { color: #ef4444; display: block; margin-bottom: 4px; font-size: 0.83rem; }

.terms-read-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.75rem; color: #10b981; font-weight: 600;
    opacity: 0; transition: opacity 0.3s; white-space: nowrap;
}
.terms-read-badge.visible { opacity: 1; }

/* Checkbox row */
.terms-checkbox-row {
    padding: 14px 16px; background: #1a1f2e;
}
.terms-checkbox-container {
    display: flex; align-items: flex-start; gap: 10px;
    cursor: pointer; transition: opacity 0.2s;
}
.terms-checkbox-container.disabled { opacity: 0.4; cursor: not-allowed; }
.terms-checkbox-container input {
    width: 18px; height: 18px; cursor: pointer;
    accent-color: #3b82f6; flex-shrink: 0; margin-top: 1px;
}
.terms-checkbox-container input:disabled { cursor: not-allowed; }
.terms-checkbox-text { font-size: 0.82rem; color: #e2e8f0; user-select: none; line-height: 1.4; }

/* Footer */
.terms-modal-footer {
    padding: 16px 24px 24px; flex-shrink: 0; background: #1a1f2e;
}
.terms-accept-btn {
    background: #3b82f6; color: white; border: none; width: 100%;
    padding: 13px; border-radius: 10px; font-size: 0.95rem;
    font-weight: 700; cursor: pointer; transition: all 0.2s ease; letter-spacing: 0.02em;
}
.terms-accept-btn:disabled {
    background: #2a3148; color: #64748b; cursor: not-allowed; opacity: 0.8;
}
.terms-accept-btn:not(:disabled):hover {
    background: #2563eb; transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

@media (max-width: 768px) {
    .modal-content {
        max-height: 95vh;
        padding: 24px 16px;
        width: 98%;
    }
}

/* AI Digest Feature */
.ai-digest-btn {
    margin-left: auto;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(106, 17, 203, 0.3);
}

.ai-digest-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(106, 17, 203, 0.4);
}

.ai-digest-btn.loading {
    opacity: 0.8;
    cursor: not-allowed;
    transform: none;
}

.ai-digest-btn .sparkle {
    font-size: 14px;
}

.ai-digest-btn .premium-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-digest-container {
    margin: 15px 0 25px 0;
    padding: 20px;
    border-radius: 12px;
    background: rgba(106, 17, 203, 0.03);
    border: 1px solid rgba(106, 17, 203, 0.1);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.02);
}

.ai-digest-badge {
    display: inline-block;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    color: #4a4a4a;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.ai-digest-badge .cached-badge {
    margin-left: 5px;
    color: #f59f00;
    font-size: 14px;
}

.ai-digest-content h4 {
    color: #2575fc;
    margin: 0 0 8px 0;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-digest-content p {
    margin: 0 0 20px 0;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--text-primary);
}

.ai-digest-content p:last-child {
    margin-bottom: 0;
}

.ai-digest-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6a11cb;
    font-weight: 600;
}

.ai-digest-loading .spinner {
    animation: spin 2s linear infinite;
}

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

.ai-digest-error {
    color: #e53e3e;
    font-weight: 600;
    padding: 10px;
    background: #fff5f5;
    border-radius: 6px;
    border: 1px solid #fed7d7;
}

body.dark-mode .ai-digest-container {
    background: rgba(106, 17, 203, 0.1);
    border-color: rgba(106, 17, 203, 0.3);
}

body.dark-mode .ai-digest-badge {
    background: #2d3748;
    color: #e2e8f0;
    border-color: #4a5568;
}

body.dark-mode .ai-digest-content h4 {
    color: #63b3ed;
}

body.dark-mode .ai-digest-content p {
    color: #e2e8f0;
}
