/* ============================================================
   ELIPI CHAPAN — Minimal glassmorphism additions
   Strategy: ADD utilities, don't override existing layout.
   The redesigned pages opt-in by using .glass / .cta-btn / etc.
   Original pages keep working unchanged.
   ============================================================ */

/* ---------- 1. FONT (local only, no Google Fonts) ---------- */
/* Variable font (single file, covers all weights 100–900). Used by modern browsers. */
@font-face {
    font-family: 'Vazirmatn';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: local('Vazirmatn'),
         url('/static/fonts/vazirmatn/Vazirmatn-Variable.woff2') format('woff2-variations'),
         url('/static/fonts/vazirmatn/Vazirmatn-Variable.woff2') format('woff2');
}
/* Static fallbacks (Regular + Bold) for older browsers that don't read the variable
   font correctly. The variable font above is preferred and tried first. */
@font-face {
    font-family: 'Vazirmatn';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: local('Vazirmatn Regular'), local('Vazirmatn'),
         url('/static/fonts/vazirmatn/Vazirmatn-Regular.woff2') format('woff2');
}
@font-face {
    font-family: 'Vazirmatn';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: local('Vazirmatn Bold'),
         url('/static/fonts/vazirmatn/Vazirmatn-Bold.woff2') format('woff2');
}

/* ---------- 1b. TYPOGRAPHY BASELINE (Vazirmatn-aware) ----------
   - Body uses regular (400) for Persian readability
   - Headings use 800 (extra-bold) for clear hierarchy
   - Small/caption text uses 300 (light)
   - Smoothing tuned for Persian glyphs
   ============================================================ */
html, body {
    font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif !important;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}
/* Apply Vazirmatn to ALL elements — including form controls + Tailwind utilities */
* {
    font-family: inherit;
}
/* Common headings → strong weight */
h1, .text-3xl, .text-4xl, .text-5xl { font-weight: 800; letter-spacing: -0.02em; }
h2, .text-2xl                       { font-weight: 800; letter-spacing: -0.015em; }
h3, .text-xl                        { font-weight: 700; letter-spacing: -0.01em; }
h4, h5, h6                          { font-weight: 700; }
/* Buttons + CTAs */
button, .btn-primary, .btn-ghost, .nav-cta, .cta-btn, .cta-btn-ghost { font-weight: 700; }
/* Body / paragraph default */
p, li, label, span, div, td, th { font-weight: 400; }
/* Smaller text labels (uppercase tracking widgets / chips / pills) */
.text-xs, .text-\[10px\], .text-\[11px\], .text-\[12px\], .chip, .pill {
    font-weight: 500;
}
/* Numbers, prices, codes — semi-bold for readability */
.text-gradient, .price, .num, code, kbd { font-weight: 700; }
/* Form inputs */
input, textarea, select { font-weight: 500; }
input::placeholder, textarea::placeholder { font-weight: 400; opacity: .7; }


/* ---------- 2. DESIGN TOKENS ---------- */
:root {
    --brand-50:  #fef2f2;
    --brand-100: #fee2e2;
    --brand-200: #fecaca;
    --brand-300: #fca5a5;
    --brand-400: #f87171;
    --brand-500: #dc2626;
    --brand-600: #b91c1c;
    --brand-700: #991b1b;
    --brand-800: #7f1d1d;
    --brand-900: #5c1212;
    --accent-1: #b91c1c; /* deep red */
    --accent-2: #e11d48; /* rose */
    --accent-3: #7f1d1d; /* blood */

    --t-bg:        #ffffff;
    --t-surface:   rgba(255, 252, 250, 0.78);
    --t-card:      #fffaf7;
    --t-text:      #2a0808;
    --t-muted:     #6b4848;
    --t-soft:      #a78787;
    --t-border:    rgba(185, 28, 28, 0.18);
    --t-input-bg:  rgba(255, 255, 255, 0.9);
    --t-input-bd:  rgba(185, 28, 28, 0.22);

    --glass-bg:     rgba(255, 252, 250, 0.6);
    --glass-border: rgba(255, 220, 215, 0.7);
    --glass-shadow: 0 8px 32px 0 rgba(185, 28, 28, 0.12);
    --card-shadow:  0 10px 25px -5px rgba(185, 28, 28, 0.12), 0 4px 10px -4px rgba(185, 28, 28, 0.08);
    --card-shadow-lg: 0 20px 50px -10px rgba(185, 28, 28, 0.22), 0 8px 16px -6px rgba(185, 28, 28, 0.12);
    --glow:         0 0 30px rgba(220, 38, 38, 0.4);
}

.dark {
    /* Dark mode = PURPLE/VIOLET (was the original v1 dark palette) */
    --brand-50:  #faf5ff;
    --brand-100: #f3e8ff;
    --brand-200: #e9d5ff;
    --brand-300: #d8b4fe;
    --brand-400: #c084fc;
    --brand-500: #a855f7;
    --brand-600: #9333ea;
    --brand-700: #7e22ce;
    --brand-800: #6b21a8;
    --brand-900: #581c87;
    --accent-1: #a855f7;
    --accent-2: #ec4899;
    --accent-3: #6366f1;

    --t-bg:        #0b0816;
    --t-surface:   rgba(30, 27, 75, 0.55);
    --t-card:      #1e1b4b;
    --t-text:      #f1f5f9;
    --t-muted:     #cbd5e1;
    --t-soft:      #94a3b8;
    --t-border:    rgba(168, 85, 247, 0.18);
    --t-input-bg:  rgba(15, 12, 41, 0.75);
    --t-input-bd:  rgba(168, 85, 247, 0.3);

    --glass-bg:     rgba(30, 27, 75, 0.45);
    --glass-border: rgba(168, 85, 247, 0.18);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --card-shadow:  0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 4px 10px -4px rgba(0, 0, 0, 0.3);
    --card-shadow-lg: 0 20px 50px -10px rgba(0, 0, 0, 0.6), 0 8px 16px -6px rgba(0, 0, 0, 0.4);
    --glow:         0 0 40px rgba(168, 85, 247, 0.5);
}

/* ---------- 3. FONT ONLY (safe, applies everywhere) ---------- */
html, body, input, select, textarea, button {
    font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
}

/* ---------- 4. SCROLLBAR ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--brand-500), var(--brand-700));
    border-radius: 8px;
}

/* ---------- 5. OPT-IN PAGE WRAPPER (only used by redesigned pages) ----------
   Add class="theme-page" to <body> on pages that fully use the new design.
   Pages without this class keep their original look untouched.
*/
body.theme-page {
    margin: 0;
    min-height: 100vh;
    color: var(--t-text);
    background-color: var(--t-bg);
    /* Light mode = pure white, no gradients.
       Dark mode re-adds gradients in the .dark rule below. */
    background-image: none;
    background-attachment: fixed;
    transition: background-color 0.4s ease, color 0.4s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.dark body.theme-page {
    background-image:
        radial-gradient(at 15% 10%,  rgba(168, 85, 247, 0.18) 0px, transparent 50%),
        radial-gradient(at 85% 0%,   rgba(236, 72, 153, 0.10) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(99, 102, 241, 0.18) 0px, transparent 55%);
}

/* ---------- 6. GLASS COMPONENTS ---------- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 1.25rem;
}
.glass-strong {
    background: var(--t-surface);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--card-shadow);
    border-radius: 1.5rem;
}

/* ---------- 7. TEXT UTILITIES ---------- */
.t-text       { color: var(--t-text); }
.t-muted      { color: var(--t-muted); }
.t-soft       { color: var(--t-soft); }
.text-gradient {
    background: linear-gradient(135deg, var(--brand-500) 0%, var(--accent-2) 100%);
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* ---------- 8. BUTTONS (opt-in classes only) ---------- */
.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.85rem;
    padding: 1.25rem 2.25rem;
    font-weight: 800; font-size: 1.35rem;
    color: white;
    background: linear-gradient(135deg, var(--brand-600), var(--accent-3));
    border: none; border-radius: 0.875rem;
    box-shadow: 0 8px 22px rgba(220, 38, 38, .4);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(220, 38, 38, .55); filter: brightness(1.05); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.85rem;
    padding: 1.2rem 2.1rem;
    font-weight: 800; font-size: 1.35rem;
    color: var(--t-text);
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1.5px solid var(--glass-border);
    border-radius: 0.875rem;
    cursor: pointer;
    transition: all .2s ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--brand-500); color: var(--brand-600); }
.dark .btn-ghost:hover { color: var(--brand-300); }

/* ---------- 9. FIELD (opt-in input class) ---------- */
.field-label {
    display: block; font-size: 0.7rem; font-weight: 800;
    color: var(--t-muted); margin-bottom: 0.5rem;
    text-transform: uppercase; letter-spacing: 0.08em;
}
.field {
    width: 100%; display: block;
    background: var(--t-input-bg);
    color: var(--t-text);
    border: 1.5px solid var(--t-input-bd);
    border-radius: 0.75rem;
    padding: 0.8rem 1rem;
    font-size: 0.95rem; font-weight: 600;
    outline: none;
    backdrop-filter: blur(8px);
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.field::placeholder { color: var(--t-soft); opacity: 0.9; }
.field:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15);
    background: var(--t-card);
}
.field-ltr { text-align: left; direction: ltr; }

/* ---------- 10. CHIP ---------- */
.chip {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.35rem 0.85rem; border-radius: 999px;
    font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em;
    background: rgba(220, 38, 38, .12);
    color: var(--brand-700);
    border: 1px solid rgba(220, 38, 38, .25);
    backdrop-filter: blur(8px);
}
.dark .chip { color: #e9d5ff; background: rgba(220, 38, 38, .18); border-color: rgba(220, 38, 38, .35); }

/* ---------- 11. SITE HEADER (opt-in) ---------- */
/* ============================================================
   SITE HEADER — 2-row layout
   - Top row: logo + tagline + greeting + login button
   - Divider line in the middle
   - Bottom row: nav tabs (خانه / پنل مراکز / etc.)
   All text sizes are HALVED vs the old (one-row) header.
   ============================================================ */
.site-nav {
    position: fixed; top: 0; inset-inline: 0; z-index: 50;
    height: 8.2rem;
    display: flex; flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
}
.site-nav .nav-inner {
    width: 100%; max-width: 68rem; margin: 0 auto;
    padding: 0 1.5rem;       /* slightly more so logo isn't kissing the edge */
    height: 100%;
    position: relative;       /* anchor for absolutely-positioned edge clusters */
    display: flex; flex-direction: column;
    gap: 0;
}

/* ---------- TOP ROW: holds only the tagline (centered); edge clusters are absolute ---------- */
.nav-top {
    flex: 1 1 auto;
    position: relative;        /* anchor for the shortened divider */
    display: flex;
    align-items: center;
    justify-content: center;    /* center the tagline */
    gap: 1.5rem;
    padding-bottom: 0.4rem;
}
/* Shortened centered divider line */
.nav-top::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    max-width: 50rem;
    height: 1px;
    background: var(--glass-border);
}
/* Edge clusters — anchored to the very edges of the header AND vertically
   centered on the header's full midline (straddling both rows equally).
   Anchored against .nav-inner (full-height) instead of .nav-top. */
.site-nav .nav-inner > .nav-top-start,
.site-nav .nav-inner > .nav-top-end {
    /* placeholder so selectors compile even if HTML moves the clusters */
}
.nav-top-start,
.nav-top-end {
    display: flex; align-items: center; gap: 1rem;
    position: absolute;
    top: 50%;                       /* relative to .nav-inner (full header) */
    transform: translateY(-50%);    /* shift center ONTO header midline */
    z-index: 2;                     /* sit above the divider line */
}
/* In RTL: inline-start = visual RIGHT  →  logo on the very right */
.nav-top-start { inset-inline-start: 0; }
/* In RTL: inline-end   = visual LEFT   →  login/greeting on the very left */
.nav-top-end   { inset-inline-end:   0; }

.nav-tagline {
    font-size: 1.3rem;         /* bigger description line */
    font-weight: 700;
    color: var(--t-muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}
@media (max-width: 768px) { .nav-tagline { display: none; } }

/* ---------- BOTTOM ROW: tabs vertically centered ---------- */
.nav-bottom {
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;   /* center horizontally */
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    min-height: 2.4rem;       /* gives tabs room to be vertically centered */
}



/* Header greeting next to the login/logout button.
   Hidden by default; shown on desktop (≥1024px). On mobile the drawer's
   mm-greeting handles this. */
.nav-greeting {
    display: none;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--t-muted);
    white-space: nowrap;
}
@media (min-width: 1024px) {
    .nav-greeting { display: inline-block; }
}

.brand {
    font-weight: 900; letter-spacing: -0.04em; font-size: 1.55rem;
    text-decoration: none; display: inline-flex; align-items: center;
    gap: 0.6rem;
}
.brand .brand-light { color: var(--t-soft); font-weight: 300; }

/* Brand wordmark next to the logo (sits to the RIGHT of the logo in RTL).
   Inherits .brand font-size + weight. */
.brand .brand-text {
    display: inline-flex;
    align-items: center;
    gap: 0.18em;
    line-height: 1.4;            /* enough room for Persian diacritics — was 1 (clipping) */
    white-space: nowrap;
    padding: 0.15em 0;           /* extra breathing room so the gradient text isn't clipped */
    overflow: visible;
}
.brand .brand-text > span {
    line-height: 1.4;
    display: inline-block;
    padding-bottom: 0.06em;       /* prevents the gradient-clipped descender from being chopped */
}
@media (max-width: 480px) { .brand .brand-text { font-size: 1.15rem; } }
/* Hide the wordmark on tiny phones to keep the header compact */
@media (max-width: 360px) { .brand .brand-text { display: none; } }
/* Logo image inside .brand — sized for the new 2-row header */
.brand .brand-logo {
    height: 4.4rem;          /* bigger logo */
    width: auto;
    display: block;
    object-fit: contain;
    transition: filter .3s ease;
}
@media (max-width: 768px) { .brand .brand-logo { height: 3.2rem; } }
/* Dark theme — logo is black, invert it so it stays visible on dark backgrounds */
.dark .brand .brand-logo { filter: invert(1) brightness(1.05); }

/* ====== Nav tabs — previous underline style ====== */
.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-link {
    position: relative;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--t-muted);
    padding: 0.4rem 0.2rem;
    text-decoration: none;
    transition: color .2s;
    line-height: 1.1;
}
.nav-link::after {
    content: '';
    position: absolute;
    inset-inline-end: 0;
    bottom: -4px;
    width: 0; height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--brand-500), var(--accent-2));
    transition: width .25s ease;
}
.nav-link:hover, .nav-link.active { color: var(--brand-600); }
.dark .nav-link:hover, .dark .nav-link.active { color: var(--brand-300); }
.nav-link:hover::after, .nav-link.active::after { width: 100%; }

/* ---------- 12. THEME TOGGLE BUTTON ---------- */
.theme-toggle {
    position: fixed; bottom: 1.25rem; inset-inline-start: 1.25rem;
    z-index: 60;
    width: 3rem; height: 3rem; border-radius: 999px;
    border: 1.5px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--card-shadow);
    cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--brand-600);
    transition: transform .25s, box-shadow .25s, color .25s;
}
.theme-toggle:hover { transform: scale(1.08) rotate(15deg); box-shadow: var(--glow); }
.dark .theme-toggle { color: var(--brand-300); }
.theme-toggle svg { width: 1.3rem; height: 1.3rem; }
.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }
.dark .theme-toggle .sun-icon { display: block; }
.dark .theme-toggle .moon-icon { display: none; }

/* ---------- 13. STATUS PILLS ---------- */
.pill {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.25rem 0.7rem; border-radius: 999px;
    font-size: 0.7rem; font-weight: 800;
}
.pill-amber  { background: rgba(251,191,36,.18); color: #b45309; }
.pill-green  { background: rgba(16,185,129,.18); color: #047857; }
.pill-rose   { background: rgba(244,63,94,.18);  color: #be123c; }
.pill-purple { background: rgba(220, 38, 38, .18); color: #7e22ce; }
.pill-blue   { background: rgba(59,130,246,.18); color: #1d4ed8; }
.pill-orange { background: rgba(249,115,22,.18); color: #c2410c; }
.dark .pill-amber  { color: #fde68a; }
.dark .pill-green  { color: #6ee7b7; }
.dark .pill-rose   { color: #fda4af; }
.dark .pill-purple { color: #e9d5ff; }
.dark .pill-blue   { color: #93c5fd; }
.dark .pill-orange { color: #fdba74; }

/* ---------- 14. ICON HELPERS ---------- */
.icon-svg {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.25em; height: 1.25em; line-height: 1; vertical-align: middle;
}
.icon-svg svg { width: 100%; height: 100%; }

/* Material symbols fallback (when Google font not loaded) */
.material-symbols-outlined {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.25em; height: 1.25em; line-height: 1; vertical-align: middle;
}
.material-symbols-outlined svg { width: 100%; height: 100%; }
.material-symbols-outlined:not(:has(svg)) {
    font-size: 0 !important; width: 0; overflow: hidden;
}

/* ---------- 15. ANIMATIONS ---------- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(15px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.45s ease-out both; }

/* ---------- 16. DIVIDER ---------- */
.divider {
    height: 1px; border: 0;
    background: linear-gradient(90deg, transparent, var(--t-border), transparent);
    margin: 1.25rem 0;
}

/* ---------- 17. RESPONSIVE TWEAKS for redesigned pages ---------- */
@media (max-width: 768px) {
    .site-nav { height: 6.1rem; }
    .nav-links { display: none; }
    .brand { font-size: 1.3rem; }
}

/* ---------- 18. FOCUS RING ---------- */
:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ============================================================
   PAGE-THEME OVERLAY — only applies to body.theme-page pages
   Safe: admin.html doesn't use .theme-page so it stays original.
   ============================================================ */

/* Cards (white → glass) */
body.theme-page .bg-white {
    background: var(--t-surface);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-color: var(--glass-border);
}

/* Blue → purple */
body.theme-page .bg-blue-600,
body.theme-page .bg-blue-700,
body.theme-page .bg-indigo-600,
body.theme-page .bg-indigo-700,
body.theme-page .bg-\[\#004ac6\] {
    background: linear-gradient(135deg, var(--brand-600), var(--accent-3)) !important;
    box-shadow: 0 8px 22px rgba(220, 38, 38, .35);
}
body.theme-page .hover\:bg-blue-700:hover,
body.theme-page .hover\:bg-blue-600:hover,
body.theme-page .hover\:bg-indigo-700:hover,
body.theme-page .hover\:bg-indigo-600:hover { filter: brightness(1.08); }

body.theme-page .bg-blue-50, body.theme-page .bg-indigo-50,
body.theme-page .bg-blue-100, body.theme-page .bg-indigo-100 {
    background-color: rgba(220, 38, 38, 0.10);
}
body.theme-page.dark .bg-blue-50, .dark body.theme-page .bg-blue-50,
body.theme-page.dark .bg-indigo-50, .dark body.theme-page .bg-indigo-50,
body.theme-page.dark .bg-blue-100, .dark body.theme-page .bg-blue-100,
body.theme-page.dark .bg-indigo-100, .dark body.theme-page .bg-indigo-100 {
    background-color: rgba(220, 38, 38, 0.16);
}

body.theme-page .text-blue-400,
body.theme-page .text-blue-500,
body.theme-page .text-blue-600,
body.theme-page .text-blue-700,
body.theme-page .text-indigo-400,
body.theme-page .text-indigo-500,
body.theme-page .text-indigo-600,
body.theme-page .text-indigo-700,
body.theme-page .text-\[\#004ac6\] {
    color: var(--brand-600);
}
.dark body.theme-page .text-blue-400,
.dark body.theme-page .text-blue-500,
.dark body.theme-page .text-blue-600,
.dark body.theme-page .text-blue-700,
.dark body.theme-page .text-indigo-400,
.dark body.theme-page .text-indigo-500,
.dark body.theme-page .text-indigo-600,
.dark body.theme-page .text-indigo-700,
.dark body.theme-page .text-\[\#004ac6\] {
    color: var(--brand-300);
}

body.theme-page .border-blue-100,
body.theme-page .border-blue-200,
body.theme-page .border-blue-500,
body.theme-page .border-blue-600,
body.theme-page .border-indigo-100,
body.theme-page .border-indigo-200,
body.theme-page .border-indigo-500,
body.theme-page .border-indigo-600 {
    border-color: rgba(220, 38, 38, 0.35);
}

body.theme-page .shadow-blue-200,
body.theme-page .shadow-blue-500,
body.theme-page .shadow-blue-100,
body.theme-page .shadow-indigo-200,
body.theme-page .shadow-indigo-500,
body.theme-page .shadow-indigo-100 {
    --tw-shadow-color: rgba(220, 38, 38, 0.4);
}
body.theme-page .ring-blue-500,
body.theme-page .ring-indigo-500,
body.theme-page .focus\:ring-blue-500:focus,
body.theme-page .focus\:ring-indigo-500:focus {
    --tw-ring-color: var(--brand-500);
}
body.theme-page .focus\:border-blue-600:focus,
body.theme-page .focus\:border-indigo-600:focus,
body.theme-page .focus\:border-blue-500:focus,
body.theme-page .focus\:border-indigo-500:focus {
    border-color: var(--brand-500);
}

body.theme-page .from-blue-500, body.theme-page .from-blue-600,
body.theme-page .from-indigo-500, body.theme-page .from-indigo-600,
body.theme-page .from-blue-700, body.theme-page .from-indigo-700 {
    --tw-gradient-from: var(--brand-600) var(--tw-gradient-from-position);
}
body.theme-page .to-blue-500, body.theme-page .to-blue-600,
body.theme-page .to-indigo-500, body.theme-page .to-indigo-600,
body.theme-page .to-blue-700, body.theme-page .to-indigo-700,
body.theme-page .to-purple-900, body.theme-page .to-purple-750 {
    --tw-gradient-to: var(--accent-3) var(--tw-gradient-to-position);
}
body.theme-page .via-blue-500, body.theme-page .via-indigo-500 {
    --tw-gradient-via: var(--brand-500) var(--tw-gradient-via-position);
}

/* Dark mode adjustments for legacy text on theme-page */
.dark body.theme-page .text-slate-900,
.dark body.theme-page .text-slate-800,
.dark body.theme-page .text-slate-700,
.dark body.theme-page .text-gray-900,
.dark body.theme-page .text-gray-800,
.dark body.theme-page .text-gray-700,
.dark body.theme-page h1,
.dark body.theme-page h2,
.dark body.theme-page h3,
.dark body.theme-page h4 {
    color: var(--t-text);
}
.dark body.theme-page .text-slate-500,
.dark body.theme-page .text-slate-600,
.dark body.theme-page .text-gray-500,
.dark body.theme-page .text-gray-600 {
    color: var(--t-muted);
}
.dark body.theme-page .text-slate-400,
.dark body.theme-page .text-slate-300,
.dark body.theme-page .text-gray-400,
.dark body.theme-page .text-gray-300 {
    color: var(--t-soft);
}

/* Inputs/selects on theme-page (legacy markup) */
body.theme-page input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]),
body.theme-page textarea,
body.theme-page select {
    background: var(--t-input-bg);
    color: var(--t-text);
    border: 1.5px solid var(--t-input-bd);
    transition: border-color .2s, box-shadow .2s;
}
body.theme-page input:focus, body.theme-page textarea:focus, body.theme-page select:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, .15);
    outline: none;
}

/* Borders on legacy slate borders */
body.theme-page .border-slate-100,
body.theme-page .border-slate-200,
body.theme-page .border-gray-100,
body.theme-page .border-gray-200 {
    border-color: var(--t-border);
}

/* Headers on legacy pages — make brand "الیپی" gradient */
body.theme-page .text-\[\#004ac6\].tracking-tighter {
    background: linear-gradient(135deg, var(--brand-500), var(--accent-2));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* ============================================================
   DARK MODE color overrides for hardcoded RED values in templates
   When the user toggles dark mode (purple), these decorative
   accents flip from red → purple to match the new dark palette.
   ============================================================ */

/* Orbs and decorative glows */
.dark .orb-1,
.dark .auth-orb.a,
.dark .hero-orb.a {
    background: radial-gradient(circle, rgba(168, 85, 247, .45), transparent 70%) !important;
}
.dark .orb-2,
.dark .auth-orb.b,
.dark .hero-orb.b {
    background: radial-gradient(circle, rgba(236, 72, 153, .35), transparent 70%) !important;
}
.dark .auth-orb.c,
.dark .hero-orb.c {
    background: radial-gradient(circle, rgba(99, 102, 241, .35), transparent 70%) !important;
}

/* Generic radial decorations using red rgba should go purple in dark mode */
.dark [style*="rgba(220, 38, 38"] {
    /* Only inline-styled red glows — replace via CSS variable trick where possible.
       Most are inside elements that will still look fine as a warm accent. */
}

/* Box-shadows that hardcoded red glow */
.dark .btn-primary,
.dark .feature-icon.brand,
.dark .feature-icon.pink,
.dark .printer-card,
.dark .avatar,
.dark .badge {
    box-shadow: 0 10px 24px rgba(168, 85, 247, .45) !important;
}

/* Pink feature icon flips to violet in dark mode */
.dark .feature-icon.pink {
    background: linear-gradient(135deg, #ec4899, #a855f7) !important;
}

/* CTA glows */
.dark .cta-btn,
.dark .btn-primary {
    box-shadow: 0 8px 22px rgba(168, 85, 247, .4) !important;
}
.dark .cta-btn:hover,
.dark .btn-primary:hover {
    box-shadow: 0 12px 30px rgba(168, 85, 247, .55) !important;
}

/* Progress bar (dashboard) — in dark mode the bar's gradient should also use purple */
.dark .liquid {
    background: linear-gradient(90deg, var(--brand-600), var(--accent-3)) !important;
}
.dark .tank.full {
    background-color: var(--brand-500) !important;
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.55) !important;
}
.dark .active-label {
    background: linear-gradient(135deg, var(--brand-600), var(--accent-3)) !important;
    box-shadow: 0 8px 18px -4px rgba(168, 85, 247, 0.45) !important;
}

/* Theme toggle button glow */
.dark .page-theme-toggle:hover,
.dark .nav-theme-btn:hover,
.dark .theme-toggle:hover {
    box-shadow: 0 0 22px rgba(168, 85, 247, .4) !important;
}

/* Stat cards on home */
.dark .stat {
    box-shadow: var(--card-shadow) !important;
}

/* Pay-card glow */
.dark .pay-card {
    background: linear-gradient(135deg, #1e1b4b 0%, #4c1d95 50%, #7e22ce 100%) !important;
    box-shadow: 0 20px 40px rgba(120, 41, 190, .45), inset 0 1px 0 rgba(255,255,255,.15) !important;
}


/* ============================================================
   HAMBURGER MENU — compact 3-line icon, modern minimal style
   Visible only on mobile (≤1023px). RTL: stays pinned to the right edge.
   ============================================================ */
.mobile-toggle {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border-radius: 0.7rem;
    background: transparent;
    border: 1.5px solid var(--glass-border);
    cursor: pointer;
    color: var(--t-text);
    box-shadow: none;
    transition: all .2s ease;
}
.dark .mobile-toggle { color: #f1f5f9; }
.mobile-toggle:hover {
    border-color: var(--brand-500);
    color: var(--brand-600);
    background: rgba(220,38,38,.05);
}
.dark .mobile-toggle:hover { color: var(--brand-300); background: rgba(168,85,247,.10); border-color: var(--brand-400); }
.mobile-toggle:active { transform: scale(0.94); }

.mobile-toggle .mt-bar {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform .3s ease, opacity .2s ease, width .3s ease;
}
.mobile-toggle .mt-bar:nth-child(2) { width: 13px; }

/* When open, animate into an X */
.mobile-toggle.open .mt-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
    width: 18px;
}
.mobile-toggle.open .mt-bar:nth-child(2) { opacity: 0; }
.mobile-toggle.open .mt-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
    width: 18px;
}

@media (max-width: 1023px) {
    .mobile-toggle { display: inline-flex; }
}


/* ============================================================
   TOAST notifications (used by ElipiNotify.toast)
   ============================================================ */
.elipi-toast {
    position: fixed;
    top: 1rem;
    inset-inline-end: 1rem;
    z-index: 9999;
    max-width: calc(100vw - 2rem);
    padding: 0.85rem 1.1rem 0.85rem 1rem;
    background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
    color: white;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    font-weight: 800;
    box-shadow: 0 10px 28px rgba(220, 38, 38, .35), 0 0 0 1px rgba(255,255,255,.15) inset;
    transform: translateY(-12px); opacity: 0;
    transition: transform .3s ease, opacity .3s ease;
    display: flex; align-items: center; gap: 0.5rem;
    backdrop-filter: blur(20px);
}
.elipi-toast::before {
    content: "🔔";
    font-size: 1.1rem;
}
.elipi-toast.show { transform: translateY(0); opacity: 1; }
.dark .elipi-toast {
    background: linear-gradient(135deg, #9333ea, #6366f1);
    box-shadow: 0 10px 28px rgba(168, 85, 247, .4), 0 0 0 1px rgba(255,255,255,.12) inset;
}
