/* ====== پایه کلی ====== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "IRANSans", "Segoe UI", sans-serif;
  background: #0f172a; /* آبی تیره شیک */
  color: #0f172a;
  direction: rtl;
}

/* ====== هدر بالا ====== */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: linear-gradient(135deg, #111827, #020617);
  color: #f9fafb;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.admin-subtitle {
  font-size: 0.85rem;
  color: #9ca3af;
  margin-top: 4px;
}

.admin-actions {
  display: flex;
  gap: 8px;
}

/* ====== ناوبری بالای صفحات (nav.php) ====== */
.admin-topnav {
  background: #020617;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

.admin-topnav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  overflow-x: auto;
}

.admin-topnav a {
  text-decoration: none;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 999px;
  color: #e5e7eb;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.admin-topnav a:hover {
  background: rgba(148, 163, 184, 0.16);
  border-color: rgba(148, 163, 184, 0.6);
}

.admin-topnav a.active {
  background: #6366f1;
  border-color: #6366f1;
  color: #f9fafb;
}

/* ====== کانتینر اصلی ====== */
.wrap,
main,
.main-wrap {
  max-width: 1100px;
  margin: 16px auto 32px;
  padding: 0 16px;
}

/* ====== کارت‌ها ====== */
.card {
  background: #0b1120;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e5e7eb;
}

.form-card {
  max-width: 720px;
}

/* هدر داخل کارت‌ها */
.card h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1rem;
  font-weight: 600;
  color: #e5e7eb;
}

/* ====== دکمه‌ها ====== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  font-size: 0.85rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn.primary {
  background: #6366f1;
  border-color: #6366f1;
  color: #f9fafb;
}

.btn.primary:hover {
  background: #4f46e5;
  border-color: #4f46e5;
}

.btn.ghost {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.6);
  color: #e5e7eb;
}

.btn.ghost:hover {
  background: rgba(148, 163, 184, 0.16);
}

.btn.danger {
  background: #ef4444;
  border-color: #ef4444;
  color: #fef2f2;
}

.btn.danger:hover {
  background: #dc2626;
}

/* جدول‌ها (لیست سفارش‌ها، پرداخت‌ها و …) */
.table-wrap {
  width: 100%;
  overflow: hidden;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #020617;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.55);
}

.table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: transparent;
}

.table thead {
  background: rgba(15, 23, 42, 0.9);
}

.table th,
.table td {
  padding: 10px 12px;
  font-size: 0.85rem;
  text-align: right;
  border-bottom: 1px solid rgba(30, 64, 175, 0.45);
  color: #e5e7eb;
}

.table th {
  font-weight: 600;
  color: #cbd5f5;
}

.table tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.85);
}

.table tr:hover td {
  background: rgba(37, 99, 235, 0.12);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.table-actions .btn {
  flex: 1 1 120px;
  justify-content: center;
  min-width: 0;
}

@media (max-width: 900px) {
  .table {
    min-width: 0;
    display: block;
  }

  .table thead {
    display: none;
  }

  .table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.75);
  }

  .table tr:nth-child(even) td,
  .table tr:hover td {
    background: transparent;
  }

  .table td {
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.9rem;
  }

  .table td::before {
    content: attr(data-label);
    color: #9ca3af;
    font-size: 0.78rem;
  }

  .table td.actions {
    grid-column: 1 / -1;
  }

  .table td.actions .table-actions {
    width: 100%;
    gap: 8px;
  }

  .table td.actions .btn {
    flex: 1 1 calc(50% - 8px);
  }
}

/* ====== فرم‌ها ====== */
.settings-form,
form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  font-size: 0.8rem;
  color: #cbd5f5;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: #020617;
  color: #e5e7eb;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35);
  background: #020617;
}

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

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* ====== فلش / پیام موفق/خطا ====== */
.alert {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  margin-bottom: 12px;
  background: rgba(34, 197, 94, 0.12);
  color: #bbf7d0;
  border: 1px solid rgba(34, 197, 94, 0.6);
}

.alert.error {
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.6);
}

/* پیام‌های کوچک خاکستری */
.text-muted {
  font-size: 0.78rem;
  color: #9ca3af;
}

/* ====== حالت‌های Badge (وضعیت‌ها) ====== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-pending {
  background: rgba(248, 250, 252, 0.04);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.badge-ok {
  background: rgba(22, 163, 74, 0.12);
  color: #4ade80;
  border: 1px solid rgba(22, 163, 74, 0.6);
}

.badge-rej {
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.6);
}

/* ====== Gridهای دو ستونه (مثل صفحه payments detail) ====== */
.grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .admin-actions {
    align-self: stretch;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* ====== تصویر پیش‌نمایش رسید ====== */
img.preview {
  max-width: 100%;
  border-radius: 14px;
  margin-top: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.85);
}

/* ====== لاگین صفحه (اگه داری) ====== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #020617;
  border-radius: 18px;
  padding: 20px 18px 18px;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: #e5e7eb;
}

.login-card h1 {
  font-size: 1.1rem;
  margin-top: 0;
  margin-bottom: 4px;
}

.login-card p {
  font-size: 0.82rem;
  color: #9ca3af;
  margin-top: 0;
  margin-bottom: 14px;
}
/* ====== داشبورد ====== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.dashboard-card h3 {
  margin-top: 0;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.stat-number {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 6px 0 4px;
  color: #f9fafb;
}

.stat-caption {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-bottom: 12px;
}

.quick-notes ul {
  margin: 0;
  padding-right: 18px;
  list-style: disc;
}

.quick-notes li {
  font-size: 0.8rem;
  color: #e5e7eb;
  margin-bottom: 4px;
}
