/*
 * Echo Design System
 * Modern, minimalist, unified UI
 */

/* ============================================
   CSS Variables - Design Tokens
   ============================================ */
:root {
    /* Colors - Dark theme (high contrast) */
    --bg-base: #13131a;
    --bg-surface: rgba(255, 255, 255, 0.12);
    --bg-surface-hover: rgba(255, 255, 255, 0.16);
    --bg-surface-active: rgba(255, 255, 255, 0.20);
    --bg-elevated: rgba(255, 255, 255, 0.14);
    
    --text-primary: #ffffff;
    --text-secondary: #f5f5f5;
    --text-muted: #e5e5e5;
    
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-subtle: rgba(59, 130, 246, 0.2);
    
    --border: rgba(255, 255, 255, 0.3);
    --border-focus: rgba(59, 130, 246, 0.7);
    
    /* Header specific */
    --header-bg: rgba(19, 19, 26, 0.95);
    
    --success: #22c55e;
    --warning: #eab308;
    --error: #ef4444;
    
    /* Spacing (8px grid) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    
    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
}

/* Light theme */
[data-theme="light"] {
    --bg-base: #f8f9fa;
    --bg-surface: rgba(0, 0, 0, 0.04);
    --bg-surface-hover: rgba(0, 0, 0, 0.08);
    --bg-surface-active: rgba(0, 0, 0, 0.12);
    --bg-elevated: rgba(0, 0, 0, 0.06);
    
    --text-primary: #1a1a1a;
    --text-secondary: #444444;
    --text-muted: #666666;
    
    --border: rgba(0, 0, 0, 0.12);
    --border-focus: rgba(59, 130, 246, 0.5);
    
    --accent-subtle: rgba(59, 130, 246, 0.12);
    
    /* Header light */
    --header-bg: rgba(255, 255, 255, 0.95);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-secondary);
    line-height: 1.5;
    min-height: 100vh;
}

/* ============================================
   Header / Navigation
   ============================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: var(--space-3) var(--space-5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
}

.logo {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.logo svg {
    width: 24px;
    height: 24px;
    color: var(--accent);
}

.nav {
    display: flex;
    gap: var(--space-1);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

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

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

.nav-item svg {
    width: 18px;
    height: 18px;
}

/* Theme toggle */
.theme-toggle {
    padding: var(--space-2);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    transition: all var(--transition-fast);
}

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

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: all var(--transition-base);
}

.card:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-focus);
}

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

.card-meta {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn svg {
    width: 16px;
    height: 16px;
}

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

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

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

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

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

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

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

/* ============================================
   Inputs
   ============================================ */
.input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast);
}

.input:focus {
    border-color: var(--accent);
}

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

/* Select dropdowns - fix for dark mode visibility */
select.input {
    background: var(--bg-elevated);
}

select.input option {
    background: var(--bg-base);
    color: var(--text-primary);
}

/* ============================================
   Tags / Badges
   ============================================ */
.tag {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-muted);
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    padding: 2px 6px;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-surface-active);
    border-radius: var(--radius-full);
}

/* ============================================
   Grid Layouts
   ============================================ */
.grid {
    display: grid;
    gap: var(--space-4);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ============================================
   Status Colors
   ============================================ */
.status-success { color: var(--success); }
.status-warning { color: var(--warning); }
.status-error { color: var(--error); }

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

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

::-webkit-scrollbar-thumb {
    background: var(--bg-surface-active);
    border-radius: var(--radius-full);
}

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

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    /* Larger base font for mobile readability */
    html {
        font-size: 18px;
    }
    
    .header {
        padding: var(--space-3);
    }
    
    .nav-item span {
        display: none;
    }
    
    .nav-item {
        padding: var(--space-2);
    }
    
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    
    /* Larger touch targets */
    .btn, .input, .tag {
        min-height: 44px;
        font-size: var(--text-base);
    }
    
    .card {
        padding: var(--space-5);
    }
    
    .card-title {
        font-size: var(--text-lg);
    }
}

/* ============================================
   Utilities
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
