:root {
    /* Typography Scale - Modular Scale 1.333 (Perfect Fourth) */
    --text-xs: 0.6rem;      /* 10px */
    --text-sm: 0.8rem;      /* 13px */
    --text-base: 0.95rem;   /* 15px */
    --text-lg: 1.1rem;      /* 18px */
    --text-xl: 1.333rem;    /* 21px */
    --text-2xl: 1.777rem;   /* 28px */
    --text-3xl: 2.369rem;   /* 38px */
    --text-hero: 3.158rem;  /* 50px */
    
    /* Line Heights */
    --lh-tight: 1.1;
    --lh-normal: 1.5;
    --lh-loose: 1.65;
    
    /* Spacing - 8pt Grid System */
    --space-0: 0;
    --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 */
    --space-20: 5rem;       /* 80px */
    --space-24: 6rem;       /* 96px */
    
    /* Color Palette - HSL-based */
    /* Primary: Modern Purple/Indigo */
    --color-primary: #6366F1;
    --color-primary-light: #E0E7FF;
    --color-primary-lighter: #F0F4FF;
    --color-primary-dark: #5558E3;
    
    /* Brand Colors */
    --color-brand-scale: #2563EB;    /* Blue for 'Scale' */
    --color-brand-startup: #F59E0B;  /* Gold for 'Startup' */
    
    /* Semantic Colors */
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-error: #EF4444;
    --color-info: #3B82F6;
    
    /* Neutrals - Warm undertones (HSL ~30° hue) */
    --color-neutral-50: #FAFAF9;
    --color-neutral-100: #F5F5F4;
    --color-neutral-200: #E7E5E4;
    --color-neutral-300: #D6D3D1;
    --color-neutral-400: #A8A29E;
    --color-neutral-500: #78716C;
    --color-neutral-600: #57534E;
    --color-neutral-700: #44403C;
    --color-neutral-800: #292524;
    --color-neutral-900: #1C1917;
    
    /* Dark Mode */
    --color-dark-bg: #0A0A0F;
    --color-dark-surface: #1E1B4B;
    
    /* Backgrounds */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8FAFC;
    --bg-tertiary: #E2E8F0;
    
    /* Text */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-tertiary: #94A3B8;
    --text-inverse: #FFFFFF;
    
    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.15);
    
    /* Motion */
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 200ms;
    --duration-slow: 300ms;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-base: all 0.2s var(--ease-out);
    --transition-motion: all 0.3s var(--ease-bounce);
}

/* ============================= */
/* Reset & Base Styles */
/* ============================= */

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

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    line-height: var(--lh-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================= */
/* Typography */
/* ============================= */

h1, h2, h3, h4, h5, h6 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    line-height: var(--lh-tight);
    color: var(--text-primary);
}

h1 { font-size: var(--text-hero); }
h2 { font-size: var(--text-3xl); }
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 {
    line-height: var(--lh-normal);
    margin-bottom: var(--space-4);
}

small, .text-sm {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

/* Typography Classes */
.display { font-size: var(--text-hero); font-weight: 700; font-family: 'Space Grotesk', sans-serif; line-height: var(--lh-tight); }
.h1 { font-size: var(--text-3xl); font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.h2 { font-size: var(--text-2xl); font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.h3 { font-size: var(--text-xl); font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.body { font-size: var(--text-base); line-height: var(--lh-normal); }
.caption { font-size: var(--text-sm); color: var(--text-tertiary); }
.micro { font-size: var(--text-xs); color: var(--text-tertiary); }

/* ============================= */
/* Layout */
/* ============================= */

.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 240px;
    height: 100vh;
    background: var(--color-dark-surface);
    color: white;
    padding: var(--space-8);
    overflow-y: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
    font-size: var(--text-lg);
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
}

.sidebar-brand-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 2px;
    display: block;
}

.sidebar-brand-text {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.brand-word-scale {
    color: var(--color-brand-scale);
    font-weight: 700;
}

.brand-word-startup {
    color: var(--color-brand-startup);
    font-weight: 700;
}

.sidebar-brand i {
    font-size: 1.5rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav-item {
    margin-bottom: var(--space-2);
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition-base);
    font-weight: 500;
    font-size: 0.95rem;
}

.sidebar-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-nav-link.active {
    background: var(--color-primary);
    color: white;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: var(--space-4);
    color: rgba(255, 255, 255, 0.5);
    font-size: var(--text-xs);
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: 240px;
    flex: 1;
    background: var(--bg-secondary);
}

.top-bar {
    background: var(--bg-primary);
    padding: var(--space-8);
    border-bottom: 1px solid var(--color-neutral-200);
    box-shadow: var(--shadow-sm);
}

.page-header {
    max-width: 1200px;
    margin: 0 auto;
}

.page-title {
    font-size: var(--text-3xl);
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    margin-bottom: var(--space-2);
}

.page-subtitle {
    font-size: 0.95rem;
    color: var(--text-tertiary);
    margin: 0;
}

.content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-8);
}

/* ============================= */
/* Components */
/* ============================= */

/* Cards */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    box-shadow: var(--shadow-md);
    transition: var(--transition-motion);
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
    cursor: pointer;
    transition: var(--transition-motion);
    text-decoration: none;
    font-size: var(--text-base);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #8B5CF6 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

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

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

.btn-secondary:hover {
    background: var(--color-neutral-300);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--color-neutral-300);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-lighter);
    color: var(--color-primary);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: var(--text-lg);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
}

/* Alerts */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    border-left: 4px solid;
}

.alert-danger {
    background: #FEE2E2;
    border-left-color: var(--color-error);
    color: #991B1B;
}

.alert-success {
    background: #DCFCE7;
    border-left-color: var(--color-success);
    color: #166534;
}

.alert-warning {
    background: #FEF3C7;
    border-left-color: var(--color-warning);
    color: #92400E;
}

/* ============================= */
/* Motion & Animation */
/* ============================= */

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(-16px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pop-in {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

[data-animate="fade-up"] {
    animation: fade-up 0.6s var(--ease-out) both;
}

[data-animate="slide-in"] {
    animation: slide-in 0.6s var(--ease-out) both;
}

[data-animate="pop-in"] {
    animation: pop-in 0.4s var(--ease-bounce) both;
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================= */
/* Form Elements */
/* ============================= */

input, textarea, select {
    font-family: 'Inter', sans-serif;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--color-neutral-300);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    transition: var(--transition-base);
    background: white;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

label {
    display: block;
    font-weight: 600;
    font-size: var(--text-sm);
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}

/* Focus Ring (Accessibility) */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

button:focus-visible {
    outline-offset: 4px;
}

/* ============================= */
/* Responsive */
/* ============================= */

@media (max-width: 768px) {
    .sidebar {
        width: 200px;
        padding: var(--space-4);
    }
    
    .main-content {
        margin-left: 200px;
    }
    
    .content-container {
        padding: var(--space-4);
    }
    
    .page-title {
        font-size: var(--text-2xl);
    }
    
    .top-bar {
        padding: var(--space-4);
    }
}

@media (max-width: 640px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1001;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .page-title {
        font-size: var(--text-xl);
    }
    
    h2 { font-size: var(--text-2xl); }
    h3 { font-size: var(--text-xl); }
}

/* ============================= */
/* Utility Classes */
/* ============================= */

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

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

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

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

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

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.hidden { display: none; }
