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

:root {
  --brand: #dc2626;
  --brand-soft: #fef2f2;
  --ink: #0f172a;
  --ink-2: #1e293b;
  --bg: #f8fafc;
  --card: #ffffff;
  --muted: #64748b;
  --border: #e2e8f0;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --gold: #f59e0b;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 15px; }

.container { max-width: 1080px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

/* Header */
.topbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 44px; height: 44px; border-radius: 12px; object-fit: cover;
  background: linear-gradient(135deg, var(--brand), #7f1d1d); color: #fff;
  display: grid; place-items: center; font-weight: 900; font-size: 17px; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 700; cursor: pointer; transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(220,38,38,0.22); }
.btn-primary:hover { filter: brightness(0.93); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-2); }
.btn-wa { background: #16a34a; color: #fff; box-shadow: 0 4px 14px rgba(22,163,74,0.22); }
.btn-wa:hover { filter: brightness(0.94); }
.btn-outline { background: #fff; color: var(--ink); border-color: var(--border); }
.btn-outline:hover { background: #f1f5f9; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 13px 24px; font-size: 16px; border-radius: 14px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Inputs & Grids */
.input, select, textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border);
  border-radius: 11px; background: #fff; color: var(--ink); outline: none; transition: border-color 0.15s;
}
.input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(220,38,38,0.08); }
.label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; color: var(--ink-2); }
.field { margin-bottom: 13px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* Landing Hero & Mockup */
.hero-wrap {
  background: radial-gradient(circle at top right, #1e293b 0%, #0f172a 60%, #090d16 100%);
  color: #fff;
  padding: 48px 16px 56px;
  border-bottom: 4px solid var(--brand);
}
.hero-grid {
  max-width: 1080px; margin: 0 auto;
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 36px; align-items: center;
}
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-actions { justify-content: center; }
}
.hero-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(220,38,38,0.18); color: #fca5a5; border: 1px solid rgba(248,113,113,0.35);
  padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; margin-bottom: 14px;
}
.hero-title { font-size: clamp(28px, 4.2vw, 44px); font-weight: 900; line-height: 1.25; margin-bottom: 14px; }
.hero-title span { color: #f87171; }
.hero-sub { color: #cbd5e1; font-size: 16px; margin-bottom: 24px; max-width: 560px; }

.phone-mock {
  width: 295px; margin: 0 auto; background: #fff; color: var(--ink);
  border-radius: 34px; border: 8px solid #1e293b; overflow: hidden;
  box-shadow: 0 25px 60px rgba(0,0,0,0.45);
}
.phone-head {
  background: linear-gradient(135deg, #dc2626, #991b1b); color: #fff;
  padding: 18px 16px 14px; text-align: start;
}
.phone-body { padding: 12px; background: #f8fafc; }
.phone-item {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 9px;
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px; text-align: start;
}
.phone-item img { width: 48px; height: 48px; border-radius: 9px; flex-shrink: 0; }
.phone-bar {
  background: #16a34a; color: #fff; border-radius: 11px; padding: 9px 12px;
  font-weight: 800; font-size: 13px; display: flex; justify-content: space-between; margin-top: 8px;
}

/* Section Titles */
.sec-head { text-align: center; max-width: 660px; margin: 44px auto 24px; }
.sec-head h2 { font-size: clamp(22px, 3vw, 30px); font-weight: 900; margin-bottom: 6px; }
.sec-head p { color: var(--muted); }

/* Pricing */
.price-card {
  background: #fff; border: 1px solid var(--border); border-radius: 20px;
  padding: 24px 20px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; box-shadow: var(--shadow);
}
.price-card.featured {
  border: 2px solid var(--brand);
  box-shadow: 0 12px 32px rgba(220,38,38,0.14);
  transform: translateY(-4px);
}
.price-tag { font-size: 32px; font-weight: 900; color: var(--ink); margin: 10px 0 4px; }
.price-list { list-style: none; margin: 14px 0 20px; }
.price-list li { padding: 5px 0; font-size: 14px; display: flex; gap: 8px; align-items: flex-start; }
.price-list li::before { content: '✓'; color: var(--ok); font-weight: 900; }

/* Payment Methods */
.pay-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; }
.pay-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.pay-dot {
  width: 42px; height: 42px; border-radius: 11px; color: #fff; font-weight: 900;
  display: grid; place-items: center; font-size: 14px; flex-shrink: 0;
}

/* FAQ */
.faq-item {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  margin-bottom: 10px; overflow: hidden;
}
.faq-q {
  width: 100%; text-align: start; background: none; border: none; padding: 15px 18px;
  font-weight: 800; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
}
.faq-a { padding: 0 18px 16px; color: var(--muted); font-size: 14px; display: none; }
.faq-item.open .faq-a { display: block; }

/* Menu Customer Cover & Cards */
.menu-cover {
  background: linear-gradient(135deg, var(--brand) 0%, #18181b 100%);
  color: #fff; padding: 24px 16px 28px;
}
.menu-cover-inner { max-width: 980px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.menu-sticky-bar {
  position: sticky; top: 0; z-index: 35; background: rgba(248,250,252,0.95);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); padding: 10px 0 6px;
}

.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; font-weight: 700; cursor: pointer; white-space: nowrap; font-size: 14px;
}
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.item-card {
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 13px; display: flex; gap: 13px; align-items: stretch; justify-content: space-between;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.item-card:hover { box-shadow: 0 8px 24px rgba(15,23,42,0.08); }
.item-card.sold-out { opacity: 0.55; }
.item-img {
  width: 96px; height: 96px; border-radius: 12px; object-fit: cover; flex-shrink: 0; background: #f1f5f9;
}
.item-info { flex: 1; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.item-title { font-weight: 800; font-size: 16px; line-height: 1.35; }
.item-desc { font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
.item-price { font-weight: 900; color: var(--brand); font-size: 16px; }
.pop-badge {
  display: inline-block; background: #fef3c7; color: #b45309; font-size: 11px;
  font-weight: 800; padding: 2px 8px; border-radius: 999px; margin-bottom: 4px;
}

.qty-box { display: inline-flex; align-items: center; gap: 8px; }
.qty-btn {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border);
  background: #fff; font-weight: 900; cursor: pointer; display: grid; place-items: center;
}
.qty-btn.add { background: var(--brand); color: #fff; border-color: var(--brand); }

.cart-bar {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  width: min(94%, 640px); background: var(--ink); color: #fff;
  padding: 13px 20px; border-radius: 18px; box-shadow: 0 14px 32px rgba(15,23,42,0.32);
  display: flex; align-items: center; justify-content: space-between; z-index: 45; cursor: pointer;
  border: 2px solid var(--brand);
}

/* Floating WhatsApp */
.wa-float {
  position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 45;
  background: #16a34a; color: #fff; padding: 11px 18px; border-radius: 999px;
  font-weight: 800; box-shadow: 0 10px 25px rgba(22,163,74,0.35);
  display: inline-flex; align-items: center; gap: 8px;
}

/* Badges & Alerts */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.b-active, .b-converted { background: #dcfce7; color: #166534; }
.b-trial, .b-new { background: #dbeafe; color: #1e40af; }
.b-expiring, .b-contacted { background: #fef3c7; color: #92400e; }
.b-expired, .b-suspended, .b-closed { background: #fee2e2; color: #991b1b; }

.alert {
  padding: 13px 16px; border-radius: 14px; margin-bottom: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.alert-warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-ok { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

/* Modals */
.modal-bg {
  position: fixed; inset: 0; background: rgba(15,23,42,0.6); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; padding: 14px; z-index: 60;
}
.modal-bg.open { display: flex; }
.modal {
  background: #fff; width: 100%; max-width: 540px; max-height: 90vh;
  overflow-y: auto; border-radius: 20px; padding: 22px; box-shadow: 0 24px 60px rgba(0,0,0,0.28);
}

/* QR Print Cards */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.qr-card {
  background: #fff; border: 2px solid var(--brand); border-radius: 18px;
  padding: 20px 14px; text-align: center; page-break-inside: avoid;
}
.qr-box { display: flex; justify-content: center; margin: 12px 0; }
.qr-box img, .qr-box canvas { border-radius: 8px; }

/* Admin Stats & Tables */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-box { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px; text-align: center; box-shadow: var(--shadow); }
.stat-num { font-size: 24px; font-weight: 900; color: var(--brand); }
.stat-lbl { font-size: 12px; color: var(--muted); font-weight: 700; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 9px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; font-weight: 800; background: #f8fafc; }

.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin-top: 8px; }
.stock-opt {
  border: 2px solid var(--border); border-radius: 10px; padding: 5px; text-align: center;
  cursor: pointer; font-size: 11px; font-weight: 700; background: #fff;
}
.stock-opt.selected { border-color: var(--brand); background: var(--brand-soft); }
.stock-opt img { width: 100%; height: 48px; object-fit: cover; border-radius: 7px; display: block; margin-bottom: 3px; }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 12px;
  font-weight: 700; z-index: 95; display: none; box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }

@media print {
  body { background: #fff; }
  .no-print, .topbar, .tabs, .alert, .toast, .wa-float { display: none !important; }
  .container { max-width: 100%; padding: 0; }
  .qr-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}


/* ==================== Financial & Renewals Hub (v2.0) ==================== */
.fin-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 10px;
  align-items: end;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--brand);
}
.kpi-card.kpi-rev { border-top-color: #16a34a; }
.kpi-card.kpi-exp { border-top-color: #dc2626; }
.kpi-card.kpi-net { border-top-color: #2563eb; }
.kpi-card.kpi-cnt { border-top-color: #7c3aed; }
.kpi-val { font-size: 20px; font-weight: 900; margin-top: 6px; line-height: 1.4; }
.kpi-sub { font-size: 12px; color: var(--muted); font-weight: 700; }

.wallet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 10px;
}
.wallet-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wallet-amt { font-size: 19px; font-weight: 900; color: var(--ink); }

.b-new-tx { background: #dcfce7; color: #166534; }
.b-renewal { background: #dbeafe; color: #1e40af; }
.b-addon { background: #f3e8ff; color: #6b21a8; }
.b-refund { background: #fee2e2; color: #991b1b; }
.b-detached { background: #f1f5f9; color: #475569; }


/* ==================== Security & Anti-Fake Orders (v3.0) ==================== */
.brand-logo-img {
  width: 44px; height: 44px; border-radius: 12px; object-fit: cover; flex-shrink: 0;
  display: block; box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}
.challenge-box {
  background: #f8fafc;
  border: 1px dashed #94a3b8;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 13px;
}
.challenge-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px;
}
.challenge-q {
  background: var(--ink); color: #fde68a; font-weight: 900; font-size: 16px;
  padding: 6px 14px; border-radius: 9px; letter-spacing: 1px; direction: ltr;
}
.security-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0;
  padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700;
}


/* ==================== Variants, Add-ons, Coupons & Restaurant Reports (v4.0) ==================== */
.opt-group { margin-bottom: 14px; }
.opt-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px;
  margin-bottom: 7px; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.opt-row:hover { background: #f8fafc; }
.opt-row.active { border-color: var(--brand); background: var(--brand-soft); }

.dyn-row {
  display: grid; grid-template-columns: 1fr 1fr 95px auto; gap: 6px;
  margin-bottom: 7px; align-items: center;
}
@media (max-width: 560px) {
  .dyn-row { grid-template-columns: 1fr 1fr; }
}

.bar-track {
  width: 100%; height: 9px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin-top: 5px;
}
.bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--brand), #f97316); border-radius: 999px;
}
.store-open-pill { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.store-closed-pill { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.b-cancelled { background: #fee2e2; color: #991b1b; text-decoration: line-through; }
.b-confirmed { background: #dcfce7; color: #166534; }

/* v5: clearer typography, accessible touch targets and responsive tables */
html { font-size: 16px; }
body { font-family: 'Cairo', 'Noto Sans Arabic', Tahoma, Arial, sans-serif; line-height: 1.75; }
html[lang="en"] body { font-family: system-ui, -apple-system, 'Segoe UI', Arial, sans-serif; line-height: 1.6; }
input,textarea,select { font-size: 16px !important; }
h1,h2,h3 { line-height:1.4; overflow-wrap:anywhere; }
.kpi-val,.wallet-amt,.price,.item-price { font-variant-numeric:tabular-nums; }
.btn { min-height:42px; }
.btn:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible {outline:3px solid #2563eb;outline-offset:3px;}
.samurai-credit { text-align:center; font-size:12px; padding:16px 12px; color:#64748b; overflow-wrap:anywhere; }
.samurai-credit a {text-decoration:underline;text-underline-offset:3px;}
footer .samurai-credit {color:#e2e8f0;}
caption {caption-side:top;text-align:start;padding:8px;color:var(--muted);font-size:12px;}
@media(max-width:600px){.container{padding:12px;}.card{padding:14px;} .topbar-inner{flex-wrap:wrap;gap:8px;} .topbar-inner .row{flex-wrap:wrap;} .btn{white-space:normal;} .samurai-credit{padding-bottom:90px;} }
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;transition-duration:.01ms!important;}}
