/* كاريبوني – طلب الوجبات */

@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/cairo-arabic-400-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+25CC;
}
@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/cairo-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/cairo-arabic-700-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+25CC;
}
@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/cairo-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/cairo-arabic-800-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+25CC;
}
@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/cairo-latin-800-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --primary: #c8102e;
  --primary-dark: #9d0c23;
  --bg: #faf7f5;
  --card: #ffffff;
  --text: #1f1f1f;
  --muted: #6b6b6b;
  --border: #ebe4df;
  --whatsapp: #25d366;
  --error: #c00000;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: 96px; /* room for the fixed cart bar */
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

img { max-width: 100%; display: block; }

button, input, select { font: inherit; font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ---------- Header ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: center;
  padding: 10px 16px;
}

.logo {
  height: 64px;
  width: auto;
}

/* ---------- Pickup info ---------- */
.pickup-info {
  margin: 14px 12px 6px;
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.pickup-info h2 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--primary);
}

.pickup-info ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.pickup-info li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.pickup-info small { color: var(--muted); white-space: nowrap; }

/* ---------- Categories ---------- */
.categories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 12px 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.categories::-webkit-scrollbar { display: none; }

.cat-btn {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
}

.cat-btn[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---------- Menu ---------- */
main { padding: 0 12px; }

.status {
  text-align: center;
  color: var(--muted);
  padding: 40px 10px;
}

.menu-section { margin-top: 6px; }

.section-title {
  margin: 18px 4px 10px;
  font-size: 18px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 640px) {
  .menu-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .logo { height: 68px; }
}

@media (min-width: 960px) {
  .menu-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  main, .categories, .pickup-info { max-width: 1100px; margin-inline: auto; }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f3efec;
}

.card-body {
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.card-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.card-en {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  direction: ltr;
  text-align: right;
}

.card-foot {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.price {
  direction: ltr;
  font-weight: 700;
  color: var(--primary);
  font-size: 14px;
  white-space: nowrap;
}

.price s {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  margin-inline-end: 4px;
}

.price small { font-size: 11px; font-weight: 400; }

/* ---------- Buttons & stepper ---------- */
.btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}

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

.btn-add:active { background: var(--primary-dark); }

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f6eeee;
  border-radius: 10px;
  padding: 3px;
}

.stepper button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.stepper span {
  min-width: 26px;
  text-align: center;
  font-weight: 700;
}

/* ---------- Cart bar ---------- */
.cart-bar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 30;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
}

.cart-summary { display: flex; flex-direction: column; font-size: 14px; }
.cart-summary strong { font-size: 17px; }

.btn-light {
  background: #fff;
  color: var(--primary);
  padding: 11px 18px;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  background: #fff;
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 640px) {
  .modal { align-items: center; }
  .modal-panel { border-radius: 18px; max-height: 86vh; }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 { margin: 0; font-size: 18px; }

.icon-btn {
  border: 0;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 12px;
  -webkit-overflow-scrolling: touch;
}

.modal-foot {
  border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  font-size: 17px;
  font-weight: 700;
}

.btn-wa {
  background: var(--whatsapp);
  color: #fff;
  width: 100%;
  padding: 13px;
  font-size: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.btn-wa:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-link {
  background: none;
  border: 0;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  padding: 6px;
  justify-self: center;
}

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

/* ---------- Cart lines ---------- */
.cart-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}

.cart-line .name { font-weight: 700; font-size: 15px; }
.cart-line .meta { font-size: 13px; color: var(--muted); direction: rtl; }

/* ---------- Order form ---------- */
.order-form {
  display: grid;
  gap: 4px;
  margin-top: 12px;
}

.order-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  font-size: 14px;
  margin-top: 6px;
}

.order-form input,
.order-form select,
.order-form textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #d9d2cd;
  border-radius: 10px;
  font-size: 16px; /* prevents iOS zoom on focus */
  font-weight: 400;
  background: #fff;
  color: var(--text);
}

.order-form input:focus,
.order-form select:focus,
.order-form textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: transparent;
}

.order-form .invalid { border-color: var(--error); }

.error {
  color: var(--error);
  font-size: 13px;
  min-height: 0;
}

.error:empty { display: none; }

.form-note {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #eaf8ee;
  color: #1d6b3a;
  font-size: 14px;
}

.order-form textarea { resize: vertical; min-height: 76px; font-family: inherit; }

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--muted);
}

/* ---------- حالة الإغلاق ---------- */
.closed-banner {
  margin: 12px 12px 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: #fdeaea;
  color: var(--error);
  border: 1px solid #f3c2c2;
  display: grid;
  gap: 2px;
  text-align: center;
}

.closed-banner span { color: #6b1d1d; font-size: 14px; }

.btn-add:disabled {
  background: #cfc7c1;
  color: #fff;
  cursor: not-allowed;
}

.stepper button:disabled { opacity: .4; cursor: not-allowed; }

.form-note.warn { background: #fdeaea; color: var(--error); margin: 0; }

/* ---------- خيارات المنتج ---------- */
.card-action { display: grid; justify-items: end; gap: 4px; }
.in-cart { font-size: 11px; font-weight: 700; color: #1d6b3a; background: #eaf8ee; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }

.btn-wide { width: 100%; padding: 13px; font-size: 16px; }

.opt-group { border: 0; padding: 0; margin: 10px 0 16px; min-width: 0; }
.opt-group legend { font-weight: 700; font-size: 16px; padding: 0; margin-bottom: 8px; }
.opt-group legend .req { color: var(--primary); font-size: 12px; font-weight: 400; }
.opt-group legend .optional { color: var(--muted); font-size: 12px; font-weight: 400; }

.opt-choice {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 12px; margin-bottom: 8px; cursor: pointer; background: #fff;
}
.opt-choice.sel { border-color: var(--primary); background: #fff5f6; }
.opt-choice input { accent-color: var(--primary); width: 20px; height: 20px; margin: 0; flex: 0 0 auto; }
.opt-choice .nm { flex: 1; font-weight: 600; }
.opt-choice .extra { color: var(--primary); font-weight: 700; font-size: 14px; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }

.cart-line .opts { font-size: 13px; color: var(--primary); }
