:root {
  /* لوحة ذهبية فاخرة على أبيض */
  --gold-deep: #9c7a1f;
  --gold: #c9a227;
  --gold-bright: #e8c667;
  --gold-pale: #f6ecce;
  --gold-gradient: linear-gradient(135deg, var(--gold-deep) 0%, var(--gold) 45%, var(--gold-bright) 100%);
  --gold-gradient-soft: linear-gradient(135deg, #fbf6e6 0%, #f6ecce 100%);
  --gold-text-on: #241d09;

  --ink: #201c12;
  --muted: #7a7361;
  --bg: #fffdf8;
  --card: #ffffff;
  --border: #ece3c8;
  --danger: #b3261e;
  --success: #2f7d4f;
  --warn: #a3660a;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(156, 122, 31, 0.10);
  --shadow-sm: 0 4px 14px rgba(32, 28, 18, 0.06);
  font-family: "Cairo", "Tahoma", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  line-height: 1.7;
}

a { color: var(--gold-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- شريط علوي ---------- */
.topbar {
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: saturate(160%) blur(6px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar::after {
  content: "";
  display: block;
  height: 3px;
  background: var(--gold-gradient);
}
.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--ink);
  letter-spacing: 0.2px;
}
.brand .logo-dot {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--gold-gradient);
  box-shadow: 0 4px 14px rgba(201, 162, 39, 0.45);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-text-on); font-weight: 800;
}
.nav-links { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.nav-links a { color: var(--ink); font-weight: 600; }
.nav-links a:hover { color: var(--gold-deep); text-decoration: none; }

/* ---------- أزرار ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: var(--gold-gradient);
  color: var(--gold-text-on);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  box-shadow: 0 6px 18px rgba(201, 162, 39, 0.35);
  transition: transform .08s ease, box-shadow .2s ease, filter .2s ease;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; box-shadow: 0 8px 22px rgba(201, 162, 39, 0.45); }
.btn:active { transform: scale(0.98); }
.btn.secondary { background: #fff; color: var(--gold-deep); border-color: var(--gold); box-shadow: none; }
.btn.secondary:hover { background: var(--gold-pale); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--border); box-shadow: none; }
.btn.ghost:hover { background: var(--gold-pale); filter: none; }
.btn.danger { background: var(--danger); color: #fff; box-shadow: none; }
.btn.small { padding: 8px 15px; font-size: 0.85rem; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; box-shadow: none; }
.btn.block { width: 100%; }

/* ---------- بطاقات ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ---------- نماذج ---------- */
label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 0.9rem; color: var(--ink); }
input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid var(--gold-pale);
  border-color: var(--gold);
}
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.error-box {
  background: #fdf1f0; color: var(--danger); border: 1px solid #f3cac6;
  padding: 11px 15px; border-radius: 10px; font-size: 0.9rem; margin-bottom: 14px;
}
.success-box {
  background: var(--gold-pale); color: var(--gold-deep); border: 1px solid var(--gold-bright);
  padding: 11px 15px; border-radius: 10px; font-size: 0.9rem; margin-bottom: 14px; font-weight: 600;
}

/* ---------- شارات الحالة ---------- */
.badge {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700;
}
.badge.trial { background: #fdeecb; color: #8a5a06; }
.badge.active { background: #e8f4ec; color: #1e6b41; }
.badge.past_due { background: #fbe6e4; color: #97281f; }
.badge.canceled { background: #ece8dd; color: #55503f; }
.badge.suspended { background: #f8e3e1; color: #7a231c; }

/* ---------- Hero / تسويق ---------- */
.hero {
  padding: 84px 0 56px;
  text-align: center;
  background:
    radial-gradient(600px 260px at 50% -60px, rgba(201,162,39,0.16), transparent 70%),
    var(--bg);
}
.hero h1 {
  font-size: 2.7rem; font-weight: 800; margin-bottom: 18px; line-height: 1.35;
}
.hero .accent {
  background: var(--gold-gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { color: var(--muted); font-size: 1.2rem; max-width: 660px; margin: 0 auto 30px; }
.hero-actions { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }

section { padding: 52px 0; }
h2.section-title { text-align: center; font-size: 1.9rem; font-weight: 800; margin-bottom: 10px; }
p.section-sub { text-align: center; color: var(--muted); margin-bottom: 38px; font-size: 1.05rem; }

.feature-card { text-align: center; transition: transform .15s ease, box-shadow .15s ease; }
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature-card .icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 14px;
  background: var(--gold-gradient-soft); border: 1px solid var(--gold-bright);
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
}
.feature-card h3 { font-size: 1.08rem; margin: 0 0 8px; }

/* ---------- تسعير ---------- */
.toggle-switch {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--card); border: 1.5px solid var(--border);
  padding: 6px; border-radius: 999px; margin-bottom: 34px;
}
.toggle-switch button {
  border: none; background: transparent; padding: 9px 20px;
  border-radius: 999px; cursor: pointer; font-weight: 700; color: var(--muted);
  font-family: inherit;
}
.toggle-switch button.active { background: var(--gold-gradient); color: var(--gold-text-on); }
.save-badge { background: var(--gold-pale); color: var(--gold-deep); font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; margin-inline-start: 6px; }

.plan-card { display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden; }
.plan-card::before {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 4px; background: var(--gold-gradient);
}
.plan-card h3 { margin: 0; font-size: 1.3rem; font-weight: 800; }
.plan-card .price { font-size: 2.1rem; font-weight: 800; color: var(--ink); }
.plan-card .price span { font-size: 0.95rem; color: var(--muted); font-weight: 500; }
.plan-card ul { list-style: none; padding: 0; margin: 0; flex: 1; }
.plan-card li { padding: 7px 0; color: var(--ink); border-top: 1px dashed var(--border); }
.plan-card li:first-child { border-top: none; }
.plan-card li::before { content: "✓ "; color: var(--gold-deep); font-weight: 800; }

/* ---------- تخطيط لوحة التحكم ---------- */
.dash-layout { display: flex; min-height: calc(100vh - 66px); }
.sidebar {
  width: 240px; background: var(--card); border-inline-end: 1px solid var(--border);
  padding: 22px 14px; flex-shrink: 0;
}
.sidebar a {
  display: block; padding: 11px 14px; border-radius: 10px; color: var(--ink);
  font-weight: 700; margin-bottom: 4px;
}
.sidebar a.active, .sidebar a:hover { background: var(--gold-pale); color: var(--gold-deep); text-decoration: none; }
.dash-main { flex: 1; padding: 28px; max-width: 980px; }
.dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; flex-wrap: wrap; gap: 10px; }
.dash-header h1 { margin: 0; font-size: 1.55rem; font-weight: 800; }

@media (max-width: 800px) {
  .dash-layout { flex-direction: column; }
  .sidebar { width: 100%; display: flex; overflow-x: auto; border-inline-end: none; border-bottom: 1px solid var(--border); }
  .sidebar a { white-space: nowrap; margin-inline-end: 4px; margin-bottom: 0; }
}

/* ---------- جداول وقوائم ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 11px 8px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
th { color: var(--muted); font-weight: 700; }

.list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 0; border-bottom: 1px solid var(--border); gap: 10px;
}
.list-item:last-child { border-bottom: none; }
.list-item .meta { color: var(--muted); font-size: 0.85rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.tag-lang {
  display: inline-block; background: var(--gold-pale); color: var(--gold-deep);
  padding: 2px 8px; border-radius: 6px; font-size: 0.75rem; margin-inline-end: 4px;
}

footer {
  text-align: center; color: var(--muted); padding: 34px 0; font-size: 0.85rem;
  border-top: 1px solid var(--border); margin-top: 34px;
}

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(32, 28, 18, 0.5);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal-backdrop:not([hidden]) { display: flex; }
.modal { background: #fff; border-radius: var(--radius); padding: 26px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; border-top: 4px solid var(--gold); }
.modal h3 { margin-top: 0; font-weight: 800; }
.close-x { cursor: pointer; font-size: 1.3rem; color: var(--muted); }

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

/* ---------- صفحة المنيو العامة ---------- */
.menu-cover {
  height: 210px; background-size: cover; background-position: center;
  background-color: var(--gold-deep);
  background-image: var(--gold-gradient);
  display: flex; align-items: flex-end;
}
.menu-header {
  background: linear-gradient(0deg, rgba(0,0,0,0.45), rgba(0,0,0,0.05)); width: 100%; color: #fff; padding: 20px 20px;
}
.menu-header h1 { margin: 0 0 4px; font-size: 1.6rem; font-weight: 800; }
.lang-switch { display: flex; gap: 6px; padding: 14px 0; flex-wrap: wrap; }
.lang-switch button {
  border: 1.5px solid var(--border); background: #fff; padding: 7px 16px;
  border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 0.85rem; font-family: inherit;
}
.lang-switch button.active { background: var(--gold-gradient); color: var(--gold-text-on); border-color: transparent; }
.menu-cat-title { font-size: 1.25rem; font-weight: 800; margin: 30px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--gold-pale); }
.menu-item {
  display: flex; justify-content: space-between; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--border);
}
.menu-item .name { font-weight: 700; }
.menu-item .desc { color: var(--muted); font-size: 0.87rem; margin-top: 2px; }
.menu-item .price { font-weight: 800; color: var(--gold-deep); white-space: nowrap; }
.menu-item img.thumb { width: 66px; height: 66px; border-radius: 12px; object-fit: cover; }
.qty-controls { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.qty-controls button {
  width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid var(--border);
  background: #fff; cursor: pointer; font-weight: 800;
}
.cart-bar {
  position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--border);
  padding: 15px 0; box-shadow: 0 -6px 20px rgba(32,28,18,0.08);
}
.cart-bar .container { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.qr-box { text-align: center; }
.qr-box img { border-radius: 14px; border: 1.5px solid var(--border); padding: 8px; background: #fff; }

.helper-panel { background: var(--gold-gradient-soft); border: 1px dashed var(--gold); border-radius: 12px; padding: 16px; font-size: 0.88rem; margin-bottom: 18px; }

/* ---------- تفعيل يدوي (Firebase Spark) ---------- */
.activate-box { border-top: 1px dashed var(--border); margin-top: 14px; padding-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.activate-box .field { margin-bottom: 0; min-width: 140px; }
code { background: var(--gold-pale); color: var(--gold-deep); padding: 2px 6px; border-radius: 5px; font-size: 0.85em; }
