/*
 * Revalio design tokens
 *
 * This is the single source of truth for portal color, type, spacing, sizing,
 * radius, elevation, focus, and motion values. Component rules belong in
 * revalio-components.css so pages do not need one-off values.
 */

:root,
[data-bs-theme="light"] {
    color-scheme: light;

    /* Brand */
    --rv-brand-50: #f2f8ee;
    --rv-brand-100: #e4f0dc;
    --rv-brand-200: #c9e0b9;
    --rv-brand-300: #a6ca8b;
    --rv-brand-400: #78ad58;
    --rv-brand-500: #4a8f2a;
    --rv-brand-600: #3e7a24;
    --rv-brand-700: #315f1c;
    --rv-brand-800: #294c1a;
    --rv-brand-900: #223f18;

    /* Primary actions share the selected navigation item's pale-green palette. */
    --rv-primary-bg: #dcefd2;
    --rv-primary-text: #18320f;
    --rv-primary-border: var(--rv-brand-600);
    --rv-primary-hover-bg: var(--rv-brand-200);
    --rv-primary-active-bg: var(--rv-brand-300);

    /* Neutral */
    --rv-neutral-0: #ffffff;
    --rv-neutral-25: #fcfcfd;
    --rv-neutral-50: #f8fafc;
    --rv-neutral-100: #f1f5f9;
    --rv-neutral-200: #e2e8f0;
    --rv-neutral-300: #cbd5e1;
    --rv-neutral-400: #94a3b8;
    --rv-neutral-500: #64748b;
    --rv-neutral-600: #475569;
    --rv-neutral-700: #334155;
    --rv-neutral-800: #1e293b;
    --rv-neutral-900: #0f172a;
    --rv-neutral-950: #020617;

    /* Semantic */
    --rv-info: #2563eb;
    --rv-info-strong: #1d4ed8;
    --rv-info-soft: #eff6ff;
    --rv-info-text: #1e40af;
    --rv-success: #15803d;
    --rv-success-strong: #166534;
    --rv-success-soft: #f0fdf4;
    --rv-success-text: #166534;
    --rv-warning: #b45309;
    --rv-warning-strong: #92400e;
    --rv-warning-soft: #fffbeb;
    --rv-warning-text: #92400e;
    --rv-danger: #b42318;
    --rv-danger-strong: #912018;
    --rv-danger-soft: #fff1f2;
    --rv-danger-text: #9f1239;

    /* Surfaces and content */
    --rv-canvas: var(--rv-neutral-50);
    --rv-surface: var(--rv-neutral-0);
    --rv-surface-subtle: var(--rv-neutral-25);
    --rv-surface-muted: var(--rv-neutral-100);
    --rv-surface-raised: var(--rv-neutral-0);
    --rv-border: var(--rv-neutral-200);
    --rv-border-strong: var(--rv-neutral-300);
    --rv-text: var(--rv-neutral-700);
    --rv-text-muted: var(--rv-neutral-500);
    --rv-text-subtle: var(--rv-neutral-400);
    --rv-heading: var(--rv-neutral-900);
    --rv-link: var(--rv-brand-700);
    --rv-link-hover: var(--rv-brand-900);
    --rv-overlay: rgb(15 23 42 / 56%);

    /* Typography */
    --rv-font-latin: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --rv-font-sans: var(--rv-font-latin);
    --rv-font-arabic: "Cairo", "Segoe UI", Tahoma, sans-serif;
    --rv-font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --rv-font-size-xs: 0.75rem;
    --rv-font-size-sm: 0.8125rem;
    --rv-font-size-md: 0.875rem;
    --rv-font-size-lg: 1rem;
    --rv-font-size-xl: 1.125rem;
    --rv-font-size-2xl: 1.375rem;
    --rv-font-size-3xl: 1.75rem;
    --rv-line-height-tight: 1.25;
    --rv-line-height-snug: 1.4;
    --rv-line-height-normal: 1.55;
    --rv-font-weight-regular: 400;
    --rv-font-weight-medium: 500;
    --rv-font-weight-semibold: 600;
    --rv-font-weight-bold: 700;

    /* Spacing */
    --rv-space-0: 0;
    --rv-space-1: 0.25rem;
    --rv-space-2: 0.5rem;
    --rv-space-3: 0.75rem;
    --rv-space-4: 1rem;
    --rv-space-5: 1.25rem;
    --rv-space-6: 1.5rem;
    --rv-space-8: 2rem;
    --rv-space-10: 2.5rem;
    --rv-space-12: 3rem;

    /* Sizing */
    --rv-control-height-sm: 2.25rem;
    --rv-control-height: 2.5rem;
    --rv-control-height-lg: 2.75rem;
    --rv-touch-target: 2.75rem;
    --rv-icon-sm: 1rem;
    --rv-icon-md: 1.25rem;
    --rv-icon-lg: 1.5rem;
    --rv-content-max: 100rem;

    /* Shape */
    --rv-radius-sm: 0.375rem;
    --rv-radius-md: 0.5rem;
    --rv-radius-lg: 0.75rem;
    --rv-radius-xl: 1rem;
    --rv-radius-pill: 999rem;

    /* Elevation */
    --rv-shadow-xs: 0 1px 2px rgb(15 23 42 / 5%);
    --rv-shadow-sm: 0 1px 3px rgb(15 23 42 / 8%), 0 1px 2px rgb(15 23 42 / 5%);
    --rv-shadow-md: 0 8px 20px rgb(15 23 42 / 10%);
    --rv-shadow-lg: 0 18px 40px rgb(15 23 42 / 16%);

    /* Focus and motion */
    --rv-focus: #2563eb;
    --rv-focus-ring: 0 0 0 3px rgb(37 99 235 / 28%);
    --rv-transition-fast: 120ms ease;
    --rv-transition-base: 180ms ease;
    --rv-transition-slow: 240ms ease;

    /* Bootstrap/Velzon compatibility */
    --bs-primary: var(--rv-brand-600);
    --bs-primary-rgb: 62, 122, 36;
    --bs-body-font-family: var(--rv-font-sans);
    --bs-body-font-size: var(--rv-font-size-md);
    --bs-body-line-height: var(--rv-line-height-normal);
    --bs-body-color: var(--rv-text);
    --bs-body-bg: var(--rv-canvas);
    --bs-border-color: var(--rv-border);
    --bs-link-color: var(--rv-link);
    --bs-link-hover-color: var(--rv-link-hover);
    --bs-focus-ring-color: rgb(37 99 235 / 28%);
    --vz-primary: var(--rv-brand-600);
    --vz-primary-rgb: 62, 122, 36;
    --vz-body-font-family: var(--rv-font-sans);
    --vz-body-font-size: var(--rv-font-size-md);
    --vz-body-color: var(--rv-text);
    --vz-body-bg: var(--rv-canvas);
    --vz-border-color: var(--rv-border);
}

[data-bs-theme="dark"] {
    color-scheme: dark;

    --rv-primary-border: var(--rv-brand-400);

    --rv-canvas: #0b1220;
    --rv-surface: #111827;
    --rv-surface-subtle: #0f172a;
    --rv-surface-muted: #1e293b;
    --rv-surface-raised: #182235;
    --rv-border: #334155;
    --rv-border-strong: #475569;
    --rv-text: #dbe4ef;
    --rv-text-muted: #aebdce;
    --rv-text-subtle: #94a3b8;
    --rv-heading: #f8fafc;
    --rv-link: #a6ca8b;
    --rv-link-hover: #c9e0b9;
    --rv-overlay: rgb(2 6 23 / 72%);
    --rv-info-soft: #172554;
    --rv-info-text: #bfdbfe;
    --rv-success-soft: #102b1c;
    --rv-success-text: #bbf7d0;
    --rv-warning-soft: #351d0a;
    --rv-warning-text: #fde68a;
    --rv-danger-soft: #3b1117;
    --rv-danger-text: #fecdd3;
    --rv-shadow-xs: 0 1px 2px rgb(0 0 0 / 20%);
    --rv-shadow-sm: 0 2px 6px rgb(0 0 0 / 24%);
    --rv-shadow-md: 0 10px 24px rgb(0 0 0 / 30%);
    --rv-shadow-lg: 0 20px 48px rgb(0 0 0 / 40%);

    --bs-body-color: var(--rv-text);
    --bs-body-bg: var(--rv-canvas);
    --bs-border-color: var(--rv-border);
    --bs-secondary-bg: var(--rv-surface-muted);
    --bs-tertiary-bg: var(--rv-surface-subtle);
    --bs-link-color: var(--rv-link);
    --bs-link-hover-color: var(--rv-link-hover);
    --vz-body-color: var(--rv-text);
    --vz-body-bg: var(--rv-canvas);
    --vz-border-color: var(--rv-border);
}

[dir="rtl"] {
    --rv-font-sans: var(--rv-font-arabic);
}

.rv-language-switch-label {
    unicode-bidi: isolate;
}

.rv-language-switch-label[lang="ar"] {
    direction: rtl;
    font-family: var(--rv-font-arabic);
}

.rv-language-switch-label[lang="en"] {
    direction: ltr;
    font-family: var(--rv-font-latin);
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --rv-transition-fast: 0ms;
        --rv-transition-base: 0ms;
        --rv-transition-slow: 0ms;
    }
}
