/* ==========================================
   TruthForge AI - Four Pillars Analysis
   CSS Variables & Theme System (Cursor-Clone Inspired)
   ========================================== */
:root {
    /* Light Theme (Default) - Matching Cursor Clone */
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f7f7f4;
    --color-bg-tertiary: #f0f0ed;
    --color-bg-card: #ffffff;
    --color-bg-hover: #f5f5f2;
    --color-bg-drawer: #fafaf9;

    --color-text-primary: #14120b;
    --color-text-secondary: #5a5a5a;
    --color-text-tertiary: #8a8a8a;
    --color-text-muted: #9ca3af;

    --color-accent: #0066ff;
    --color-accent-hover: #0052cc;
    --color-accent-light: rgba(0, 102, 255, 0.08);

    --color-border: #e5e5e2;
    --color-border-light: #d5d5d2;
    --color-border-dark: #c5c5c2;
    
    /* Pillar Colors */
    --color-detect: #3b82f6;
    --color-diagnose: #8b5cf6;
    --color-deframe: #10b981;
    --color-design: #f59e0b;
    
    /* Status Colors */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #06b6d4;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
    
    /* Spacing Scale */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4rem;
    --space-3xl: 6rem;
    
    /* Layout */
    --navbar-height: 64px;
    --sidebar-width: 280px;
    --bottom-bar-height: 80px;
    --drawer-width: 400px;
    
    /* Container */
    --container-max: 1400px;
    --container-padding: 1.5rem;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    --shadow-drawer: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* ==========================================
   Base Reset & Typography
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    height: 100%;
}

/* Explicitly apply dark theme to body when checkbox checked */
#theme-toggle:checked ~ .theme-switcher + *,
#theme-toggle:checked ~ .theme-switcher + * ~ * {
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
}

/* ==========================================
   Layout Structure
   ========================================== */
.main-container {
    display: flex;
    min-height: calc(100vh - var(--navbar-height) - var(--bottom-bar-height));
    max-width: 100vw;
}

/* ==========================================
   Buttons (Cursor-Clone Style)
   ========================================== */
.btn, button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 0.625rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
    font-family: var(--font-sans);
}

.btn-primary, .primary {
    background: var(--color-accent);
    color: white;
}

.btn-primary:hover, .primary:hover {
    background: var(--color-accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-ghost:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
    border-color: var(--color-border-light);
}

.btn-large {
    padding: 0.875rem 2rem;
    font-size: 1.05rem;
}

/* Toolbar buttons */
.toolbar-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
}

.toolbar-btn:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-border-dark);
}

/* Export buttons */
.export-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 0.75rem 1rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    margin-bottom: var(--space-xs);
}

.export-btn:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-border-dark);
    transform: translateY(-1px);
}

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

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

.export-btn .btn-icon {
    margin-right: var(--space-xs);
}

/* Tab buttons */
.tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text-secondary);
    border-radius: 0;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-hover);
    transform: none;
}

.tab-btn.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    background: transparent;
}

/* Close buttons */
.drawer-close,
.notification-close {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    padding: var(--space-xs);
    border-radius: 6px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.drawer-close:hover,
.notification-close:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
    border-color: var(--color-border-dark);
    transform: none;
}

/* ==========================================
   Form Elements (Cursor-Clone Style)
   ========================================== */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="search"],
textarea,
select,
.input-textarea,
.builder-textarea,
.search-input {
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: all var(--transition-fast);
    line-height: 1.5;
}

textarea,
.input-textarea,
.builder-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: var(--font-sans);
}

.builder-textarea {
    min-height: 200px;
}

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

input::placeholder,
textarea::placeholder {
    color: var(--color-text-tertiary);
}

/* Select dropdowns */
select,
.role-dropdown {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a5a5a' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Builder and narrative components */
.builder-content {
    margin-top: var(--space-md);
}

.builder-toolbar {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

.frame-tags {
    display: flex;
    gap: var(--space-xs);
    margin-top: var(--space-md);
    flex-wrap: wrap;
}

.frame-tag {
    padding: 0.375rem 0.75rem;
    background: var(--color-accent-light);
    border: 1px solid var(--color-accent);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--color-accent);
    font-weight: 500;
}

/* ==========================================
   Top Navigation Bar
   ========================================== */
.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    z-index: 1000;
    height: var(--navbar-height);
    padding: 0 var(--container-padding);
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.brand-icon {
    font-size: 1.5rem;
}

/* Mobile menu button for pillar navigation */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 8px;
    margin-right: var(--space-sm);
    border-radius: 6px;
    transition: background var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--color-bg-hover);
}

.mobile-menu-btn span {
    width: 20px;
    height: 2px;
    background: var(--color-text-primary);
    transition: all var(--transition-base);
    border-radius: 1px;
}

/* Mobile menu button animation */
.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.navbar-controls {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.role-selector {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.role-selector label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.role-dropdown {
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-size: 0.875rem;
    cursor: pointer;
}

.taxonomy-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.taxonomy-btn:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-border-dark);
}

.taxonomy-btn.active {
    background: var(--color-accent-light);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.taxonomy-btn .btn-icon {
    font-size: 0.9rem;
}

/* ==========================================
   Left Sidebar - Pillar Navigation
   ========================================== */
.pillar-nav {
    position: fixed;
    left: 0;
    top: var(--navbar-height);
    bottom: var(--bottom-bar-height);
    width: var(--sidebar-width);
    background: var(--color-bg-secondary);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    z-index: 900;
}

.nav-header {
    padding: var(--space-lg) var(--space-md) var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

.nav-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-items {
    padding: var(--space-md) 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    margin: 0 var(--space-md);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-item:hover {
    background: var(--color-bg-hover);
}

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

.nav-item.active .nav-title {
    color: var(--color-accent);
}

.nav-icon {
    font-size: 1.1rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-tertiary);
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.nav-item:hover .nav-icon {
    background: var(--color-accent-light);
    color: var(--color-accent);
}

.nav-content {
    flex: 1;
}

.nav-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.2;
}

.nav-subtitle {
    font-size: 0.8rem;
    color: var(--color-text-tertiary);
    line-height: 1.2;
}

.nav-progress {
    position: relative;
}

/* Progress Ring Animation */
.progress-ring {
    position: relative;
    transform: rotate(-90deg);
}

.progress-svg {
    position: relative;
    z-index: 1;
}

.progress-bg {
    opacity: 0.2;
}

.progress-fill {
    transition: stroke-dashoffset var(--transition-slow);
}

/* ==========================================
   Main Content Area
   ========================================== */
.content-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-top: var(--navbar-height);
    margin-bottom: var(--bottom-bar-height);
    padding: var(--space-lg);
    overflow-y: auto;
    position: relative;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 50vh;
    color: var(--color-text-muted);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top: 3px solid var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--space-md);
}

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

/* ==========================================
   Pillar Content Layouts
   ========================================== */

/* Common Panel Styles */
.panel {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
}

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

.panel-icon {
    font-size: 1.25rem;
}

/* Three Column Layout for Pillars */
.pillar-layout {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: var(--space-lg);
    margin-top: var(--space-lg);
}

/* Left Panel */
.left-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Center Panel */
.center-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Right Panel */
.right-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* ==========================================
   Pillar 1: DETECT - Specific Styles
   ========================================== */

/* Narrative Input */
.narrative-input-section {
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Dark mode narrative input */
html.dark-theme .narrative-input-section {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.3) 0%, rgba(55, 48, 163, 0.2) 100%);
    border: 1px solid rgba(59, 130, 246, 0.4);
}

/* Wide narrative section - spans full width */
.narrative-wide {
    width: 100%;
    margin-top: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.input-group {
    margin-bottom: var(--space-md);
}

.input-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-xs);
}

.domain-selector {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.domain-tag {
    padding: var(--space-xs) var(--space-sm);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.domain-tag:hover {
    background: var(--color-bg-hover);
}

.domain-tag.selected {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

/* Analysis Button */
.analysis-btn {
    width: 100%;
    max-width: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin: 0 auto;
}

.analysis-btn i {
    font-size: 1.1rem;
}

/* Video Input Group */
.video-input-group {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.video-url-input {
    flex: 1;
    height: 40px;
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.video-url-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.video-platform-select {
    flex-shrink: 0;
    width: 130px;
    height: 40px;
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.video-platform-select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Sentiment Controls */
.sentiment-controls {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

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

.sentiment-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-text-tertiary);
}

.sentiment-status .status-dot.active {
    background: var(--color-success);
    animation: pulse 2s infinite;
}

.sentiment-status .status-text {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

/* Bias Detector */
.bias-detector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.bias-bar {
    background: var(--color-bg-secondary);
    border-radius: 8px;
    padding: var(--space-md);
    position: relative;
    overflow: hidden;
}

.bias-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent), var(--color-accent-hover));
    transition: width var(--transition-slow);
}

.bias-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-xs);
}

.bias-value {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

/* ==========================================
   Right Drawer - Taxonomy Viewer
   ========================================== */
.taxonomy-drawer {
    position: fixed;
    right: 0;
    top: var(--navbar-height);
    bottom: var(--bottom-bar-height);
    width: var(--drawer-width);
    background: var(--color-bg-drawer);
    border-left: 1px solid var(--color-border);
    box-shadow: var(--shadow-drawer);
    z-index: 1100;
    transition: transform var(--transition-base);
    overflow-y: auto;
    transform: translateX(100%);
}

.taxonomy-drawer.open {
    transform: translateX(0);
}

/* Backdrop for mobile */
.taxonomy-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 840;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.taxonomy-backdrop.visible {
    opacity: 1;
    visibility: visible;
    z-index: 845;
}

.drawer-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    position: relative;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.drawer-header:hover {
    background: var(--color-bg-hover);
}

.drawer-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-xs);
}

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

.drawer-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-content {
    padding: var(--space-lg);
}

.taxonomy-search {
    margin-bottom: var(--space-lg);
}

.search-input {
    width: 100%;
    padding: var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-size: 0.875rem;
}

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

.taxonomy-tree {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.taxonomy-node {
    padding: var(--space-sm);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.taxonomy-node:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-border-dark);
}

.taxonomy-node.expanded {
    background: var(--color-accent-light);
    border-color: var(--color-accent);
}

.node-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-primary);
}

.node-toggle {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
}

.node-children {
    margin-left: var(--space-lg);
    margin-top: var(--space-xs);
    display: none;
}

.node-children.expanded {
    display: block;
}

/* ==========================================
   Bottom Bar
   ========================================== */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--color-border);
    z-index: 1000;
    height: var(--bottom-bar-height);
    padding: 0 var(--container-padding);
}

.bottom-bar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
}

.prompt-budget {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.prompt-budget label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.budget-slider {
    width: 200px;
    height: 6px;
    border-radius: 3px;
    background: var(--color-bg-tertiary);
    outline: none;
    -webkit-appearance: none;
}

.budget-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.budget-slider::-webkit-slider-thumb:hover {
    background: var(--color-accent-hover);
    transform: scale(1.1);
}

.budget-display {
    display: flex;
    align-items: baseline;
    gap: var(--space-xs);
}

.budget-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-accent);
}

.budget-unit {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.budget-impact {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.875rem;
}

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

.impact-value {
    font-weight: 600;
    color: var(--color-accent);
}

.status-indicators {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.status-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-text-tertiary);
}

.status-dot.active {
    background: var(--color-success);
    animation: pulse 2s infinite;
}

.status-text {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 1200px) {
    .pillar-layout {
        grid-template-columns: 1fr 1fr;
    }
    
    .right-panel {
        grid-column: span 2;
    }
}

@media (max-width: 968px) {
    :root {
        --sidebar-width: 240px;
    }
    
    .navbar-controls {
        gap: var(--space-sm);
    }
    
    .taxonomy-btn .btn-text {
        display: none;
    }
    
    .pillar-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --container-padding: 1rem;
        --sidebar-width: 0px;
        --drawer-width: 100vw;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .pillar-nav {
        position: fixed;
        top: var(--navbar-height);
        left: -100%;
        width: 280px;
        height: calc(100vh - var(--navbar-height) - var(--bottom-bar-height));
        z-index: 960;
        transition: transform var(--transition-base);
        box-shadow: var(--shadow-lg);
    }

    .pillar-nav.open {
        transform: translateX(100%);
    }

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

    .navbar-container {
        flex-wrap: wrap;
        gap: var(--space-sm);
        padding: var(--space-sm) 0;
    }

    .navbar-brand {
        flex: 1;
    }

    .navbar-controls {
        flex-shrink: 0;
    }

    .bottom-bar-container {
        flex-direction: column;
        gap: var(--space-sm);
        padding: var(--space-sm) 0;
    }

    .prompt-budget {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Mobile taxonomy drawer - full screen */
    .taxonomy-drawer {
        width: 100vw;
        right: -100vw;
    }

    .taxonomy-drawer.open {
        transform: translateX(0);
    }

    .taxonomy-backdrop.visible {
        opacity: 1;
        visibility: visible;
    }
}

/* ==========================================
   Theme Switcher & Dark Mode
   ========================================== */
.theme-toggle {
    display: none;
}

.theme-switcher {
    position: fixed;
    bottom: calc(var(--bottom-bar-height) + var(--space-md));
    right: var(--space-md);
    z-index: 1001;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 50px;
    padding: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: var(--shadow-md);
}

.theme-switcher-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    width: 60px;
    height: 30px;
    background: var(--color-bg-tertiary);
    border-radius: 25px;
    transition: background var(--transition-base);
}

.theme-switcher-slider {
    position: absolute;
    width: 24px;
    height: 24px;
    background: var(--color-bg-primary);
    border: 2px solid var(--color-border);
    border-radius: 50%;
    left: 3px;
    transition: transform var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-icon-light {
    display: block;
    width: 14px;
    height: 14px;
}

.theme-icon-dark {
    display: none;
    width: 14px;
    height: 14px;
}

#theme-toggle:checked ~ .theme-switcher .theme-switcher-slider {
    transform: translateX(30px);
}

#theme-toggle:checked ~ .theme-switcher .theme-icon-light {
    display: none;
}

#theme-toggle:checked ~ .theme-switcher .theme-icon-dark {
    display: block;
}

#theme-toggle:checked ~ .theme-switcher .theme-switcher-label {
    background: var(--color-bg-hover);
}

/* Dark Theme - Applied via html element class (more reliable than ~ *) */
html.dark-theme {
    --color-bg-primary: #0a0a0a;
    --color-bg-secondary: #141414;
    --color-bg-tertiary: #1a1a1a;
    --color-bg-card: #1f1f1f;
    --color-bg-hover: #2a2a2a;
    --color-bg-drawer: #1a1a1a;
    
    --color-text-primary: #f5f5f5;
    --color-text-secondary: #a0a0a0;
    --color-text-tertiary: #707070;
    --color-text-muted: #5a5a5a;
    
    --color-accent: #3b82f6;
    --color-accent-hover: #2563eb;
    --color-accent-light: rgba(59, 130, 246, 0.1);
    
    --color-border: #2a2a2a;
    --color-border-light: #3a3a3a;
    --color-border-dark: #4a4a4a;
}

/* Update navbar background for dark mode */
html.dark-theme .top-navbar,
html.dark-theme .bottom-bar {
    background: rgba(10, 10, 10, 0.95);
}

/* Respect system preference as default (cursor-clone pattern) */
@media (prefers-color-scheme: dark) {
    :root {
        --color-bg-primary: #0a0a0a;
        --color-bg-secondary: #141414;
        --color-bg-tertiary: #1a1a1a;
        --color-bg-card: #1f1f1f;
        --color-bg-hover: #2a2a2a;
        --color-bg-drawer: #1a1a1a;
        
        --color-text-primary: #f5f5f5;
        --color-text-secondary: #a0a0a0;
        --color-text-tertiary: #707070;
        --color-text-muted: #5a5a5a;
        
        --color-accent: #3b82f6;
        --color-accent-hover: #2563eb;
        --color-accent-light: rgba(59, 130, 246, 0.1);
        
        --color-border: #2a2a2a;
        --color-border-light: #3a3a3a;
        --color-border-dark: #4a4a4a;
    }
    
    .top-navbar,
    .bottom-bar {
        background: rgba(10, 10, 10, 0.95) !important;
    }
}

/* ==========================================
   Animations & Utilities
   ========================================== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

.fade-in-up {
    animation: fadeInUp 0.5s ease;
}

/* Focus states for accessibility */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================
   Pillar-Specific Color Themes
   ========================================== */
.pillar-detect .panel {
    border-left: 4px solid var(--color-detect);
}

.pillar-diagnose .panel {
    border-left: 4px solid var(--color-diagnose);
}

.pillar-deframe .panel {
    border-left: 4px solid var(--color-deframe);
}

.pillar-design .panel {
    border-left: 4px solid var(--color-design);
}

/* ==========================================
   Interactive States
   ========================================== */
.nav-item[data-pillar="detect"].active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05));
}

.nav-item[data-pillar="diagnose"].active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(139, 92, 246, 0.05));
}

.nav-item[data-pillar="deframe"].active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
}

.nav-item[data-pillar="design"].active {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
}

/* Hover effects for better UX */
.taxonomy-node:hover .node-header {
    color: var(--color-accent);
}

.bias-bar:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Loading state improvements */
.loading-state {
    background: linear-gradient(135deg, var(--color-bg-secondary), var(--color-bg-tertiary));
    border-radius: 12px;
    border: 1px dashed var(--color-border);
}

/* Budget slider enhanced styling */
.budget-slider:hover {
    cursor: pointer;
}

.budget-slider:active {
    cursor: grabbing;
}

/* Status indicators with better visual feedback */
.status-dot.active {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* ==========================================
   Print Styles
   ========================================== */
@media print {
    .top-navbar,
    .bottom-bar,
    .theme-switcher,
    .taxonomy-drawer {
        display: none !important;
    }
    
    .main-container {
        margin: 0 !important;
        min-height: auto !important;
    }
    
    .content-area {
        margin: 0 !important;
        padding: 1rem !important;
    }
    
    .panel {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}