/**
 * Premium World-Class Design System
 * Inspired by Apple, Linear, Stripe, and modern design leaders
 */

/* ============================================
   CSS RESET & BASE
   ============================================ */

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

/* ============================================
   DESIGN TOKENS - Premium Color Palette
   ============================================ */

:root {
    /* Primary - Sophisticated Blue */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;
    
    /* Accent - Elegant Purple */
    --accent-50: #faf5ff;
    --accent-100: #f3e8ff;
    --accent-200: #e9d5ff;
    --accent-300: #d8b4fe;
    --accent-400: #c084fc;
    --accent-500: #a855f7;
    --accent-600: #9333ea;
    --accent-700: #7e22ce;
    --accent-800: #6b21a8;
    --accent-900: #581c87;
    
    /* Neutrals - Sophisticated Grays */
    --neutral-0: #ffffff;
    --neutral-50: #fafafa;
    --neutral-100: #f5f5f5;
    --neutral-200: #e5e5e5;
    --neutral-300: #d4d4d4;
    --neutral-400: #a3a3a3;
    --neutral-500: #737373;
    --neutral-600: #525252;
    --neutral-700: #404040;
    --neutral-800: #262626;
    --neutral-900: #171717;
    --neutral-950: #0a0a0a;
    
    /* Semantic Colors */
    --success-50: #f0fdf4;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --success-700: #15803d;
    
    --error-50: #fef2f2;
    --error-500: #ef4444;
    --error-600: #dc2626;
    --error-700: #b91c1c;
    
    --warning-50: #fffbeb;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    
    --info-50: #eff6ff;
    --info-500: #3b82f6;
    --info-600: #2563eb;
    
    /* Elevation Shadows - Premium Depth */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
    
    /* Border Radius - Smooth & Modern */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Spacing Scale - Consistent Rhythm */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    
    /* Typography Scale - Premium Hierarchy */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Display', 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    
    --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: 1.875rem;    /* 30px */
    --text-4xl: 2.25rem;     /* 36px */
    --text-5xl: 3rem;        /* 48px */
    
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 2;
    
    /* Animation Timing - Natural Motion */
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 350ms;
    --duration-slower: 500ms;
    
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ============================================
   BASE STYLES - Foundation
   ============================================ */

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

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--neutral-900);
    background: var(--neutral-50);
    overflow-x: hidden;
}

/* ============================================
   PREMIUM GRADIENT BACKGROUNDS
   ============================================ */

.bg-premium-gradient {
    background: linear-gradient(135deg, 
        var(--primary-600) 0%, 
        var(--primary-500) 25%,
        var(--accent-600) 75%,
        var(--accent-500) 100%);
    position: relative;
}

.bg-premium-gradient::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.bg-subtle-pattern {
    background-color: var(--neutral-0);
    background-image: 
        radial-gradient(at 40% 20%, rgba(59, 130, 246, 0.03) 0px, transparent 50%),
        radial-gradient(at 80% 0%, rgba(168, 85, 247, 0.03) 0px, transparent 50%),
        radial-gradient(at 0% 50%, rgba(59, 130, 246, 0.03) 0px, transparent 50%);
}

/* ============================================
   GLASSMORPHISM EFFECTS
   ============================================ */

.glass {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.glass-dark {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   PREMIUM CARD COMPONENTS
   ============================================ */

.card {
    background: var(--neutral-0);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--neutral-200);
    transition: all var(--duration-base) var(--ease-out);
}

.card:hover {
    box-shadow: var(--shadow-xl);
    border-color: var(--neutral-300);
    transform: translateY(-2px);
}

.card-premium {
    background: var(--neutral-0);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--neutral-200);
    position: relative;
    overflow: hidden;
}

.card-premium::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--primary-200) 50%, 
        transparent 100%);
}

/* ============================================
   PREMIUM BUTTONS - Multiple Variants
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    color: var(--neutral-0);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(37, 99, 235, 0.1);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-600));
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--accent-600), var(--accent-500));
    color: var(--neutral-0);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(147, 51, 234, 0.1);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--accent-700), var(--accent-600));
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(147, 51, 234, 0.2);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--neutral-700);
    border: 1px solid var(--neutral-300);
}

.btn-ghost:hover {
    background: var(--neutral-100);
    border-color: var(--neutral-400);
}

.btn-text {
    background: transparent;
    color: var(--primary-600);
    padding: var(--space-2) var(--space-4);
}

.btn-text:hover {
    background: var(--primary-50);
    color: var(--primary-700);
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
    border-radius: var(--radius-xl);
}

/* ============================================
   PREMIUM FORM INPUTS
   ============================================ */

.input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--neutral-900);
    background: var(--neutral-0);
    border: 1px solid var(--neutral-300);
    border-radius: var(--radius-lg);
    transition: all var(--duration-base) var(--ease-out);
    outline: none;
}

.input:hover {
    border-color: var(--neutral-400);
}

.input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), var(--shadow-sm);
}

.input::placeholder {
    color: var(--neutral-400);
}

.input-error {
    border-color: var(--error-500);
}

.input-error:focus {
    border-color: var(--error-600);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ============================================
   ALERT COMPONENTS - Premium Feedback
   ============================================ */

.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    border-left-width: 4px;
    border-left-style: solid;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    animation: slideDown var(--duration-slow) var(--ease-out);
}

.alert-success {
    background: var(--success-50);
    border-left-color: var(--success-600);
    color: var(--success-900);
}

.alert-error {
    background: var(--error-50);
    border-left-color: var(--error-600);
    color: var(--error-900);
}

.alert-warning {
    background: var(--warning-50);
    border-left-color: var(--warning-600);
    color: var(--warning-900);
}

.alert-info {
    background: var(--info-50);
    border-left-color: var(--info-600);
    color: var(--info-900);
}

/* ============================================
   BADGE COMPONENTS
   ============================================ */

.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;
    line-height: 1;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

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

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

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

.badge-info {
    background: var(--info-100);
    color: var(--info-700);
}

/* ============================================
   TABLE - Premium Data Display
   ============================================ */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--neutral-200);
    background: var(--neutral-0);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead {
    background: linear-gradient(180deg, var(--neutral-50), var(--neutral-100));
}

thead th {
    padding: var(--space-4) var(--space-6);
    text-align: left;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--neutral-700);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--neutral-200);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--neutral-100);
    transition: all var(--duration-fast) var(--ease-out);
}

tbody tr:hover {
    background: var(--neutral-50);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody td {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-sm);
    color: var(--neutral-700);
}

/* ============================================
   PREMIUM ANIMATIONS
   ============================================ */

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

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

.animate-slide-down {
    animation: slideDown var(--duration-base) var(--ease-out);
}

.animate-scale-in {
    animation: scaleIn var(--duration-base) var(--ease-out);
}

/* ============================================
   UTILITY CLASSES - Spacing & Layout
   ============================================ */

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

.section {
    padding: var(--space-16) 0;
}

/* Spacing */
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }

.m-4 { margin: var(--space-4); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Typography */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }
.text-5xl { font-size: var(--text-5xl); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Colors */
.text-neutral-600 { color: var(--neutral-600); }
.text-neutral-700 { color: var(--neutral-700); }
.text-neutral-800 { color: var(--neutral-800); }
.text-neutral-900 { color: var(--neutral-900); }

/* Layout */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-8 { width: 2rem; }
.w-12 { width: 3rem; }

.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-8 { height: 2rem; }
.h-12 { height: 3rem; }

.mx-auto { margin-left: auto; margin-right: auto; }

.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.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); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.shadow-2xl { box-shadow: var(--shadow-2xl); }

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

@media (min-width: 640px) {
    .sm\:p-8 { padding: var(--space-8); }
    .sm\:px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }
    .sm\:text-lg { font-size: var(--text-lg); }
    .sm\:text-xl { font-size: var(--text-xl); }
    .sm\:text-3xl { font-size: var(--text-3xl); }
    .sm\:text-4xl { font-size: var(--text-4xl); }
    .sm\:flex-row { flex-direction: row; }
}

@media (min-width: 768px) {
    .md\:p-10 { padding: var(--space-10); }
    .md\:text-2xl { font-size: var(--text-2xl); }
}

@media (min-width: 1024px) {
    .lg\:p-12 { padding: var(--space-12); }
    .lg\:text-5xl { font-size: var(--text-5xl); }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

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

/* ============================================
   DARK MODE SUPPORT (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .dark-mode-auto {
        --neutral-0: var(--neutral-950);
        --neutral-900: var(--neutral-50);
    }
}
