/* ==================== menu-royal.css - منوهای «خزانه‌ی سلطنتی» ====================
   کاشی‌ها و منوی جانبی: بدنه‌ی تیره و عمیق (از رنگ همان طرح انتخاب‌شده) + قاب و نشان طلایی.
   همه‌ی رنگ‌ها از توکن‌های طرح (--chrome-a/b ، --accent) می‌آیند؛ با تغییر طرح بالای صفحه خودکار هماهنگ می‌شود.
   اگر طرحی --accent نداشت (طرح پیش‌فرض)، طلایی ثابت جایگزین می‌شود. */

:root {
    --rv-gold: var(--accent, #d4a017);
    --rv-gold-2: var(--accent-light, #f2c94c);
    --rv-gold-rgb: var(--accent-rgb, 212,160,23);
    --rv-top: color-mix(in srgb, var(--chrome-b, #7c3aed) 80%, #000);
    --rv-bot: color-mix(in srgb, var(--chrome-a, #c026d3) 58%, #000);
    --rv-ink: color-mix(in srgb, var(--chrome-a, #c026d3) 55%, #000);
    --rv-cream: #fff6dc;
}

/* ---------- کاشی‌های صفحه‌ی اصلی ---------- */
html:root:root:root .main-menu-grid { gap: 14px; }

html:root:root:root .menu-tile {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid rgba(var(--rv-gold-rgb), 0.55) !important;
    border-radius: 22px !important;
    padding: 20px 8px 16px !important;
    background:
        radial-gradient(120% 70% at 50% -10%, rgba(var(--rv-gold-rgb), 0.30), transparent 62%),
        linear-gradient(158deg, var(--rv-top) 0%, var(--rv-bot) 100%) !important;
    box-shadow:
        0 10px 22px rgba(0, 0, 0, 0.28),
        0 1px 0 rgba(255, 255, 255, 0.18) inset,
        0 -14px 24px rgba(0, 0, 0, 0.22) inset !important;
    transition: transform 0.28s cubic-bezier(.2,.8,.2,1), box-shadow 0.28s ease, border-color 0.28s ease !important;
}
/* قاب طلایی داخلی + الگوی نگین (لوزی گل‌دار) */
html:root:root:root .menu-tile::after {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 17px;
    border: 1px solid rgba(var(--rv-gold-rgb), 0.35);
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%3E%3Cg%20fill='none'%20stroke='%23f2c94c'%20stroke-width='.8'%20stroke-opacity='.16'%3E%3Cpath%20d='M16%200L32%2016L16%2032L0%2016Z'/%3E%3Cpath%20d='M16%207L25%2016L16%2025L7%2016Z'/%3E%3C/g%3E%3Cg%20fill='%23f2c94c'%20fill-opacity='.16'%3E%3Ccircle%20cx='16'%20cy='16'%20r='1.8'/%3E%3Ccircle%20cx='0'%20cy='0'%20r='1.5'/%3E%3Ccircle%20cx='32'%20cy='0'%20r='1.5'/%3E%3Ccircle%20cx='0'%20cy='32'%20r='1.5'/%3E%3Ccircle%20cx='32'%20cy='32'%20r='1.5'/%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
    z-index: -1;
}
/* برق طلایی که روی کاشی می‌لغزد */
html:root:root:root .menu-tile::before {
    content: '';
    position: absolute;
    top: -20%; bottom: -20%;
    left: 0;
    width: 55%;
    height: auto;
    background: linear-gradient(100deg, transparent 0%, rgba(255, 236, 170, 0.0) 20%, rgba(255, 236, 170, 0.42) 50%, rgba(255, 236, 170, 0.0) 80%, transparent 100%);
    transform: translateX(-140%) skewX(-18deg);
    transition: none;
    pointer-events: none;
    z-index: 3;
}
html:root:root:root .menu-tile:hover::before,
html:root:root:root .menu-tile:focus-visible::before {
    transform: translateX(330%) skewX(-18deg);
    transition: transform 0.9s ease;
}
html:root:root:root .menu-tile:hover,
html:root:root:root .menu-tile:focus-visible {
    transform: translateY(-5px) !important;
    border-color: var(--rv-gold-2) !important;
    box-shadow:
        0 16px 30px rgba(0, 0, 0, 0.38),
        0 0 0 1px rgba(var(--rv-gold-rgb), 0.55),
        0 0 26px rgba(var(--rv-gold-rgb), 0.38),
        0 1px 0 rgba(255, 255, 255, 0.25) inset,
        0 -14px 24px rgba(0, 0, 0, 0.22) inset !important;
}
html:root:root:root .menu-tile:active { transform: translateY(-1px) scale(0.98) !important; }
html:root:root:root .menu-tile:focus-visible { outline: 2px solid var(--rv-gold-2); outline-offset: 2px; }

html:root:root:root .menu-tile > * { position: relative; z-index: 2; }

/* نشان طلایی آیکون (سکه‌ی طلا) */
html:root:root:root .menu-tile .ic-badge {
    --ic-size: 62px;
    margin: 0 auto 11px;
    border-radius: 50%;
    color: var(--rv-ink);
    background:
        radial-gradient(circle at 30% 24%, #fff7cf 0%, var(--rv-gold-2) 34%, var(--rv-gold) 72%, color-mix(in srgb, var(--rv-gold) 62%, #000) 100%) !important;
    box-shadow:
        0 0 0 2px rgba(var(--rv-gold-rgb), 0.95),
        0 0 0 4px rgba(0, 0, 0, 0.30),
        0 9px 18px rgba(0, 0, 0, 0.45),
        inset 0 2px 3px rgba(255, 255, 255, 0.65),
        inset 0 -4px 7px rgba(0, 0, 0, 0.26) !important;
    filter: none !important;
}
html:root:root:root .menu-tile .ic-badge::before { opacity: 0; }
html:root:root:root .menu-tile .ic-badge svg { width: 54%; height: 54%; filter: drop-shadow(0 1px 0 rgba(255,255,255,.45)); }
html:root:root:root .menu-tile:hover .ic-badge,
html:root:root:root .menu-tile:active .ic-badge {
    transform: translateY(-2px) scale(1.09) rotate(-4deg);
    box-shadow:
        0 0 0 2px var(--rv-gold-2),
        0 0 0 4px rgba(0, 0, 0, 0.30),
        0 0 22px rgba(var(--rv-gold-rgb), 0.75),
        0 10px 20px rgba(0, 0, 0, 0.5),
        inset 0 2px 3px rgba(255, 255, 255, 0.7),
        inset 0 -4px 7px rgba(0, 0, 0, 0.26) !important;
}
/* اگر آیکون SVG نبود و ایموجی آمد */
html:root:root:root .menu-tile-icon { filter: drop-shadow(0 2px 4px rgba(0,0,0,.45)) !important; }

html:root:root:root .menu-tile-title {
    color: var(--rv-cream) !important;
    font-weight: 900;
    letter-spacing: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
html:root:root:root .menu-tile-desc {
    color: var(--rv-gold-2) !important;
    opacity: 0.85;
    font-weight: 600;
}

/* ---------- دکمه‌ی «منوهای جانبی» ---------- */
html:root:root:root .hamburger-mini {
    background:
        linear-gradient(135deg, var(--rv-top), var(--rv-bot)) padding-box,
        linear-gradient(135deg, var(--rv-gold-2), var(--rv-gold), var(--rv-gold-2)) border-box !important;
    border: 1.5px solid transparent !important;
    color: var(--rv-gold-2) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.30), 0 0 14px rgba(var(--rv-gold-rgb), 0.28) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
html:root:root:root .hamburger-mini::before { background: linear-gradient(90deg, transparent, #fff3c4, transparent); }

/* ---------- پنل منوی جانبی ---------- */
html:root:root:root .menu-items {
    background:
        radial-gradient(90% 30% at 50% 0%, rgba(var(--rv-gold-rgb), 0.22), transparent 70%),
        linear-gradient(170deg, var(--rv-top), var(--rv-bot)) !important;
    border: 1.5px solid rgba(var(--rv-gold-rgb), 0.75) !important;
    border-radius: 24px !important;
    padding: 12px !important;
    box-shadow:
        0 22px 44px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(0, 0, 0, 0.25),
        0 0 28px rgba(var(--rv-gold-rgb), 0.22),
        inset 0 0 0 4px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

html:root:root:root .menu-item {
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(var(--rv-gold-rgb), 0.30) !important;
    border-radius: 16px !important;
    color: var(--rv-cream) !important;
    padding: 10px 12px !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
/* خط طلایی لبه‌ی راست هر ردیف */
html:root:root:root .menu-item::after {
    content: '';
    position: absolute;
    top: 14%; bottom: 14%; right: 0;
    width: 3px;
    border-radius: 3px 0 0 3px;
    background: linear-gradient(180deg, var(--rv-gold-2), var(--rv-gold));
    opacity: 0.85;
    pointer-events: none;
}
html:root:root:root .menu-item::before { background: linear-gradient(90deg, transparent, var(--rv-gold-2), transparent); height: 2px; }
html:root:root:root .menu-item:hover {
    background: rgba(var(--rv-gold-rgb), 0.20) !important;
    border-color: var(--rv-gold-2) !important;
    transform: translateX(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.30), 0 0 16px rgba(var(--rv-gold-rgb), 0.25);
}
html:root:root:root .menu-item:focus-visible { outline: 2px solid var(--rv-gold-2); outline-offset: 1px; }
html:root:root:root .menu-item-title { color: var(--rv-cream); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45); }
html:root:root:root .menu-item-desc { color: rgba(255, 246, 220, 0.68) !important; }

html:root:root:root .menu-item-icon .ic-badge {
    --ic-size: 40px;
    border-radius: 50%;
    color: var(--rv-ink);
    background: radial-gradient(circle at 30% 24%, #fff7cf 0%, var(--rv-gold-2) 36%, var(--rv-gold) 74%, color-mix(in srgb, var(--rv-gold) 62%, #000) 100%) !important;
    box-shadow:
        0 0 0 1.5px rgba(var(--rv-gold-rgb), 0.95),
        0 0 0 3px rgba(0, 0, 0, 0.28),
        0 5px 10px rgba(0, 0, 0, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.65),
        inset 0 -3px 5px rgba(0, 0, 0, 0.24) !important;
    filter: none !important;
}
html:root:root:root .menu-item-icon .ic-badge::before { opacity: 0; }
html:root:root:root .menu-item-icon .ic-badge svg { width: 54%; height: 54%; }

/* خروج: حاشیه‌ی قرمز ملایم بماند تا اشتباهی لمس نشود */
html:root:root:root .menu-item-logout {
    background: rgba(239, 68, 68, 0.14) !important;
    border-color: rgba(252, 165, 165, 0.55) !important;
    color: #ffd5d5 !important;
}
html:root:root:root .menu-item-logout::after { background: linear-gradient(180deg, #fca5a5, #ef4444); }
html:root:root:root .menu-item-logout .menu-item-title { color: #ffe1e1; }

/* ---------- ورود: برق طلایی یک‌بار روی کاشی‌ها (پشت‌سرهم) ---------- */
@keyframes rvEntranceGlint {
    0%   { transform: translateX(-140%) skewX(-18deg); opacity: 1; }
    100% { transform: translateX(330%) skewX(-18deg); opacity: 1; }
}
@media (prefers-reduced-motion: no-preference) {
    html:root:root:root .menu-tile::before { animation: rvEntranceGlint 1.1s ease-out both; animation-delay: calc(0.25s + var(--rv-i, 0) * 0.07s); }
    html:root:root:root .menu-tile:hover::before { animation: none; }
}
@media (prefers-reduced-motion: reduce) {
    html:root:root:root .menu-tile, html:root:root:root .menu-item, html:root:root:root .menu-tile .ic-badge { transition: none !important; }
    html:root:root:root .menu-tile:hover { transform: none !important; }
}

/* ---------- موبایل ---------- */
@media (max-width: 600px) {
    html:root:root:root .main-menu-grid { gap: 10px; }
    html:root:root:root .menu-tile { padding: 14px 4px 12px !important; border-radius: 18px !important; }
    html:root:root:root .menu-tile::after { inset: 4px; border-radius: 14px; }
    html:root:root:root .menu-tile .ic-badge { --ic-size: 50px; margin-bottom: 8px; }
}

/* ---------- نشان «مدیر کل» ---------- */
.role-badge.role-owner {
    background: linear-gradient(135deg, #f2c94c, #d4a017) !important;
    color: #3b2a00 !important;
    font-weight: 900;
    box-shadow: 0 0 0 1px rgba(120, 80, 0, 0.35), 0 2px 8px rgba(212, 160, 23, 0.45);
}

/* ==================== هدر بالای سایت - همان طرح سلطنتی ==================== */
html:root:root:root .site-header {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid rgba(var(--rv-gold-rgb), 0.6) !important;
    border-radius: 22px !important;
    background:
        radial-gradient(120% 90% at 50% -20%, rgba(var(--rv-gold-rgb), 0.34), transparent 62%),
        linear-gradient(158deg, var(--rv-top) 0%, var(--rv-bot) 100%) !important;
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.30),
        0 1px 0 rgba(255, 255, 255, 0.20) inset,
        0 -16px 28px rgba(0, 0, 0, 0.22) inset !important;
}
/* قاب طلایی داخلی + نگین (لوزی گل‌دار) */
html:root:root:root .site-header::after {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 17px;
    border: 1px solid rgba(var(--rv-gold-rgb), 0.45);
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%3E%3Cg%20fill='none'%20stroke='%23f2c94c'%20stroke-width='.8'%20stroke-opacity='.22'%3E%3Cpath%20d='M16%200L32%2016L16%2032L0%2016Z'/%3E%3Cpath%20d='M16%207L25%2016L16%2025L7%2016Z'/%3E%3C/g%3E%3Cg%20fill='%23f2c94c'%20fill-opacity='.22'%3E%3Ccircle%20cx='16'%20cy='16'%20r='1.8'/%3E%3Ccircle%20cx='0'%20cy='0'%20r='1.5'/%3E%3Ccircle%20cx='32'%20cy='0'%20r='1.5'/%3E%3Ccircle%20cx='0'%20cy='32'%20r='1.5'/%3E%3Ccircle%20cx='32'%20cy='32'%20r='1.5'/%3E%3C/g%3E%3C/svg%3E");
    background-color: transparent;
    pointer-events: none;
    z-index: -1;
}
/* برق طلایی که هر چند ثانیه یک بار از روی هدر می‌گذرد */
html:root:root:root .site-header::before {
    content: '';
    position: absolute;
    top: -20%; bottom: -20%;
    left: 0;
    width: 40%;
    background: linear-gradient(100deg, transparent 0%, rgba(255, 236, 170, 0.0) 20%, rgba(255, 236, 170, 0.30) 50%, rgba(255, 236, 170, 0.0) 80%, transparent 100%);
    transform: translateX(-160%) skewX(-18deg);
    pointer-events: none;
    z-index: 0;
    animation: rvHeaderShine 9s ease-in-out 1.5s infinite;
}
@keyframes rvHeaderShine {
    0%, 70% { transform: translateX(-160%) skewX(-18deg); }
    100% { transform: translateX(380%) skewX(-18deg); }
}
@media (prefers-reduced-motion: reduce) {
    html:root:root:root .site-header::before { animation: none; }
}
html:root:root:root .site-header > * { position: relative; z-index: 1; }
html:root:root:root .site-title {
    color: var(--rv-cream) !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
html:root:root:root .site-title img {
    position: relative;
    z-index: 5;
    width: 78px !important;
    height: 78px !important;
    padding: 5px;
    border-radius: 24px;
    background: rgba(255, 246, 220, 0.95);
    box-shadow: none;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
    box-sizing: border-box;
}
html:root:root:root .site-header .user-info span {
    background: linear-gradient(var(--rv-ink), var(--rv-ink)) padding-box,
                linear-gradient(135deg, var(--rv-gold-2), var(--rv-gold)) border-box !important;
    border: 1px solid transparent !important;
    color: var(--rv-gold-2) !important;
    font-weight: bold;
}
html:root:root:root .site-header .quran-verse {
    background: rgba(0, 0, 0, 0.26) !important;
    border: 1px solid rgba(var(--rv-gold-rgb), 0.45) !important;
    color: var(--rv-cream) !important;
}
@media (max-width: 600px) {
    html:root:root:root .site-header { border-radius: 18px !important; }
    html:root:root:root .site-header::after { inset: 4px; border-radius: 14px; }
}

/* طرح‌های ساده‌ی قدیمی (سبز، آبی، …) توکن chrome ندارند؛ رنگ سلطنتی را از رنگ خود همان طرح می‌گیرند */
html:not([data-themed]) {
    --rv-top: color-mix(in srgb, var(--islamic-green-light, #0ea5e9) 55%, #000);
    --rv-bot: color-mix(in srgb, var(--islamic-green, #0284c7) 62%, #000);
    --rv-ink: color-mix(in srgb, var(--islamic-green, #0284c7) 50%, #000);
}
