/* ===== GLOBAL PROFESSIONAL STYLES FOR ALL PAGES ===== */
/* Universal design system for consistency across JARVIS */

:root {
    /* 2026 Color Palette */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --success-color: #00ff88;
    --warning-color: #ffd93d;
    --error-color: #ff6b6b;
    --info-color: #00d4ff;
    
    /* Background Colors */
    --bg-primary: #0f1419;
    --bg-secondary: #16181d;
    --bg-tertiary: #1e2126;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-hover: rgba(102, 126, 234, 0.1);
    
    /* Text Colors */
    --text-primary: #e7e9ea;
    --text-secondary: #8b949e;
    --text-tertiary: #6e7681;
    
    /* Border & Divider */
    --border-color: rgba(255, 255, 255, 0.1);
    --divider-color: rgba(255, 255, 255, 0.05);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.3);
    
    /* Spacing Scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-index Scale */
    --z-base: 1;
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* Light Mode Variables */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --bg-card: rgba(0, 0, 0, 0.02);
    --bg-hover: rgba(102, 126, 234, 0.08);
    
    --text-primary: #1a1a1a;
    --text-secondary: #4a5568;
    --text-tertiary: #718096;
    
    --border-color: rgba(0, 0, 0, 0.1);
    --divider-color: rgba(0, 0, 0, 0.05);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
}

/* ===== GLOBAL RESETS & BASE STYLES ===== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Smooth scrolling for all browsers */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Selection Colors */
::selection {
    background: rgba(102, 126, 234, 0.3);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(102, 126, 234, 0.3);
    color: var(--text-primary);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.5) var(--bg-secondary);
}

/* ===== PROFESSIONAL NAVIGATION ===== */

nav, .navbar, .header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(22, 24, 29, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-md) var(--space-xl);
    z-index: var(--z-fixed);
    transition: all var(--transition-base);
}

nav.scrolled, .navbar.scrolled, .header.scrolled {
    background: rgba(22, 24, 29, 0.98);
    box-shadow: var(--shadow-md);
}

.nav-brand, .navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition-base);
}

.nav-brand:hover, .navbar-brand:hover {
    transform: scale(1.05);
}

.nav-brand i, .navbar-brand i {
    font-size: 2rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== PROFESSIONAL BUTTONS ===== */

.btn, button[class*="btn-"], .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn-primary, .primary-btn {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover, .primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary, .secondary-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover, .secondary-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn:active {
    transform: scale(0.98);
}

/* ===== PROFESSIONAL CARDS ===== */

.card, .project-card, .course-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform var(--transition-base);
}

.card:hover::before {
    transform: scaleX(1);
}

.card:hover {
    transform: translateY(-8px);
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* ===== PROFESSIONAL INPUTS ===== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    transition: all var(--transition-base);
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: var(--bg-tertiary);
}

/* ===== PROFESSIONAL GRID LAYOUTS ===== */

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
}

/* ===== MOBILE RESPONSIVE BREAKPOINTS ===== */

/* Tablet */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile */
@media (max-width: 768px) {
    nav, .navbar, .header {
        padding: var(--space-md);
    }
    
    .grid-4,
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .btn, button[class*="btn-"] {
        width: 100%;
        justify-content: center;
    }
    
    .card {
        padding: var(--space-md);
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    :root {
        --space-xl: 24px;
        --space-2xl: 32px;
    }
    
    .nav-brand, .navbar-brand {
        font-size: 1.25rem;
    }
}

/* ===== UTILITY CLASSES ===== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }

.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-0 { padding: 0; }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.hidden { display: none !important; }
.visible { display: block !important; }

/* ===== PROFESSIONAL LOADING STATES ===== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 20, 25, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== PROFESSIONAL ANIMATIONS ===== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(102, 126, 234, 0.6);
    }
}

.fade-in { animation: fadeIn var(--transition-base) ease-out; }
.fade-in-up { animation: fadeInUp var(--transition-base) ease-out; }
.slide-in-right { animation: slideInRight var(--transition-base) ease-out; }
.slide-in-left { animation: slideInLeft var(--transition-base) ease-out; }
.pulse-animation { animation: pulse 2s ease-in-out infinite; }
.glow-animation { animation: glow 2s ease-in-out infinite; }

/* ===== ACCESSIBILITY ===== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: high) {
    :root {
        --border-color: rgba(255, 255, 255, 0.3);
    }
    
    .card,
    .btn {
        border-width: 2px;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== SOURCES LIST (Perplexity Style) ===== */
.sources-container {
    margin-top: 12px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(168, 85, 247, 0.05));
    border-left: 3px solid rgba(99, 102, 241, 0.4);
    border-radius: 8px;
    font-size: 13px;
    color: #9aa0a6;
}
.sources-header {
    font-weight: 700;
    margin-bottom: 8px;
    color: #d0d0d0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sources-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.source-item {
    margin-bottom: 8px;
    padding: 4px 0;
}
.source-item a {
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}
.source-item a:hover {
    color: #a855f7;
    text-decoration: underline;
}
.source-snippet {
    margin-top: 4px;
    color: #7d838a;
    font-size: 12px;
    line-height: 1.4;
}

/* ===== PRINT STYLES ===== */

@media print {
    nav, .navbar, .header,
    .sidebar,
    .loading-overlay,
    button {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .card {
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}
