/**
 * MusicBlocks Design Tokens
 * A centralized design system for consistent UI theming.
 */

:root {
    /* =========================================================================
     Base Colors (Light Theme Default)
     ========================================================================= */
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f3f4f6;
    --color-bg-tertiary: #e5e7eb;

    --color-text-primary: #1f2937;
    --color-text-secondary: #4b5563;
    --color-text-tertiary: #9ca3af;
    --color-text-inverse: #ffffff;

    --color-border-primary: #d1d5db;
    --color-border-secondary: #e5e7eb;

    /* Semantic Brand & State Colors */
    --color-brand-primary: #3b82f6;
    --color-brand-primary-hover: #2563eb;
    --color-brand-secondary: #8b5cf6;

    /* Selector / Widget Colors */
    --color-selector-bg: #8cc6ff;
    --color-selector-selected: #1a8cff;

    --color-success: #10b981;
    --color-success-bg: #d1fae5;
    --color-warning: #f59e0b;
    --color-warning-bg: #fef3c7;
    --color-error: #ef4444;
    --color-error-bg: #fee2e2;
    --color-info: #3b82f6;
    --color-info-bg: #dbeafe;

    /* =========================================================================
     Spacing (Base 4px 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 */

    /* =========================================================================
     Typography
     ========================================================================= */
    --font-family-system:
        system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
        sans-serif;
    --font-family-mono:
        ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
        monospace;

    --font-size-xs: 0.75rem; /* 12px */
    --font-size-sm: 0.875rem; /* 14px */
    --font-size-md: 1rem; /* 16px */
    --font-size-lg: 1.125rem; /* 18px */
    --font-size-xl: 1.25rem; /* 20px */
    --font-size-2xl: 1.5rem; /* 24px */

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-loose: 2;

    /* =========================================================================
     Border Radius
     ========================================================================= */
    --radius-sm: 0.25rem; /* 4px */
    --radius-md: 0.375rem; /* 6px */
    --radius-lg: 0.5rem; /* 8px */
    --radius-xl: 0.75rem; /* 12px */
    --radius-full: 9999px; /* Pill shape */

    /* =========================================================================
     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-focus: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* ==========================================================================
   Dark Theme
   ========================================================================== */
body.dark {
    --color-bg-primary: #111827;
    --color-bg-secondary: #1f2937;
    --color-bg-tertiary: #374151;

    --color-text-primary: #f9fafb;
    --color-text-secondary: #d1d5db;
    --color-text-tertiary: #9ca3af;
    --color-text-inverse: #111827;

    --color-border-primary: #4b5563;
    --color-border-secondary: #374151;

    --color-brand-primary: #60a5fa;
    --color-brand-primary-hover: #3b82f6;
    --color-brand-secondary: #a78bfa;

    --color-selector-bg: #64b5f6;
    --color-selector-selected: #1e88e5;

    /* Adjusted state backgrounds for dark mode */
    --color-success-bg: rgba(16, 185, 129, 0.2);
    --color-warning-bg: rgba(245, 158, 11, 0.2);
    --color-error-bg: rgba(239, 68, 68, 0.2);
    --color-info-bg: rgba(59, 130, 246, 0.2);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-focus: 0 0 0 3px rgba(96, 165, 250, 0.5);
}

/* ==========================================================================
   High-Contrast Theme
   ========================================================================== */
body.highcontrast {
    --color-bg-primary: #000000;
    --color-bg-secondary: #000000;
    --color-bg-tertiary: #000000;

    --color-text-primary: #ffffff;
    --color-text-secondary: #ffff00;
    --color-text-tertiary: #ffffff;
    --color-text-inverse: #000000;

    --color-border-primary: #ffffff;
    --color-border-secondary: #ffffff;

    --color-brand-primary: #ffff00;
    --color-brand-primary-hover: #ffffff;
    --color-brand-secondary: #00ffff;

    --color-selector-bg: #00ffff;
    --color-selector-selected: #00cccc;

    --color-success: #00ff00;
    --color-success-bg: #000000;
    --color-warning: #ffaa00;
    --color-warning-bg: #000000;
    --color-error: #ff0000;
    --color-error-bg: #000000;
    --color-info: #00ffff;
    --color-info-bg: #000000;

    --shadow-focus: 0 0 0 4px #ffff00;
}
