/* ========================================
   CSS Reset and Normalize
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   CSS Variables
   ======================================== */

:root {
    /* Primary Colors */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --secondary-hover: #475569;

    /* Background Colors */
    --background: #ffffff;
    --background-alt: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --hover: #f1f5f9;

    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;

    /* Border Colors */
    --border: #e2e8f0;
    --border-hover: #cbd5e1;

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

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

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

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

/* Dark Theme */
[data-theme='dark'] {
    /* Primary Colors - slightly brighter for dark backgrounds */
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --secondary: #94a3b8;
    --secondary-hover: #cbd5e1;

    /* Background Colors */
    --background: #0f172a;
    --background-alt: #1e293b;
    --surface: #1e293b;
    --surface-hover: #334155;
    --hover: #334155;

    /* Text Colors */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;

    /* Border Colors */
    --border: #334155;
    --border-hover: #475569;

    /* Status Colors - same as light theme */
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    /* Shadows - darker for dark theme */
    --shadow-sm: 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.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
}

/* ========================================
   Typography
   ======================================== */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--background);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Theme transition for all elements using CSS variables */
*,
*::before,
*::after {
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

h1 {
    font-size: 24px;
    font-weight: 700;
}

h2 {
    font-size: 20px;
    font-weight: 700;
}

h3 {
    font-size: 16px;
    font-weight: 700;
}

h4 {
    font-size: 14px;
    font-weight: 600;
}

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

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

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

/* ========================================
   Global Styles
   ======================================== */

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
}

/* Smooth scrolling */
* {
    scroll-behavior: smooth;
}

/* Focus styles for accessibility */
*:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Selection styles */
::selection {
    background-color: var(--primary);
    color: white;
}

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

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: var(--radius-sm);
}

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

/* ========================================
   Layout Utilities
   ======================================== */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-sm {
    gap: var(--spacing-sm);
}

.gap-md {
    gap: var(--spacing-md);
}

.gap-lg {
    gap: var(--spacing-lg);
}

/* ========================================
   Text Utilities
   ======================================== */

.text-sm {
    font-size: 12px;
}

.text-base {
    font-size: 14px;
}

.text-lg {
    font-size: 16px;
}

.text-xl {
    font-size: 18px;
}

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-tertiary {
    color: var(--text-tertiary);
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

/* ========================================
   Code and Monospace Text
   ======================================== */

code, pre, kbd, samp {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', 'Courier New', monospace;
}

code {
    font-size: 0.9em;
    background-color: var(--background-alt);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

pre {
    background-color: var(--background-alt);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    overflow-x: auto;
    line-height: 1.6;
}

pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: white;
    }

    a {
        text-decoration: underline;
    }

    pre, code {
        background-color: #f5f5f5;
    }
}
