* {
  box-sizing: border-box;
}

/* -------- رنگ‌های پایه‌ی سیستم - بر اساس نقش عوض می‌شود -------- */
:root {
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.15);
}

/* سوپرادمین: بنفش - نشان‌دهنده‌ی بالاترین سطح دسترسی */
body.role-super_admin {
  --accent: #a855f7;
  --accent-dark: #7e22ce;
  --accent-soft: rgba(168, 85, 247, 0.18);
}

/* ادمین: آبی - سطح مدیریتی میانی */
body.role-admin {
  --accent: #3b82f6;
  --accent-dark: #1d4ed8;
  --accent-soft: rgba(59, 130, 246, 0.18);
}

/* کاربر: سبز - سطح عملیاتی/کاربری */
body.role-user {
  --accent: #10b981;
  --accent-dark: #047857;
  --accent-soft: rgba(16, 185, 129, 0.18);
}

body {
  font-family: Tahoma, Arial, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  margin: 0;
  padding: 0;
  direction: rtl;
}

.center-box {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: #1e293b;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card h1 {
  font-size: 20px;
  margin-bottom: 24px;
  text-align: center;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: #94a3b8;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 16px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 14px;
  font-family: inherit;
}

button {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.5);
}

button:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.4);
}

button:disabled {
  background: #475569;
  cursor: not-allowed;
}

button:disabled:hover {
  transform: none;
  box-shadow: none;
  background: #475569;
}

.error-message {
  background: #7f1d1d;
  color: #fecaca;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  display: none;
}

.success-message {
  background: #14532d;
  color: #bbf7d0;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  display: none;
}

/* -------- چیدمان کلی داشبورد با منوی کناری -------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  min-width: 250px;
  background: #1e293b;
  border-left: 1px solid #334155;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 0 20px 16px;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 12px;
}

.sidebar-header .welcome-text {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 6px;
}

.sidebar-nav {
  flex: 1;
}

/* سرفصل‌های دسته‌بندی منو (ارسال، نظارت، اطلاع‌رسانی، مدیریت، مالی و ...) -
   درشت و رنگی، بر اساس رنگ نقش فعلی */
.sidebar-group-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: var(--accent);
  padding: 16px 20px 8px;
}

.sidebar-nav-item {
  display: block;
  width: 100%;
  text-align: right;
  background: none;
  border: none;
  color: #cbd5e1;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: normal;
  cursor: pointer;
  border-right: 3px solid transparent;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, padding-right 0.2s ease;
}

.sidebar-nav-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-right: 3px solid var(--accent);
  padding-right: 24px;
}

.sidebar-nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-right: 3px solid var(--accent);
  font-weight: bold;
}

.sidebar-footer {
  padding: 12px 20px 0;
  border-top: 1px solid #334155;
  margin-top: 12px;
}

.sidebar-footer .logout-btn {
  width: 100%;
}

.main-content {
  flex: 1;
  padding: 24px;
  max-width: 1600px;
  height: 100vh;
  overflow-y: auto;
}

.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

/* -------- داشبورد (عناصر باقیمانده) -------- */
.dashboard {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #334155;
}

.topbar .role-badge {
  background: var(--accent);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.role-badge {
  background: var(--accent);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  display: inline-block;
}

.logout-btn {
  width: auto;
  padding: 8px 16px;
  background: #334155;
  font-weight: normal;
  font-size: 13px;
}

.logout-btn:hover {
  background: #475569;
}

.section-title {
  font-size: 16px;
  margin: 24px 0 12px;
  color: #cbd5e1;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

th, td {
  text-align: right;
  padding: 8px 10px;
  border-bottom: 1px solid #334155;
  font-size: 13px;
}

th {
  color: #94a3b8;
  font-weight: normal;
}

/* -------- پاپ‌آپ «درخواست پنل جدید» (فقط سوپرادمین) - به‌صورت پیش‌فرض
   مخفی است؛ فقط با overlay.style.display = "flex" در جاوااسکریپت نشان
   داده می‌شود -------- */
.reseller-popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.reseller-popup-box {
  background: #1e293b;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.reseller-popup-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.reseller-popup-box h2 {
  font-size: 18px;
  margin: 0 0 12px;
}

.reseller-popup-box p {
  font-size: 14px;
  color: #cbd5e1;
  margin-bottom: 20px;
}

.reseller-popup-box button {
  width: 100%;
}
