/* ==========================================================================
   MED X TECH - DESIGN SYSTEM & GLOBAL STYLES
   ========================================================================== */

/* 1. Design Tokens (Variables) */
:root {
    /* Color Palette */
    --primary-hsl: 220, 95%, 50%;
    --primary: hsl(var(--primary-hsl));
    --primary-light: hsla(220, 95%, 50%, 0.06);
    --primary-dark: hsl(220, 100%, 38%);
    --primary-glow: rgba(26, 86, 219, 0.15);
    
    --secondary-hsl: 195, 95%, 45%;
    --secondary: hsl(var(--secondary-hsl));
    --secondary-light: hsla(195, 95%, 45%, 0.08);
    --secondary-dark: hsl(195, 100%, 35%);
    
    --accent-hsl: 270, 90%, 60%;
    --accent: hsl(var(--accent-hsl));
    
    /* Neutrals */
    --text-main: #0f172a;
    --text-muted: #475569;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border-light: #e2e8f0;
    --border-hover: hsl(220, 95%, 50%);
    
    /* Feedback Alerts */
    --success: hsl(142, 72%, 29%);
    --success-light: hsla(142, 72%, 29%, 0.08);
    --warning: hsl(38, 92%, 40%);
    --warning-light: hsla(38, 92%, 40%, 0.08);
    --danger: hsl(355, 84%, 44%);
    --danger-light: hsla(355, 84%, 44%, 0.08);

    /* Fonts */
    --font-heading: 'Outfit', system-ui, -apple-system, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;

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

    /* Borders & Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    /* Shadow Profiles */
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.06), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.06), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    
    /* Layout & Containment */
    --max-width: 1280px;
    --header-height: 80px;

    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. Modern Reset & Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    text-size-adjust: 100%;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(hsla(220, 95%, 50%, 0.03) 1.5px, transparent 1.5px);
    background-size: 32px 32px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.975rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Scrollbar styling for premium look */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-main);
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Typography Rules */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 800;
    line-height: 1.25;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

.gradient-text {
    background: linear-gradient(135deg, #0f172a 30%, #1a56db 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.accent-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h1 {
    font-size: clamp(2.5rem, 5vw + 1rem, 4rem);
    letter-spacing: -0.03em;
}

h2 {
    font-size: clamp(1.85rem, 3.5vw + 0.5rem, 2.75rem);
    letter-spacing: -0.02em;
}

h3 {
    font-size: clamp(1.35rem, 2vw + 0.25rem, 1.85rem);
}

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

/* WCAG 2.1 AA Keyboard Focus Accessibility Styles */
a:focus-visible, 
button:focus-visible, 
input:focus-visible, 
select:focus-visible, 
textarea:focus-visible {
    outline: 3px solid var(--secondary);
    outline-offset: 3px;
}

/* 3. Base Layout System */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
}

.grid {
    display: grid;
    gap: var(--space-xl);
}

.grid-2 {
    grid-template-columns: 1fr;
}

.grid-3 {
    grid-template-columns: 1fr;
}

.grid-4 {
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 4. Utility Helper Classes */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }

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

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

@media (min-width: 768px) {
    .section {
        padding-top: var(--space-4xl);
        padding-bottom: var(--space-4xl);
    }
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary {
    background-color: var(--primary-light);
    color: var(--primary);
}

.badge-secondary {
    background-color: var(--secondary-light);
    color: var(--secondary);
}

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

/* 5. Keyframe Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(22, 82, 240, 0.2);
    }
    50% {
        box-shadow: 0 0 15px 5px rgba(22, 82, 240, 0.4);
    }
}

.animate-fade-in-up {
    animation: fadeInUp var(--transition-slow) forwards;
}

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

/* Overlay framework for page transitions */
.page-container {
    min-height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
}
