/* =========================================================
   سیوان — استایل‌شیت اصلی (نسخه پاکسازی‌شده)
   نکته: نسخه‌ی قبلی این فایل چند لایه طراحی روی هم داشت که
   آخری‌ها بقیه را بی‌اثر می‌کردند. این نسخه فقط طرح نهایی
   واقعی را نگه داشته تا فایل قابل نگهداری و شفاف باشد.
   ========================================================= */

/* توجه: @font-face های فونت فارسی و انگلیسی به‌صورت پویا توسط assets/js/common.js
   (بخش «مدیریت فونت») تزریق می‌شوند تا هم فونت‌های آماده و هم فونت‌های آپلودی کاربر
   با همان تکنیک یکسان (unicode-range زیر یک font-family به نام SivanFont) اعمال شوند. */

 :root{
  --grad1:#0E3A5F; --grad2:#12897C; --grad3:#D9A441; --primary:#0E7C8C;
  --theme-bg:#FAF6EC; --theme-text:#211D17;
  --bg:var(--theme-bg); --surface:#fff; --input-bg:#fcfaf5; --text:var(--theme-text);
  --muted:#756B5A; --border:#E7DFCB; --radius:24px; --font:'SivanFont',Tahoma,sans-serif;
}

html[data-theme="dark"]{
  --bg:#0b1018; --surface:#121a26; --input-bg:#0d1520; --text:#f5f7fb;
  --muted:#b9c2d0; --border:#2b394c;
}

*{ box-sizing: border-box; }
/* line-height به‌صورت عددی (نسبت به font-size) ثابت می‌شود، نه «normal».
   این‌طوری اندازه‌ی واقعی هر فونت (BNazanin، Rezvan، Oliver، ...) در ارتفاع
   قابل‌محاسبه‌ی خودش هیچ تأثیری نمی‌گذارد و با عوض‌شدن فونت، ارتفاع خطوط و
   در نتیجه ارتفاع کل صفحه ثابت می‌ماند (نیازی به اسکرول برای فونت‌های مختلف نیست).
   مقادیر line-height اختصاصی‌ای که جاهای دیگر تعریف شده‌اند (مثل .subtitle) دست‌نخورده می‌مانند. */
html,body{ margin:0; min-height:100%; font-family: var(--font); font-size:17px; line-height:1.25; }
body{
  background-color: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 1.6px);
  background-size: 26px 26px;
  color: var(--text);
}
a{ text-decoration:none; color: var(--primary); }
a:hover{ text-decoration:underline; }
button,input{ font: inherit; }

/* ---------- پس‌زمینه‌ی تصویری مشترک (صفحه ورود، ثبت‌نام و صفحات فرعی احراز هویت) ---------- */
.visual, .simple-page{
  color:#fff; position:relative; overflow:hidden; isolation:isolate;
  background:
    radial-gradient(circle at 15% 20%, color-mix(in srgb, var(--grad3) 55%, transparent) 0 2%, transparent 25%),
    radial-gradient(circle at 85% 80%, color-mix(in srgb, var(--grad2) 65%, transparent) 0 4%, transparent 30%),
    linear-gradient(135deg, var(--grad1), var(--grad2));
}
.visual::before, .simple-page::before{
  content:""; position:absolute; inset:0;
  animation: modernFloat 16s ease-in-out infinite alternate;
  background:
    linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px),
    radial-gradient(circle at 78% 18%, rgba(255,255,255,.22) 0 1px, transparent 2px),
    radial-gradient(circle at 30% 75%, rgba(255,255,255,.18) 0 1px, transparent 2px);
  background-size: 48px 48px, 48px 48px, 18px 18px, 22px 22px;
  mask-image: linear-gradient(135deg, rgba(0,0,0,.8), transparent 75%);
  z-index:0;
}
.visual::after, .simple-page::after{
  content:""; position:absolute; width:440px; height:440px; right:-170px; top:-120px; left:auto; bottom:auto;
  border-radius:50%; opacity:.55; filter:blur(1px);
  animation: orbMove 12s ease-in-out infinite alternate;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.35), rgba(255,255,255,.08) 35%, transparent 65%);
  border:1px solid rgba(255,255,255,.16);
  box-shadow: inset 0 0 70px rgba(255,255,255,.08);
  z-index:0;
}
@keyframes modernFloat{ 0%{ background-position:0 0,0 0,0 0,0 0; } 100%{ background-position:48px 48px,-48px 48px,36px 36px,-30px 30px; } }
@keyframes orbMove{ from{ transform:translate3d(0,0,0) scale(1); } to{ transform:translate3d(-55px,55px,0) scale(1.12); } }

/* ---------- چیدمان دوستونه (صفحات ورود و ثبت‌نام) ---------- */
.page{ min-height:100vh; display:flex; direction:rtl; }

.visual{
  flex:1; display:flex; align-items:center; justify-content:center; padding:40px;
}

.visual-content{
  position:relative; z-index:1; text-align:center; max-width:460px;
  padding:38px; border:1px solid rgba(255,255,255,.14); border-radius:32px;
  background: linear-gradient(135deg, rgba(255,255,255,.10), rgba(255,255,255,.025));
  backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(0,0,0,.16);
}
.brand{
  display:inline-block; border:1px solid rgba(255,255,255,.5); padding:5px 26px;
  border-radius:99px; font-size:22px; background:rgba(255,255,255,.1);
  backdrop-filter: blur(8px); box-shadow:0 8px 30px rgba(0,0,0,.1);
}
.visual h1{ font-size:38px; margin:26px 0 10px; letter-spacing:.2px; text-shadow:0 8px 30px rgba(0,0,0,.18); }
.visual p{ font-size:19px; line-height:1.85; opacity:.92; margin:0; }

/* ---------- هویت برند / لوگو ---------- */
.brand-logo{
  width:104px; height:104px; margin:0 auto 20px; border-radius:28px;
  border:1px solid rgba(255,255,255,.5); background:rgba(255,255,255,.12);
  backdrop-filter: blur(8px); display:flex; align-items:center; justify-content:center;
  overflow:hidden; box-shadow:0 15px 40px rgba(0,0,0,.15);
}
.brand-logo img{ width:100%; height:100%; object-fit:contain; padding:10px; }
.brand-logo .fallback{ font-size:36px; color:#fff; }
.brand-logo.logo-square{ border-radius:14px; }
.brand-logo.logo-circle{ border-radius:50%; }

/* برند کوچک بالای کارت فرم — روی همه‌ی صفحات یکسان نمایش داده می‌شود */
.mini-brand{
  display:inline-block; margin:0 auto 18px; font-size:14px; font-weight:700;
  color: var(--primary); letter-spacing:.4px; padding:5px 16px;
  border:1px solid var(--border); border-radius:99px; background: var(--bg);
}
.card > .mini-brand{ display:block; width:fit-content; margin-inline:auto; }

/* ---------- کارت فرم ---------- */
.form-area{ flex:1; display:flex; align-items:center; justify-content:center; padding:35px; }
.card{
  position:relative; overflow:hidden; width:min(440px,100%); color: var(--text);
  background-color: var(--surface);
  background-image:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1.6px);
  background-size: 22px 22px;
  border:1px solid var(--border); border-radius: var(--radius);
  padding:42px; box-shadow:0 20px 60px rgba(0,0,0,.12); text-align:center;
}
.card::before{
  content:""; position:absolute; width:180px; height:180px; left:-100px; bottom:-110px;
  border-radius:50%; background: color-mix(in srgb, var(--grad3) 22%, transparent);
  filter: blur(12px); pointer-events:none;
}
.form-area .card::after{
  content:""; position:absolute; width:150px; height:150px; right:-90px; top:-90px;
  border-radius:50%; background: color-mix(in srgb, var(--grad2) 16%, transparent);
  filter: blur(14px); pointer-events:none;
}
.card > *{ position:relative; z-index:1; }
.card h1{ font-size:30px; margin:0 0 6px; }
.subtitle{ color: var(--muted); margin:0 0 26px; line-height:1.8; }

.field{ text-align:right; margin-bottom:18px; }
.field label{ display:block; margin-bottom:6px; color: var(--muted); font-size:14.5px; }
.field input{
  width:100%; padding:13px 15px; border:1px solid var(--border); border-radius:12px;
  background: var(--input-bg); color: var(--text); outline:none;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.field input::placeholder{ color: var(--muted); opacity:.8; }
.field input:focus{ border-color: var(--primary); box-shadow:0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); transform: translateY(-1px); }

.password-wrap{ position:relative; }
.eye{
  position:absolute; left:6px; top:50%; transform:translateY(-50%);
  border:0; background:transparent; cursor:pointer; width:34px; height:34px;
  display:flex; align-items:center; justify-content:center; border-radius:50%; color: var(--muted);
}
.eye:hover{ background: var(--bg); }

.options{ display:flex; justify-content:space-between; align-items:center; margin:6px 0 22px; font-size:14.5px; }
.options label{ display:flex; align-items:center; gap:6px; color: var(--muted); cursor:pointer; }
.options input[type="checkbox"]{ width:16px; height:16px; accent-color: var(--primary); }

.btn{
  width:100%; border:0; border-radius:12px; padding:14px; color:#fff; font-size:18px; cursor:pointer;
  background: linear-gradient(120deg, var(--grad1), var(--grad2));
  box-shadow: 0 14px 30px color-mix(in srgb, var(--primary) 28%, transparent);
  transition: transform .25s ease, box-shadow .25s ease, filter .2s ease;
}
.btn:hover{ transform: translateY(-2px); filter:brightness(1.05); box-shadow:0 18px 36px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn:active{ transform: translateY(0); }

.divider{ text-align:center; color: var(--muted); margin:24px 0; font-size:13.5px; }
.divider::before,.divider::after{ content:""; display:inline-block; width:28%; height:1px; background: var(--border); vertical-align:middle; margin:0 8px; }

.socials{ display:flex; gap:10px; }
.socials button{
  flex:1; padding:11px; border:1px solid var(--border); background: var(--surface); color: var(--text); border-radius:10px;
  cursor:pointer; transition: border-color .2s ease, transform .2s ease;
}
.socials button:hover{ border-color: var(--primary); transform: translateY(-2px); }

.footer{ text-align:center; margin-top:22px; color: var(--muted); font-size:14.5px; }

.message{ display:none; padding:10px 12px; border-radius:10px; margin-bottom:15px; text-align:center; font-size:14px; }
.message.show{ display:block; }
.message.error{ background:#fee2e2; color:#991b1b; }
.message.success{ background:#dcfce7; color:#166534; }

/* ---------- صفحات فرعی احراز هویت (فراموشی رمز / تأیید کد / رمز جدید) ---------- */
/* پس‌زمینه‌ی این صفحات با پس‌زمینه‌ی پنل تصویری صفحات ورود/ثبت‌نام مشترک است (تعریف در بالای فایل) */
.simple-page{
  min-height:100vh; display:flex; align-items:center; justify-content:center; padding:25px;
}

.simple-page .card{
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border:1px solid rgba(255,255,255,.38); box-shadow:0 30px 100px rgba(0,0,0,.28);
}
.simple-page .card::after{
  content:""; display:block; width:58px; height:4px; border-radius:99px;
  background: linear-gradient(90deg, var(--grad3), var(--primary)); margin:0 auto 20px;
}
.simple-page .subtitle{ font-size:16.5px; }
.simple-page .footer{ margin-top:24px; }
.simple-page .mini-brand{ background: rgba(255,255,255,.5); }

/* ---------- پنل مدیریت ---------- */
.admin{ max-width:1200px; margin:auto; padding:32px 24px 60px; }
.admin-header{ display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom:26px; flex-wrap:wrap; }
.admin-header h1{ margin:0 0 4px; font-size:24px; }
.admin-header p{ margin:0; color: var(--muted); }
.secondary-link{ padding:9px 16px; border:1px solid var(--border); border-radius:10px; background: var(--surface); color: var(--text); }

.admin-tabs{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:22px; border-bottom:1px solid var(--border); padding-bottom:14px; }
.admin-tabs button{ border:1px solid var(--border); background: var(--surface); color: var(--text); border-radius:10px; padding:10px 18px; cursor:pointer; transition: all .2s ease; }
.admin-tabs button:hover{ border-color: var(--primary); }
.admin-tabs button.active{ background: var(--primary); color:#fff; border-color: var(--primary); }

.admin-view{ display:none; }
.admin-view.active{ display:block; animation: fadeIn .3s ease; }
@keyframes fadeIn{ from{ opacity:0; transform:translateY(6px); } to{ opacity:1; transform:translateY(0); } }

.panel{ background: var(--surface); color: var(--text); border:1px solid var(--border); padding:24px; border-radius:20px; }
.panel.wide{ width:100%; }
.panel h2{ margin:0 0 6px; font-size:19px; }
.panel > p{ color: var(--muted); margin:0 0 18px; font-size:14.5px; }
.panel h2.section-title{ margin-top:32px; border-top:1px solid var(--border); padding-top:22px; font-size:18px; }

.grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap:18px; }

.settings-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap:16px; }
.settings-grid label,.custom-palette label{ display:flex; flex-direction:column; gap:6px; color: var(--muted); font-size:13.5px; }
.settings-grid input,.settings-grid select,.custom-palette input{
  width:100%; margin:0; padding:9px 10px; border:1px solid var(--border); border-radius:9px; font-size:14px;
  color: var(--text); background: var(--input-bg);
}
.custom-palette{ display:grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap:16px; }
.custom-palette input[type="color"]{ height:42px; padding:3px; cursor:pointer; }

.presets{ display:grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap:14px; }
.preset{ border:2px solid var(--border); background: var(--surface); color: var(--text); border-radius:16px; padding:12px; cursor:pointer; font-family:inherit; font-size:15px; transition: all .2s ease; }
.preset i{ display:block; height:48px; border-radius:10px; background: linear-gradient(135deg, var(--a), var(--b) 65%, var(--c)); margin-bottom:8px; }
.preset:hover{ border-color: var(--primary); transform: translateY(-2px); }
.preset.active{ border-color: var(--primary); box-shadow:0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }

.toggle-list{ display:flex; gap:24px; flex-wrap:wrap; margin-top:22px; font-size:14.5px; }
.toggle-list label{ display:flex; align-items:center; gap:8px; cursor:pointer; }

/* ---------- مدیریت فونت ---------- */
.font-groups{ display:grid; grid-template-columns: repeat(auto-fit, minmax(320px,1fr)); gap:24px; }
.font-group h3{ margin:0 0 12px; font-size:16px; }
.font-list{ display:grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap:12px; }
.font-card{
  position:relative; border:2px solid var(--border); background: var(--surface); color: var(--text);
  border-radius:14px; padding:14px 14px 12px; cursor:pointer; text-align:right; transition: all .2s ease;
}
.font-card:hover{ border-color: var(--primary); transform: translateY(-2px); }
.font-card.active{ border-color: var(--primary); box-shadow:0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.font-card .font-preview{ font-size:20px; line-height:1.4; margin-bottom:8px; word-break:break-word; }
.font-card .font-name{ display:block; font-size:12.5px; color: var(--muted); }
.font-card .font-current-badge{
  display:inline-block; margin-inline-start:4px; padding:1px 8px; border-radius:99px;
  background: var(--primary); color:#fff; font-size:11px; font-weight:700; vertical-align:middle;
}
.font-card .font-remove{
  position:absolute; top:8px; left:8px; width:22px; height:22px; border-radius:50%; border:0;
  background: var(--border); color: var(--text); font-size:13px; line-height:1; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
}
.font-card .font-remove:hover{ background:#e11d48; color:#fff; }
.font-upload-form{
  display:grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap:16px; align-items:end; margin-top:18px;
}
.font-upload-form label{ display:flex; flex-direction:column; gap:6px; color: var(--muted); font-size:13.5px; }
.font-upload-form input[type="text"], .font-upload-form input[type="file"]{
  padding:9px 10px; border:1px solid var(--border); border-radius:9px; font-size:14px;
  color: var(--text); background: var(--input-bg);
}
.font-lang-radio{ flex-direction:row !important; align-items:center; gap:18px !important; }
.font-lang-radio span{ display:flex; align-items:center; gap:6px; cursor:pointer; }
.font-upload-form button{ padding:10px 18px; border-radius:9px; border:0; background: var(--primary); color:#fff; cursor:pointer; font-size:14px; }
.font-empty-note{ color: var(--muted); font-size:13px; }

.admin-note{ color: var(--muted); font-size:13px; margin-top:14px; }
.admin-actions{ display:flex; gap:10px; margin-top:24px; position:sticky; bottom:0; background:linear-gradient(0deg, var(--bg) 60%, transparent); padding:14px 0 4px; }
.admin-actions button{ padding:12px 22px; border-radius:10px; border:0; cursor:pointer; font-size:15px; transition: transform .2s ease; }
.admin-actions button:hover{ transform: translateY(-2px); }
.primary{ background: var(--primary); color:#fff; }
.secondary{ background: var(--border); color: var(--text); }

.admin-logo-preview{
  width:130px; height:130px; border:2px dashed var(--border); border-radius:20px;
  display:flex; align-items:center; justify-content:center; margin:10px 0 16px;
  overflow:hidden; background: var(--bg); color: var(--muted); font-size:13px;
}
.admin-logo-preview img{ width:100%; height:100%; object-fit:contain; padding:8px; }

/* ---------- تم شب سراسری ---------- */
html[data-theme="dark"] body{ color:var(--text); background-color:var(--bg); background-image:radial-gradient(circle at 1px 1px, rgba(255,255,255,.045) 1px, transparent 1.6px); }
html[data-theme="dark"] .card, html[data-theme="dark"] .panel, html[data-theme="dark"] .socials button, html[data-theme="dark"] .secondary-link, html[data-theme="dark"] .preset{ color:var(--text); }
html[data-theme="dark"] .card{ background-color:var(--surface); background-image:radial-gradient(circle at 1px 1px, rgba(255,255,255,.045) 1px, transparent 1.6px); border-color:var(--border); }
html[data-theme="dark"] .field label, html[data-theme="dark"] .options label, html[data-theme="dark"] .footer, html[data-theme="dark"] .subtitle, html[data-theme="dark"] .divider, html[data-theme="dark"] .panel > p, html[data-theme="dark"] .settings-grid label, html[data-theme="dark"] .custom-palette label, html[data-theme="dark"] .admin-note, html[data-theme="dark"] .admin-header p{ color:var(--muted); }
html[data-theme="dark"] .card h1, html[data-theme="dark"] .panel h2, html[data-theme="dark"] .admin-header h1, html[data-theme="dark"] .admin-header p, html[data-theme="dark"] .admin-note{ color:var(--text); }
html[data-theme="dark"] .field input, html[data-theme="dark"] .settings-grid input, html[data-theme="dark"] .settings-grid select, html[data-theme="dark"] .custom-palette input{ color:var(--text); background:var(--input-bg); border-color:var(--border); caret-color:var(--text); }
html[data-theme="dark"] .field input::placeholder{ color:#9da8b8; opacity:1; }
html[data-theme="dark"] .mini-brand{ color:var(--text); background:rgba(255,255,255,.07); border-color:var(--border); }
html[data-theme="dark"] .simple-page .mini-brand{ background:rgba(255,255,255,.08); }
html[data-theme="dark"] .simple-page .card{ background:color-mix(in srgb,var(--surface) 94%,transparent); border-color:rgba(255,255,255,.18); }
html[data-theme="dark"] .secondary{ background:#263244; color:var(--text); }
html[data-theme="dark"] .message.error{ background:#451d26; color:#ffb4bd; }
html[data-theme="dark"] .message.success{ background:#123a2a; color:#9be7bd; }
html[data-theme="dark"] .admin-actions{ background:linear-gradient(0deg,var(--bg) 60%,transparent); }
html[data-theme="dark"] .admin-tabs{ border-color:var(--border); }
html[data-theme="dark"] .admin-tabs button{ background:var(--surface); color:var(--text); border-color:var(--border); }
html[data-theme="dark"] .admin-tabs button.active{ color:#fff; }
html[data-theme="dark"] .font-card{ background:var(--surface); color:var(--text); border-color:var(--border); }
html[data-theme="dark"] .font-card .font-name{ color:var(--muted); }
html[data-theme="dark"] .font-group h3{ color:var(--text); }
html[data-theme="dark"] .font-upload-form label{ color:var(--muted); }
html[data-theme="dark"] .font-upload-form input{ color:var(--text); background:var(--input-bg); border-color:var(--border); }
html[data-theme="dark"] .font-empty-note{ color:var(--muted); }
html[data-theme="dark"] .eye{ color:var(--muted); }

.theme-toggle{
  position:fixed; z-index:50; top:18px; left:18px; width:44px; height:44px; border-radius:50%;
  border:1px solid rgba(255,255,255,.32); background:rgba(17,24,39,.92); color:#fff;
  display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:22px;
  box-shadow:0 10px 28px rgba(0,0,0,.18); backdrop-filter:blur(10px);
}
.theme-toggle:hover{ transform:translateY(-1px); }
html[data-theme="dark"] .theme-toggle{ background:#f4f7fb; color:#17202c; border-color:#d7deea; }

/* ---------- واکنش‌گرایی ---------- */
@media (max-width:860px){
  .visual-content{ padding:28px; }
  .visual::after{ width:300px; height:300px; }
}
@media (max-width:800px){
  .page{ flex-direction:column; }
  .visual{ min-height:34vh; padding:30px; }
  .visual h1{ font-size:28px; }
  .card{ padding:30px 22px; }
  .socials{ flex-wrap:wrap; }
  .socials button{ min-width:30%; }
}
@media (max-width:700px){
  .simple-page{ padding:18px; }
  .simple-page .card{ padding:30px 22px; }
  .visual::after, .simple-page::after{ width:300px; height:300px; }
  .admin{ padding:20px 16px 48px; }
  .admin-header{ flex-direction:column; align-items:flex-start; gap:10px; }
}

/* دسترسی‌پذیری */
button:focus-visible, input:focus-visible, a:focus-visible{ outline:2px solid var(--primary); outline-offset:2px; }
@media (prefers-reduced-motion: reduce){
  *{ animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; }
}
