/*
 * Mini Max design tokens — the single source of truth for the Admin/Staff UI.
 *
 * Plain CSS custom properties, switchable at runtime through the data-theme /
 * data-font attributes on <html> (set from a saved preference by the inline
 * boot script in components/theme-boot.blade.php and by resources/js/app.js).
 * app.css maps these onto Tailwind utilities (bg-surface, text-fg-2,
 * border-line, bg-brand ...) so pages never hardcode a color and every theme
 * works everywhere.
 *
 * Surface hierarchy (darkest to lightest) — keep these roles distinct:
 *   --mm-bg         app canvas
 *   --mm-sidebar    navigation rail
 *   --mm-surface    cards, panels, tables
 *   --mm-surface-2  inputs, table headers, nested panels, hover rows
 *   --mm-surface-3  menus, dialogs, popovers
 * The brand color is reserved for actions, selection, focus and links; it is
 * never used as a page or card background (--mm-brand-soft is the tinted
 * "selected" surface).
 *
 * Android mirrors the color-theme names and values in mobile/src/theme/tokens.ts.
 *
 * Day / Night mode (Admin & Staff panels only) is a second, independent layer
 * at the end of this file, switched by data-mode="light|dark" on <html>: light
 * mode replaces the neutral surfaces, text and semantic colors for every color
 * theme and darkens each theme's brand text; dark mode gives the default
 * Purple Glassmorphism theme Mini Max's night palette. The color-theme blocks
 * below stay the shared (Android-mirrored) source for each brand family.
 */

:root {
    color-scheme: dark;

    /*
     * Semantic colors carry meaning independent of the chosen theme. The plain
     * token is the text/icon color; the -soft token is the tint behind it. Error
     * text is a lighter tint of the #f04452 error red, which is used for the
     * tints themselves: the base red is 4.35:1 on a night card, under AA.
     */
    --mm-success: #20d58a;
    --mm-success-soft: rgb(32 213 138 / 0.12);
    --mm-warning: #f5c451;
    --mm-warning-soft: rgb(245 196 81 / 0.12);
    --mm-danger: #f87c86;
    --mm-danger-soft: rgb(240 68 82 / 0.12);
    --mm-danger-solid: #d92d3f;
    --mm-danger-solid-hover: #b8202f;
    --mm-on-danger: #ffffff;
    --mm-info: #74b1fb;
    --mm-info-soft: rgb(96 165 250 / 0.12);

    --mm-overlay: rgb(5 3 8 / 0.7);
    --mm-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.35);
    --mm-shadow-float: 0 16px 40px -12px rgb(0 0 0 / 0.65), 0 0 0 1px var(--mm-border);

    /* Cards: a faint top highlight at night, a restrained drop shadow by day. */
    --mm-shadow-card: 0 1px 0 color-mix(in oklab, var(--mm-fg) 5%, transparent) inset;
    --mm-glass-shadow: 0 1px 0 rgb(255 255 255 / 0.04) inset, 0 30px 70px -32px rgb(0 0 0 / 0.75);

    /* Menus and dialogs, and the sticky header. Light mode lifts both to white. */
    --mm-float: var(--mm-surface-3);
    --mm-header: var(--mm-bg);

    /*
     * Glass. One set of tunables shared by every theme (the surfaces themselves
     * come from the active theme). Each glass surface keeps this share of its
     * colour; the rest lets the soft background glow show through. The blur is
     * used only by layers that overlap other content — the header, sticky
     * action bars, menus, dialogs and toasts — never by static cards.
     * AdminUiDesignSystemTest asserts WCAG AA text contrast for every theme at
     * these values, in the worst case behind the surface. app.css drops all of
     * this to solid surfaces when the browser cannot blur, or the visitor asks
     * for reduced transparency or more contrast.
     */
    --mm-glass-opacity: 88%;
    --mm-glass-float-opacity: 94%;
    --mm-glass-hero-opacity: 78%;
    --mm-glass-filter: blur(16px) saturate(1.15);
    --mm-glow-strength: 14%;
    --mm-glow-strength-2: 8%;
}

/* ---------- Color themes ---------- */

/* Purple Glassmorphism (default). */
:root,
[data-theme='purple-glass'] {
    --mm-bg: #0d0a12;
    --mm-sidebar: #120d19;
    --mm-surface: #19131f;
    --mm-surface-2: #21192b;
    --mm-surface-3: #291f35;
    --mm-border: #382a46;
    --mm-border-strong: #4d3a61;

    --mm-fg: #f6f1fb;
    --mm-fg-2: #c2b5d0;
    --mm-fg-3: #9788a6;

    --mm-brand: #8b35f6;
    --mm-brand-hover: #a855f7;
    --mm-brand-pressed: #7025d8;
    --mm-brand-soft: #241536;
    --mm-brand-text: #b987fb;
    --mm-on-brand: #ffffff;
    --mm-ring: #a855f7;
}

[data-theme='midnight-emerald'] {
    --mm-bg: #090f0d;
    --mm-sidebar: #0d1512;
    --mm-surface: #121c18;
    --mm-surface-2: #19251f;
    --mm-surface-3: #202e27;
    --mm-border: #2b3e34;
    --mm-border-strong: #3a5446;

    --mm-fg: #f0faf5;
    --mm-fg-2: #b5cfc2;
    --mm-fg-3: #84a394;

    --mm-brand: #10b981;
    --mm-brand-hover: #34d399;
    --mm-brand-pressed: #059669;
    --mm-brand-soft: #0f2a21;
    --mm-brand-text: #34d399;
    --mm-on-brand: #04140e;
    --mm-ring: #34d399;
}

[data-theme='crimson-arena'] {
    --mm-bg: #120909;
    --mm-sidebar: #190d0d;
    --mm-surface: #221414;
    --mm-surface-2: #2c1a1a;
    --mm-surface-3: #372121;
    --mm-border: #4a2b2b;
    --mm-border-strong: #613838;

    --mm-fg: #fdf1f1;
    --mm-fg-2: #d8b8b8;
    --mm-fg-3: #ab8b8b;

    --mm-brand: #dc2626;
    --mm-brand-hover: #ef4444;
    --mm-brand-pressed: #b91c1c;
    --mm-brand-soft: #3a1414;
    --mm-brand-text: #f87171;
    --mm-on-brand: #ffffff;
    --mm-ring: #ef4444;
}

[data-theme='cyber-blue'] {
    --mm-bg: #08111a;
    --mm-sidebar: #0c1824;
    --mm-surface: #111f2d;
    --mm-surface-2: #182939;
    --mm-surface-3: #1f3346;
    --mm-border: #2a4157;
    --mm-border-strong: #38566f;

    --mm-fg: #eef6fc;
    --mm-fg-2: #b1c8da;
    --mm-fg-3: #8da5b8;

    --mm-brand: #0ea5e9;
    --mm-brand-hover: #38bdf8;
    --mm-brand-pressed: #0284c7;
    --mm-brand-soft: #0f2638;
    --mm-brand-text: #38bdf8;
    --mm-on-brand: #04121c;
    --mm-ring: #38bdf8;
}

[data-theme='sunset-gold'] {
    --mm-bg: #120d07;
    --mm-sidebar: #19120a;
    --mm-surface: #221a0f;
    --mm-surface-2: #2c2214;
    --mm-surface-3: #372b1a;
    --mm-border: #4a3a22;
    --mm-border-strong: #614c2d;

    --mm-fg: #fdf6ec;
    --mm-fg-2: #d9c6a5;
    --mm-fg-3: #ae9c80;

    --mm-brand: #f59e0b;
    --mm-brand-hover: #fbbf24;
    --mm-brand-pressed: #d97706;
    --mm-brand-soft: #33220a;
    --mm-brand-text: #fbbf24;
    --mm-on-brand: #1a1004;
    --mm-ring: #fbbf24;
}

[data-theme='royal-indigo'] {
    --mm-bg: #0a0a18;
    --mm-sidebar: #0f0f20;
    --mm-surface: #161629;
    --mm-surface-2: #1d1d35;
    --mm-surface-3: #262643;
    --mm-border: #34345a;
    --mm-border-strong: #46467a;

    --mm-fg: #f1f1fd;
    --mm-fg-2: #babad8;
    --mm-fg-3: #9292b4;

    --mm-brand: #5558e8;
    --mm-brand-hover: #7c7ff5;
    --mm-brand-pressed: #4338ca;
    --mm-brand-soft: #1b1b3d;
    --mm-brand-text: #a5a8fb;
    --mm-on-brand: #ffffff;
    --mm-ring: #7c7ff5;
}

[data-theme='monochrome-steel'] {
    --mm-bg: #0e0f11;
    --mm-sidebar: #131518;
    --mm-surface: #1a1d21;
    --mm-surface-2: #22262b;
    --mm-surface-3: #2b3036;
    --mm-border: #373d45;
    --mm-border-strong: #4a525c;

    --mm-fg: #f3f5f7;
    --mm-fg-2: #bdc4cc;
    --mm-fg-3: #99a1ab;

    --mm-brand: #94a3b8;
    --mm-brand-hover: #cbd5e1;
    --mm-brand-pressed: #7a8799;
    --mm-brand-soft: #20262e;
    --mm-brand-text: #cbd5e1;
    --mm-on-brand: #0b0f14;
    --mm-ring: #cbd5e1;
}

/* ---------- Font themes ---------- */

:root,
[data-font='default-sans'] {
    --mm-font-active: 'Inter', 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[data-font='modern-grotesk'] {
    --mm-font-active: 'Helvetica Neue', Arial, ui-sans-serif, sans-serif;
}

[data-font='rounded-friendly'] {
    --mm-font-active: ui-rounded, 'SF Pro Rounded', Nunito, ui-sans-serif, sans-serif;
}

[data-font='classic-serif'] {
    --mm-font-active: Georgia, 'Times New Roman', ui-serif, serif;
}

[data-font='technical-mono'] {
    --mm-font-active: 'SF Mono', 'Cascadia Code', Consolas, ui-monospace, monospace;
}

[data-font='condensed-impact'] {
    --mm-font-active: 'Arial Narrow', 'Helvetica Neue Condensed', ui-sans-serif, sans-serif;
}

[data-font='elegant-display'] {
    --mm-font-active: Didot, 'Bodoni MT', Georgia, ui-serif, serif;
}

/* ---------- Day / Night mode (Admin & Staff panels) ---------- */

/*
 * Night. The default theme takes Mini Max's own night palette; the other color
 * themes keep their tinted surfaces above. The [data-mode] [data-theme] form
 * also covers the theme swatches in the Appearance menu, which carry their own
 * data-theme.
 */
[data-mode='dark']:not([data-theme]),
[data-mode='dark'][data-theme='purple-glass'],
[data-mode='dark'] [data-theme='purple-glass'] {
    --mm-bg: #17111f;
    --mm-sidebar: #1e1729;
    --mm-surface: #251d32;
    --mm-surface-2: #2b2239;
    --mm-surface-3: #302440;
    --mm-border: #3b304b;
    --mm-border-strong: #4e4063;

    --mm-fg: #f8fafc;
    --mm-fg-2: #b6afc4;
    --mm-fg-3: #9a90ac;

    --mm-brand: #6d28d9;
    --mm-brand-hover: #7c3aed;
    --mm-brand-pressed: #5b21b6;
    --mm-brand-soft: #33204d;
    --mm-brand-text: #c4b0fa;
    --mm-on-brand: #ffffff;
    --mm-ring: #a78bfa;
}

/*
 * Day. One neutral set for every color theme: a slightly tinted canvas (no
 * pure-white glare), white sidebar, cards, menus and dialogs, slate text, and
 * semantic text colors deep enough for AA on their own tints.
 */
[data-mode='light'],
[data-mode='light'] [data-theme] {
    color-scheme: light;

    --mm-bg: #f8fafc;
    --mm-sidebar: #ffffff;
    --mm-surface: #ffffff;
    --mm-surface-2: #f1f5f9;
    --mm-surface-3: #eaeff5;
    --mm-border: #e2e8f0;
    --mm-border-strong: #cbd5e1;

    --mm-fg: #17111f;
    --mm-fg-2: #475569;
    --mm-fg-3: #5a6779;

    --mm-success: #05704c;
    --mm-success-soft: rgb(32 213 138 / 0.16);
    --mm-warning: #835500;
    --mm-warning-soft: rgb(245 196 81 / 0.26);
    --mm-danger: #be1a2e;
    --mm-danger-soft: rgb(240 68 82 / 0.12);
    --mm-info: #1a58c4;
    --mm-info-soft: rgb(59 130 246 / 0.12);

    --mm-overlay: rgb(15 23 42 / 0.42);
    --mm-shadow-sm: 0 1px 2px rgb(15 23 42 / 0.06);
    --mm-shadow-float: 0 18px 44px -18px rgb(15 23 42 / 0.28), 0 0 0 1px var(--mm-border);
    --mm-shadow-card: 0 1px 2px rgb(15 23 42 / 0.04), 0 2px 8px -2px rgb(15 23 42 / 0.06);
    --mm-glass-shadow: 0 1px 0 rgb(255 255 255 / 0.7) inset, 0 24px 60px -30px rgb(15 23 42 / 0.28);

    --mm-float: #ffffff;
    --mm-header: #ffffff;

    --mm-glow-strength: 6%;
    --mm-glow-strength-2: 4%;
}

/* Day brand text and tints: each theme's accent, deepened to AA on white. */
[data-mode='light']:not([data-theme]),
[data-mode='light'][data-theme='purple-glass'],
[data-mode='light'] [data-theme='purple-glass'] {
    --mm-brand: #6d28d9;
    --mm-brand-hover: #7c3aed;
    --mm-brand-pressed: #5b21b6;
    --mm-brand-soft: #ede9fe;
    --mm-brand-text: #6d28d9;
    --mm-on-brand: #ffffff;
    --mm-ring: #7c3aed;
}

[data-mode='light'][data-theme='midnight-emerald'],
[data-mode='light'] [data-theme='midnight-emerald'] {
    --mm-brand-soft: #d1fae5;
    --mm-brand-text: #047857;
    --mm-ring: #059669;
}

[data-mode='light'][data-theme='crimson-arena'],
[data-mode='light'] [data-theme='crimson-arena'] {
    --mm-brand-soft: #fee2e2;
    --mm-brand-text: #b91c1c;
    --mm-ring: #dc2626;
}

[data-mode='light'][data-theme='cyber-blue'],
[data-mode='light'] [data-theme='cyber-blue'] {
    --mm-brand-soft: #e0f2fe;
    --mm-brand-text: #0369a1;
    --mm-ring: #0284c7;
}

[data-mode='light'][data-theme='sunset-gold'],
[data-mode='light'] [data-theme='sunset-gold'] {
    --mm-brand-soft: #fef3c7;
    --mm-brand-text: #92400e;
    --mm-ring: #d97706;
}

[data-mode='light'][data-theme='royal-indigo'],
[data-mode='light'] [data-theme='royal-indigo'] {
    --mm-brand-soft: #e0e7ff;
    --mm-brand-text: #4338ca;
    --mm-ring: #5558e8;
}

[data-mode='light'][data-theme='monochrome-steel'],
[data-mode='light'] [data-theme='monochrome-steel'] {
    --mm-brand: #475569;
    --mm-brand-hover: #64748b;
    --mm-brand-pressed: #334155;
    --mm-brand-soft: #e2e8f0;
    --mm-brand-text: #334155;
    --mm-on-brand: #ffffff;
    --mm-ring: #475569;
}
