/**
 * DataScience Masterclass - Design System
 * A unified design system for all modules
 * Version: 2.0.0
 */

/* ========================================
   1. CSS CUSTOM PROPERTIES (Design Tokens)
   ======================================== */

:root {
    /* === Colors - Dark Theme (Default) === */
    --color-bg-primary: #0d1117;
    --color-bg-secondary: #161b22;
    --color-bg-tertiary: #1a1f2e;
    --color-bg-elevated: #21262d;

    --color-text-primary: #e4e6eb;
    --color-text-secondary: #8b949e;
    --color-text-muted: #6e7681;
    --color-text-link: #58a6ff;

    /* Accent Colors */
    --color-accent-dl: #ff6b35;
    /* Deep Learning - Orange */
    --color-accent-ml: #00d4ff;
    /* Machine Learning - Cyan */
    --color-accent-math: #a371f7;
    /* Mathematics - Purple */
    --color-accent-stats: #2ecc71;
    /* Statistics - Green */
    --color-accent-viz: #ffce56;
    /* Visualization - Yellow */
    --color-accent-prompt: #f771b6;
    /* Prompt Eng - Pink */
    --color-accent-devops: #0078D4;
    /* Azure DevOps - Azure Blue */
    --color-accent-python: #3776AB;
    /* Python - Python Blue */

    /* Semantic Colors */
    --color-success: #2ecc71;
    --color-warning: #f39c12;
    --color-error: #e74c3c;
    --color-info: #3498db;

    /* Borders */
    --color-border-default: #30363d;
    --color-border-muted: #21262d;
    --color-border-hover: #8b949e;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.2);

    /* === Typography === */
    --font-family-base: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-family-mono: 'Fira Code', 'Monaco', 'Consolas', monospace;

    --font-size-xs: 0.75rem;
    /* 12px */
    --font-size-sm: 0.875rem;
    /* 14px */
    --font-size-base: 1rem;
    /* 16px */
    --font-size-lg: 1.125rem;
    /* 18px */
    --font-size-xl: 1.25rem;
    /* 20px */
    --font-size-2xl: 1.5rem;
    /* 24px */
    --font-size-3xl: 1.875rem;
    /* 30px */
    --font-size-4xl: 2.25rem;
    /* 36px */
    --font-size-5xl: 3rem;
    /* 48px */

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    --line-height-tight: 1.25;
    --line-height-normal: 1.6;
    --line-height-relaxed: 1.8;

    /* === Spacing === */
    --space-1: 0.25rem;
    /* 4px */
    --space-2: 0.5rem;
    /* 8px */
    --space-3: 0.75rem;
    /* 12px */
    --space-4: 1rem;
    /* 16px */
    --space-5: 1.25rem;
    /* 20px */
    --space-6: 1.5rem;
    /* 24px */
    --space-8: 2rem;
    /* 32px */
    --space-10: 2.5rem;
    /* 40px */
    --space-12: 3rem;
    /* 48px */
    --space-16: 4rem;
    /* 64px */

    /* === Layout === */
    --container-max-width: 1400px;
    --sidebar-width: 280px;
    --border-radius-sm: 6px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    --border-radius-full: 9999px;

    /* === Transitions === */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms 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;
}

/* === Light Theme === */
[data-theme="light"] {
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f6f8fa;
    --color-bg-tertiary: #f0f2f5;
    --color-bg-elevated: #ffffff;

    --color-text-primary: #1f2328;
    --color-text-secondary: #57606a;
    --color-text-muted: #6e7781;
    --color-text-link: #0969da;

    --color-border-default: #d0d7de;
    --color-border-muted: #d8dee4;
    --color-border-hover: #57606a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* ========================================
   2. CSS RESET & BASE STYLES
   ======================================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   3. ACCESSIBILITY
   ======================================== */

/* Skip Link */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--color-accent-ml);
    color: var(--color-bg-primary);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--border-radius-md);
    z-index: var(--z-tooltip);
    text-decoration: none;
    transition: top var(--transition-fast);
}

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

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

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* Screen Reader Only */
.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;
}

/* ========================================
   4. LAYOUT UTILITIES
   ======================================== */

.container {
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: var(--space-2);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-6 {
    gap: var(--space-6);
}

.grid {
    display: grid;
}

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

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ========================================
   5. TYPOGRAPHY
   ======================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
}

h1 {
    font-size: var(--font-size-4xl);
}

h2 {
    font-size: var(--font-size-3xl);
}

h3 {
    font-size: var(--font-size-2xl);
}

h4 {
    font-size: var(--font-size-xl);
}

h5 {
    font-size: var(--font-size-lg);
}

h6 {
    font-size: var(--font-size-base);
}

p {
    margin-bottom: var(--space-4);
    line-height: var(--line-height-relaxed);
}

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

a:hover {
    text-decoration: underline;
}

code,
pre {
    font-family: var(--font-family-mono);
}

code {
    padding: var(--space-1) var(--space-2);
    background: var(--color-bg-tertiary);
    border-radius: var(--border-radius-sm);
    font-size: 0.875em;
}

pre {
    padding: var(--space-4);
    background: var(--color-bg-tertiary);
    border-radius: var(--border-radius-md);
    overflow-x: auto;
}

/* ========================================
   6. GRADIENT EFFECTS
   ======================================== */

.gradient-text {
    background: linear-gradient(45deg, var(--color-accent-ml), var(--color-accent-math), var(--color-accent-dl));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-border {
    position: relative;
    background: var(--color-bg-secondary);
    border-radius: var(--border-radius-lg);
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, var(--color-accent-ml), var(--color-accent-math), var(--color-accent-dl));
    border-radius: inherit;
    z-index: -1;
}

/* ========================================
   7. ANIMATION KEYFRAMES
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.animate-fade-in {
    animation: fadeIn var(--transition-slow) ease;
}

.animate-fade-in-up {
    animation: fadeInUp var(--transition-slow) ease;
}

.animate-slide-in {
    animation: slideInRight var(--transition-slow) ease;
}

.animate-pulse {
    animation: pulse 2s ease infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ========================================
   8. RESPONSIVE BREAKPOINTS
   ======================================== */

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
    }

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

    h1 {
        font-size: var(--font-size-3xl);
    }

    h2 {
        font-size: var(--font-size-2xl);
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
}

/* ========================================
   9. GLASSMORPHISM & MODERN EFFECTS
   ======================================== */

/* Glassmorphism */
.glass {
    background: rgba(22, 27, 34, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-strong {
    background: rgba(22, 27, 34, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .glass {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .glass-strong {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.15);
}

/* Glow Effects */
.glow {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.15);
}

.glow-dl {
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.2);
}

.glow-ml {
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.2);
}

.glow-math {
    box-shadow: 0 0 30px rgba(163, 113, 247, 0.2);
}

.glow-stats {
    box-shadow: 0 0 30px rgba(46, 204, 113, 0.2);
}

/* Hover Scale Effects */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

.hover-scale {
    transition: transform var(--transition-fast);
}

.hover-scale:hover {
    transform: scale(1.02);
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.25);
}

/* ========================================
   10. STAGGERED ANIMATIONS
   ======================================== */

@keyframes staggerFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes staggerSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.stagger {
    animation: staggerFadeIn 0.5s ease forwards;
    opacity: 0;
}

.stagger-1 {
    animation-delay: 0.05s;
}

.stagger-2 {
    animation-delay: 0.1s;
}

.stagger-3 {
    animation-delay: 0.15s;
}

.stagger-4 {
    animation-delay: 0.2s;
}

.stagger-5 {
    animation-delay: 0.25s;
}

.stagger-6 {
    animation-delay: 0.3s;
}

.stagger-7 {
    animation-delay: 0.35s;
}

.stagger-8 {
    animation-delay: 0.4s;
}

.slide-in {
    animation: staggerSlideIn 0.4s ease forwards;
    opacity: 0;
}

/* ========================================
   11. ENHANCED INTERACTIVE STATES
   ======================================== */

/* Card Gradient Border on Hover */
.card-gradient-border {
    position: relative;
    background: var(--color-bg-secondary);
    border: none;
}

.card-gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--color-accent-ml), var(--color-accent-math), var(--color-accent-dl));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.card-gradient-border:hover::before {
    opacity: 1;
}

/* Focus Ring */
.focus-ring:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.4);
}

/* Button Press Effect */
.btn-press:active {
    transform: scale(0.97);
}

/* ========================================
   12. UTILITY CLASSES
   ======================================== */

/* Text Utilities */
.text-gradient {
    background: linear-gradient(90deg, var(--color-accent-ml), var(--color-accent-math));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-balance {
    text-wrap: balance;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Display Utilities */
.hidden {
    display: none !important;
}

.block {
    display: block;
}

.inline-block {
    display: inline-block;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-1 {
    flex: 1;
}

/* Spacing Utilities */
.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.mt-0 {
    margin-top: 0;
}

.mb-0 {
    margin-bottom: 0;
}

.p-0 {
    padding: 0;
}

/* Border Utilities */
.rounded {
    border-radius: var(--border-radius-md);
}

.rounded-lg {
    border-radius: var(--border-radius-lg);
}

.rounded-full {
    border-radius: var(--border-radius-full);
}

/* Overflow */
.overflow-hidden {
    overflow: hidden;
}

.overflow-auto {
    overflow: auto;
}

/* Position */
.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.sticky {
    position: sticky;
}

/* Z-Index */
.z-10 {
    z-index: 10;
}

.z-20 {
    z-index: 20;
}

.z-50 {
    z-index: 50;
}