/* ============================================
   COOKIEJAR DESIGN SYSTEM v3.0
   Abstract, Cinematic, Research Terminal
   ============================================ */

/* ============================================
   CSS CUSTOM PROPERTIES - LIGHT MODE
   ============================================ */
:root {
    /* Color Palette - Light Mode (Research Lab Aesthetic) */
    --color-bg-primary: #f5f4f1;
    --color-bg-secondary: #eceae6;
    --color-bg-tertiary: #e4e2dd;
    --color-bg-elevated: #ffffff;

    /* Surface colors with subtle violet undertone */
    --color-surface: #faf9f7;
    --color-surface-hover: #f0efec;
    --color-surface-active: #e8e6e2;

    /* Text colors - neutral, calm */
    --color-text-primary: #1a1a1a;
    --color-text-secondary: #555555;
    --color-text-tertiary: #888888;
    --color-text-muted: #aaaaaa;

    /* Accent colors - cold, professional */
    --color-accent-primary: #4a6fa5;
    --color-accent-secondary: #6b8cbe;
    --color-accent-tertiary: #8fa8d0;
    --color-accent-glow: rgba(74, 111, 165, 0.15);

    /* State colors */
    --color-success: #4a9b7f;
    --color-warning: #c4923a;
    --color-error: #c45c5c;
    --color-info: #5a8ac4;

    /* Borders and dividers */
    --color-border: rgba(0, 0, 0, 0.08);
    --color-border-subtle: rgba(0, 0, 0, 0.04);
    --color-border-focus: var(--color-accent-primary);

    /* Shadows - soft, diffused */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.06), 0 4px 8px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.08), 0 8px 16px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px var(--color-accent-glow);

    /* Gradients */
    --gradient-bg: linear-gradient(135deg, #f5f4f1 0%, #eae8e4 100%);
    --gradient-surface: linear-gradient(180deg, rgba(255,255,255,0.8) 0%, rgba(250,249,247,0.6) 100%);
    --gradient-accent: linear-gradient(135deg, var(--color-accent-primary) 0%, var(--color-accent-secondary) 100%);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

    /* Font sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;

    /* Font weights */
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* Line heights */
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    /* Spacing */
    --space-0: 0;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    --transition-slower: 500ms ease;

    /* Z-index scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --topbar-height: 64px;
    --content-max-width: 1200px;
}

/* ============================================
   DARK MODE - Atmospheric Research Terminal
   ============================================ */
[data-theme="dark"] {
    /* Background - deep, layered darkness with subtle color */
    --color-bg-primary: #0d0f14;
    --color-bg-secondary: #12151c;
    --color-bg-tertiary: #181c26;
    --color-bg-elevated: #1e222e;

    /* Surface colors - soft dark with depth */
    --color-surface: #1a1e28;
    --color-surface-hover: #22273a;
    --color-surface-active: #2a3044;

    /* Text colors - soft, not harsh white */
    --color-text-primary: #e8e9ed;
    --color-text-secondary: #a0a4b0;
    --color-text-tertiary: #6b7080;
    --color-text-muted: #4a4f5c;

    /* Accent colors - cold cyan, electric purple, icy blue */
    --color-accent-primary: #64b5f6;
    --color-accent-secondary: #90caf9;
    --color-accent-tertiary: #bbdefb;
    --color-accent-glow: rgba(100, 181, 246, 0.2);

    /* State colors - adjusted for dark mode */
    --color-success: #66bb6a;
    --color-warning: #ffa726;
    --color-error: #ef5350;
    --color-info: #42a5f5;

    /* Borders - subtle luminosity */
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-subtle: rgba(255, 255, 255, 0.04);
    --color-border-focus: var(--color-accent-primary);

    /* Shadows - deeper, more dramatic */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6), 0 8px 16px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px var(--color-accent-glow), 0 0 60px rgba(100, 181, 246, 0.1);

    /* Gradients - atmospheric depth */
    --gradient-bg: linear-gradient(180deg, #0d0f14 0%, #0a0c10 100%);
    --gradient-surface: linear-gradient(180deg, rgba(30, 34, 46, 0.8) 0%, rgba(26, 30, 40, 0.6) 100%);
    --gradient-accent: linear-gradient(135deg, #64b5f6 0%, #42a5f5 100%);
}

/* ============================================
   BASE RESET & GLOBAL STYLES
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-normal);
    color: var(--color-text-primary);
    background: var(--gradient-bg);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   CUSTOM SCROLLBAR - Themed scrollbar styling
   ============================================ */

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--color-accent-tertiary);
    border-radius: 5px;
    border: 2px solid var(--color-bg-secondary);
    transition: background 0.2s ease;
}

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

::-webkit-scrollbar-corner {
    background: var(--color-bg-secondary);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-accent-tertiary) var(--color-bg-secondary);
}

/* Dark mode scrollbar adjustments */
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--color-bg-tertiary);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(100, 181, 246, 0.4);
    border-color: var(--color-bg-tertiary);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--color-accent-primary);
}

[data-theme="dark"] * {
    scrollbar-color: rgba(100, 181, 246, 0.4) var(--color-bg-tertiary);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   CUSTOM CURSOR SYSTEM (High-Tech HTML Element)
   Desktop only - smooth trailing movement

   ROBUST GATING: cursor:none ONLY when .cj-cursor-enabled is on <html>
   This class is only applied when custom cursor elements are confirmed ready.
   If cursor fails at any point, the watchdog removes this class = native cursor returns.
   ============================================ */

/* GATING: Only hide native cursor when custom cursor is CONFIRMED active */
html.cj-cursor-enabled,
html.cj-cursor-enabled *,
html.cj-cursor-enabled *::before,
html.cj-cursor-enabled *::after {
    cursor: none !important;
}

/* FALLBACK: When NOT enabled, force native cursor to be visible */
html:not(.cj-cursor-enabled),
html:not(.cj-cursor-enabled) * {
    /* Allow normal cursor values - don't force auto, let CSS cascade work */
}

/* Legacy class support (body-based) */
.custom-cursor-active {
    cursor: none !important;
}

.custom-cursor-active *,
.custom-cursor-active *::before,
.custom-cursor-active *::after {
    cursor: none !important;
}

/* Custom cursor element - HIGHEST possible z-index to be above EVERYTHING */
.custom-cursor {
    --cursor-size: 24px;
    --cursor-dot-size: 4px;
    --cursor-color: #64b5f6;
    --cursor-glow: rgba(100, 181, 246, 0.4);
    --cursor-glow-strong: rgba(100, 181, 246, 0.6);

    position: fixed;
    top: 0;
    left: 0;
    width: var(--cursor-size);
    height: var(--cursor-size);
    pointer-events: none;
    /* Max int32 z-index - cursor MUST be above all dropdowns, portals, modals */
    z-index: 2147483647;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    mix-blend-mode: screen;
}

.custom-cursor.visible {
    opacity: 1;
}

/* Cursor ring (outer circle) */
.custom-cursor-ring {
    position: absolute;
    inset: 0;
    border: 1.5px solid var(--cursor-color);
    border-radius: 50%;
    opacity: 0.9;
    box-shadow:
        0 0 8px var(--cursor-glow),
        0 0 16px var(--cursor-glow),
        inset 0 0 4px var(--cursor-glow);
    transition:
        transform 0.15s cubic-bezier(0.25, 0.1, 0.25, 1),
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        opacity 0.2s ease;
}

/* Cursor dot (center) */
.custom-cursor-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--cursor-dot-size);
    height: var(--cursor-dot-size);
    background: var(--cursor-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px var(--cursor-glow);
    transition:
        transform 0.15s cubic-bezier(0.25, 0.1, 0.25, 1),
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        width 0.15s ease,
        height 0.15s ease;
}

/* I-beam element for text cursor */
.custom-cursor-ibeam {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 18px;
    background: var(--cursor-color);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.15s ease;
    box-shadow: 0 0 4px var(--cursor-glow);
}

.custom-cursor-ibeam::before,
.custom-cursor-ibeam::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 2px;
    background: var(--cursor-color);
}

.custom-cursor-ibeam::before {
    top: 0;
}

.custom-cursor-ibeam::after {
    bottom: 0;
}

/* Drag grip dots */
.custom-cursor-grip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 3px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.custom-cursor-grip::before,
.custom-cursor-grip::after {
    content: '';
    width: 3px;
    height: 3px;
    background: var(--cursor-color);
    border-radius: 50%;
    box-shadow: 0 0 4px var(--cursor-glow);
}

/* Resize arrows */
.custom-cursor-arrows {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.custom-cursor-arrows svg {
    width: 16px;
    height: 16px;
    fill: var(--cursor-color);
    filter: drop-shadow(0 0 4px var(--cursor-glow));
}

/* Forbidden slash */
.custom-cursor-forbidden {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--cursor-color);
    transform: translate(-50%, -50%) rotate(-45deg);
    opacity: 0;
    transition: opacity 0.15s ease;
}

/* Busy spinner segment */
.custom-cursor-spinner {
    position: absolute;
    inset: -2px;
    border: 2px solid transparent;
    border-top-color: var(--cursor-color);
    border-radius: 50%;
    opacity: 0;
    animation: cursor-spin 0.8s linear infinite;
    animation-play-state: paused;
}

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

/* ============================================
   CURSOR STATES
   ============================================ */

/* DEFAULT STATE */
.custom-cursor[data-state="default"] .custom-cursor-ring {
    transform: scale(1);
}

.custom-cursor[data-state="default"] .custom-cursor-dot {
    transform: translate(-50%, -50%) scale(1);
}

/* POINTER STATE (buttons, links, clickables) */
.custom-cursor[data-state="pointer"] {
    --cursor-size: 32px;
}

.custom-cursor[data-state="pointer"] .custom-cursor-ring {
    transform: scale(1.3);
    box-shadow:
        0 0 12px var(--cursor-glow-strong),
        0 0 24px var(--cursor-glow),
        inset 0 0 8px var(--cursor-glow);
}

.custom-cursor[data-state="pointer"] .custom-cursor-dot {
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 0 10px var(--cursor-glow-strong);
}

/* TEXT STATE (inputs, textareas) */
.custom-cursor[data-state="text"] {
    --cursor-size: 20px;
}

.custom-cursor[data-state="text"] .custom-cursor-ring {
    transform: scale(0.7);
    opacity: 0.5;
}

.custom-cursor[data-state="text"] .custom-cursor-dot {
    opacity: 0;
}

.custom-cursor[data-state="text"] .custom-cursor-ibeam {
    opacity: 1;
}

/* DRAG STATE */
.custom-cursor[data-state="drag"] {
    --cursor-size: 28px;
}

.custom-cursor[data-state="drag"] .custom-cursor-ring {
    transform: scaleX(1.2) scaleY(0.9);
    animation: cursor-wobble 0.3s ease-in-out infinite;
}

.custom-cursor[data-state="drag"] .custom-cursor-dot {
    opacity: 0;
}

.custom-cursor[data-state="drag"] .custom-cursor-grip {
    opacity: 1;
}

@keyframes cursor-wobble {
    0%, 100% { transform: scaleX(1.2) scaleY(0.9) rotate(-2deg); }
    50% { transform: scaleX(1.2) scaleY(0.9) rotate(2deg); }
}

/* RESIZE STATES */
.custom-cursor[data-state="resize-x"],
.custom-cursor[data-state="resize-y"],
.custom-cursor[data-state="resize-diag"] {
    --cursor-size: 28px;
}

.custom-cursor[data-state="resize-x"] .custom-cursor-arrows,
.custom-cursor[data-state="resize-y"] .custom-cursor-arrows,
.custom-cursor[data-state="resize-diag"] .custom-cursor-arrows {
    opacity: 1;
}

.custom-cursor[data-state="resize-x"] .custom-cursor-dot,
.custom-cursor[data-state="resize-y"] .custom-cursor-dot,
.custom-cursor[data-state="resize-diag"] .custom-cursor-dot {
    opacity: 0;
}

.custom-cursor[data-state="resize-y"] .custom-cursor-arrows {
    transform: translate(-50%, -50%) rotate(90deg);
}

.custom-cursor[data-state="resize-diag"] .custom-cursor-arrows {
    transform: translate(-50%, -50%) rotate(45deg);
}

/* FORBIDDEN STATE */
.custom-cursor[data-state="forbidden"] {
    --cursor-color: #ef5350;
    --cursor-glow: rgba(239, 83, 80, 0.4);
}

.custom-cursor[data-state="forbidden"] .custom-cursor-ring {
    animation: cursor-pulse-red 1s ease-in-out infinite;
}

.custom-cursor[data-state="forbidden"] .custom-cursor-forbidden {
    opacity: 1;
}

.custom-cursor[data-state="forbidden"] .custom-cursor-dot {
    opacity: 0;
}

@keyframes cursor-pulse-red {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 8px var(--cursor-glow), 0 0 16px var(--cursor-glow);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 12px var(--cursor-glow), 0 0 24px var(--cursor-glow);
    }
}

/* BUSY STATE */
.custom-cursor[data-state="busy"] .custom-cursor-spinner {
    opacity: 1;
    animation-play-state: running;
}

.custom-cursor[data-state="busy"] .custom-cursor-dot {
    animation: cursor-pulse-dot 1.5s ease-in-out infinite;
}

@keyframes cursor-pulse-dot {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    50% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
}

/* WAIT STATE (loading indicator) */
.custom-cursor[data-state="wait"] {
    --cursor-color: #ffa726;
    --cursor-glow: rgba(255, 167, 38, 0.4);
}

.custom-cursor[data-state="wait"] .custom-cursor-spinner {
    opacity: 1;
    animation-play-state: running;
    border-top-color: #ffa726;
}

.custom-cursor[data-state="wait"] .custom-cursor-ring {
    border-color: rgba(255, 167, 38, 0.5);
    animation: cursor-pulse-wait 1s ease-in-out infinite;
}

@keyframes cursor-pulse-wait {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* HELP STATE (question mark) */
.custom-cursor[data-state="help"] {
    --cursor-color: #29b6f6;
    --cursor-glow: rgba(41, 182, 246, 0.4);
}

.custom-cursor[data-state="help"] .custom-cursor-dot::after {
    content: '?';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: bold;
    color: #29b6f6;
    text-shadow: 0 0 4px rgba(41, 182, 246, 0.6);
}

.custom-cursor[data-state="help"] .custom-cursor-dot {
    width: 14px;
    height: 14px;
    background: transparent;
}

/* CROSSHAIR STATE */
.custom-cursor[data-state="crosshair"] {
    --cursor-color: #66bb6a;
    --cursor-glow: rgba(102, 187, 106, 0.4);
}

.custom-cursor[data-state="crosshair"] .custom-cursor-ring {
    opacity: 0.4;
    transform: scale(1.2);
}

.custom-cursor[data-state="crosshair"] .custom-cursor-dot {
    width: 2px;
    height: 2px;
}

.custom-cursor[data-state="crosshair"] .custom-cursor-dot::before,
.custom-cursor[data-state="crosshair"] .custom-cursor-dot::after {
    content: '';
    position: absolute;
    background: var(--cursor-color);
    box-shadow: 0 0 4px var(--cursor-glow);
}

.custom-cursor[data-state="crosshair"] .custom-cursor-dot::before {
    width: 12px;
    height: 1px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.custom-cursor[data-state="crosshair"] .custom-cursor-dot::after {
    width: 1px;
    height: 12px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* GRAB STATE (grabbable, not yet grabbed) */
.custom-cursor[data-state="grab"] {
    --cursor-size: 28px;
}

.custom-cursor[data-state="grab"] .custom-cursor-ring {
    transform: scale(1.1);
    border-style: dashed;
}

.custom-cursor[data-state="grab"] .custom-cursor-dot {
    opacity: 0;
}

.custom-cursor[data-state="grab"] .custom-cursor-grip {
    opacity: 1;
}

/* GRABBING STATE (actively grabbing) */
.custom-cursor[data-state="grabbing"] {
    --cursor-size: 24px;
}

.custom-cursor[data-state="grabbing"] .custom-cursor-ring {
    transform: scale(0.9);
    background: rgba(100, 181, 246, 0.2);
}

.custom-cursor[data-state="grabbing"] .custom-cursor-dot {
    opacity: 0;
}

.custom-cursor[data-state="grabbing"] .custom-cursor-grip {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.8);
}

/* NOT-ALLOWED STATE (alias for forbidden) */
.custom-cursor[data-state="not-allowed"] {
    --cursor-color: #ef5350;
    --cursor-glow: rgba(239, 83, 80, 0.4);
}

.custom-cursor[data-state="not-allowed"] .custom-cursor-ring {
    animation: cursor-pulse-red 1s ease-in-out infinite;
}

.custom-cursor[data-state="not-allowed"] .custom-cursor-forbidden {
    opacity: 1;
}

.custom-cursor[data-state="not-allowed"] .custom-cursor-dot {
    opacity: 0;
}

/* Light mode adjustments */
[data-theme="light"] .custom-cursor {
    --cursor-color: #4a6fa5;
    --cursor-glow: rgba(74, 111, 165, 0.4);
    --cursor-glow-strong: rgba(74, 111, 165, 0.6);
    mix-blend-mode: multiply;
}

/* Touch device - hide cursor completely */
@media (pointer: coarse), (hover: none) {
    .custom-cursor {
        display: none !important;
    }

    .custom-cursor-active {
        cursor: auto !important;
    }

    .custom-cursor-active *,
    .custom-cursor-active *::before,
    .custom-cursor-active *::after {
        cursor: auto !important;
    }
}

/* ============================================
   CUSTOM SCROLLBAR (High-Tech Neon Aesthetic)
   Desktop only - thin, dark glass track, neon blue thumb
   ============================================ */
@media (min-width: 768px) {
    /* Webkit scrollbar (Chrome, Safari, Edge) */
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }

    ::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 10px;
        backdrop-filter: blur(4px);
    }

    ::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, #64b5f6 0%, #42a5f5 50%, #1e88e5 100%);
        border-radius: 10px;
        box-shadow:
            0 0 6px rgba(100, 181, 246, 0.4),
            inset 0 0 2px rgba(255, 255, 255, 0.3);
    }

    ::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(180deg, #90caf9 0%, #64b5f6 50%, #42a5f5 100%);
        box-shadow:
            0 0 12px rgba(100, 181, 246, 0.6),
            0 0 20px rgba(100, 181, 246, 0.3),
            inset 0 0 4px rgba(255, 255, 255, 0.4);
    }

    ::-webkit-scrollbar-thumb:active {
        background: linear-gradient(180deg, #bbdefb 0%, #90caf9 50%, #64b5f6 100%);
    }

    ::-webkit-scrollbar-corner {
        background: rgba(0, 0, 0, 0.2);
    }

    /* Firefox scrollbar */
    html {
        scrollbar-width: thin;
        scrollbar-color: #64b5f6 rgba(0, 0, 0, 0.2);
    }

    /* Dark mode scrollbar enhancement */
    [data-theme="dark"] ::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.4);
    }

    [data-theme="dark"] ::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, #64b5f6 0%, #42a5f5 50%, #1e88e5 100%);
        box-shadow:
            0 0 8px rgba(100, 181, 246, 0.5),
            0 0 16px rgba(100, 181, 246, 0.2),
            inset 0 0 2px rgba(255, 255, 255, 0.2);
    }

    [data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
        box-shadow:
            0 0 14px rgba(100, 181, 246, 0.7),
            0 0 28px rgba(100, 181, 246, 0.4),
            inset 0 0 4px rgba(255, 255, 255, 0.3);
    }

    /* Light mode scrollbar */
    [data-theme="light"] ::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.08);
    }

    [data-theme="light"] ::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, #4a6fa5 0%, #5a8ac4 50%, #6b9bd1 100%);
        box-shadow:
            0 0 4px rgba(74, 111, 165, 0.3),
            inset 0 0 2px rgba(255, 255, 255, 0.4);
    }

    [data-theme="light"] ::-webkit-scrollbar-thumb:hover {
        box-shadow:
            0 0 10px rgba(74, 111, 165, 0.5),
            0 0 20px rgba(74, 111, 165, 0.2);
    }

    [data-theme="light"] html {
        scrollbar-color: #4a6fa5 rgba(0, 0, 0, 0.08);
    }
}

/* Fallback for browsers without custom scrollbar support (Firefox uses scrollbar-width/color) */
@supports not selector(::-webkit-scrollbar) {
    html {
        overflow-y: scroll;
        scrollbar-width: thin;
        scrollbar-color: #64b5f6 rgba(0, 0, 0, 0.2);
    }
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
}

h1 { font-size: var(--text-4xl); font-weight: var(--font-bold); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}

a {
    color: var(--color-accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* ============================================
   FOCUS STYLES (Accessibility)
   ============================================ */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--color-accent-primary);
    outline-offset: 2px;
}

/* ============================================
   SKIP LINK (Accessibility)
   ============================================ */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    z-index: var(--z-tooltip);
    padding: var(--space-3) var(--space-4);
    background: var(--color-accent-primary);
    color: white;
    font-weight: var(--font-semibold);
    border-radius: var(--radius-md);
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: var(--space-4);
}

/* ============================================
   APP SHELL LAYOUT
   ============================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Top Bar */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--color-bg-elevated);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    z-index: var(--z-fixed);
    backdrop-filter: blur(12px);
}

[data-theme="dark"] .topbar {
    background: rgba(30, 34, 46, 0.85);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    text-decoration: none;
}

.logo-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--gradient-accent);
    border-radius: var(--radius-md);
    color: white;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--color-bg-secondary);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sticky);
    transition: transform var(--transition-slow), width var(--transition-slow);
}

[data-theme="dark"] .sidebar {
    background: var(--color-bg-secondary);
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto;
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--color-border);
}

/* Navigation items */
.nav-section {
    margin-bottom: var(--space-6);
}

.nav-section-title {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    color: var(--color-text-secondary);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.nav-item:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
}

.nav-item.active {
    background: var(--color-accent-glow);
    color: var(--color-accent-primary);
}

.nav-item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-item-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item-badge {
    padding: var(--space-1) var(--space-2);
    background: var(--color-accent-primary);
    color: white;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    padding: var(--space-8);
}

.content-container {
    max-width: var(--content-max-width);
    margin: 0 auto;
}

/* Mobile sidebar */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: calc(var(--z-sticky) - 1);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: all var(--transition-slow);
    }

    .sidebar-overlay.visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    line-height: 1;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

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

/* Primary button */
.btn-primary {
    background: var(--gradient-accent);
    color: white;
    box-shadow: var(--shadow-sm), 0 0 0 0 var(--color-accent-glow);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: var(--shadow-md), var(--shadow-glow);
    transform: translateY(-1px);
}

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

/* Secondary button */
.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-surface-hover);
    border-color: var(--color-border-focus);
}

/* Ghost button */
.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
}

/* Button sizes */
.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-base);
}

.btn-xl {
    padding: var(--space-5) var(--space-8);
    font-size: var(--text-lg);
}

/* Icon button */
.btn-icon {
    padding: var(--space-2);
    border-radius: var(--radius-md);
}

.btn-icon.btn-lg {
    padding: var(--space-3);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--color-text-primary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-muted);
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
    border-color: var(--color-text-tertiary);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 0 3px var(--color-accent-glow);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* Large input for search/research questions */
.form-input-lg {
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-lg);
}

.form-textarea-lg {
    padding: var(--space-5);
    font-size: var(--text-lg);
    min-height: 160px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    transition: all var(--transition-base);
}

.card-hover:hover {
    border-color: var(--color-border-focus);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

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

.card-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
}

.card-body {
    color: var(--color-text-secondary);
}

.card-footer {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border-subtle);
}

/* Floating card effect */
.card-floating {
    background: var(--gradient-surface);
    backdrop-filter: blur(8px);
    border: 1px solid var(--color-border-subtle);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   RESEARCH RESULT SECTIONS
   ============================================ */
.research-section {
    margin-bottom: var(--space-8);
}

.research-section-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.research-section-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent-glow);
    color: var(--color-accent-primary);
    border-radius: var(--radius-md);
    font-size: var(--text-lg);
}

.research-section-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
}

.research-section-content {
    padding-left: var(--space-10);
}

/* Source cards */
.source-card {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
    transition: all var(--transition-fast);
}

.source-card:hover {
    border-color: var(--color-accent-primary);
    box-shadow: var(--shadow-sm);
}

.source-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.source-card-content {
    flex: 1;
    min-width: 0;
}

.source-card-title {
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
}

.source-card-meta {
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-2);
}

.source-card-snippet {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}

.source-card-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-accent-primary);
    margin-top: var(--space-2);
}

/* ============================================
   LOADING STATES
   ============================================ */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-surface) 25%,
        var(--color-surface-hover) 50%,
        var(--color-surface) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1em;
    margin-bottom: var(--space-2);
}

.skeleton-title {
    height: 1.5em;
    width: 60%;
    margin-bottom: var(--space-3);
}

.skeleton-card {
    height: 120px;
}

/* Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-lg {
    width: 48px;
    height: 48px;
    border-width: 3px;
}

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

/* Loading overlay */
.loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    padding: var(--space-12);
    text-align: center;
}

.loading-text {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
}

.loading-progress {
    width: 100%;
    max-width: 400px;
    height: 4px;
    background: var(--color-surface);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
    box-shadow: var(--shadow-glow);
}

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-16);
    text-align: center;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    border-radius: var(--radius-2xl);
    font-size: 2.5rem;
    margin-bottom: var(--space-6);
}

.empty-state-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    max-width: 400px;
    margin-bottom: var(--space-6);
}

/* ============================================
   ERROR STATES
   ============================================ */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12);
    text-align: center;
    background: rgba(196, 92, 92, 0.05);
    border: 1px solid rgba(196, 92, 92, 0.2);
    border-radius: var(--radius-xl);
}

.error-state-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(196, 92, 92, 0.1);
    color: var(--color-error);
    border-radius: var(--radius-xl);
    font-size: 2rem;
    margin-bottom: var(--space-4);
}

.error-state-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-error);
    margin-bottom: var(--space-2);
}

.error-state-message {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-4);
}

/* ============================================
   TOASTS / NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: var(--z-tooltip);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    animation: toast-in 0.3s ease;
}

.toast-success {
    border-left: 4px solid var(--color-success);
}

.toast-error {
    border-left: 4px solid var(--color-error);
}

.toast-warning {
    border-left: 4px solid var(--color-warning);
}

.toast-info {
    border-left: 4px solid var(--color-info);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   MODAL
   ============================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    animation: fade-in 0.2s ease;
}

.modal {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - var(--space-8));
    overflow: hidden;
    animation: modal-in 0.3s ease;
}

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

.modal-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--color-text-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-6);
    border-top: 1px solid var(--color-border);
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ============================================
   THEME TOGGLE
   ============================================ */
.theme-toggle {
    position: relative;
    width: 48px;
    height: 28px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    border-color: var(--color-accent-primary);
}

.theme-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: var(--color-accent-primary);
    border-radius: 50%;
    transition: transform var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
}

[data-theme="dark"] .theme-toggle-thumb {
    transform: translateX(20px);
}

/* ============================================
   USER MENU
   ============================================ */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.user-menu-trigger:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-border);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--gradient-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
}

.user-info {
    text-align: left;
}

.user-name {
    font-weight: var(--font-medium);
    font-size: var(--text-sm);
    color: var(--color-text-primary);
}

.user-tier {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    min-width: 200px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
}

.user-menu.open .user-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.user-menu-item:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
}

.user-menu-item:first-child {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.user-menu-item:last-child {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.user-menu-divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--space-2) 0;
}

/* ============================================
   CREDITS / USAGE DISPLAY
   ============================================ */
.credits-display {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
}

.credits-value {
    font-weight: var(--font-semibold);
    color: var(--color-accent-primary);
}

.credits-label {
    color: var(--color-text-tertiary);
}

/* ============================================
   BADGE / TAG
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-primary {
    background: var(--color-accent-glow);
    color: var(--color-accent-primary);
}

.badge-success {
    background: rgba(74, 155, 127, 0.15);
    color: var(--color-success);
}

.badge-warning {
    background: rgba(196, 146, 58, 0.15);
    color: var(--color-warning);
}

.badge-error {
    background: rgba(196, 92, 92, 0.15);
    color: var(--color-error);
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-6);
}

.tab {
    padding: var(--space-3) var(--space-4);
    font-weight: var(--font-medium);
    color: var(--color-text-tertiary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: -1px;
}

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

.tab.active {
    color: var(--color-accent-primary);
    border-bottom-color: var(--color-accent-primary);
}

.tab-content {
    display: none;
}

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

/* ============================================
   ABSTRACT BACKGROUND EFFECTS
   ============================================ */
.bg-gradient-subtle {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
}

[data-theme="dark"] .bg-gradient-subtle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        ellipse at 30% 20%,
        rgba(100, 181, 246, 0.08) 0%,
        transparent 50%
    ),
    radial-gradient(
        ellipse at 70% 80%,
        rgba(126, 87, 194, 0.06) 0%,
        transparent 50%
    );
}

/* Subtle noise texture */
.bg-noise {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */
@media (max-width: 768px) {
    :root {
        --space-8: 1.5rem;
        --space-10: 2rem;
        --space-12: 2.5rem;
    }

    .main-content {
        padding: var(--space-4);
    }

    .card {
        padding: var(--space-4);
    }

    h1 { font-size: var(--text-3xl); }
    h2 { font-size: var(--text-2xl); }
    h3 { font-size: var(--text-xl); }
}

/* Hide on mobile */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Hide on desktop */
@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}

/* ============================================
   CONFIRM MODAL (Themed Glassmorphism Neon)
   ============================================ */
.confirm-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    animation: confirm-modal-fade-in 0.2s ease-out;
}

.confirm-modal-backdrop.open {
    display: flex;
}

@keyframes confirm-modal-fade-in {
    from {
        opacity: 0;
        backdrop-filter: blur(0);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
}

.confirm-modal {
    position: relative;
    background: rgba(30, 35, 50, 0.85);
    border: 1px solid rgba(100, 181, 246, 0.3);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    max-width: 420px;
    width: 100%;
    box-shadow:
        0 0 40px rgba(100, 181, 246, 0.15),
        0 0 80px rgba(100, 181, 246, 0.1),
        0 25px 50px -12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: confirm-modal-scale-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

@keyframes confirm-modal-scale-in {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Neon edge glow effect */
.confirm-modal-glow {
    position: absolute;
    inset: -1px;
    border-radius: var(--radius-xl);
    background: linear-gradient(
        135deg,
        rgba(100, 181, 246, 0.4) 0%,
        rgba(100, 181, 246, 0.1) 25%,
        transparent 50%,
        rgba(100, 181, 246, 0.1) 75%,
        rgba(100, 181, 246, 0.4) 100%
    );
    z-index: -1;
    animation: confirm-modal-glow-pulse 3s ease-in-out infinite;
}

@keyframes confirm-modal-glow-pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

.confirm-modal-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    border-bottom: none;
    padding-bottom: 0;
}

.confirm-modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(239, 83, 80, 0.15);
    border: 1px solid rgba(239, 83, 80, 0.3);
    border-radius: 50%;
    color: #ef5350;
    box-shadow: 0 0 20px rgba(239, 83, 80, 0.2);
}

.confirm-modal-icon svg {
    width: 24px;
    height: 24px;
}

.confirm-modal-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    margin: 0;
}

.confirm-modal-body {
    padding: 0;
    margin-bottom: var(--space-6);
}

.confirm-modal-body p {
    margin: 0;
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}

.confirm-modal-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
}

.confirm-modal-cancel {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--color-text);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-lg);
    font-weight: var(--font-medium);
    transition: all 0.2s ease;
}

.confirm-modal-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.confirm-modal-confirm {
    background: linear-gradient(135deg, #ef5350 0%, #d32f2f 100%);
    border: 1px solid rgba(239, 83, 80, 0.5);
    color: white;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-lg);
    font-weight: var(--font-medium);
    box-shadow: 0 0 20px rgba(239, 83, 80, 0.3);
    transition: all 0.2s ease;
}

.confirm-modal-confirm:hover {
    background: linear-gradient(135deg, #f44336 0%, #e53935 100%);
    box-shadow: 0 0 30px rgba(239, 83, 80, 0.5);
    transform: translateY(-1px);
}

.confirm-modal-confirm:active {
    transform: translateY(0);
}

/* Light mode adjustments */
[data-theme="light"] .confirm-modal {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(74, 111, 165, 0.3);
    box-shadow:
        0 0 40px rgba(74, 111, 165, 0.1),
        0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .confirm-modal-glow {
    background: linear-gradient(
        135deg,
        rgba(74, 111, 165, 0.3) 0%,
        rgba(74, 111, 165, 0.1) 25%,
        transparent 50%,
        rgba(74, 111, 165, 0.1) 75%,
        rgba(74, 111, 165, 0.3) 100%
    );
}

[data-theme="light"] .confirm-modal-cancel {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .confirm-modal-cancel:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Mobile responsive */
@media (max-width: 480px) {
    .confirm-modal {
        padding: var(--space-5);
        margin: var(--space-4);
    }

    .confirm-modal-actions {
        flex-direction: column-reverse;
    }

    .confirm-modal-actions button {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   TRENDING TOPICS
   ============================================ */
.trending-card {
    position: relative;
}

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

.trending-header h3 {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
}

.trending-refresh {
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.trending-refresh:hover {
    background: var(--color-surface-hover);
}

.trending-refresh-icon {
    transition: transform var(--transition-slow);
}

.trending-refresh.loading .trending-refresh-icon {
    animation: spin 1s linear infinite;
}

.trending-grid {
    display: grid;
    gap: var(--space-3);
}

/* Trending topic item */
.trending-topic {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.trending-topic::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-accent);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.trending-topic:hover {
    border-color: var(--color-accent-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow), var(--shadow-md);
}

.trending-topic:hover::before {
    opacity: 0.05;
}

.trending-topic:active {
    transform: translateY(0);
}

.trending-topic-content {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.trending-topic-prompt {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-primary);
    line-height: var(--leading-snug);
    margin-bottom: var(--space-1);
}

.trending-topic-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.trending-topic-sources {
    display: flex;
    gap: var(--space-1);
}

.trending-topic-source {
    padding: 2px 6px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: var(--font-medium);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-secondary);
}

.trending-topic-arrow {
    flex-shrink: 0;
    color: var(--color-text-tertiary);
    transition: all var(--transition-base);
    position: relative;
    z-index: 1;
}

.trending-topic:hover .trending-topic-arrow {
    color: var(--color-accent-primary);
    transform: translateX(3px);
}

/* Score indicator */
.trending-topic-score {
    position: absolute;
    top: 0;
    right: 0;
    width: 3px;
    height: 100%;
    background: var(--color-accent-primary);
    opacity: 0.3;
    transition: opacity var(--transition-base);
}

.trending-topic:hover .trending-topic-score {
    opacity: 0.6;
}

/* Skeleton loading */
.trending-skeleton {
    display: grid;
    gap: var(--space-3);
}

.trending-skeleton .skeleton-item {
    height: 64px;
    background: linear-gradient(
        90deg,
        var(--color-surface) 0%,
        var(--color-surface-hover) 50%,
        var(--color-surface) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-lg);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Dark mode neon glow enhancement */
[data-theme="dark"] .trending-topic:hover {
    box-shadow:
        0 0 20px rgba(100, 181, 246, 0.15),
        0 0 40px rgba(100, 181, 246, 0.1),
        var(--shadow-md);
}

[data-theme="dark"] .trending-topic-source {
    background: rgba(100, 181, 246, 0.1);
    color: var(--color-accent-secondary);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .trending-topic {
        padding: var(--space-3);
    }

    .trending-topic-prompt {
        font-size: var(--text-xs);
    }

    .trending-topic-meta {
        flex-wrap: wrap;
    }

    .trending-topic-sources {
        display: none;
    }
}

/* ============================================
   AUDIENCE & VOICE LAB COMPONENTS
   ============================================ */

/* Debate Engine Container */
.debate-engine-container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-4);
}

.debate-engine-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

/* Mode Toggle Buttons */
.debate-mode-toggle {
    display: flex;
    gap: var(--space-2);
    background: var(--color-surface);
    padding: var(--space-1);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.debate-mode-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    font-weight: var(--font-medium);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.debate-mode-btn:hover {
    color: var(--color-text-primary);
    background: var(--color-surface-hover);
}

.debate-mode-btn.active {
    background: var(--color-accent-primary);
    color: white;
}

/* Debate Panels */
.debate-panel {
    display: none;
}

.debate-panel.active {
    display: block;
}

/* Intro Card */
.debate-intro-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-5);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-6);
}

.debate-intro-card.adversarial {
    border-color: var(--color-warning);
    background: rgba(255, 167, 38, 0.05);
}

.debate-intro-card h3 {
    margin: 0 0 var(--space-2) 0;
    font-size: var(--text-lg);
}

.debate-intro-card p {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

/* Debate Input Section */
.debate-input-section {
    margin-bottom: var(--space-6);
}

.debate-textarea {
    width: 100%;
    padding: var(--space-4);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--color-text-primary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    resize: vertical;
    min-height: 100px;
    transition: all var(--transition-fast);
}

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

/* Perspective Categories */
.perspective-categories {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.perspective-category {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.category-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.category-header:hover {
    background: var(--color-surface-hover);
}

.category-title {
    flex: 1;
    font-weight: var(--font-medium);
}

.category-arrow {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--color-text-tertiary);
    transition: transform var(--transition-fast);
}

.perspective-category.open .category-arrow {
    transform: rotate(180deg);
}

.category-options {
    display: none;
    padding: var(--space-2) var(--space-4) var(--space-4);
    gap: var(--space-2);
    flex-wrap: wrap;
}

.perspective-category.open .category-options {
    display: flex;
}

/* Perspective Options */
.perspective-option {
    display: inline-flex;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.perspective-option:hover {
    border-color: var(--color-accent-primary);
    color: var(--color-text-primary);
}

.perspective-option.selected {
    background: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
    color: white;
}

/* Action Bar */
.debate-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
}

.selected-perspective {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

/* Results Area */
.perspective-results {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
}

.result-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.comparison-column {
    padding: var(--space-4);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
}

.column-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
}

.comparison-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    color: var(--color-text-tertiary);
}

.insight-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-accent-glow);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-accent-tertiary);
}

.insight-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.insight-content {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}

/* Critic Selection */
.critic-selection {
    margin-bottom: var(--space-6);
}

.critic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-3);
}

.critic-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4);
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.critic-card:hover {
    border-color: var(--color-accent-primary);
    background: var(--color-surface-hover);
}

.critic-card.active {
    border-color: var(--color-accent-primary);
    background: var(--color-accent-glow);
}

.critic-name {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-primary);
}

.critic-desc {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.critic-tags {
    font-size: var(--text-2xs, 10px);
    color: var(--color-text-muted);
    margin-top: var(--space-2);
    text-align: center;
    font-style: italic;
}

/* Engagement Mode Selection (replaces Intensity) */
.engagement-mode-selection {
    margin-bottom: var(--space-6);
}

.engagement-mode-options {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.engagement-mode-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.engagement-mode-btn .mode-desc {
    font-size: var(--text-xs);
    font-weight: var(--font-normal);
    color: var(--color-text-tertiary);
}

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

.engagement-mode-btn.active {
    background: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
    color: white;
}

.engagement-mode-btn.active .mode-desc {
    color: rgba(255, 255, 255, 0.8);
}

/* Focus Area Presets */
.focus-presets-selection {
    margin-bottom: var(--space-4);
}

.focus-presets-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.focus-preset-chip {
    display: inline-flex;
    align-items: center;
    padding: var(--space-2) var(--space-4);
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.focus-preset-chip:hover {
    border-color: var(--color-accent-primary);
    color: var(--color-text-primary);
}

.focus-preset-chip.active {
    background: var(--color-accent-glow);
    border-color: var(--color-accent-primary);
    color: var(--color-accent-primary);
}

/* Intensity Selection (legacy) */
.intensity-selection {
    margin-bottom: var(--space-6);
}

.intensity-options {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.intensity-btn {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.intensity-btn.active {
    background: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
    color: white;
}

/* Focus Areas */
.focus-areas-selection {
    margin-bottom: var(--space-6);
}

.focus-areas-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.focus-chip {
    display: inline-flex;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.focus-chip:hover {
    border-color: var(--color-accent-primary);
    color: var(--color-text-primary);
}

.focus-chip.active {
    background: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
    color: white;
}

/* Debate Arena */
.debate-arena {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
}

.arena-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-6);
}

.arena-round,
.arena-score {
    text-align: center;
}

.round-label,
.score-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.round-number,
.score-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--color-accent-primary);
}

.arena-critic {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: var(--font-medium);
}

/* Attack Card */
.attack-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
}

.attack-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    font-weight: var(--font-medium);
    color: var(--color-text-primary);
}

.attack-content {
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}

.critique-summary {
    font-weight: var(--font-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--space-4);
}

/* Scorecard Review (Multi-Round Format) */
.scorecard-review {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

.scorecard-header {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-4);
}

.scorecard-header h4 {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
}

.scorecard-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-6);
    margin-bottom: var(--space-4);
}

.resilience-score {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.score-label {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.score-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
}

.score-value.score-high {
    color: var(--color-success);
}

.score-value.score-medium {
    color: var(--color-warning);
}

.score-value.score-low {
    color: var(--color-warning-dark, #d97706);
}

.score-value.score-critical {
    color: var(--color-error);
}

.primary-focus {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.focus-label {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.focus-value {
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--color-accent-primary);
}

.critic-tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.critic-tag {
    display: inline-flex;
    padding: var(--space-1) var(--space-2);
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

.scorecard-section {
    margin-bottom: var(--space-5);
}

.scorecard-section h5 {
    margin: 0 0 var(--space-3) 0;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.weaknesses-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.weakness-item {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-3);
}

.weakness-number {
    font-weight: var(--font-bold);
    color: var(--color-accent-primary);
    margin-right: var(--space-2);
}

.weakness-title {
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
}

.weakness-description {
    margin-top: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}

.risk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-3);
}

.risk-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.risk-label {
    color: var(--color-text-secondary);
}

.risk-value {
    font-weight: var(--font-medium);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
}

.risk-value.risk-low {
    background: var(--color-success-bg, rgba(34, 197, 94, 0.1));
    color: var(--color-success);
}

.risk-value.risk-moderate {
    background: var(--color-warning-bg, rgba(234, 179, 8, 0.1));
    color: var(--color-warning);
}

.risk-value.risk-high {
    background: var(--color-error-bg, rgba(239, 68, 68, 0.1));
    color: var(--color-error);
}

.reinforcements-list {
    list-style: disc;
    padding-left: var(--space-5);
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.reinforcements-list li {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}

.defense-prompt {
    background: var(--color-accent-glow);
    border: 1px dashed var(--color-accent-primary);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.defense-instruction {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

/* Score Transition (Reevaluation) */
.score-transition {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.prev-score {
    color: var(--color-text-tertiary);
    text-decoration: line-through;
}

.score-arrow {
    color: var(--color-text-muted);
}

.new-score {
    font-weight: var(--font-bold);
}

.score-change {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.score-change.score-improved {
    color: var(--color-success);
}

.score-change.score-declined {
    color: var(--color-error);
}

/* Attack Items List */
.attacks-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.attack-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

.attack-item.has-rebuttal {
    border-left: 3px solid var(--color-success);
}

.attack-item-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}

.attack-type-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    background: var(--color-warning);
    color: white;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-sm);
    text-transform: capitalize;
}

.attack-type-badge.severity-major {
    background: var(--color-error);
}

.attack-type-badge.severity-minor {
    background: var(--color-success);
}

.attack-type-badge.severity-moderate {
    background: var(--color-warning);
}

.attack-focus-tag {
    display: inline-flex;
    padding: var(--space-1) var(--space-2);
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

.attack-severity {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.attack-description {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-3);
}

.attack-actions {
    display: flex;
    gap: var(--space-2);
}

/* Rebuttal Editor */
.rebuttal-editor {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.rebuttal-prompt {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    font-style: italic;
    margin-bottom: var(--space-3);
}

.rebuttal-textarea {
    width: 100%;
    padding: var(--space-3);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    resize: vertical;
    min-height: 80px;
}

.rebuttal-textarea:focus {
    outline: none;
    border-color: var(--color-accent-primary);
}

.rebuttal-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

/* Rebuttal Feedback */
.rebuttal-feedback {
    margin-top: var(--space-4);
    padding: var(--space-4);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.rebuttal-feedback-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.feedback-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: white;
}

.feedback-score.score-good {
    background: var(--color-success);
}

.feedback-score.score-moderate {
    background: var(--color-warning);
}

.feedback-score.score-low {
    background: var(--color-error);
}

.feedback-verdict {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-primary);
    text-transform: capitalize;
}

.feedback-text {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
    margin: 0;
}

.feedback-strengths,
.feedback-weaknesses,
.feedback-followup {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    line-height: var(--leading-relaxed);
}

.feedback-strengths strong,
.feedback-weaknesses strong,
.feedback-followup strong {
    color: var(--color-text-secondary);
}

/* Vulnerabilities */
.vulnerabilities {
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-top: var(--space-4);
}

.vuln-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

.vuln-list {
    margin: 0;
    padding-left: var(--space-5);
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
}

.vuln-list li {
    margin-bottom: var(--space-1);
}

/* Defense Section */
.defense-section {
    margin-top: var(--space-6);
}

.defense-actions {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

/* Evaluation Card */
.evaluation-card {
    background: var(--color-surface);
    border: 1px solid var(--color-success);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-top: var(--space-6);
}

.eval-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.eval-score {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--color-accent-primary);
}

.eval-verdict {
    font-size: var(--text-lg);
    font-weight: var(--font-medium);
    color: var(--color-text-primary);
}

.eval-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.eval-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

.eval-strengths ul,
.eval-weaknesses ul {
    margin: 0;
    padding-left: var(--space-5);
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
}

.eval-feedback {
    padding: var(--space-4);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-4);
}

.eval-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.eval-badges .badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    background: var(--color-accent-glow);
    color: var(--color-accent-primary);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
}

.eval-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* Debate Summary */
.debate-summary {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    text-align: center;
}

.summary-header {
    margin-bottom: var(--space-6);
}

.summary-grade {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.grade-icon {
    color: var(--color-accent-primary);
}

.grade-letter {
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    color: var(--color-accent-primary);
}

.summary-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-semibold);
}

.summary-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-8);
    margin-bottom: var(--space-6);
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--color-accent-primary);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
}

.summary-content {
    text-align: left;
    padding: var(--space-5);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}

.summary-actions {
    display: flex;
    justify-content: center;
}

/* ============================================
   INLINE LOADING & ERROR STATES
   For Audience & Voice Lab panels
   ============================================ */

/* Inline loading indicator */
.inline-loading {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

/* Loading spinner (small) */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn .loading-spinner {
    width: 14px;
    height: 14px;
    border-width: 2px;
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: white;
}

/* Inline error message */
.inline-error {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4);
    background: rgba(196, 92, 92, 0.1);
    border: 1px solid rgba(196, 92, 92, 0.3);
    border-radius: var(--radius-md);
    color: var(--color-error);
    font-size: var(--text-sm);
}

.inline-error::before {
    content: '!';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: var(--color-error);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: var(--font-bold);
    flex-shrink: 0;
}

/* ============================================
   TOOLTIPS
   ============================================ */

/* Tooltip container - any element with data-tooltip attribute */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::before,
[data-tooltip]::after {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
    z-index: var(--z-tooltip);
}

/* Tooltip text */
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: var(--color-text-primary);
    font-size: var(--text-xs);
    font-weight: var(--font-normal);
    line-height: var(--leading-snug);
    white-space: normal;
    max-width: 250px;
    text-align: left;
}

/* Tooltip arrow */
[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--color-border);
}

/* Show tooltip on hover */
[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    visibility: visible;
    opacity: 1;
}

/* Dark mode tooltip */
[data-theme="dark"] [data-tooltip]::after {
    background: var(--color-bg-tertiary);
    border-color: var(--color-border);
}

[data-theme="dark"] [data-tooltip]::before {
    border-top-color: var(--color-border);
}

/* Tooltip position variants */
[data-tooltip-position="bottom"]::after {
    bottom: auto;
    top: calc(100% + 8px);
}

[data-tooltip-position="bottom"]::before {
    bottom: auto;
    top: calc(100% + 3px);
    border-top-color: transparent;
    border-bottom-color: var(--color-border);
}

[data-tooltip-position="left"]::after {
    bottom: auto;
    left: auto;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
}

[data-tooltip-position="left"]::before {
    bottom: auto;
    left: auto;
    right: calc(100% + 3px);
    top: 50%;
    transform: translateY(-50%);
    border-top-color: transparent;
    border-left-color: var(--color-border);
}

[data-tooltip-position="right"]::after {
    bottom: auto;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
}

[data-tooltip-position="right"]::before {
    bottom: auto;
    left: calc(100% + 3px);
    top: 50%;
    transform: translateY(-50%);
    border-top-color: transparent;
    border-right-color: var(--color-border);
}

/* Disable tooltips on touch devices */
@media (hover: none) {
    [data-tooltip]::before,
    [data-tooltip]::after {
        display: none;
    }
}

/* ============================================
   RESPONSIVE - DEBATE ENGINE
   ============================================ */
@media (max-width: 768px) {
    .debate-engine-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .debate-mode-toggle {
        width: 100%;
    }

    .debate-mode-btn {
        flex: 1;
        justify-content: center;
    }

    .result-comparison {
        grid-template-columns: 1fr;
    }

    .comparison-arrow {
        display: none;
    }

    .critic-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .eval-details {
        grid-template-columns: 1fr;
    }

    .summary-stats {
        flex-direction: column;
        gap: var(--space-4);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sidebar,
    .topbar,
    .btn,
    .theme-toggle {
        display: none !important;
    }

    .main-content {
        margin: 0;
        padding: 0;
    }

    body {
        background: white;
        color: black;
    }
}
