/**
 * Modern Design System
 * Production-ready, mobile-first, accessible design
 */

/* ============================================
   CSS VARIABLES - Design Tokens
   ============================================ */
:root {
    /* Brand Colors */
    --color-primary: #3b82f6;
    --color-primary-dark: #2563eb;
    --color-primary-light: #60a5fa;
    --color-secondary: #8b5cf6;
    --color-accent: #10b981;

    /* Semantic Colors */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;

    /* Neutral Colors */
    --color-text-primary: #0f172a;
    --color-text-secondary: #64748b;
    --color-text-tertiary: #94a3b8;
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f8fafc;
    --color-bg-tertiary: #f1f5f9;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;

    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;

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

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

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

    /* Transitions */
    --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);

    /* 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;
}

/* Dark Mode Variables */
@media (prefers-color-scheme: dark) {
    :root {
        --color-text-primary: #f1f5f9;
        --color-text-secondary: #cbd5e1;
        --color-text-tertiary: #94a3b8;
        --color-bg-primary: #0f172a;
        --color-bg-secondary: #1e293b;
        --color-bg-tertiary: #334155;
        --color-border: #334155;
        --color-border-light: #475569;
    }
}

/* ============================================
   RESET & 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;
    scroll-behavior: smooth;
}

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

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-bold);
    line-height: 1.2;
    margin-bottom: var(--space-md);
    color: var(--color-text-primary);
}

h1 { font-size: var(--text-4xl); }
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 {
    margin-bottom: var(--space-md);
    color: var(--color-text-secondary);
}

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

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

/* ============================================
   LAYOUT
   ============================================ */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

.container-fluid {
    width: 100%;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

.section {
    padding-top: var(--space-3xl);
    padding-bottom: var(--space-3xl);
}

/* ============================================
   MODERN HEADER/NAVIGATION
   ============================================ */
.modern-header {
    background: var(--color-bg-primary);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.modern-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
    gap: var(--space-lg);
}

.modern-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    text-decoration: none;
}

.modern-logo i {
    color: var(--color-primary);
    font-size: 1.5rem;
}

.modern-nav-menu {
    display: flex;
    list-style: none;
    gap: var(--space-sm);
    align-items: center;
}

.modern-nav-link {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
}

.modern-nav-link:hover {
    background: var(--color-bg-secondary);
    color: var(--color-primary);
}

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

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-primary);
    cursor: pointer;
    padding: var(--space-sm);
}

/* ============================================
   MODERN CARDS
   ============================================ */
.modern-card {
    background: var(--color-bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all var(--transition-base);
}

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

.modern-card-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
}

.modern-card-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

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

.modern-card-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
}

/* ============================================
   MODERN BUTTONS
   ============================================ */
.modern-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    line-height: 1.5;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.modern-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modern-btn-primary {
    background: var(--color-primary);
    color: white;
}

.modern-btn-primary:hover:not(:disabled) {
    background: var(--color-primary-dark);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

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

.modern-btn-secondary:hover:not(:disabled) {
    background: var(--color-bg-tertiary);
}

.modern-btn-success {
    background: var(--color-success);
    color: white;
}

.modern-btn-success:hover:not(:disabled) {
    background: #059669;
}

.modern-btn-danger {
    background: var(--color-error);
    color: white;
}

.modern-btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.modern-btn-outline {
    background: transparent;
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.modern-btn-outline:hover:not(:disabled) {
    background: var(--color-primary);
    color: white;
}

.modern-btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: var(--text-sm);
}

.modern-btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: var(--text-lg);
}

/* ============================================
   MODERN FORMS
   ============================================ */
.modern-form-group {
    margin-bottom: var(--space-lg);
}

.modern-form-label {
    display: block;
    font-weight: var(--font-medium);
    margin-bottom: var(--space-sm);
    color: var(--color-text-primary);
}

.modern-form-label-required::after {
    content: ' *';
    color: var(--color-error);
}

.modern-form-input,
.modern-form-select,
.modern-form-textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    line-height: 1.5;
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.modern-form-input:focus,
.modern-form-select:focus,
.modern-form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modern-form-input::placeholder {
    color: var(--color-text-tertiary);
}

.modern-form-help {
    margin-top: var(--space-xs);
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
}

.modern-form-error {
    margin-top: var(--space-xs);
    font-size: var(--text-sm);
    color: var(--color-error);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

/* ============================================
   MODERN ALERTS
   ============================================ */
.modern-alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}

.modern-alert i {
    font-size: var(--text-xl);
}

.modern-alert-success {
    background: #d1fae5;
    border-left: 4px solid var(--color-success);
    color: #065f46;
}

.modern-alert-error {
    background: #fee2e2;
    border-left: 4px solid var(--color-error);
    color: #991b1b;
}

.modern-alert-warning {
    background: #fef3c7;
    border-left: 4px solid var(--color-warning);
    color: #92400e;
}

.modern-alert-info {
    background: #dbeafe;
    border-left: 4px solid var(--color-info);
    color: #1e40af;
}

/* ============================================
   MODERN BADGES
   ============================================ */
.modern-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modern-badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

.modern-badge-success {
    background: #d1fae5;
    color: #065f46;
}

.modern-badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.modern-badge-error {
    background: #fee2e2;
    color: #991b1b;
}

/* ============================================
   RESPONSIVE GRID
   ============================================ */
.modern-grid {
    display: grid;
    gap: var(--space-lg);
}

.modern-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.modern-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.modern-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ============================================
   MOBILE RESPONSIVENESS
   ============================================ */
@media (max-width: 1024px) {
    .modern-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --text-xs: 0.7rem;
        --text-sm: 0.8125rem;
        --text-base: 0.9375rem;
        --text-lg: 1.0625rem;
        --text-xl: 1.1875rem;
        --text-2xl: 1.375rem;
        --text-3xl: 1.625rem;
        --text-4xl: 2rem;
    }

    .container {
        padding-left: var(--space-sm);
        padding-right: var(--space-sm);
    }

    .modern-nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--color-bg-primary);
        flex-direction: column;
        padding: var(--space-md);
        box-shadow: var(--shadow-lg);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
    }

    .modern-nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .modern-grid-2,
    .modern-grid-3,
    .modern-grid-4 {
        grid-template-columns: 1fr;
    }

    .section {
        padding-top: var(--space-xl);
        padding-bottom: var(--space-xl);
    }
}

@media (max-width: 480px) {
    .modern-btn {
        width: 100%;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

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

/* Accessibility */
.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;
}
