/**
 * BASE STYLES
 * ===================================================================
 * CSS Variables, Reset, Typography, Base Elements
 * ===================================================================
 */

/* ===================================================================
   CSS VARIABLES (Design Tokens)
   =================================================================== */
:root {
    /* Primary Colors */
    --primary: #667eea;
    --primary-dark: #5568d3;
    --primary-light: #7c8df0;
    --secondary: #764ba2;

    /* Status Colors */
    --success: #28a745;
    --success-light: #d4edda;
    --success-dark: #155724;

    --error: #dc3545;
    --error-light: #f8d7da;
    --error-dark: #721c24;

    --warning: #ffc107;
    --warning-light: #fff3cd;
    --warning-dark: #856404;

    --info: #17a2b8;
    --info-light: #d1ecf1;
    --info-dark: #0c5460;

    /* Neutral Colors */
    --white: #ffffff;
    --black: #000000;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;

    /* Text Colors */
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #999999;
    --text-light: #ffffff;

    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-dark: #212529;

    /* Border Colors */
    --border-color: #dee2e6;
    --border-light: #e9ecef;
    --border-dark: #ced4da;

    /* Spacing Scale */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;

    /* Font Families */
    --font-primary: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-monospace: 'Courier New', monospace;

    /* Font Sizes */
    --font-xs: 12px;
    --font-sm: 14px;
    --font-base: 16px;
    --font-lg: 18px;
    --font-xl: 20px;
    --font-2xl: 24px;
    --font-3xl: 32px;
    --font-4xl: 40px;

    /* Font Weights */
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* Line Heights */
    --line-tight: 1.2;
    --line-normal: 1.5;
    --line-relaxed: 1.75;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-toast: 9999;
}

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

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

body {
    font-family: var(--font-primary);
    font-size: var(--font-base);
    font-weight: var(--font-normal);
    line-height: var(--line-normal);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    min-height: 100vh;
}

/* ===================================================================
   TYPOGRAPHY
   =================================================================== */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: var(--font-semibold);
    line-height: var(--line-tight);
    color: var(--text-primary);
}

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

p {
    margin: 0 0 var(--spacing-md) 0;
}

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

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

strong, b {
    font-weight: var(--font-bold);
}

em, i {
    font-style: italic;
}

small {
    font-size: var(--font-sm);
}

code {
    font-family: var(--font-monospace);
    font-size: 0.9em;
    padding: 2px 6px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    color: var(--error);
}

pre {
    font-family: var(--font-monospace);
    font-size: var(--font-sm);
    padding: var(--spacing-md);
    background: var(--gray-900);
    color: var(--white);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

/* ===================================================================
   LISTS
   =================================================================== */
ul, ol {
    margin: 0 0 var(--spacing-md) 0;
    padding-left: var(--spacing-lg);
}

ul {
    list-style-type: disc;
}

ol {
    list-style-type: decimal;
}

li {
    margin-bottom: var(--spacing-xs);
}

/* ===================================================================
   TABLES
   =================================================================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-md);
}

/* ===================================================================
   IMAGES & MEDIA
   =================================================================== */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

svg {
    fill: currentColor;
}

/* ===================================================================
   FORMS (Basic Reset)
   =================================================================== */
input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

button {
    cursor: pointer;
}

/* ===================================================================
   SCROLLBAR STYLING (Webkit)
   =================================================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* ===================================================================
   SELECTION
   =================================================================== */
::selection {
    background: var(--primary);
    color: var(--white);
}

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

/* ===================================================================
   FOCUS VISIBLE (Accessibility)
   =================================================================== */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===================================================================
   PRINT STYLES
   =================================================================== */
@media print {
    body {
        background: white;
        color: black;
    }

    a {
        text-decoration: underline;
    }

    .no-print {
        display: none !important;
    }
}
