/* ========================================
   LUMAVINE DESIGN SYSTEM
   Version: 5.0 - Unified Production Build
   Single source of truth for all tokens
======================================== */

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

/* ========== DESIGN TOKENS ========== */
:root {
    /* Brand Core */
    --lv-primary: #00d4aa;
    --lv-primary-hover: #00b894;
    --lv-secondary: #8a4fff;
    --lv-accent: #5ce1e6;
    --lv-purple: #7C3AED;
    --lv-cyan: #00d4ff;
    --lv-pink: #f472b6;
    --lv-amber: #fbbf24;

    /* Neon Palette */
    --neon-cyan: #00ffff;
    --neon-teal: #14f4d8;
    --neon-purple: #bf5fff;
    --neon-magenta: #ff00ff;
    --neon-blue: #4d7cff;
    --neon-pink: #ff4d94;
    --neon-amber: #ffb800;
    --neon-green: #00ff88;
    --neon-red: #ff3366;

    /* Surfaces */
    --lv-bg-void: #000000;
    --lv-bg-dark: #070714;
    --lv-bg-deep: #020208;
    --lv-bg-surface: rgba(12, 12, 24, 0.75);
    --lv-bg-card: rgba(12, 12, 20, 0.85);
    --lv-bg-elevated: rgba(18, 18, 28, 0.9);
    --lv-bg-glass: rgba(255, 255, 255, 0.03);
    --lv-bg-hover: rgba(124, 58, 237, 0.08);

    /* Text */
    --lv-text-primary: #ffffff;
    --lv-text-secondary: rgba(255, 255, 255, 0.7);
    --lv-text-muted: rgba(255, 255, 255, 0.45);

    /* Borders */
    --lv-border: rgba(138, 79, 255, 0.15);
    --lv-border-hover: rgba(138, 79, 255, 0.3);
    --lv-border-active: rgba(138, 79, 255, 0.5);

    /* Status */
    --lv-success: #10b981;
    --lv-warning: #f59e0b;
    --lv-error: #ef4444;
    --lv-info: #3b82f6;

    /* Gradients */
    --lv-gradient: linear-gradient(135deg, #00d4aa 0%, #7c3aed 50%, #f472b6 100%);
    --lv-gradient-purple: linear-gradient(135deg, #8a4fff 0%, #5ce1e6 100%);
    --lv-gradient-warm: linear-gradient(135deg, #f472b6 0%, #fbbf24 100%);

    /* Glow */
    --lv-glow-cyan: rgba(0, 255, 255, 0.15);
    --lv-glow-purple: rgba(191, 95, 255, 0.15);
    --lv-glow-teal: rgba(20, 244, 216, 0.15);
    --lv-shadow-glow: 0 0 30px rgba(138, 79, 255, 0.3);

    /* Effects */
    --lv-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --lv-transition-fast: all 0.15s ease;
    --lv-transition-slow: all 0.5s ease;

    /* Radius */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.5);

    /* Layout */
    --nav-width: 280px;
    --nav-width-collapsed: 72px;
    --header-height: 64px;
    --content-max-width: 1400px;

    /* Z-Index Scale */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sidebar: 1000;
    --z-overlay: 1050;
    --z-modal: 1100;
    --z-toast: 1200;
}

/* ========== BASE ========== */
html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--lv-bg-dark);
    color: var(--lv-text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Orbitron', 'Rajdhani', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    color: var(--lv-text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h4 { font-size: 1.25rem; }

p {
    color: var(--lv-text-secondary);
    margin-bottom: 1rem;
}

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

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

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--lv-transition);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--lv-gradient);
    color: var(--lv-bg-dark);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 212, 170, 0.3);
    color: var(--lv-bg-dark);
}

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

.btn-ghost {
    background: transparent;
    color: var(--lv-text-secondary);
    padding: 8px 16px;
}
.btn-ghost:hover {
    color: var(--lv-text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-lg { padding: 16px 32px; font-size: 16px; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius); }

/* ========== CARDS ========== */
.card {
    background: var(--lv-bg-card);
    border: 1px solid var(--lv-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--lv-transition);
}
.card:hover {
    border-color: var(--lv-border-hover);
    box-shadow: var(--shadow-md);
}

.card-header {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--lv-border);
}

/* ========== FORMS ========== */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--lv-text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--lv-bg-surface);
    border: 1px solid var(--lv-border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    color: var(--lv-text-primary);
    transition: var(--lv-transition);
}
.form-input::placeholder { color: var(--lv-text-muted); }
.form-input:focus {
    outline: none;
    border-color: var(--lv-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.1);
}

textarea.form-input { min-height: 120px; resize: vertical; }

/* ========== BADGES ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--lv-gradient-purple);
    color: white;
}
.badge-success { background: linear-gradient(135deg, #10b981, #34d399); }
.badge-warning { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #1f2937; }
.badge-danger { background: linear-gradient(135deg, #ef4444, #f87171); }

/* ========== UTILITY ========== */
.text-gradient {
    background: var(--lv-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.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;
}

/* ========== SPACE BACKGROUND ========== */
.space-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(1px 1px at 20px 30px, white, transparent),
        radial-gradient(1px 1px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 50px 160px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 90px 40px, white, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 160px 120px, var(--neon-cyan), transparent);
    background-size: 250px 250px;
    animation: twinkle 8s ease-in-out infinite alternate;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.nebula {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background:
        radial-gradient(ellipse 600px 400px at 30% 30%, var(--lv-glow-cyan), transparent),
        radial-gradient(ellipse 500px 600px at 70% 60%, var(--lv-glow-purple), transparent),
        radial-gradient(ellipse 400px 300px at 50% 80%, var(--lv-glow-teal), transparent);
    animation: nebulaFlow 40s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes nebulaFlow {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(3%, -2%) rotate(2deg); }
    66% { transform: translate(-2%, 3%) rotate(-1deg); }
}

/* ========== LOADING ========== */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--lv-border);
    border-top-color: var(--lv-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--lv-bg-elevated);
    border: 1px solid var(--lv-border);
    border-radius: var(--radius);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    transform: translateX(120%);
    animation: toastIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.toast.exiting {
    animation: toastOut 0.3s ease forwards;
}

.toast-icon { flex-shrink: 0; width: 20px; height: 20px; }
.toast-message { flex: 1; font-size: 14px; color: var(--lv-text-secondary); }
.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--lv-text-muted);
    cursor: pointer;
    padding: 4px;
}

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

@keyframes toastIn {
    to { transform: translateX(0); }
}
@keyframes toastOut {
    to { transform: translateX(120%); opacity: 0; }
}

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--lv-transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--lv-bg-elevated);
    border: 1px solid var(--lv-border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: var(--lv-transition);
}
.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 0;
}
.modal-body { padding: 24px; }
.modal-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ========== LAYOUT ========== */
.has-sidebar {
    margin-left: var(--nav-width);
    min-height: 100vh;
    padding: 40px;
    position: relative;
    z-index: var(--z-base);
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    margin-bottom: 8px;
}

.page-header p {
    color: var(--lv-text-muted);
    font-size: 16px;
}

.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card {
    background: var(--lv-bg-card);
    border: 1px solid var(--lv-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    transition: var(--lv-transition);
}
.stat-card:hover {
    border-color: var(--lv-border-hover);
    transform: translateY(-2px);
    box-shadow: var(--lv-shadow-glow);
}
.stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    background: var(--lv-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-label {
    font-size: 13px;
    color: var(--lv-text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.section-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: var(--lv-text-primary);
}

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

@media (max-width: 768px) {
    .has-sidebar {
        margin-left: 0;
        padding: 20px;
        padding-top: 80px;
    }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--lv-bg-dark); }
::-webkit-scrollbar-thumb { background: var(--lv-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--lv-border-hover); }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
    .hide-desktop { display: none !important; }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== PRINT ========== */
@media print {
    .space-bg, .nav-sidebar, .nav-mobile-toggle, .toast-container { display: none !important; }
    body { background: white; color: black; }
    .has-sidebar { margin-left: 0 !important; }
}
