/**
 * UNIFIED DESIGN TOKENS
 * Water Meter Monitoring System
 *
 * @version 1.0.0
 * @description Single source of truth for all design variables
 *
 * This file provides canonical values for:
 * - Status colors (Sky Blue theme)
 * - Typography
 * - Spacing (4px base grid)
 * - Border radius
 * - Shadows
 * - Transitions
 * - Z-index layers
 *
 * Import this file FIRST in all CSS stacks.
 */

:root {
    /* ================================================
       STATUS COLORS - CANONICAL (Sky Blue Theme)
       ================================================
       These are the ONLY status colors to use across
       all views: admin, customer, mini app
       ================================================ */

    --status-operational: #0369A1;
    --status-operational-bg: rgba(3, 105, 161, 0.1);
    --status-operational-border: #7DD3FC;

    --status-warning: #f59e0b;
    --status-warning-bg: rgba(245, 158, 11, 0.1);
    --status-warning-border: #fcd34d;

    --status-critical: #ef4444;
    --status-critical-bg: rgba(239, 68, 68, 0.1);
    --status-critical-border: #fca5a5;

    --status-pending: #64748b;
    --status-pending-bg: rgba(100, 116, 139, 0.1);
    --status-pending-border: #94a3b8;

    /* ================================================
       PRIMARY BRAND PALETTE
       ================================================ */

    --primary: #0369A1;
    --primary-hover: #0284C7;
    --primary-light: #DBEAFE;
    --primary-dark: #075985;

    --secondary: #3b82f6;
    --secondary-hover: #2563eb;
    --secondary-light: #dbeafe;

    --accent: #0ea5e9;
    --accent-bright: #38bdf8;

    /* ================================================
       SEMANTIC COLORS
       ================================================ */

    --success: var(--status-operational);
    --success-bg: var(--status-operational-bg);
    --success-border: var(--status-operational-border);

    --warning: var(--status-warning);
    --warning-bg: var(--status-warning-bg);
    --warning-border: var(--status-warning-border);

    --danger: var(--status-critical);
    --danger-bg: var(--status-critical-bg);
    --danger-border: var(--status-critical-border);

    --info: #3b82f6;
    --info-bg: #dbeafe;
    --info-border: #93c5fd;

    --neutral: var(--status-pending);
    --neutral-bg: var(--status-pending-bg);

    /* ================================================
       GRAY SCALE
       ================================================ */

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

    /* ================================================
       TEXT COLORS
       ================================================ */

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    /* ================================================
       BACKGROUND COLORS
       ================================================ */

    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-active: #e2e8f0;

    /* ================================================
       BORDER COLORS
       ================================================ */

    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --border-dark: #cbd5e1;

    /* ================================================
       TYPOGRAPHY - CANONICAL
       ================================================ */

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'IBM Plex Mono', 'SF Mono', Monaco, 'Cascadia Code', monospace;
    --font-sans: var(--font-family);

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

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

    /* Line Heights */
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    /* ================================================
       SPACING - 4px BASE GRID (Canonical)
       ================================================ */

    --space-0: 0;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* ================================================
       BORDER RADIUS - CANONICAL
       ================================================ */

    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* ================================================
       SHADOWS
       ================================================ */

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

    /* Component-specific shadows */
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.1);

    /* ================================================
       TRANSITIONS - CANONICAL
       ================================================ */

    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;
    --transition-slower: 500ms ease;

    /* Animation duration for JS modules */
    --animation-duration: 300ms;

    /* ================================================
       Z-INDEX LAYERS
       ================================================ */

    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 900;
    --z-modal: 1000;
    --z-popover: 1100;
    --z-tooltip: 1200;
    --z-toast: 1300;

    /* ================================================
       LAYOUT
       ================================================ */

    --container-max: 1400px;
    --sidebar-width: 280px;
    --header-height: 64px;

    /* Grid Gaps */
    --grid-gap-sm: var(--space-3);
    --grid-gap-md: var(--space-4);
    --grid-gap-lg: var(--space-6);

    /* ================================================
       TABLE TOKENS - CANONICAL
       ================================================ */

    /* Table structure */
    --table-border-radius: var(--radius-lg);
    --table-border-color: var(--border-light);
    --table-border-width: 1px;

    /* Table header */
    --table-header-bg: var(--gray-50);
    --table-header-bg-hover: var(--gray-100);
    --table-header-color: var(--text-secondary);
    --table-header-font-size: 11px;
    --table-header-font-weight: var(--font-semibold);
    --table-header-padding: var(--space-3) var(--space-4);
    --table-header-letter-spacing: 0.05em;

    /* Table body */
    --table-cell-font-size: 13px;
    --table-cell-padding: var(--space-3) var(--space-4);
    --table-cell-color: var(--text-primary);
    --table-row-border-color: var(--border-light);
    --table-row-hover-bg: var(--bg-hover);
    --table-row-stripe-bg: var(--gray-50);

    /* Table card wrapper */
    --table-card-bg: var(--bg-card);
    --table-card-shadow: var(--shadow-card);
    --table-card-header-padding: var(--space-4) var(--space-5);

    /* Table pagination */
    --table-pagination-bg: var(--gray-50);
    --table-pagination-padding: var(--space-3) var(--space-4);

    /* Safe Areas (for mobile) */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
}

/* ================================================
   DARK MODE OVERRIDES
   ================================================ */

@media (prefers-color-scheme: dark) {
    :root.dark-mode {
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --text-muted: #64748b;

        --bg-page: #0f172a;
        --bg-card: #1e293b;
        --bg-hover: #334155;
        --bg-active: #475569;

        --border: #334155;
        --border-light: #1e293b;
        --border-dark: #475569;

        --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
        --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
    }
}

/* ================================================
   CSS BREAKPOINTS (Reference)

   Use these consistent values in all @media queries:

   --breakpoint-sm:  640px   (Mobile landscape)
   --breakpoint-md:  768px   (Tablet portrait)
   --breakpoint-lg:  1024px  (Tablet landscape / Desktop)
   --breakpoint-xl:  1280px  (Wide desktop)

   Usage:
   - Mobile-first: @media (min-width: 768px) { }
   - Desktop-first: @media (max-width: 767px) { }
   ================================================ */
