/* DARWIN Platform Global Styles - Dynamic Analytics & Resource Workflow Intelligence Network */

/*
 * BREAKPOINT STRATEGY
 * ===================
 * CSS custom properties (CSS variables) cannot be used in media queries.
 * For consistency across the codebase, use these breakpoint values:
 *
 * Small:  640px  (--breakpoint-sm) - Mobile devices
 * Medium: 768px  (--breakpoint-md) - Tablets
 * Large:  1024px (--breakpoint-lg) - Small desktops
 * XLarge: 1280px (--breakpoint-xl) - Large desktops
 *
 * All media queries should include a comment referencing the breakpoint variable
 * to maintain consistency and make future updates easier.
 *
 * Example: @media (max-width: 768px) { /* Medium breakpoint: 768px (--breakpoint-md) */ }
 */

/* Font Face Declaration */
@font-face {
    font-family: 'Rotunda';
    src: url('../assets/fonts/RotundaVariable.ttf') format('truetype');
    font-weight: 100 900;
    font-display: swap;
}

/* CSS Variables - Brand Colors and Design System */
:root {
    /* DARWIN Brand Colors */
    --color-primary: #1E3A8A;        /* Deep Navy - Trust & stability */
    --color-secondary: #0EA5E9;      /* Electric Blue - Energy & innovation */
    --color-accent: #06B6D4;         /* Bright Cyan - Data highlights */

    /* Extended Color Palette */
    --color-primary-dark: #172554;   /* Darker navy for hover states */
    --color-primary-light: #3B82F6;  /* Lighter navy for backgrounds */
    --color-secondary-dark: #0284C7; /* Darker blue for hover states */
    --color-secondary-light: #38BDF8; /* Lighter blue for accents */
    --color-accent-dark: #0891B2;    /* Darker cyan for hover states */
    --color-accent-light: #22D3EE;   /* Lighter cyan for highlights */

    /* DARWIN Evolution Gradient */
    --gradient-primary: linear-gradient(135deg, #1E3A8A 0%, #0EA5E9 50%, #06B6D4 100%);

    /* Neutral Colors */
    --color-white: #ffffff;
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;

    /* Semantic Colors */
    --color-success: #059669;
    --color-warning: #f59e0b;
    --color-error: #dc2626;
    --color-info: var(--color-secondary);

    /* Background Colors */
    --color-bg-primary: var(--color-gray-50);
    --color-bg-secondary: var(--color-white);
    --color-bg-tertiary: var(--color-gray-100);

    /* Text Colors */
    --color-text-primary: var(--color-gray-900);
    --color-text-secondary: var(--color-gray-600);
    --color-text-tertiary: var(--color-gray-500);
    --color-text-inverse: var(--color-white);

    /* Typography - Using Rotunda as primary font */
    --font-family-primary: 'Rotunda', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;

    /* Font Sizes */
    --font-size-xs: 0.75rem;    /* 12px */
    --font-size-sm: 0.875rem;   /* 14px */
    --font-size-base: 1rem;     /* 16px */
    --font-size-lg: 1.125rem;   /* 18px */
    --font-size-xl: 1.25rem;    /* 20px */
    --font-size-2xl: 1.5rem;    /* 24px */
    --font-size-3xl: 1.875rem;  /* 30px */
    --font-size-4xl: 2.25rem;   /* 36px */

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

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

    /* Spacing Scale */
    --spacing-xs: 0.25rem;   /* 4px */
    --spacing-sm: 0.5rem;    /* 8px */
    --spacing-md: 1rem;      /* 16px */
    --spacing-lg: 1.5rem;    /* 24px */
    --spacing-xl: 2rem;      /* 32px */
    --spacing-2xl: 3rem;     /* 48px */
    --spacing-3xl: 4rem;     /* 64px */

    /* Border Radius */
    --radius-sm: 0.25rem;    /* 4px */
    --radius-md: 0.5rem;     /* 8px */
    --radius-lg: 0.75rem;    /* 12px */
    --radius-xl: 1rem;       /* 16px */
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --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;

    /* Container */
    --container-max-width: 1400px;
    --container-padding: var(--spacing-lg);

    /* Breakpoints */
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
}

/* Dark Mode Theme */
[data-theme="dark"] {
    /* Background Colors - Dark Mode */
    --color-bg-primary: #0f1419;         /* Very dark background */
    --color-bg-secondary: #1a1f2e;      /* Slightly lighter for cards */
    --color-bg-tertiary: #242937;       /* For hover states */

    /* Text Colors - Dark Mode */
    --color-text-primary: #e8eaed;      /* Light text for readability */
    --color-text-secondary: #9aa0a6;    /* Muted text */
    --color-text-tertiary: #70757a;     /* Even more muted */
    --color-text-inverse: #1a1f2e;     /* Dark text on light backgrounds */

    /* Extended Color Palette - Dark Mode Adjustments */
    --color-primary-light: #3d5a8c;    /* Lighter for better contrast in dark mode */
    --color-secondary-light: #4dc9e6;   /* Brighter cyan for visibility */

    /* Neutral Colors - Dark Mode */
    --color-gray-50: #242937;
    --color-gray-100: #2d3340;
    --color-gray-200: #3d4455;
    --color-gray-300: #4e566d;
    --color-gray-400: #6b7280;
    --color-gray-500: #8892a2;
    --color-gray-600: #9aa0a6;
    --color-gray-700: #c1c7cd;
    --color-gray-800: #e8eaed;
    --color-gray-900: #f8f9fa;

    /* Semantic Colors - Dark Mode */
    --color-success: #34d399;           /* Brighter green for dark backgrounds */
    --color-warning: #fbbf24;           /* Brighter yellow */
    --color-error: #f87171;             /* Softer red */

    /* Shadows - Dark Mode */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

/* Global Reset */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Base Styles */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* Smooth theme transitions */
* {
    transition-property: background-color, border-color, color, fill, stroke, box-shadow;
    transition-duration: 200ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Disable transitions during theme switch to prevent flash */
html.theme-transitioning * {
    transition: none !important;
}

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

h1 {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
}

h2 {
    font-size: var(--font-size-3xl);
}

h3 {
    font-size: var(--font-size-2xl);
}

h4 {
    font-size: var(--font-size-xl);
}

h5 {
    font-size: var(--font-size-lg);
}

h6 {
    font-size: var(--font-size-base);
}

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

a {
    color: var(--color-secondary);
    text-decoration: none;
    transition: color var(--transition-base);
}

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

/* Container */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* Utility Classes */
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }
.text-muted { color: var(--color-text-secondary); }

.bg-primary { background-color: var(--color-primary); }
.bg-secondary { background-color: var(--color-secondary); }
.bg-white { background-color: var(--color-white); }
.bg-gray-50 { background-color: var(--color-gray-50); }

/* Spacing Utilities */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }
.mt-5 { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }
.mb-5 { margin-bottom: var(--spacing-xl); }

.p-0 { padding: 0; }
.p-1 { padding: var(--spacing-xs); }
.p-2 { padding: var(--spacing-sm); }
.p-3 { padding: var(--spacing-md); }
.p-4 { padding: var(--spacing-lg); }
.p-5 { padding: var(--spacing-xl); }

/* Grid System */
.grid {
    display: grid;
    gap: var(--spacing-lg);
}

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

/* Flexbox Utilities */
.flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.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-1 { gap: var(--spacing-xs); }
.gap-2 { gap: var(--spacing-sm); }
.gap-3 { gap: var(--spacing-md); }
.gap-4 { gap: var(--spacing-lg); }

/* Responsive Utilities */
/* Medium breakpoint: 768px (--breakpoint-md) */
@media (max-width: 768px) {
    .hide-mobile { display: none; }
    .grid-cols-md-1 { grid-template-columns: repeat(1, 1fr); }
}

@media (min-width: 769px) {
    .hide-desktop { display: none; }
}

/* Loading State */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--color-gray-200);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Focus Styles */
:focus {
    outline: 2px solid var(--color-secondary);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .no-print {
        display: none;
    }
}
