﻿/* =========================================================
   eVe theme tokens — light / dark + accent colours
   Applied via <html data-theme="light|dark" data-accent="red|blue|teal|green|purple|orange">
   Set early by eve-theme.js (stored per browser in localStorage).
   ========================================================= */

:root {
    --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --font-ar: "Noto Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;

    --bg: #F6F7F9;
    --surface: #FFFFFF;
    --surface-2: #F3F4F6;
    --border: #E1E4EA;
    --text: #1F2937;
    --strong: #111827;
    --muted: #5B6472;
    --shadow: 0 12px 32px rgba(17, 24, 39, .14);
    --shadow-sm: 0 1px 3px rgba(17, 24, 39, .12);
    --grid: rgba(17, 24, 39, .045);
    --ring-line: rgba(17, 24, 39, .16);

    --ok: #15803D;   --ok-bg: #DCFCE7;
    --warn: #B45309; --warn-bg: #FEF3C7;
    --bad: #B91C1C;  --bad-bg: #FEE2E2;
    --info: #1D4ED8; --info-bg: #DBEAFE;

    --radius: 10px;
    --radius-lg: 14px;

    /* default accent (TimeWatch red) */
    --acc: #C8102E; --acc-hover: #A50D25; --acc-tint: #FDE8EB; --acc-text: #C8102E; --acc-soft: #FDF1F3;
}

[data-theme="dark"] {
    --bg: #0B1020;
    --surface: #131A2A;
    --surface-2: #1B2437;
    --border: #253047;
    --text: #D6DBE4;
    --strong: #F8FAFC;
    --muted: #9AA4B5;
    --shadow: 0 12px 32px rgba(0, 0, 0, .5);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
    --grid: rgba(255, 255, 255, .04);
    --ring-line: rgba(255, 255, 255, .16);

    --ok: #4ADE80;   --ok-bg: rgba(74, 222, 128, .14);
    --warn: #FBBF24; --warn-bg: rgba(251, 191, 36, .14);
    --bad: #F87171;  --bad-bg: rgba(248, 113, 113, .14);
    --info: #93C5FD; --info-bg: rgba(147, 197, 253, .14);
}

/* ---------- accents (light) ---------- */
[data-accent="red"]    { --acc: #C8102E; --acc-hover: #A50D25; --acc-tint: #FDE8EB; --acc-text: #C8102E; --acc-soft: #FDF1F3; }
[data-accent="blue"]   { --acc: #2563EB; --acc-hover: #1D4ED8; --acc-tint: #E3ECFF; --acc-text: #1D4ED8; --acc-soft: #EEF3FF; }
[data-accent="teal"]   { --acc: #0F766E; --acc-hover: #115E59; --acc-tint: #DDF3F0; --acc-text: #0F766E; --acc-soft: #EBF7F5; }
[data-accent="green"]  { --acc: #15803D; --acc-hover: #166534; --acc-tint: #DCFCE7; --acc-text: #15803D; --acc-soft: #EDF9F1; }
[data-accent="purple"] { --acc: #7C3AED; --acc-hover: #6D28D9; --acc-tint: #EDE5FF; --acc-text: #6D28D9; --acc-soft: #F4F0FF; }
[data-accent="orange"] { --acc: #C2410C; --acc-hover: #9A3412; --acc-tint: #FFEDD5; --acc-text: #C2410C; --acc-soft: #FFF5EB; }

/* ---------- accents (dark) ---------- */
[data-theme="dark"][data-accent="red"]    { --acc-tint: rgba(240, 80, 100, .18); --acc-text: #FF8C9B; --acc-soft: #111829; }
[data-theme="dark"][data-accent="blue"]   { --acc-tint: rgba(96, 140, 255, .20); --acc-text: #93B4FF; --acc-soft: #111829; }
[data-theme="dark"][data-accent="teal"]   { --acc-tint: rgba(45, 212, 191, .16); --acc-text: #5EEAD4; --acc-soft: #111829; }
[data-theme="dark"][data-accent="green"]  { --acc-tint: rgba(74, 222, 128, .16); --acc-text: #86EFAC; --acc-soft: #111829; }
[data-theme="dark"][data-accent="purple"] { --acc-tint: rgba(167, 139, 250, .20); --acc-text: #C4B5FD; --acc-soft: #111829; }
[data-theme="dark"][data-accent="orange"] { --acc-tint: rgba(251, 146, 60, .18); --acc-text: #FDBA74; --acc-soft: #111829; }

/* ---------- shared controls (reused across pages) ---------- */
.eve-iconbtn {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    border-radius: var(--radius); cursor: pointer; padding: 0;
    transition: border-color .15s, background .15s;
}
.eve-iconbtn:hover { border-color: var(--acc); }
.eve-iconbtn:focus-visible, .eve-seg button:focus-visible, .eve-swatch:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

.eve-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--acc); display: inline-block; }

.eve-seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.eve-seg button { border: 0; background: transparent; color: var(--text); padding: 9px 14px; font: inherit; font-size: 13px; cursor: pointer; }
.eve-seg button[aria-pressed="true"] { background: var(--acc-tint); color: var(--acc-text); font-weight: 600; }

.eve-popover {
    position: absolute; z-index: 50; top: calc(100% + 8px); inset-inline-end: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); padding: 14px; display: none;
}
.eve-popover.open { display: block; }
.eve-swatches { display: flex; gap: 10px; }
.eve-swatch {
    width: 32px; height: 32px; border-radius: 50%; cursor: pointer; padding: 0;
    border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--border);
}
.eve-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px currentColor; }

/* =========================================================
   Biometric loader (eve-loader.js) - face > fingerprint > ID card > iris
   Theme-aware: surface / border / accent tokens.
   ========================================================= */
.app-loader {
    position: fixed; inset: 0; z-index: 2147483000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(11, 16, 32, .32);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease;
}
[data-theme="dark"] .app-loader { background: rgba(0, 0, 0, .55); }
.app-loader.visible { opacity: 1; visibility: visible; }
.app-loader-panel {
    background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
    box-shadow: var(--shadow); padding: 20px 22px 14px;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    transform: translateY(6px) scale(.98); transition: transform .2s ease;
}
.app-loader.visible .app-loader-panel { transform: none; }
.app-loader-stages-container { display: flex; gap: 12px; }
.app-loader-icon-wrap {
    position: relative; width: 62px; height: 62px; border-radius: 16px;
    background: var(--surface-2); color: var(--muted);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    transition: background .25s ease, color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.app-loader-icon { width: 34px; height: 34px; display: block; }
.app-loader-stage.active .app-loader-icon-wrap {
    background: var(--acc-tint); color: var(--acc-text);
    box-shadow: inset 0 0 0 2px var(--acc); transform: scale(1.06);
}
.app-loader-scanline {
    position: absolute; left: 8px; right: 8px; top: 10px; height: 2px; border-radius: 2px;
    background: var(--acc); box-shadow: 0 0 10px 2px var(--acc); opacity: 0;
}
.app-loader-stage.scanning .app-loader-scanline { opacity: 1; animation: appLoaderScan .7s ease-in-out infinite alternate; }
@keyframes appLoaderScan { from { top: 10px; } to { top: 50px; } }
.app-loader-check {
    position: absolute; right: 4px; bottom: 4px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--acc); color: #fff; display: flex; align-items: center; justify-content: center;
    transform: scale(0); transition: transform .2s cubic-bezier(.3, 1.6, .5, 1);
    box-shadow: 0 0 0 2px var(--surface);
}
.app-loader-stage.checked .app-loader-check { transform: scale(1); }
.app-loader-label { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .2px; }
@media (max-width: 420px) {
    .app-loader-stages-container { gap: 8px; }
    .app-loader-icon-wrap { width: 52px; height: 52px; }
    .app-loader-icon { width: 28px; height: 28px; }
}
@media (prefers-reduced-motion: reduce) {
    .app-loader-stage.scanning .app-loader-scanline { animation: none; top: 30px; }
    .app-loader, .app-loader-panel, .app-loader-icon-wrap, .app-loader-check { transition: none; }
}


/* =========================================================
   Colour plate (accent picker) — used in the user menu and on login
   ========================================================= */
.eve-plate { display: flex; flex-direction: column; gap: 10px; min-width: 250px; }
.eve-plate-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.eve-plate-sw { aspect-ratio: 1; width: 100%; min-width: 18px; padding: 0; border: 0; border-radius: 6px; cursor: pointer; position: relative; transition: transform .1s; }
.eve-plate-sw:hover { transform: scale(1.12); z-index: 1; }
.eve-plate-sw:focus-visible { outline: 2px solid var(--strong); outline-offset: 2px; }
.eve-plate-sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--strong); }
.eve-plate-sw[aria-pressed="true"]::after { content: ""; position: absolute; left: 50%; top: 45%; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: translate(-50%, -50%) rotate(45deg); }
.eve-plate-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.eve-plate-row .eve-plate-sw { width: 22px; min-width: 22px; }
.eve-plate-lbl { font-size: 11px; color: var(--muted); margin-inline-end: 2px; }
.eve-plate-lbl:not(:first-child) { margin-inline-start: 8px; }
.eve-plate-custom { display: flex; align-items: center; gap: 8px; }
.eve-plate-wheel { position: relative; display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 5px 10px 5px 5px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text); }
.eve-plate-wheel::before { content: ""; width: 20px; height: 20px; border-radius: 50%; background: conic-gradient(#ef4444, #f59e0b, #22c55e, #06b6d4, #3b82f6, #8b5cf6, #ec4899, #ef4444); }
.eve-plate-wheel input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }
.eve-plate-hex { width: 84px; border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; font: 600 12px ui-monospace, Menlo, Consolas, monospace; color: var(--text); background: var(--surface); text-transform: uppercase; }
.eve-plate-hex:focus { outline: 2px solid var(--acc); outline-offset: -1px; }
.eve-plate-prev { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; }
.eve-plate-prev i { width: 26px; height: 26px; border-radius: 8px; }
.eve-plate-prev em { font-style: normal; font-weight: 700; font-size: 15px; }
.eve-plate-note { font-size: 11px; color: var(--muted); min-height: 14px; }
.eve-plate-actions { display: flex; align-items: center; gap: 6px; }
.eve-plate-actions span { flex: 1; }
.eve-plate-actions button { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.eve-plate-actions button[data-act="reset"] { border-color: transparent; color: var(--muted); padding-inline: 4px; }
.eve-plate-actions button.primary { background: var(--acc); border-color: var(--acc); color: #fff; }
.eve-plate-actions button:disabled { opacity: .45; cursor: default; }


/* Arabic: switch the whole type stack (eve-app.css forces var(--font) app-wide) */
html[dir="rtl"] { --font: "Noto Sans Arabic", "Inter", "Segoe UI", Tahoma, Arial, sans-serif; }
