@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800;900&display=swap');

/* ==========================================================================
   Design Tokens — "Aurora" theme: vibrant glassmorphism, animated gradients
   ========================================================================== */
:root {
  --bg-void:      #0A0714;
  --bg-base:      #0F0B1F;
  --bg-surface:   rgba(255,255,255,.045);
  --bg-elevated:  rgba(255,255,255,.065);
  --bg-hover:     rgba(255,255,255,.11);
  --border-soft:  rgba(255,255,255,.09);
  --border-strong:rgba(255,255,255,.20);

  --text-primary: #F6F4FF;
  --text-secondary:#BDB3E0;
  --text-muted:   #8378A6;

  /* پالت اصلی: بنفش-صورتی-فیروزه‌ای زنده */
  --violet:       #8B5CF6;
  --violet-strong:#A78BFA;
  --pink:         #EC4899;
  --cyan:         #22D3EE;
  --emerald:      #34D399;

  /* نگاشت رنگ‌های معنایی (برای سازگاری با کلاس‌های موجود در کل پنل) */
  --gold:         #F5A623;
  --gold-soft:    rgba(245,166,35,.15);
  --gold-strong:  #FBBF4E;
  --teal:         var(--cyan);
  --teal-soft:    rgba(34,211,238,.15);
  --red:          #FB5A7E;
  --red-soft:     rgba(251,90,126,.15);
  --blue:         #818CF8;
  --blue-soft:    rgba(129,140,248,.15);

  --silver:       #C7CFD8;
  --bronze:       #D99B6C;

  --grad-1: linear-gradient(135deg, var(--violet), var(--pink));
  --grad-2: linear-gradient(135deg, var(--cyan), var(--emerald));
  --grad-3: linear-gradient(135deg, var(--pink), var(--gold));

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --shadow-card: 0 1px 0 rgba(255,255,255,.06) inset, 0 20px 44px -20px rgba(0,0,0,.65);
  --glow-violet: 0 0 0 rgba(139,92,246,0);
  --ease: cubic-bezier(.22,1,.36,1);
  --bounce: cubic-bezier(.34,1.56,.64,1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
code { font-family: 'Vazirmatn', monospace; direction: ltr; display: inline-block; }

::selection { background: rgba(139,92,246,.35); color: #fff; }

/* ==========================================================================
   پس‌زمینه‌ی متحرک — Aurora blobs
   ========================================================================== */
body.app-body { position: relative; }
body.app-body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(38vw 38vw at 88% -8%, rgba(139,92,246,.28), transparent 60%),
    radial-gradient(34vw 34vw at 8% 18%, rgba(236,72,153,.20), transparent 60%),
    radial-gradient(40vw 40vw at 70% 105%, rgba(34,211,238,.16), transparent 60%),
    var(--bg-base);
  pointer-events: none; z-index: 0;
  animation: auroraShift 22s ease-in-out infinite alternate;
}
@keyframes auroraShift {
  0%   { filter: hue-rotate(0deg) brightness(1); }
  50%  { filter: hue-rotate(12deg) brightness(1.06); }
  100% { filter: hue-rotate(-8deg) brightness(1); }
}

/* ==========================================================================
   Auth pages (login / install)
   ========================================================================== */
.auth-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-void);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth-body::before {
  content: '';
  position: absolute; inset: -10%;
  background:
    radial-gradient(32vw 32vw at 15% 20%, rgba(139,92,246,.35), transparent 60%),
    radial-gradient(30vw 30vw at 85% 15%, rgba(236,72,153,.28), transparent 60%),
    radial-gradient(36vw 36vw at 50% 100%, rgba(34,211,238,.22), transparent 60%);
  animation: auroraShift 18s ease-in-out infinite alternate;
}
.bg-glow {
  position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,.25), transparent 70%);
  top: -160px; left: -160px; filter: blur(20px);
  animation: floaty 12s var(--ease) infinite;
}
@keyframes floaty { 0%,100%{ transform: translate(0,0) scale(1);} 50%{ transform: translate(50px,70px) scale(1.08);} }

.auth-wrap { width: 100%; max-width: 460px; z-index: 1; position: relative; }
.install-card { max-width: 640px; }
.auth-card {
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 38px 34px;
  box-shadow: var(--shadow-card);
  animation: cardIn .65s var(--bounce) both;
}
@keyframes cardIn { from { opacity:0; transform: translateY(22px) scale(.95);} to {opacity:1; transform:none;} }

.auth-brand { text-align: center; margin-bottom: 24px; }
.brand-mark {
  width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center; font-size: 27px;
  background: var(--grad-1);
  box-shadow: 0 10px 30px -8px rgba(139,92,246,.6);
  animation: markPulse 3.5s var(--ease) infinite;
}
@keyframes markPulse { 0%,100%{ box-shadow: 0 10px 30px -8px rgba(139,92,246,.6);} 50%{ box-shadow: 0 14px 40px -6px rgba(236,72,153,.65);} }
.auth-brand h1 {
  font-size: 20px; margin: 0 0 6px; font-weight: 800;
  background: var(--grad-1); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.muted { color: var(--text-muted); font-size: 13.5px; margin: 0; line-height: 1.9; }

.auth-form { display: flex; flex-direction: column; gap: 15px; margin-top: 20px; }
.auth-form label, .form-grid label {
  display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-secondary);
}
input, select, textarea {
  font-family: inherit; background: rgba(255,255,255,.04); border: 1px solid var(--border-soft);
  color: var(--text-primary); border-radius: var(--radius-sm); padding: 11px 14px; font-size: 14px;
  outline: none; transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--violet-strong); box-shadow: 0 0 0 4px rgba(139,92,246,.18); background: rgba(255,255,255,.07);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section-title {
  font-size: 13px; margin: 20px 0 4px; font-weight: 700;
  padding-bottom: 6px; border-bottom: 1px dashed var(--border-soft);
  background: var(--grad-2); -webkit-background-clip: text; background-clip: text; color: transparent;
}

.btn {
  cursor: pointer; border: none; border-radius: var(--radius-sm); padding: 11px 20px;
  font-family: inherit; font-size: 14px; font-weight: 700; transition: transform .18s var(--bounce), filter .18s var(--ease), box-shadow .25s var(--ease);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  position: relative; overflow: hidden;
}
.btn:active { transform: scale(.95); }
.btn-primary {
  background: var(--grad-1); color: #fff;
  box-shadow: 0 8px 24px -8px rgba(139,92,246,.55);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 10px 30px -6px rgba(236,72,153,.55); transform: translateY(-1px); }
.btn-block { width: 100%; margin-top: 6px; }
.btn-ghost { background: rgba(255,255,255,.06); color: var(--text-primary); border: 1px solid var(--border-soft); }
.btn-ghost:hover { border-color: var(--violet-strong); background: rgba(139,92,246,.12); }
.btn-danger { background: var(--red-soft); color: #ffc2d1; border: 1px solid rgba(251,90,126,.4); }
.btn-danger:hover { background: rgba(251,90,126,.25); }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 10px; }

.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 14px; line-height: 1.8; border: 1px solid transparent; }
.alert p { margin: 2px 0; }
.alert-error { background: var(--red-soft); color: #ffc2d1; border-color: rgba(251,90,126,.35); }
.alert-success { background: rgba(52,211,153,.14); color: #a8f5da; border-color: rgba(52,211,153,.35); }
.alert-info { background: var(--blue-soft); color: #cdd3ff; border-color: rgba(129,140,248,.35); }

/* ==========================================================================
   App shell
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
  width: 258px; flex-shrink: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02));
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--border-soft);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 20;
  transition: transform .3s var(--ease);
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 22px 18px 18px; border-bottom: 1px solid var(--border-soft); }
.sidebar-brand .brand-mark { width: 40px; height: 40px; font-size: 19px; margin: 0; border-radius: 12px; animation: none; }
.sidebar-brand-text b {
  display: block; font-size: 13.5px; font-weight: 800;
  background: var(--grad-1); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sidebar-brand-text span { display: block; font-size: 11px; color: var(--text-muted); }

.nav-scroll { flex: 1; overflow-y: auto; padding: 16px 12px; }
.nav-group-label { font-size: 10.5px; color: var(--text-muted); letter-spacing: .06em; margin: 18px 8px 7px; text-transform: uppercase; font-weight: 700; }
.nav-group-label:first-child { margin-top: 4px; }

.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 10.5px 13px; border-radius: 12px;
  color: var(--text-secondary); font-size: 13.5px; margin-bottom: 3px; transition: background .2s var(--ease), color .2s var(--ease), transform .15s var(--ease);
  position: relative;
}
.nav-link .ic { width: 19px; text-align: center; font-size: 15px; }
.nav-link:hover { background: rgba(255,255,255,.06); color: var(--text-primary); transform: translateX(-2px); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(139,92,246,.22), rgba(236,72,153,.10));
  color: #fff; font-weight: 700;
}
.nav-link.active::before {
  content: ''; position: absolute; right: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px;
  background: var(--grad-1);
}
.nav-badge {
  margin-right: auto; background: var(--grad-3); color: #2b1400; font-size: 10.5px; font-weight: 800;
  padding: 1px 7px; border-radius: 20px; animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse { 0%,100%{ transform: scale(1);} 50%{ transform: scale(1.12);} }

.sidebar-foot { padding: 15px 18px; border-top: 1px solid var(--border-soft); }
.admin-chip { display: flex; align-items: center; gap: 10px; }
.avatar-mini {
  width: 35px; height: 35px; border-radius: 11px; background: var(--grad-2);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: #05241d;
}
.admin-chip-text b { display: block; font-size: 12.5px; }
.admin-chip-text span { display: block; font-size: 10.5px; color: var(--text-muted); }
.logout-link { margin-right: auto; color: var(--text-muted); font-size: 17px; transition: color .2s var(--ease), transform .2s var(--bounce); }
.logout-link:hover { color: var(--red); transform: rotate(-12deg) scale(1.1); }

/* main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 17px 28px;
  border-bottom: 1px solid var(--border-soft); position: sticky; top: 0;
  background: rgba(15,11,31,.78); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); z-index: 15;
}
.topbar h1 { font-size: 17.5px; margin: 0; font-weight: 800; }
.topbar .page-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.burger { display: none; background: rgba(255,255,255,.06); border: 1px solid var(--border-soft); border-radius: 10px; width: 36px; height: 36px; color: var(--text-primary); font-size: 16px; }

.live-pill {
  margin-right: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary);
  background: rgba(255,255,255,.05); border: 1px solid var(--border-soft); padding: 7px 14px; border-radius: 30px;
}
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald); position: relative; }
.pulse-dot::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--emerald);
  animation: pulse 1.8s var(--ease) infinite;
}
@keyframes pulse { 0%{ transform: scale(.6); opacity: .9;} 100%{ transform: scale(2.1); opacity: 0;} }

.content { padding: 26px 28px 60px; flex: 1; }

/* ==========================================================================
   Animation utility — staggered fade/slide in
   ========================================================================== */
.reveal { opacity: 0; transform: translateY(14px) scale(.98); animation: revealUp .6s var(--bounce) forwards; }
@keyframes revealUp { to { opacity: 1; transform: none; } }
.d1{animation-delay:.03s}.d2{animation-delay:.08s}.d3{animation-delay:.13s}.d4{animation-delay:.18s}
.d5{animation-delay:.23s}.d6{animation-delay:.28s}.d7{animation-delay:.33s}.d8{animation-delay:.38s}

/* ==========================================================================
   KPI cards
   ========================================================================== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.kpi-card {
  background: linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 19px 21px;
  box-shadow: var(--shadow-card); position: relative; overflow: hidden;
  transition: border-color .25s var(--ease), transform .25s var(--bounce), box-shadow .25s var(--ease);
}
.kpi-card::before {
  content: ''; position: absolute; inset: 0; opacity: 0; border-radius: inherit;
  background: linear-gradient(135deg, rgba(139,92,246,.12), transparent 60%);
  transition: opacity .3s var(--ease);
}
.kpi-card:hover { border-color: var(--border-strong); transform: translateY(-4px); box-shadow: 0 24px 50px -20px rgba(139,92,246,.35); }
.kpi-card:hover::before { opacity: 1; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; position: relative; }
.kpi-icon { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 17px; }
.kpi-icon.gold { background: var(--gold-soft); color: var(--gold-strong); }
.kpi-icon.teal { background: var(--teal-soft); color: var(--teal); }
.kpi-icon.blue { background: var(--blue-soft); color: var(--blue); }
.kpi-icon.red { background: var(--red-soft); color: var(--red); }
.kpi-trend { font-size: 11.5px; padding: 3px 9px; border-radius: 20px; font-weight: 700; }
.kpi-trend.up { background: rgba(52,211,153,.16); color: var(--emerald); }
.kpi-trend.down { background: var(--red-soft); color: var(--red); }
.kpi-value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; position: relative; }
.kpi-label { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; position: relative; }

/* ==========================================================================
   Panels / Cards
   ========================================================================== */
.panel {
  background: linear-gradient(160deg, rgba(255,255,255,.045), rgba(255,255,255,.015));
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); margin-bottom: 20px; transition: border-color .25s var(--ease);
}
.panel:hover { border-color: rgba(255,255,255,.14); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 21px; border-bottom: 1px solid var(--border-soft); gap: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 14.5px; margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 800; }
.panel-head .sub { font-size: 11.5px; color: var(--text-muted); font-weight: 400; }
.panel-body { padding: 19px 21px; }
.panel-body.flush { padding: 0; }

.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ==========================================================================
   City leaderboard strip — signature element
   ========================================================================== */
.city-rank-list { display: flex; flex-direction: column; gap: 11px; }
.city-rank-row { display: grid; grid-template-columns: 28px 100px 1fr 70px; align-items: center; gap: 12px; }
.city-rank-num {
  width: 27px; height: 27px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 800; background: rgba(255,255,255,.06); color: var(--text-secondary);
}
.city-rank-row.top1 .city-rank-num { background: var(--grad-3); color: #2b1400; box-shadow: 0 0 16px rgba(245,166,35,.5); }
.city-rank-row.top2 .city-rank-num { background: linear-gradient(135deg, #E4E9EE, var(--silver)); color: #21262b; }
.city-rank-row.top3 .city-rank-num { background: linear-gradient(135deg, #E0A272, var(--bronze)); color: #2b1a0e; }
.city-rank-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.city-rank-track { height: 10px; border-radius: 20px; background: rgba(255,255,255,.05); overflow: hidden; border: 1px solid var(--border-soft); }
.city-rank-fill {
  height: 100%; border-radius: 20px; width: 0; position: relative; overflow: hidden;
  background: var(--grad-1);
  transition: width 1.2s var(--bounce);
}
.city-rank-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transform: translateX(-100%); animation: shimmer 2.6s ease-in-out infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.city-rank-row.top1 .city-rank-fill { background: var(--grad-3); box-shadow: 0 0 16px rgba(245,166,35,.45); }
.city-rank-row.top2 .city-rank-fill { background: linear-gradient(90deg, #9AA6B2, var(--silver)); }
.city-rank-row.top3 .city-rank-fill { background: linear-gradient(90deg, var(--bronze), #DB9E6C); }
.city-rank-score { font-size: 12.5px; color: var(--text-secondary); text-align: left; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: right; padding: 12px 16px; color: var(--text-muted); font-weight: 700; font-size: 11.5px;
  border-bottom: 1px solid var(--border-soft); white-space: nowrap; background: rgba(255,255,255,.03);
  position: sticky; top: 0;
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.data-table tbody tr { transition: background .15s var(--ease); }
.data-table tbody tr:hover { background: rgba(139,92,246,.07); }
.data-table tbody tr:last-child td { border-bottom: none; }

.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user .av {
  width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,.07); display: flex; align-items: center;
  justify-content: center; font-size: 12.5px; font-weight: 700; color: var(--text-secondary); flex-shrink: 0;
}
.cell-user b { display: block; font-size: 13px; }
.cell-user span { display: block; font-size: 11px; color: var(--text-muted); direction: ltr; text-align: right; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge.gold { background: var(--gold-soft); color: var(--gold-strong); }
.badge.teal { background: var(--teal-soft); color: var(--teal); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.gray { background: rgba(255,255,255,.07); color: var(--text-secondary); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty-state { text-align: center; padding: 54px 20px; color: var(--text-muted); }
.empty-state .ic { font-size: 36px; margin-bottom: 12px; opacity: .55; }
.empty-state p { font-size: 13.5px; margin: 4px 0 0; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 18px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 33px; height: 33px; display: flex; align-items: center; justify-content: center;
  border-radius: 9px; font-size: 12.5px; color: var(--text-secondary); border: 1px solid var(--border-soft);
  transition: all .2s var(--ease);
}
.pagination a:hover { background: rgba(139,92,246,.15); border-color: var(--violet-strong); }
.pagination .active { background: var(--grad-1); color: #fff; border-color: transparent; font-weight: 700; }
.pagination .disabled { opacity: .35; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border-soft); padding: 0 20px; flex-wrap: wrap; }
.tab-link { padding: 14px 6px; font-size: 13px; color: var(--text-muted); position: relative; margin-left: 20px; transition: color .2s var(--ease); }
.tab-link.active { background: var(--grad-1); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.tab-link.active::after { content:''; position:absolute; right:0; left:0; bottom:-1px; height:2.5px; background: var(--grad-1); border-radius:2px; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 15px 21px; border-bottom: 1px solid var(--border-soft); }
.filter-bar input, .filter-bar select { padding: 8px 12px; font-size: 12.5px; }
.filter-bar form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; flex: 1; }
.hidden-range { display: none !important; }

.mini-bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.05); overflow: hidden; border: 1px solid var(--border-soft);}
.mini-bar > span { display:block; height:100%; background: var(--grad-2); border-radius: 6px; }

.switch { position: relative; display: inline-block; width: 44px; height: 25px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0; background: rgba(255,255,255,.08); border: 1px solid var(--border-soft);
  border-radius: 30px; transition: .25s var(--ease);
}
.switch .slider::before {
  content: ''; position: absolute; height: 17px; width: 17px; right: 3px; bottom: 3px; background: var(--text-muted);
  border-radius: 50%; transition: .25s var(--bounce);
}
.switch input:checked + .slider { background: rgba(52,211,153,.22); border-color: rgba(52,211,153,.5); }
.switch input:checked + .slider::before { transform: translateX(-19px); background: var(--emerald); box-shadow: 0 0 10px rgba(52,211,153,.6); }

.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 200px; }

.stat-inline { display: flex; align-items: baseline; gap: 6px; }
.stat-inline b { font-size: 20px; font-weight: 800; }
.stat-inline span { font-size: 11.5px; color: var(--text-muted); }

.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-avatar {
  width: 64px; height: 64px; border-radius: 18px; background: var(--grad-1);
  display: flex; align-items: center; justify-content: center; font-size: 25px; font-weight: 800; color: #fff;
  flex-shrink: 0; box-shadow: 0 10px 26px -8px rgba(139,92,246,.55);
}
.info-list { display: flex; flex-direction: column; gap: 12px; }
.info-row { display: flex; justify-content: space-between; font-size: 13px; padding-bottom: 10px; border-bottom: 1px dashed var(--border-soft); }
.info-row span { color: var(--text-muted); }
.info-row b { font-weight: 700; }

#toast-stack { position: fixed; bottom: 24px; left: 24px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: linear-gradient(160deg, rgba(30,20,50,.95), rgba(20,14,36,.95));
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 13px 17px;
  font-size: 12.5px; box-shadow: 0 16px 36px -12px rgba(0,0,0,.7); animation: toastIn .35s var(--bounce);
  display: flex; align-items: center; gap: 8px; min-width: 230px;
}
.toast.success { border-color: rgba(52,211,153,.5); }
.toast.error { border-color: rgba(251,90,126,.5); }
@keyframes toastIn { from { opacity:0; transform: translateY(14px) scale(.9);} to {opacity:1; transform:none;} }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(6,3,15,.72); backdrop-filter: blur(5px); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; animation: fadeIn .25s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: linear-gradient(160deg, rgba(28,18,48,.97), rgba(18,12,32,.97));
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  padding: 24px; width: 100%; max-width: 420px; animation: cardIn .3s var(--bounce);
}
.modal-box h3 { margin: 0 0 12px; font-size: 15px; font-weight: 800; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; justify-content: flex-end; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,.35); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,.55); background-clip: content-box; }

/* ==========================================================================
   کارنامه / Report Card — printable transcript styling
   ========================================================================== */
.print-toolbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; background: rgba(15,11,31,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft); margin: -26px -28px 20px;
}
.print-toolbar h1 { font-size: 15px; margin: 0; }
.print-toolbar .spacer { flex: 1; }

.report-card {
  background: linear-gradient(165deg, rgba(255,255,255,.055), rgba(255,255,255,.02));
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
  padding: 34px; max-width: 900px; margin: 0 auto; box-shadow: var(--shadow-card);
}
.report-header {
  display: flex; align-items: center; gap: 18px; padding-bottom: 22px; margin-bottom: 22px;
  border-bottom: 2px solid transparent; border-image: var(--grad-1) 1;
}
.report-header .mark { width: 60px; height: 60px; border-radius: 18px; background: var(--grad-1); display:flex; align-items:center; justify-content:center; font-size:27px; flex-shrink:0; box-shadow: 0 10px 26px -8px rgba(139,92,246,.55); }
.report-header h1 { font-size: 20px; margin: 0 0 4px; font-weight: 800; }
.report-header .sub { font-size: 12.5px; color: var(--text-muted); }
.report-header .meta { margin-right: auto; text-align: left; font-size: 11.5px; color: var(--text-muted); }

.report-tier {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 30px;
  font-size: 14px; font-weight: 800; margin-bottom: 22px;
}
.report-tier.tier-gold { background: linear-gradient(90deg, var(--gold-soft), transparent); color: var(--gold-strong); border: 1px solid rgba(245,166,35,.4); }
.report-tier.tier-silver { background: linear-gradient(90deg, rgba(199,207,216,.15), transparent); color: var(--silver); border: 1px solid rgba(199,207,216,.35); }
.report-tier.tier-bronze { background: linear-gradient(90deg, rgba(217,155,108,.18), transparent); color: var(--bronze); border: 1px solid rgba(217,155,108,.35); }
.report-tier.tier-normal { background: rgba(255,255,255,.06); color: var(--text-secondary); border: 1px solid var(--border-soft); }

.report-stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.report-stat {
  text-align: center; padding: 17px 10px; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid var(--border-soft);
  transition: transform .2s var(--bounce);
}
.report-stat:hover { transform: translateY(-3px); }
.report-stat b { display: block; font-size: 23px; font-weight: 800; background: var(--grad-1); -webkit-background-clip: text; background-clip: text; color: transparent; }
.report-stat span { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.report-section-title {
  font-size: 13.5px; font-weight: 800; margin: 26px 0 14px; padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-soft); display: flex; align-items: center; gap: 8px;
}

.report-footer {
  margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--border-soft);
  display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-muted);
}

@media print {
  body * { visibility: hidden; }
  .report-print-area, .report-print-area * { visibility: visible; }
  .report-print-area { position: absolute; inset: 0; margin: 0; padding: 0; }
  .sidebar, .topbar, .print-toolbar, .no-print { display: none !important; }
  .main, .content { padding: 0 !important; margin: 0 !important; }
  body.app-body::before { display: none !important; }
  .report-card { box-shadow: none; border: none; max-width: 100%; background: #fff; color: #111; backdrop-filter: none; }
  .report-card .report-header { border-image: none; border-bottom-color: #8B5CF6; }
  .report-card .report-stat { background: #f4f4f4; border-color: #ddd; }
  .report-card .report-stat b { -webkit-text-fill-color: #7C3AED; color: #7C3AED; }
  .report-card .report-section-title { border-bottom-color: #ddd; color: #111; }
  .report-card .muted, .report-card .info-row span { color: #666; }
  .report-card table.data-table th { background: #eee; color: #333; }
  .report-card table.data-table td { color: #222; border-bottom-color: #eee; }
  @page { margin: 14mm; }
}

/* ==========================================================================
   جلوه‌های بصری اضافه — برای حس متمایز و پرانرژی
   ========================================================================== */

/* الگوی نقطه‌ای ظریف روی محتوا */
.content { position: relative; }
.content::before {
  content: '';
  position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 100%);
}

/* متن گرادیانی متحرک برای عناوین اصلی */
.topbar h1 {
  background: linear-gradient(90deg, var(--text-primary), var(--violet-strong), var(--pink), var(--text-primary));
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: textSheen 8s linear infinite;
}
@keyframes textSheen { 0% { background-position: 0% 50%; } 100% { background-position: 300% 50%; } }

/* اورب‌های تزئینی شناور در نوار بالا */
.topbar { overflow: visible; position: sticky; }
.live-pill { position: relative; }
.live-pill::before {
  content: ''; position: absolute; inset: -1px; border-radius: 30px; padding: 1px;
  background: var(--grad-1); opacity: .35;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: borderSpin 4s linear infinite;
}
@keyframes borderSpin { 0% { filter: hue-rotate(0deg);} 100% { filter: hue-rotate(360deg);} }

/* درخشش رنگی روی هاور کارت‌های KPI بر اساس نوع آیکون */
.kpi-card:has(.kpi-icon.gold):hover { box-shadow: 0 24px 55px -20px rgba(245,166,35,.4); border-color: rgba(245,166,35,.4); }
.kpi-card:has(.kpi-icon.teal):hover { box-shadow: 0 24px 55px -20px rgba(34,211,238,.4); border-color: rgba(34,211,238,.4); }
.kpi-card:has(.kpi-icon.blue):hover { box-shadow: 0 24px 55px -20px rgba(129,140,248,.4); border-color: rgba(129,140,248,.4); }
.kpi-card:has(.kpi-icon.red):hover { box-shadow: 0 24px 55px -20px rgba(251,90,126,.4); border-color: rgba(251,90,126,.4); }

/* برند سایدبار با نشان درخشان چرخان */
.sidebar-brand .brand-mark { position: relative; animation: markPulse 3.5s var(--ease) infinite; }
.sidebar-brand .brand-mark::after {
  content: ''; position: absolute; inset: -3px; border-radius: 15px; z-index: -1;
  background: conic-gradient(from 0deg, var(--violet), var(--pink), var(--cyan), var(--violet));
  animation: spin 6s linear infinite; opacity: .55; filter: blur(6px);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* دکمه اصلی با جلوه‌ی درخشش عبوری روی هاور */
.btn-primary::before {
  content: ''; position: absolute; top: 0; right: -60%; width: 40%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-20deg); transition: right .6s var(--ease);
}
.btn-primary:hover::before { right: 130%; }

/* کارت‌های reveal با چرخش ظریف سه‌بعدی هنگام ورود */
.reveal { transform-origin: top center; }

/* نشان رتبه‌ی اول با تابش نبض‌دار */
.city-rank-row.top1 .city-rank-num {
  animation: topGlow 2.4s ease-in-out infinite;
}
@keyframes topGlow {
  0%,100% { box-shadow: 0 0 12px rgba(245,166,35,.5); }
  50% { box-shadow: 0 0 22px rgba(245,166,35,.85); }
}

/* بج‌های رنگی با درخشش ظریف هنگام هاور */
.badge { transition: transform .2s var(--bounce), box-shadow .2s var(--ease); }
.badge:hover { transform: translateY(-1px); }

/* نوار پیشرفت‌ها با گرادیان متحرک */
.mini-bar > span { background-size: 200% 100%; animation: gradientMove 3s linear infinite; }
@keyframes gradientMove { 0% { background-position: 0% 0; } 100% { background-position: 200% 0; } }
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .burger { display: inline-flex; align-items:center; justify-content:center; }
  .sidebar { position: fixed; right: 0; top: 0; transform: translateX(100%); box-shadow: -24px 0 70px rgba(0,0,0,.55); }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 14px 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .city-rank-row { grid-template-columns: 24px 74px 1fr 54px; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
