/* Upgradient V2.1 - Unified Design System */
/* Vibe: Premium, sleek, cohesive dark mode */

/* ====================================
   FONTS
   ==================================== */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400&family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

/* ====================================
   DESIGN TOKENS - Single Source of Truth
   ==================================== */
:root {
    /* === Colors === */
    --bg-deep: #0a0a0c;
    --bg-primary: #0f0f12;
    --bg-secondary: #151518;
    --bg-tertiary: #1a1a1f;
    --bg-elevated: #222228;
    --bg-hover: #28282f;
    
    /* Gradients & Effects */
    --surface-gradient: linear-gradient(145deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%);
    --glow-subtle: radial-gradient(ellipse at center, rgba(139,92,246,0.06) 0%, transparent 70%);
    
    /* Text */
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-faint: #52525b;
    
    /* Accent - Violet */
    --accent: #8b5cf6;
    --accent-hover: #a78bfa;
    --accent-muted: rgba(139,92,246,0.12);
    --accent-glow: rgba(139,92,246,0.25);
    
    /* Gold */
    --gold: #fbbf24;
    --gold-muted: rgba(251,191,36,0.12);
    
    /* Status */
    --success: #22c55e;
    --success-muted: rgba(34,197,94,0.12);
    --warning: #f59e0b;
    --warning-muted: rgba(245,158,11,0.12);
    --error: #ef4444;
    --error-muted: rgba(239,68,68,0.12);
    
    /* Borders */
    --border: rgba(255,255,255,0.06);
    --border-subtle: rgba(255,255,255,0.03);
    --border-strong: rgba(255,255,255,0.1);
    --border-accent: rgba(139,92,246,0.3);
    
    /* === Typography === */
    --font-serif: 'Fraunces', Georgia, serif;
    --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', monospace;
    
    /* Type Scale - Consistent */
    --text-xs: 0.75rem;      /* 12px */
    --text-sm: 0.875rem;     /* 14px */
    --text-base: 1rem;       /* 16px */
    --text-lg: 1.125rem;     /* 18px */
    --text-xl: 1.25rem;      /* 20px */
    --text-2xl: 1.5rem;      /* 24px */
    --text-3xl: 2rem;        /* 32px */
    --text-4xl: 2.5rem;      /* 40px */
    --text-5xl: 3.5rem;      /* 56px */
    
    /* Line Heights */
    --leading-tight: 1.2;
    --leading-snug: 1.35;
    --leading-normal: 1.5;
    --leading-relaxed: 1.65;
    
    /* Letter Spacing */
    --tracking-tight: -0.02em;
    --tracking-normal: 0;
    --tracking-wide: 0.02em;
    --tracking-wider: 0.08em;
    
    /* === Spacing Scale (4px base) === */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;
    --space-24: 96px;
    
    /* === Border Radius (consistent: 8px base) === */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --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 12px 32px rgba(0,0,0,0.5);
    --shadow-xl: 0 24px 48px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 40px var(--accent-glow);
    --shadow-gold-glow: 0 0 30px rgba(251,191,36,0.15);
    
    /* === Transitions === */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 150ms;
    --duration-normal: 200ms;
    --duration-slow: 350ms;
    
    /* === Z-Index === */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 300;
    --z-toast: 400;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: var(--leading-normal);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Subtle ambient glow */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: var(--glow-subtle);
    pointer-events: none;
    z-index: -1;
}

::selection {
    background: var(--accent);
    color: white;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* ====================================
   TYPOGRAPHY - Unified Hierarchy
   ==================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    font-weight: 500;
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
}

h1 {
    font-size: var(--text-5xl);
    font-weight: 400;
}

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

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

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

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

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

p {
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

.font-serif { font-family: var(--font-serif); }
.font-sans { font-family: var(--font-sans); }
.font-mono { font-family: var(--font-mono); }

/* Text effects */
.text-gradient {
    background: linear-gradient(135deg, var(--accent) 0%, #c084fc 50%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gold { color: var(--gold); }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }

/* Label styling */
.label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    color: var(--text-muted);
}

/* ====================================
   BUTTONS - Unified System
   ==================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: var(--tracking-wide);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.btn:hover::before {
    opacity: 1;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: var(--shadow-md), 0 0 20px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

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

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

.btn-gold {
    background: linear-gradient(135deg, var(--gold) 0%, #fcd34d 100%);
    color: #1a1a1a;
    font-weight: 600;
}

.btn-gold:hover {
    box-shadow: var(--shadow-gold-glow);
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--error-muted);
    color: var(--error);
    border: 1px solid var(--error);
}

.btn-danger:hover {
    background: var(--error);
    color: white;
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-base);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ====================================
   FORMS - Unified Inputs
   ==================================== */
.input, .textarea, .select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--duration-fast) var(--ease-out);
}

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

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

.form-group {
    margin-bottom: var(--space-5);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group:last-child {
    margin-bottom: 0;
}

/* ====================================
   CARDS - Unified System
   ==================================== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--surface-gradient);
    pointer-events: none;
}

.card-hover {
    transition: all var(--duration-normal) var(--ease-out);
}

.card-hover:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}

.card-glow:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg), 0 0 40px var(--accent-muted);
}

/* ====================================
   LAYOUT
   ==================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-sm { max-width: 640px; }
.container-lg { max-width: 1400px; }

/* Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }

/* Grid */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Gap */
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.gap-10 { gap: var(--space-10); }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ====================================
   NAVIGATION - Unified
   ==================================== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-sticky);
    padding: var(--space-4) 0;
    background: rgba(10, 10, 12, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: var(--tracking-tight);
}

.nav-logo:hover {
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.nav-link {
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: color var(--duration-fast);
}

.nav-link:hover {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .nav-links { gap: var(--space-4); }
    .nav-link { display: none; }
}

/* ====================================
   HERO
   ==================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-24) 0;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    height: 60%;
    background: radial-gradient(ellipse at top, var(--accent-muted) 0%, transparent 60%);
    pointer-events: none;
}

.hero-content {
    max-width: 800px;
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-8);
}

.hero h1 {
    margin-bottom: var(--space-6);
    font-size: clamp(2.5rem, 6vw, 4rem);
}

.hero p {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    margin-bottom: var(--space-10);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: var(--leading-relaxed);
}

.hero-cta {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    flex-wrap: wrap;
}

/* ====================================
   SECTIONS
   ==================================== */
.section {
    padding: var(--space-24) 0;
    position: relative;
}

.section-header {
    text-align: center;
    max-width: 600px;
    margin: 0 auto var(--space-16);
}

.section-header h2 {
    margin-bottom: var(--space-4);
}

.section-header p {
    color: var(--text-secondary);
    font-size: var(--text-lg);
}

.section-dark {
    background: var(--bg-secondary);
}

.section-gradient {
    background: linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-secondary) 50%, var(--bg-deep) 100%);
}

/* ====================================
   FEATURE CARDS
   ==================================== */
.feature-card {
    padding: var(--space-6);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
}

.feature-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--surface-gradient);
    pointer-events: none;
}

.feature-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 30px var(--accent-muted);
    transform: translateY(-4px);
}

.feature-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
    font-size: var(--text-xl);
}

.feature-card h3 {
    margin-bottom: var(--space-2);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: var(--text-lg);
}

.feature-card p {
    color: var(--text-muted);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

/* ====================================
   PRICING CARDS
   ==================================== */
.pricing-card {
    padding: var(--space-8);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    text-align: center;
    position: relative;
}

.pricing-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--surface-gradient);
    pointer-events: none;
}

.pricing-card.featured {
    border-color: var(--accent);
    box-shadow: 0 0 60px var(--accent-muted), var(--shadow-lg);
}

.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-1) var(--space-4);
    background: var(--accent);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    color: white;
    letter-spacing: var(--tracking-wide);
}

.pricing-card h3 {
    font-family: var(--font-sans);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.pricing-price {
    font-family: var(--font-serif);
    font-size: var(--text-5xl);
    font-weight: 400;
    margin: var(--space-6) 0;
    color: var(--text-primary);
}

.pricing-price span {
    font-size: var(--text-lg);
    font-family: var(--font-sans);
    color: var(--text-muted);
}

.pricing-features {
    list-style: none;
    margin: var(--space-6) 0;
    text-align: left;
}

.pricing-features li {
    padding: var(--space-3) 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
}

.pricing-features li::before {
    content: "✓";
    color: var(--success);
    font-weight: 700;
    font-size: var(--text-xs);
}

/* ====================================
   FOOTER
   ==================================== */
.footer {
    padding: var(--space-12) 0;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
    color: var(--text-faint);
    font-size: var(--text-sm);
}

/* ====================================
   BADGES
   ==================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    letter-spacing: var(--tracking-wide);
}

.badge-success {
    background: var(--success-muted);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-muted);
    color: var(--warning);
}

.badge-error {
    background: var(--error-muted);
    color: var(--error);
}

.badge-accent {
    background: var(--accent-muted);
    color: var(--accent);
}

/* Status badges */
.quiz-status {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
}

.quiz-status.draft {
    background: var(--warning-muted);
    color: var(--warning);
}

.quiz-status.published {
    background: var(--success-muted);
    color: var(--success);
}

/* ====================================
   MODAL
   ==================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: var(--space-6);
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    max-width: 480px;
    width: 100%;
    position: relative;
    animation: modalIn var(--duration-normal) var(--ease-out);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.modal-header h3 {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: var(--text-lg);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-md);
    font-size: var(--text-xl);
    transition: all var(--duration-fast);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
    justify-content: flex-end;
}

/* ====================================
   UTILITIES
   ==================================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Margin */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* Padding */
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.w-full { width: 100%; }

/* Opacity */
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

/* ====================================
   ANIMATIONS
   ==================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in {
    animation: fadeIn var(--duration-normal) var(--ease-out);
}

.animate-slide-up {
    animation: slideUp var(--duration-slow) var(--ease-out);
}

.animate-pulse {
    animation: pulse 2s var(--ease-in-out) infinite;
}

/* ====================================
   RESPONSIVE
   ==================================== */
@media (max-width: 768px) {
    h1 { font-size: var(--text-3xl); }
    h2 { font-size: var(--text-2xl); }
    
    .section { padding: var(--space-16) 0; }
    .container { padding: 0 var(--space-4); }
}

/* ====================================
   ERROR MESSAGE
   ==================================== */
.error-message {
    background: var(--error-muted);
    border: 1px solid var(--error);
    color: var(--error);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

.success-message {
    background: var(--success-muted);
    border: 1px solid var(--success);
    color: var(--success);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}
