/* ============================================================
   پنل ادمین — دیزاین سیستم «سفید و بنفش لوکس»
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Vazirmatn:wght@400;500;600;700&display=swap');

:root {
  --bg:            #ffffff;
  --bg-soft:       #faf8fd;
  --panel:         #ffffff;
  --purple-deep:   #2c1854;
  --purple:        #5b2a9d;
  --purple-mid:    #7c3aed;
  --purple-soft:   #f2ecfb;
  --purple-line:   #e8e0f7;
  --gold:          #b9975b;
  --text:          #1e1730;
  --text-muted:    #726c85;
  --success:       #1f8a5f;
  --success-bg:    #eaf7f1;
  --danger:        #c0392b;
  --danger-bg:     #fdecea;
  --warn:          #a9781f;
  --warn-bg:       #faf1de;
  --radius:        14px;
  --radius-sm:     9px;
  --shadow:        0 8px 30px rgba(44, 24, 84, 0.08);
  --shadow-sm:     0 2px 10px rgba(44, 24, 84, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-soft);
  color: var(--text);
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  direction: rtl;
}

h1, h2, h3, .brand-title {
  font-family: 'Fraunces', 'Vazirmatn', serif;
  font-weight: 600;
  letter-spacing: 0.2px;
}

a { color: inherit; text-decoration: none; }

/* ── Layout ──────────────────────────────────────────────── */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: linear-gradient(190deg, var(--purple-deep) 0%, #1c1038 100%);
  color: #f4f0fb;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(201, 166, 91, 0.35);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold), #7a5b25);
  flex-shrink: 0;
}

.brand-title {
  font-size: 17px;
  color: #fff;
}

.brand-sub {
  font-size: 11px;
  color: rgba(244, 240, 251, 0.55);
  letter-spacing: 0.5px;
}

.nav-group { margin-bottom: 6px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: rgba(244, 240, 251, 0.78);
  margin-bottom: 2px;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--gold);
}

.nav-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(201, 166, 91, 0.25);
  font-size: 12.5px;
  color: rgba(244, 240, 251, 0.6);
}

.logout-link {
  display: block;
  margin-top: 8px;
  color: #f4c9c9;
}

.main {
  flex: 1;
  padding: 34px 40px;
  max-width: 1200px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 26px;
  flex-wrap: wrap;
  gap: 14px;
}

.page-eyebrow {
  font-size: 11.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--purple-mid);
  font-weight: 600;
  margin-bottom: 4px;
}

.page-title { font-size: 26px; color: var(--purple-deep); margin: 0; }
.page-desc { color: var(--text-muted); font-size: 13.5px; margin-top: 6px; }

/* ── Cards / panels ──────────────────────────────────────── */

.card {
  background: var(--panel);
  border: 1px solid var(--purple-line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--purple-line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--purple-mid));
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  color: var(--purple-deep);
  font-weight: 600;
}

.stat-value.small { font-size: 20px; }

/* ── Tables ──────────────────────────────────────────────── */

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--purple-line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead th {
  text-align: right;
  background: var(--purple-soft);
  color: var(--purple-deep);
  font-weight: 600;
  padding: 13px 16px;
  font-size: 12px;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--purple-line);
}

tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid #f1edfa;
  color: var(--text);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfaff; }

.mono { font-family: 'Courier New', monospace; direction: ltr; display: inline-block; }

/* ── Badges ──────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-muted { background: #f2f0f6; color: var(--text-muted); }

/* ── Buttons ─────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple-mid), var(--purple));
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-outline {
  background: #fff;
  border: 1px solid var(--purple-line);
  color: var(--purple);
}
.btn-outline:hover { background: var(--purple-soft); }

.btn-danger-outline {
  background: #fff;
  border: 1px solid #f0d2ce;
  color: var(--danger);
}
.btn-danger-outline:hover { background: var(--danger-bg); }

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* ── Forms ───────────────────────────────────────────────── */

label {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

input[type=text], input[type=number], input[type=password], textarea, select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--purple-line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  background: #fff;
  color: var(--text);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--purple-mid);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

textarea { resize: vertical; min-height: 90px; }

.field { margin-bottom: 16px; }
.field-row { display: flex; gap: 14px; }
.field-row > .field { flex: 1; }

/* ── Tabs / filters ──────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.tab {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: #fff;
  border: 1px solid var(--purple-line);
}

.tab.active {
  background: var(--purple-deep);
  color: #fff;
  border-color: var(--purple-deep);
}

.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.search-bar input { flex: 1; }

/* ── Flash messages ──────────────────────────────────────── */

.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13.5px;
}

.flash-success { background: var(--success-bg); color: var(--success); }
.flash-error { background: var(--danger-bg); color: var(--danger); }

/* ── Login page ──────────────────────────────────────────── */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(124, 58, 237, 0.10), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(201, 166, 91, 0.12), transparent 40%),
    var(--bg-soft);
}

.login-card {
  width: 380px;
  background: #fff;
  border: 1px solid var(--purple-line);
  border-radius: 18px;
  padding: 40px 34px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-mark {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  margin: 0 auto 18px;
  background: radial-gradient(circle at 30% 30%, var(--gold), var(--purple-deep));
}

.login-title { font-size: 21px; color: var(--purple-deep); margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 26px; }
.login-card .field { text-align: right; }
.login-card .btn { width: 100%; margin-top: 6px; padding: 11px; }

/* ── Empty state ─────────────────────────────────────────── */

.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}

.empty-icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--purple-soft);
  margin: 0 auto 14px;
}

/* ── Progress bar (broadcast) ────────────────────────────── */

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--purple-soft);
  overflow: hidden;
  margin: 14px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--purple-mid));
  width: 0%;
  transition: width 0.3s ease;
}

.recipient-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border: 1px solid var(--purple-line);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
}

.recipient-option:has(input:checked) {
  border-color: var(--purple-mid);
  background: var(--purple-soft);
}

.recipient-option input { width: auto; }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .main { padding: 22px; }
}
