/*******************************************
 * MacOS UI Kit Styles
 * Theme variables, components, and animations
 *******************************************/

/* ============================================
   THEME VARIABLES
   ============================================ */

/* Dark Theme (Default) */
:root {
    /* Overlay */
    --overlay-bg: rgba(0, 0, 0, 0.6);
    
    /* Backgrounds */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: rgba(18, 18, 26, 0.6);
    --bg-hover: rgba(255, 255, 255, 0.05);
    
    /* Glassmorphism */
    --glass-bg: rgba(18, 18, 26, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(255, 255, 255, 0.15);
    --glass-blur: blur(20px) saturate(180%);
    
    /* Text */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0a0a0f;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(168, 85, 247, 0.15);
    
    /* Model Accents */
    --brain: #a855f7;
    --brain-glow: rgba(168, 85, 247, 0.25);
    --heartbeat: #ec4899;
    --heartbeat-glow: rgba(236, 72, 153, 0.25);
    --coding: #10b981;
    --coding-glow: rgba(16, 185, 129, 0.25);
    --websearch: #3b82f6;
    --websearch-glow: rgba(59, 130, 246, 0.25);
    
    /* Status */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Border */
    --border: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.05);
    
    /* Legacy compatibility */
    --bg: var(--bg-primary);
    --surface: var(--bg-secondary);
    --surface-hover: var(--bg-tertiary);
    --text: var(--text-primary);
    --accent: var(--brain);
    --accent-hover: #b46bf7;
    
    /* Layout */
    --radius: 12px;
    --radius-lg: 20px;
    --sidebar-width: 280px;
    
    /* Animation */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

/* Light Theme */
[data-theme="light"] {
    --overlay-bg: rgba(0, 0, 0, 0.3);
    
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-hover: rgba(0, 0, 0, 0.03);
    
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-border-hover: rgba(0, 0, 0, 0.15);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(168, 85, 247, 0.2);
    
    --border: rgba(0, 0, 0, 0.08);
    --border-subtle: rgba(0, 0, 0, 0.05);
    
    /* Light mode accent adjustments */
    --accent-hover: #9333ea;
    
    --bg: var(--bg-primary);
    --surface: var(--bg-secondary);
    --surface-hover: var(--bg-tertiary);
    --text: var(--text-primary);
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */
.theme-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: all var(--transition-base);
}

.theme-toggle:hover {
    transform: scale(1.1);
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-glow), var(--shadow-lg);
}

[data-theme="light"] .theme-toggle {
    background: var(--glass-bg);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-subtle);
}

[data-theme="light"] .theme-toggle:hover {
    box-shadow: var(--shadow-glow), var(--shadow-lg), 0 0 0 1px var(--glass-border-hover);
}

.theme-toggle:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .theme-toggle {
        bottom: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

/* ============================================
   SPOTLIGHT SEARCH (Cmd+K)
   ============================================ */
.spotlight-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg, rgba(0, 0, 0, 0.6));
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 120px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.spotlight-overlay.show {
    opacity: 1;
    visibility: visible;
}

.spotlight-container {
    width: 100%;
    max-width: 600px;
    margin: 0 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
    overflow: hidden;
}

.spotlight-input-wrapper {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.spotlight-icon {
    font-size: 20px;
    margin-right: 12px;
    opacity: 0.5;
}

.spotlight-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
}

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

.spotlight-input:focus {
    outline: none;
}

.spotlight-results {
    max-height: 400px;
    overflow-y: auto;
}

.spotlight-result {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.spotlight-result:hover,
.spotlight-result.highlighted {
    background: var(--bg-hover);
}

.spotlight-result-icon {
    font-size: 20px;
    margin-right: 12px;
}

.spotlight-result-name {
    flex: 1;
    color: var(--text-primary);
    font-size: 14px;
}

.spotlight-result-type {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
}

[data-theme="light"] .spotlight-result-type {
    background: var(--bg-primary);
    color: var(--text-muted);
}

.spotlight-no-results {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .spotlight-overlay {
        padding-top: 80px;
    }
    
    .spotlight-container {
        margin: 0 16px;
        max-height: calc(100vh - 100px);
    }
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-width: 400px;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-message {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.4;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }

[data-theme="light"] .toast {
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
}

[data-theme="light"] .toast-success { border-left-color: #16a34a; }
[data-theme="light"] .toast-error { border-left-color: #dc2626; }
[data-theme="light"] .toast-warning { border-left-color: #d97706; }
[data-theme="light"] .toast-info { border-left-color: #2563eb; }

@media (max-width: 768px) {
    #toast-container {
        top: auto;
        bottom: 80px;
        right: 16px;
        left: 16px;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
        transform: translateY(100%);
    }
    
    .toast.show {
        transform: translateY(0);
    }
}

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

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

.loading .spinner {
    margin-right: 8px;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.reduce-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

body:not(.keyboard-navigation) *:focus {
    outline: none;
}

body.keyboard-navigation *:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Spotlight search focus styles */
body.keyboard-navigation .spotlight-input:focus-visible {
    outline: none;
}

body.keyboard-navigation .spotlight-result.highlighted {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

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

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

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: var(--text-muted);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============================================
   SELECTION STYLING
   ============================================ */
::selection {
    background: var(--accent);
    color: var(--text-inverse);
}

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

.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
}

.hover-lift {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

.text-gradient {
    background: linear-gradient(135deg, var(--accent), var(--heartbeat));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
