/* ==========================================================================
   گنجینه — لایه‌ی هویت بصری موقوفه (روی base.css، هم سایت و هم پنل‌ها)
   طاق ایوانی، گره‌چینی هشت‌پر، قاب طلایی، خطوط تذهیب. همه با متغیرهای رنگ پوسته.
   ========================================================================== */

/* ---------------------------------------------------------------- تایپوگرافی تزئینی */
.kufi { font-family: var(--font-display); letter-spacing: 0; }
.nastaliq { font-family: var(--font-nastaliq); font-weight: 400; line-height: 2.1; }
.display-xl { font-family: var(--font-display); font-size: clamp(2.2rem, 5.6vw, 4.2rem); line-height: 1.25; }
.text-grad { background: var(--grad-logo); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-theme="dark"] .text-grad { background: linear-gradient(180deg, var(--brand-3), var(--gold-2)); -webkit-background-clip: text; background-clip: text; }
.gold-grad { background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------------------------------------------------------------- نقش گره (ماسک؛ رنگ از --gold) */
.girih-bg { position: relative; isolation: isolate; }
.girih-bg::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--gold); opacity: var(--girih-opacity, .10);
  -webkit-mask: var(--pattern) 0 0 / var(--girih-size, 120px) repeat; mask: var(--pattern) 0 0 / var(--girih-size, 120px) repeat;
}
.girih-fade::before { -webkit-mask-image: var(--pattern), linear-gradient(to bottom, #000, transparent 85%); mask-image: var(--pattern), linear-gradient(to bottom, #000, transparent 85%); -webkit-mask-composite: source-in; mask-composite: intersect; -webkit-mask-size: var(--girih-size, 120px), 100% 100%; mask-size: var(--girih-size, 120px), 100% 100%; }
body.has-pattern { background-image: none; }
body.has-pattern::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--gold); opacity: var(--site-pattern-opacity, .05);
  -webkit-mask: var(--site-pattern, var(--pattern)) 0 0 / var(--site-pattern-size, 140px) repeat; mask: var(--site-pattern, var(--pattern)) 0 0 / var(--site-pattern-size, 140px) repeat;
}

/* ---------------------------------------------------------------- جداکننده‌ی تذهیب */
.ornament { display: flex; align-items: center; gap: 14px; color: var(--gold); margin: 18px auto; max-width: 420px; }
.ornament::before, .ornament::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.ornament::after { background: linear-gradient(90deg, var(--gold), transparent); }
.ornament i { width: 10px; height: 10px; transform: rotate(45deg); background: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.ornament.start { margin-inline: 0; }

/* ---------------------------------------------------------------- طاق ایوانی (قاب تصویر و کارت) */
.arch { --r: 999px; border-radius: var(--r) var(--r) var(--radius) var(--radius); overflow: hidden; }
.arch-pointed { clip-path: path('M0,100% L0,32% C0,14% 22%,4% 50%,0 C78%,4% 100%,14% 100%,32% L100%,100% Z'); }
.arch-frame { position: relative; padding: 10px; border-radius: 999px 999px 28px 28px; background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad-gold) border-box; border: 1.5px solid transparent; box-shadow: var(--shadow-lg); }
.arch-frame > img, .arch-frame > .arch-inner { display: block; width: 100%; border-radius: 999px 999px 20px 20px; object-fit: cover; }

/* کارت طاقی خدمات */
.iwan-card {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 34px 24px 24px; text-align: center; height: 100%;
  border-radius: 140px 140px var(--radius-lg) var(--radius-lg); background: var(--surface); border: 1px solid var(--line);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease), border-color .4s; color: inherit; overflow: hidden; isolation: isolate;
}
.iwan-card::before { content: ''; position: absolute; inset: 8px 8px auto; height: 55%; border-radius: 130px 130px 0 0; border: 1px solid var(--line); border-bottom: 0; z-index: -1; transition: border-color .4s; }
.iwan-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--gold-3); color: inherit; }
.iwan-card:hover::before { border-color: var(--gold-2); }
.iwan-card .iw-icon { width: 64px; height: 64px; margin: 0 auto 6px; display: grid; place-items: center; border-radius: 20px; transform: rotate(45deg); background: var(--grad-brand); box-shadow: var(--shadow); }
.iwan-card .iw-icon > * { transform: rotate(-45deg); color: var(--gold-3); width: 26px; height: 26px; }
.iwan-card h3 { font-size: 1.05rem; margin: 6px 0 0; }
.iwan-card p { color: var(--muted); font-size: .88rem; margin: 0; }
.iwan-card .iw-lock { position: absolute; top: 16px; inset-inline-end: 16px; }

/* ---------------------------------------------------------------- لوگو و برند */
.brand .brand-logo { height: 46px; width: auto; }
.brand-logo-light { display: none; }
[data-theme="dark"] .brand .brand-logo-dark { display: none; }
[data-theme="dark"] .brand .brand-logo-light { display: block; }
.sidebar .brand .brand-logo-dark, .site-footer .brand .brand-logo-dark, .on-dark .brand .brand-logo-dark { display: none; }
.sidebar .brand .brand-logo-light, .site-footer .brand .brand-logo-light, .on-dark .brand .brand-logo-light { display: block; }
.logo-hero { width: min(420px, 80%); filter: drop-shadow(0 20px 40px color-mix(in srgb, var(--c-brand2) 35%, transparent)); }

/* ---------------------------------------------------------------- قاب طلایی لوکس */
.lux-frame { position: relative; border-radius: var(--radius-xl); padding: 1.5px; background: var(--grad-gold); box-shadow: var(--shadow-lg); }
.lux-frame > .lux-inner { border-radius: calc(var(--radius-xl) - 1.5px); background: var(--surface); padding: clamp(22px, 4vw, 40px); position: relative; overflow: hidden; }
.corner-orn { position: absolute; width: 56px; height: 56px; pointer-events: none; opacity: .7; border: 1.5px solid var(--gold); }
.corner-orn.tl { top: 12px; inset-inline-start: 12px; border-inline-end: 0; border-bottom: 0; border-start-start-radius: 14px; }
.corner-orn.tr { top: 12px; inset-inline-end: 12px; border-inline-start: 0; border-bottom: 0; border-start-end-radius: 14px; }
.corner-orn.bl { bottom: 12px; inset-inline-start: 12px; border-inline-end: 0; border-top: 0; border-end-start-radius: 14px; }
.corner-orn.br { bottom: 12px; inset-inline-end: 12px; border-inline-start: 0; border-top: 0; border-end-end-radius: 14px; }

/* ---------------------------------------------------------------- باند آمار */
.stat-band { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border-radius: var(--radius-xl); overflow: hidden; background: var(--grad-brand); color: #F4EFE3; box-shadow: var(--shadow-lg); position: relative; isolation: isolate; }
.stat-band::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--c-accent); opacity: .08; -webkit-mask: var(--pattern) 0 0 / 110px repeat; mask: var(--pattern) 0 0 / 110px repeat; }
.stat-band > div { padding: 30px 22px; text-align: center; border-inline-start: 1px solid rgba(255, 255, 255, .08); }
.stat-band > div:first-child { border-inline-start: 0; }
.stat-band b { display: block; font-family: var(--font-display); font-size: clamp(1.9rem, 3.4vw, 2.7rem); line-height: 1.2; color: var(--gold-3); }
.stat-band > div > span { font-size: .88rem; opacity: .8; }
.stat-band b [data-count] { font-size: inherit; opacity: 1; }

/* ---------------------------------------------------------------- وضعیت قفل (امکان نیازمند تأیید پروفایل) */
.lock-note { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--warn); background: var(--warn-soft); padding: 2px 10px; border-radius: 999px; }
.is-locked { opacity: .62; filter: saturate(.6); }

/* ---------------------------------------------------------------- جدول قوانین لغو */
.policy-steps { display: grid; gap: 8px; }
.policy-step { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.policy-step .ps-bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.policy-step .ps-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), var(--warn), var(--bad)); }
.policy-step.is-current { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.policy-step .ps-fee { font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- فاکتور/رسید */
.invoice { border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.invoice-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 18px; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.invoice-row:last-child { border-bottom: 0; }
.invoice-row.total { background: var(--gold-soft); font-weight: 800; font-size: 1.02rem; border-bottom: 0; }
.invoice-row.minus span:last-child { color: var(--bad); }
.invoice-row.plus span:last-child { color: var(--ok); }

/* ---------------------------------------------------------------- کارت بانکی مقصد */
.bank-card { position: relative; border-radius: 22px; padding: 24px; aspect-ratio: 1.6 / 1; max-width: 400px; color: #F4EFE3; background: var(--grad-brand); box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; isolation: isolate; }
.bank-card::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--c-accent); opacity: .12; -webkit-mask: var(--pattern) 0 0 / 90px repeat; mask: var(--pattern) 0 0 / 90px repeat; }
.bank-card .bc-no { font-size: clamp(1.15rem, 3.4vw, 1.5rem); letter-spacing: .12em; direction: ltr; font-variant-numeric: tabular-nums; font-weight: 700; }
.bank-card .bc-chip { width: 44px; height: 32px; border-radius: 7px; background: var(--grad-gold); }

/* ---------------------------------------------------------------- مودال سبک (برای بخش‌هایی که Alpine ندارند) */
.gk-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgba(4, 8, 18, .6); backdrop-filter: blur(6px); }
.gk-modal[hidden] { display: none; }
.gk-modal > .gk-dialog { width: min(640px, 100%); max-height: 90vh; overflow: auto; border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-lg); border: 1px solid var(--line); }

/* ---------------------------------------------------------------- دستیار هوشمند (دکمه‌ی شناور) */
.assistant-fab { position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 120; width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: var(--gold-3); background: var(--grad-brand); box-shadow: var(--shadow-lg), 0 0 0 6px color-mix(in srgb, var(--c-brand) 18%, transparent); transition: transform .3s var(--ease); }
.assistant-fab:hover { transform: scale(1.06) rotate(-4deg); }
.assistant-fab .icon { width: 26px; height: 26px; }

@media (max-width: 640px) {
  .iwan-card { border-radius: 90px 90px var(--radius) var(--radius); padding: 28px 18px 20px; }
  .stat-band > div { padding: 22px 12px; }
}

/* ---------------------------------------------------------------- چاپ رسمی (برگه‌ی رزرو، کارت، رسید) */
@media print {
  .assistant-fab, .site-header, .site-footer, .topbar, .sidebar, .topnav, .no-print { display: none !important; }
  body { background: #fff !important; }
  .girih-bg::before, body.has-pattern::before { display: none; }
}

/* ---------------------------------------------------------------- سربرگ در گوشی: بدون اسکرول افقی */
@media (max-width: 560px) {
  .site-header .brand-name, .site-header .brand-sub { display: none; }
  .site-header .brand .brand-logo { height: 38px; }
  .site-header .header-actions { gap: 4px; }
  .site-header .header-actions .btn-icon { width: 36px; height: 36px; }
  .site-header .container { gap: 8px; padding-inline: 12px; }
  html, body { overflow-x: clip; }
}
/* منوی کشویی بیرون از صفحه نباید اسکرول افقی بسازد */
@media (max-width: 1020px) { html, body.site { overflow-x: clip; } }
/* اعلان‌های شناور بالای دکمه‌ی دستیار قرار بگیرند */
body:has(.assistant-fab) .toasts { bottom: 96px; }

/* ---------------------------------------------------------------- [X2] حالت embed: صفحه‌ی پنل داخل WebView اپ موبایل (body.is-embed) */
body.is-embed .sidebar, body.is-embed .topnav, body.is-embed .panel-foot, body.is-embed .assistant-fab { display: none !important; }
body.is-embed .panel-shell { display: block; min-height: 100vh; min-height: 100dvh; }
body.is-embed .panel-content { padding: 14px 12px; max-width: none; }
body.is-embed .toasts { bottom: 16px; }
