/**
 * Tempory Design System - Professional SaaS UI
 * Inspired by: Stripe, Linear, Vercel, Notion, GitHub
 * Design: Minimalist, Black & White, Premium
 */

/* ============================================
   TYPOGRAPHY SYSTEM
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Typography Scale */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
    
    /* Font Sizes - Fluid Typography */
    --text-xs: 0.6875rem;      /* 11px - micro labels */
    --text-sm: 0.8125rem;      /* 13px - secondary text */
    --text-base: 0.875rem;     /* 14px - body text */
    --text-md: 0.9375rem;      /* 15px - emphasized body */
    --text-lg: 1rem;           /* 16px - large body */
    --text-xl: 1.125rem;       /* 18px - small headings */
    --text-2xl: 1.25rem;       /* 20px - H4 */
    --text-3xl: 1.5rem;        /* 24px - H3 */
    --text-4xl: 1.875rem;      /* 30px - H2 */
    --text-5xl: 2.25rem;       /* 36px - H1 */
    --text-6xl: 3rem;          /* 48px - Hero */
    --text-7xl: 3.75rem;       /* 60px - Landing hero */
    
    /* Font Weights */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    
    /* Line Heights */
    --line-tight: 1.25;
    --line-snug: 1.375;
    --line-normal: 1.5;
    --line-relaxed: 1.625;
    --line-loose: 2;
    
    /* Letter Spacing */
    --tracking-tighter: -0.05em;
    --tracking-tight: -0.025em;
    --tracking-normal: 0;
    --tracking-wide: 0.025em;
    --tracking-wider: 0.05em;
    
    /* ============================================
       COLOR SYSTEM - Black & White Theme
       ============================================ */
    
    /* Grayscale Palette */
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-400: #a3a3a3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;
    --gray-950: #0a0a0a;
    
    /* Semantic Colors - Light Theme */
    --background: #ffffff;
    --foreground: #0a0a0a;
    --surface: #fafafa;
    --surface-elevated: #ffffff;
    --border: #e5e5e5;
    --border-strong: #d4d4d4;
    --divider: #f5f5f5;
    
    /* Text Colors */
    --text-primary: #0a0a0a;
    --text-secondary: #525252;
    --text-tertiary: #737373;
    --text-quaternary: #a3a3a3;
    --text-disabled: #d4d4d4;
    --text-inverse: #ffffff;
    
    /* Accent Color (subtle, 1 color only) */
    --accent: #0a0a0a;
    --accent-hover: #262626;
    --accent-subtle: #f5f5f5;
    
    /* Status Colors (grayscale based) */
    --success: #0a0a0a;
    --success-bg: #fafafa;
    --error: #0a0a0a;
    --error-bg: #f5f5f5;
    --warning: #525252;
    --warning-bg: #fafafa;
    --info: #737373;
    --info-bg: #fafafa;
    
    /* Interactive States */
    --hover: #fafafa;
    --active: #f5f5f5;
    --focus-ring: #0a0a0a;
    --focus-ring-offset: #ffffff;
    
    /* ============================================
       SPACING SYSTEM - 4px Base Grid
       ============================================ */
    
    --space-0: 0;
    --space-0-5: 0.125rem;    /* 2px */
    --space-1: 0.25rem;       /* 4px */
    --space-1-5: 0.375rem;    /* 6px */
    --space-2: 0.5rem;        /* 8px */
    --space-2-5: 0.625rem;    /* 10px */
    --space-3: 0.75rem;       /* 12px */
    --space-3-5: 0.875rem;    /* 14px */
    --space-4: 1rem;          /* 16px */
    --space-5: 1.25rem;       /* 20px */
    --space-6: 1.5rem;        /* 24px */
    --space-7: 1.75rem;       /* 28px */
    --space-8: 2rem;          /* 32px */
    --space-9: 2.25rem;       /* 36px */
    --space-10: 2.5rem;       /* 40px */
    --space-11: 2.75rem;      /* 44px */
    --space-12: 3rem;         /* 48px */
    --space-14: 3.5rem;       /* 56px */
    --space-16: 4rem;         /* 64px */
    --space-20: 5rem;         /* 80px */
    --space-24: 6rem;         /* 96px */
    --space-32: 8rem;         /* 128px */
    
    /* ============================================
       BORDER SYSTEM
       ============================================ */
    
    --radius-none: 0;
    --radius-sm: 0.25rem;     /* 4px */
    --radius-md: 0.375rem;    /* 6px */
    --radius-lg: 0.5rem;      /* 8px */
    --radius-xl: 0.75rem;     /* 12px */
    --radius-2xl: 1rem;       /* 16px */
    --radius-3xl: 1.5rem;     /* 24px */
    --radius-full: 9999px;
    
    --border-width: 1px;
    --border-width-2: 2px;
    --border-width-3: 3px;
    
    /* ============================================
       SHADOW SYSTEM - Subtle, Premium
       ============================================ */
    
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
    
    /* Focus Shadow */
    --shadow-focus: 0 0 0 3px rgba(0, 0, 0, 0.1);
    
    /* ============================================
       TRANSITIONS & ANIMATIONS
       ============================================ */
    
    --transition-fastest: 100ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slowest: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Easing Functions */
    --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.175, 0.885, 0.32, 1.275);
    
    /* ============================================
       Z-INDEX SCALE
       ============================================ */
    
    --z-base: 0;
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    
    /* ============================================
       LAYOUT DIMENSIONS
       ============================================ */
    
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 64px;
    --topbar-height: 64px;
    --container-max-width: 1440px;
    --content-max-width: 1200px;
    --narrow-max-width: 720px;
}

/* ============================================
   DARK THEME
   ============================================ */

[data-theme="dark"] {
    /* Backgrounds */
    --background: #0a0a0a;
    --foreground: #fafafa;
    --surface: #171717;
    --surface-elevated: #262626;
    --border: #262626;
    --border-strong: #404040;
    --divider: #1a1a1a;
    
    /* Text Colors */
    --text-primary: #fafafa;
    --text-secondary: #a3a3a3;
    --text-tertiary: #737373;
    --text-quaternary: #525252;
    --text-disabled: #404040;
    --text-inverse: #0a0a0a;
    
    /* Accent */
    --accent: #fafafa;
    --accent-hover: #e5e5e5;
    --accent-subtle: #262626;
    
    /* Interactive States */
    --hover: #1a1a1a;
    --active: #262626;
    --focus-ring: #fafafa;
    --focus-ring-offset: #0a0a0a;
    
    /* Shadows - more prominent in dark mode */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.6), 0 1px 2px -1px rgba(0, 0, 0, 0.6);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.7), 0 2px 4px -2px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.8), 0 4px 6px -4px rgba(0, 0, 0, 0.8);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.9), 0 8px 10px -6px rgba(0, 0, 0, 0.9);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.95);
}

/* ============================================
   BASE STYLES
   ============================================ */

*,
*::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;
}

body {
    font-family: var(--font-family);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--line-normal);
    color: var(--text-primary);
    background: var(--background);
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* ============================================
   TYPOGRAPHY COMPONENTS
   ============================================ */

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

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

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

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

a:hover {
    color: var(--text-secondary);
}

strong { font-weight: var(--font-semibold); }
em { font-style: italic; }
code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 0.125rem 0.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* ============================================
   BUTTON SYSTEM
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0 var(--space-4);
    height: 36px;
    font-family: var(--font-family);
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    line-height: 1;
    color: var(--text-primary);
    background: var(--background);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

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

.btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button Variants */
.btn-primary {
    color: var(--text-inverse);
    background: var(--accent);
    border-color: var(--accent);
}

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

.btn-secondary {
    background: var(--surface);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--hover);
}

.btn-danger {
    color: var(--text-inverse);
    background: var(--error);
    border-color: var(--error);
}

/* Button Sizes */
.btn-sm {
    height: 28px;
    padding: 0 var(--space-3);
    font-size: var(--text-sm);
}

.btn-lg {
    height: 44px;
    padding: 0 var(--space-6);
    font-size: var(--text-md);
}

.btn-icon {
    width: 36px;
    padding: 0;
}

.btn-icon.btn-sm {
    width: 28px;
}

.btn-icon.btn-lg {
    width: 44px;
}

/* ============================================
   INPUT SYSTEM
   ============================================ */

.input,
.select,
.textarea {
    width: 100%;
    padding: 0 var(--space-3);
    height: 36px;
    font-family: var(--font-family);
    font-size: var(--text-base);
    color: var(--text-primary);
    background: var(--background);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.input:hover,
.select:hover,
.textarea:hover {
    border-color: var(--border-strong);
}

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

.input::placeholder {
    color: var(--text-quaternary);
}

.textarea {
    min-height: 80px;
    padding: var(--space-3);
    resize: vertical;
}

.input-sm {
    height: 28px;
    font-size: var(--text-sm);
    padding: 0 var(--space-2);
}

.input-lg {
    height: 44px;
    font-size: var(--text-md);
    padding: 0 var(--space-4);
}

/* Input with icon */
.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

.input-wrapper .input {
    padding-left: var(--space-10);
}

/* ============================================
   CARD SYSTEM
   ============================================ */

.card {
    background: var(--surface);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-xl);
    transition: all var(--transition-base);
}

.card-hover:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: var(--space-6);
    border-bottom: var(--border-width) solid var(--border);
}

.card-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.card-body {
    padding: var(--space-6);
}

.card-footer {
    padding: var(--space-6);
    border-top: var(--border-width) solid var(--border);
    background: var(--surface-elevated);
}

/* ============================================
   BADGE SYSTEM
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0 var(--space-2);
    height: 20px;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--text-secondary);
    background: var(--surface);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-md);
}

.badge-primary {
    color: var(--text-inverse);
    background: var(--accent);
    border-color: var(--accent);
}

.badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: var(--radius-full);
}

/* ============================================
   AVATAR SYSTEM
   ============================================ */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-inverse);
    background: var(--accent);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm { width: 24px; height: 24px; font-size: var(--text-xs); }
.avatar-lg { width: 40px; height: 40px; font-size: var(--text-base); }
.avatar-xl { width: 48px; height: 48px; font-size: var(--text-lg); }

/* ============================================
   UTILITY CLASSES
   ============================================ */

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

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

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

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

/* Display */
.hidden { display: none; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Flex utilities */
.flex-col { flex-direction: column; }
.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; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

.animate-slide-up {
    animation: slideUp var(--transition-base);
}

.animate-slide-down {
    animation: slideDown var(--transition-base);
}
