:root {
  --green: #3E2F26;
  --green-dark: #281B15;

  --orange: #F6B828;
  --orange-dark: #E5A713;
  --orange-text: #8D670C;

  --bg: #FAF7F2;
  --card: #FFFFFF;

  --border: #ECE5DB;
  --border-strong: #DED6C9;

  --text: #1E1611;
  --text-soft: #786E67;

  --danger: #D8232A;
  --danger-dark: #B91D24;

  --shadow-sm: 0 2px 8px rgba(62, 47, 38, 0.08);
  --shadow-md: 0 8px 24px rgba(62, 47, 38, 0.12);
  --shadow-lg: 0 10px 28px rgba(62, 47, 38, 0.22);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius: var(--radius-md); /* legacy alias */

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  letter-spacing: -0.02em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html:lang(ar), html:lang(ar) body { font-family: "Cairo", sans-serif; }

h1, h2, h3, .brand-mark { 
  font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.025em;
  color: var(--text);
}
html:lang(ar) h1, html:lang(ar) h2, html:lang(ar) .brand-mark { font-family: "Cairo", sans-serif; }

.hidden { display: none !important; }

.loader-mark {
  font-family: "Poppins", sans-serif; font-size: 48px; font-weight: 700; color: #fff;
  width: 72px; height: 72px; border: 3px solid #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  animation: pulse-loader 1.4s ease-in-out infinite;
}
@keyframes pulse-loader { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: 0.7; } }

.brand-logo {
  height: 42px !important;
  max-height: 42px !important;
  width: auto !important;
  max-width: 150px !important;
  object-fit: contain !important;
  display: block !important;
}

/* Ensure the hero title doesn't touch the glass now that the wrapper padding is gone */
.hero h1, .hero-title, .hero h2 {
  padding: 0 16px !important;
}

.hero-title {
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--green-dark);
  line-height: 1.2;
}

.offers-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 0 0 10px;
  scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.offers-row::-webkit-scrollbar {
  display: none;
}

.offer-card {
  background-size: cover !important;
  background-position: center !important;
  flex: 0 0 86%;
  width: 86%;
  max-width: 86%;
  min-height: 172px;
  background: linear-gradient(145deg, var(--green), var(--green-dark));
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-md);
    display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  box-sizing: border-box;
}

.offer-title {
  font-weight: 500;
  font-size: 18px;
  line-height: 1.3;
  margin-bottom: 12px;
  min-height: 0;
}

.offer-prices {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.old-price {
  text-decoration: line-through;
  opacity: 0.8;
  font-size: 14px;
  color: var(--orange);
}

.new-price {
  font-size: 26px;
  line-height: 1;
  font-weight: 800;
  color: var(--orange);
}

.offer-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  margin-bottom: 11px;
}

.offer-code {
  font-weight: 700;
  letter-spacing: 0.4px;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
}

.offer-add-btn {
  width: 100%;
  min-height: 42px;
  background: var(--orange);
  color: var(--green-dark);
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.offer-add-btn:active {
  background: var(--orange-dark);
  transform: scale(0.98);
}
.qty-stepper-sm button:disabled { opacity: 0.35; cursor: default; }

.offers-stack { display: flex; flex-direction: column; gap: 14px; }
.launch-offer-card {
  display: flex; gap: 16px; align-items: center;
  background: linear-gradient(145deg, var(--green), var(--green-dark));
  border-radius: var(--radius-lg); padding: 16px;
  color: #fff; box-shadow: var(--shadow-md); overflow: hidden;
}
.launch-offer-badge {
  display: block;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
  font-size: 11px; font-weight: 700; color: var(--green-dark);
  background: var(--orange); border: 1px solid rgba(0,0,0,0.08);
  border-radius: 999px; padding: 5px 12px;
}
.launch-offer-row {
  display: flex;
  gap: 14px;
  align-items: center;
  width: 100%;
}
.launch-offer-body { flex: 1; min-width: 0; }
.launch-offer-media {
  width: 100px; height: 100px; flex-shrink: 0; border-radius: var(--radius-md);
  overflow: hidden; background: #EFEBE4;
}
.launch-offer-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.launch-offer-title { font-size: 18px; font-weight: 500; line-height: 1.3; margin-bottom: 4px; }
.launch-offer-sub { font-size: 11px; opacity: 0.85; margin-bottom: 10px; }
.launch-offer-prices { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.launch-offer-prices .old-price {
  text-decoration: line-through; opacity: 0.65; font-size: 13px; color: #fff;
  display: inline-flex; align-items: baseline; gap: 3px;
}
.launch-offer-prices .old-price .riyal-svg { filter: brightness(0) invert(1); opacity: 0.65; height: 11px; }
.launch-offer-prices .new-price {
  font-size: 23px; font-weight: 800; color: #F59E0B;
  display: inline-flex; align-items: baseline; gap: 4px;
}
.launch-offer-prices .new-price .riyal-svg {
  filter: brightness(0) saturate(100%) invert(70%) sepia(74%) saturate(1000%) hue-rotate(1deg) brightness(101%) contrast(96%);
  height: 19px;
}
.launch-offer-btn {
  width: 100%; min-height: 42px; background: var(--orange); color: var(--green-dark); border: none;
  border-radius: 999px; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}
.launch-offer-btn:active { transform: scale(0.97); background: var(--orange-dark); }
.launch-offer-btn.is-added { background: rgba(255,255,255,0.18); color: #fff; cursor: default; }

.cart-line-promo-tag { font-size: 11px; font-weight: 700; color: var(--orange-text); margin-top: 2px; }
.cart-line-old-price { text-decoration: line-through; opacity: 0.6; font-size: 12px; margin-inline-end: 4px; }

.category-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px 14px;
  background: var(--bg);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  position: sticky;
  top: 54px !important;
  z-index: 20;
  border-bottom: 1px solid var(--border);
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.cat-tab {
  flex: 0 0 auto;
  background: none;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  width: 96px;
  box-shadow: none;
  transition: transform 0.15s ease;
}

.cat-tab:active {
  transform: scale(0.95);
}

.cat-squircle {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-md);
  background: #EFECE6;
  border: 2px solid transparent;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.cat-squircle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cat-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 96px;
}

.cat-tab.active .cat-squircle {
  border-color: var(--orange);
  background: var(--card);
  box-shadow: 0 3px 12px rgba(246, 184, 40, 0.35);
}

.cat-tab.active .cat-name {
  color: var(--text);
  font-weight: 700;
}

.cat-tab:active {
  transform: scale(0.97);
}

.menu-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 20px 110px;
}

.item-card {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 16px 0;
  box-shadow: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.item-card:last-child {
  border-bottom: none;
}

.item-card:active {
  opacity: 0.8;
  transform: none;
}

.item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.item-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px; /* Increased line spacing */
  line-height: 1.35;
}

.item-desc {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.35;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-cal {
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 6px;
}

/* Image box on the right */
.item-media {
  position: relative;
  width: 116px;
  height: 96px;
  min-width: 116px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #EFECE6;
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Placeholder when no image exists in Firestore */
.item-media .img-placeholder {
  width: 100%;
  height: 100%;
  background: #EFECE6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-media .img-placeholder::after {
  content: "🍽️";
  font-size: 26px;
  opacity: 0.35;
}

/* Plus button on the image */
.item-add-icon {
  position: absolute;
  bottom: 4px;
  inset-inline-end: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--orange);
  border: none;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
/* ==========================================================================
   FIT CONTENT TO SCREEN (FIX SIDE GAPS)
   ========================================================================== */
#appRoot {
  width: 100% !important;
  max-width: 480px !important;
  margin: 0 auto !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

.hero {
  padding: 16px 16px 8px 16px !important;
  box-sizing: border-box !important;
}

.menu-grid, #menuGrid {
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 8px 0 4px 0 !important;
}

.item-card {
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 16px 16px !important; /* Moves padding inside so the card spans 100% */
}
.riyal-svg {
  height: 14px !important;
  width: auto !important;
  display: inline-block !important;
  vertical-align: middle !important;
}
/* ==========================================================================
   UPGRADED STICKY CART ACTION BAR
   ========================================================================== */
.fab-cart {
  position: fixed !important;
  bottom: calc(16px + env(safe-area-inset-bottom)) !important;
  left: 16px !important;
  right: 16px !important;
  max-width: 448px !important;
  margin: 0 auto !important;
  height: 58px !important;
  border-radius: 999px !important;
  background: #1E1611 !important; /* Polished brand dark brown */
  color: #FFFFFF !important;
  border: none !important;
  z-index: 10000 !important; /* Highest z-index: category tabs will never overlap */
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 16px !important;
  box-sizing: border-box !important;
  cursor: pointer !important;
  box-shadow: var(--shadow-lg) !important;
  transition: transform 0.15s ease, background 0.15s ease !important;
}

.fab-cart:active {
  transform: scale(0.985) !important;
  background: #2B2019 !important;
}

.cart-bar-start {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-bar-icon-svg {
  width: 20px; height: 20px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

.cart-bar-count-text {
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
}

.cart-bar-divider {
  opacity: 0.35;
  font-size: 14px;
}

.cart-bar-total {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.cart-bar-end {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 500;
  color: #F8D147; /* High-contrast CTA accent */
}

/* Flips arrow direction automatically in Arabic / RTL */
[dir="rtl"] .cart-bar-arrow {
  transform: rotate(180deg);
  display: inline-block;
}

@keyframes badge-pulse { 
  0% { transform: scale(1); } 
  50% { transform: scale(1.4); } 
  100% { transform: scale(1); } 
}

/* Modal Overlay & Scroll Lock */
body.modal-open {
  overflow: hidden;
  touch-action: none;
}

body.modal-open .topbar,
body.modal-open .category-tabs,
body.modal-open .fab-cart {
  display: none !important;
}

.modal-overlay {
  position: fixed; 
  inset: 0; 
  background: rgba(20, 25, 22, 0.6); 
  z-index: 20000;
  display: flex; 
  align-items: flex-end; 
  justify-content: center;
  overscroll-behavior: contain;
}

.modal-overlay.hidden {
  display: none !important;
}

.sheet-drag-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: #D8D4C7;
  margin: 0 auto 14px;
}

/* Distinct Item Modal Image Placeholder Box */
.modal-img {
  position: relative;
  width: 100%;
  margin-bottom: 18px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #EFEBE4;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-img:has(.img-placeholder) {
  height: 220px;
}
.modal-img img {
  width: 100%;
  height: auto;
  max-height: 360px;
  display: block;
}
.img-placeholder.large {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #EFECE6, #DFD9CE);
}
.ph-icon {
  font-size: 42px;
  opacity: 0.35;
}

/* Standalone Master "All Sauces" Button */
.master-sauce-btn {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 10px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}
.master-sauce-btn.selected {
  background: rgba(246, 184, 40, 0.14);
  border-color: var(--orange);
  color: var(--green-dark);
}

/* Full-width Stacked Size Rows */
.size-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.size-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.size-item.selected {
  border-color: #E2A012;
  background: #FFFBF0;
  color: #1E1B18;
}

.size-item-radio {
  display: flex;
  align-items: center;
  gap: 10px;
}

.radio-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #C4C0B3;
  position: relative;
}

.size-item.selected .radio-circle {
  border-color: #E2A012;
}

.size-item.selected .radio-circle::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #E2A012;
}

/* Required Chip */
.badge-req {
  font-size: 11px;
  font-weight: 500;
  color: #A32020;
  background: #FEE8E8;
  padding: 2px 7px;
  border-radius: 999px;
  margin-inline-start: 6px;
}

/* Modal Sticky Footer with Integrated Stepper */

.modal-footer .qty-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 150px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 6px;
  flex-shrink: 0;
}

.modal-footer .qty-stepper button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.modal-footer .qty-stepper span {
  font-size: 15px;
  font-weight: 600;
}

/* Enhanced CTA Button Contrast */
#modalAddBtn {
  background: #F6B828;
  color: #241A14 !important;
  font-weight: 600;
  font-size: 15px;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  cursor: pointer;
}

.flex-grow {
  flex-grow: 1;
}

.modal-sheet {
  background: var(--bg);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; 
  padding: 20px 20px 24px; 
  position: relative;
}

#itemModal,
#confirmScreen {
  z-index: 20000 !important;
}

#itemModal .modal-sheet {
  padding-bottom: 90px; /* Reserves space only for the item modal add button */
}
.modal-close {
  position: absolute; top: 22px; inset-inline-end: 22px; margin-top: -6px; box-shadow: var(--shadow-md);
  background: rgba(255, 255, 255, 0.85); border: 1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  width: 44px; height: 44px; border-radius: 50%; font-size: 18px; 
  display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10;
}
.modal-body h2 { margin: 0; font-size: 22px; font-weight: 500; color: var(--text); }
.modal-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 20px;
}
.modal-title-row .fav-btn { margin-block: 0; margin-inline-end: -10px; flex-shrink: 0; }
.modal-img { margin-bottom: 20px; }
.ingredients { font-size: 13px; color: var(--text-soft); margin: 0 0 4px; }
.calories { font-size: 13px; color: var(--text-soft); margin: 0 0 14px; }

.modal-group { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.modal-group:last-of-type { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.modal-group-title { font-weight: 500; font-size: 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.req { color: var(--danger); }
.opt-hint { font-weight: 400; color: var(--text-soft); font-size: 12px; }
.option-row { display: flex; flex-wrap: wrap; gap: 8px; }
.opt-btn {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--card);
  font-size: 13px; cursor: pointer; color: var(--text);
}
.opt-btn.selected { background: var(--green); border-color: var(--green); color: #fff; }

.segmented-control { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #EFECE6; padding: 4px; border-radius: 999px; }
.segmented-btn { border: none; background: transparent; padding: 10px 8px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--text-soft); cursor: pointer; text-align: center; }
.segmented-btn.selected { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }

.option-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt-btn-grid { border: 1px solid var(--border); background: var(--card); padding: 10px 8px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text-soft); cursor: pointer; text-align: center; line-height: 1.25; }
.opt-btn-grid.selected { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }

input[type="text"], input[type="tel"] {
  width: 100%; border: 1px solid var(--border); border-radius: 999px; padding: 11px 16px;
  font-size: 14px; font-family: inherit; background: var(--card); color: var(--text);
}
textarea {
  width: 100%; min-height: 68px; padding: 12px 16px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--card); font-family: inherit;
  font-size: 14px; color: var(--text); outline: none; resize: vertical;
  transition: border-color 0.15s, background 0.15s;
}
textarea:focus { border-color: var(--orange); background: var(--card); }

.modal-qty-row { display: flex; align-items: center; justify-content: space-between; }
.qty-stepper { display: flex; align-items: center; gap: 14px; }
.qty-stepper button {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--card);
  font-size: 18px; cursor: pointer;
}
#qtyVal { font-weight: 700; min-width: 20px; text-align: center; }

.modal-footer {
  position: fixed; bottom: 0; inset-inline: 0; max-width: 480px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; z-index: 10;
  background: var(--bg); padding: 14px 20px; border-top: 1px solid var(--border);
}
.primary-btn {
  background: var(--orange); color: var(--text); border: none; border-radius: 999px;
  padding: 13px 20px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.primary-btn.wide { width: 100%; }
.secondary-btn {
  background: var(--card); color: var(--green); border: 1px solid var(--green); border-radius: 999px;
  padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.secondary-btn.wide { width: 100%; }

.cart-lines { margin-top: 12px; }
.empty-cart { color: var(--text-soft); text-align: center; padding: 30px 0; }
.cart-line { display: flex; gap: 12px; border-bottom: 1px solid var(--border); padding: 14px 0; }
.cart-line-thumb {
  width: 56px; height: 56px; border-radius: var(--radius-sm); overflow: hidden; flex-shrink: 0;
  background: #EFEBE4; display: flex; align-items: center; justify-content: center;
}
.cart-line-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cart-line-thumb .ph-icon { font-size: 20px; }
.cart-line-body { flex: 1; min-width: 0; }
.cart-line-main { display: flex; justify-content: space-between; font-weight: 600; font-size: 14px; }
.cart-line-mod { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.cart-line-comment { font-size: 12px; margin-top: 4px; color: var(--danger); }
.cart-line-controls { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.qty-stepper-sm { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; }
.qty-stepper-sm button {
  width: 22px; height: 22px; border: none; background: none; font-size: 15px; font-weight: 700;
  color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.qty-stepper-sm span { font-size: 13px; font-weight: 700; min-width: 14px; text-align: center; }
.cart-line-trash {
  background: none; border: none; color: var(--text-soft); cursor: pointer; padding: 6px;
  display: flex; align-items: center; justify-content: center;
}
.cart-line-trash svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.cart-footer { margin-top: 10px; }
.checkout-total-row {
  display: flex; justify-content: space-between; font-weight: 700; font-size: 16px;
  padding: 12px 0; border-top: 1px solid var(--border); margin: 12px 0;
}
.cart-total-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 12px 0; border-top: 1px solid var(--border); margin: 12px 0 16px;
}
.cart-total-label-group { display: flex; flex-direction: column; }
.cart-total-label-group > span:first-child { font-weight: 700; font-size: 15px; color: var(--text); }
.cart-total-amount { font-weight: 700; font-size: 17px; }
.vat-note { font-size: 11px; color: var(--text-soft); margin-top: 2px; text-align: start; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.sheet-subtitle { font-size: 12px; font-weight: 400; color: var(--text-soft); margin-top: 2px; }
.pin-box-row { display: flex; gap: 10px; }
.pin-box { width: 48px; height: 48px; text-align: center; font-size: 20px; }
.radio-row { display: flex; gap: 12px; }
.radio-opt {
  flex: 1; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border);
  border-radius: 999px; padding: 10px 16px; cursor: pointer; font-size: 14px; background: var(--card);
}
.delivery-notice {
  background: #FFF3E4; border: 1px solid #F0C27B; color: #8A5A1E; border-radius: 10px;
  padding: 10px 14px; font-size: 13px; margin-bottom: 16px;
}

/* ---- Delivery location (GPS / map picker / road-distance gate) ---- */
.delivery-location-buttons { display: flex; gap: 10px; margin-bottom: 12px; }
.location-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); color: var(--text); font-size: 13px; font-weight: 600;
  padding: 10px 12px; cursor: pointer; text-align: center; line-height: 1.3;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.location-btn.active { border-color: #E2A012; background: #FFFBF0; color: #8D670C; }
.location-btn.active .btn-icon-svg { stroke: #E2A012; }
.location-btn:active { transform: scale(0.98); background: rgba(62, 47, 38, 0.06); }
.btn-icon-svg {
  width: 16px; height: 16px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.location-btn.is-loading { opacity: 0.7; cursor: default; }
.location-btn.is-loading .btn-icon-svg {
  animation: locateSpin 0.8s linear infinite;
}
@keyframes locateSpin {
  to { transform: rotate(360deg); }
}

.geo-fallback-note {
  background: #FFF3E4; border: 1px solid #F0C27B; color: #8A5A1E; border-radius: 10px;
  padding: 9px 14px; font-size: 12px; margin-bottom: 12px;
}

.delivery-location-summary { margin-bottom: 14px; }
.distance-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700;
  padding: 8px 16px; border-radius: 999px; background: #DCFCE7; color: #15803D; border: 1px solid #86EFAC;
}
.distance-badge.estimated { background: #FFF3E4; color: #8A5A1E; border-color: #F0C27B; }

.delivery-overlimit-banner {
  background: #FEE2E2; border: 1.5px solid #FCA5A5; color: #991B1B; border-radius: 12px;
  padding: 14px 16px; margin-bottom: 14px;
}
.overlimit-text { font-size: 13px; font-weight: 600; margin: 0 0 6px; line-height: 1.5; }
.overlimit-text:last-of-type { margin-bottom: 12px; }
.overlimit-actions { display: flex; gap: 10px; }
.overlimit-btn {
  flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px;
  text-align: center; font-size: 13px; text-decoration: none;
}
.overlimit-btn { border-radius: 999px; padding: 10px 16px; }
.overlimit-btn.primary-btn { background: var(--orange); color: var(--text); border: none; }
.overlimit-btn.secondary-btn { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.landmark-group { margin-top: 4px; }
.leaflet-map-container { position: relative; }
.map-layer-toggle {
  display: flex; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 3px; box-shadow: var(--shadow-sm);
}
.map-layer-btn {
  border: none; background: transparent; font-size: 12px; font-weight: 600;
  color: var(--text-soft); padding: 6px 12px; border-radius: var(--radius-lg);
  cursor: pointer; white-space: nowrap;
}
.map-layer-btn.active { background: #FFFBF0; color: #E2A012; }

.map-picker-hint { font-size: 12px; color: var(--text-soft); margin: -6px 0 12px; }
.leaflet-map-container {
  width: 100%; height: 320px; border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--border); margin-bottom: 12px; background: #EFEBE4;
}
.map-picker-distance-info {
  text-align: center; font-size: 14px; font-weight: 700; color: var(--text);
  padding: 10px 0; margin-bottom: 12px;
}

.promo-row { display: flex; gap: 8px; }
.promo-row input { flex: 1; }
.promo-row #applyPromoBtn { border-radius: 999px; }
.promo-msg { font-size: 12px; margin-top: 6px; }
.promo-msg.success { color: var(--green); }
.promo-msg.error { color: var(--danger); }
.error-msg { color: var(--danger); font-size: 13px; margin-bottom: 10px; min-height: 18px; }

.confirm-sheet { text-align: center; padding-top: 40px; }
.confirm-check {
  width: 88px; height: 88px; border-radius: 50%;
  background: linear-gradient(145deg, var(--green), var(--green-dark));
  display: flex; align-items: center; justify-content: center; margin: 0 auto 20px;
  box-shadow: var(--shadow-lg);
  animation: confirm-pop 480ms var(--ease-out) backwards;
}
.confirm-check-svg { width: 44px; height: 44px; overflow: visible; }
.confirm-check-path {
  fill: none; stroke: #fff; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 28px; stroke-dashoffset: 28px;
  animation: confirm-draw 420ms var(--ease-out) 260ms forwards;
}
@keyframes confirm-pop { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes confirm-draw { to { stroke-dashoffset: 0; } }

.confirm-order-num {
  display: inline-flex; flex-direction: column; align-items: center; gap: 3px;
  margin: 4px auto 28px; padding: 10px 24px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--card);
}
.confirm-order-num-label { font-size: 12px; color: var(--text-soft); font-weight: 600; }
.confirm-order-num-value {
  font-size: 22px; font-weight: 700; letter-spacing: 0.5px; color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: "Poppins", "Inter", monospace;
}

.status-tracker { position: relative; display: flex; justify-content: space-between; margin-bottom: 20px; padding-top: 6px; }
.status-track {
  position: absolute; top: 13px; inset-inline-start: 12.5%; width: 75%; height: 3px;
  background: var(--border); border-radius: 999px;
}
.status-track-fill {
  position: absolute; inset-inline-start: 0; top: 0; height: 100%; width: 0%;
  background: var(--green); border-radius: 999px;
  transition: width 500ms var(--ease-out);
}
.status-step {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; color: var(--text-soft);
}
.ts-dot {
  width: 14px; height: 14px; border-radius: 50%; background: var(--card);
  border: 2.5px solid var(--border-strong);
  transition: background-color 200ms var(--ease-out), border-color 200ms var(--ease-out);
}
.status-step.done .ts-dot { background: var(--green); border-color: var(--green); }
.status-step.done .ts-label { color: var(--text); }
.status-step.active .ts-dot {
  background: var(--orange); border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(246, 184, 40, 0.25);
  animation: timeline-glow 1.8s ease-in-out infinite;
}
.status-step.active .ts-label { color: var(--text); font-weight: 700; }
@keyframes timeline-glow {
  0%, 100% { box-shadow: 0 0 0 4px rgba(246, 184, 40, 0.25); }
  50%      { box-shadow: 0 0 0 7px rgba(246, 184, 40, 0.10); }
}
.confirm-status-text { font-size: 14px; color: var(--text-soft); margin-bottom: 26px; }
.cancel-order-btn {
  background: #FFF1F1;
  color: var(--danger);
  border: 1px solid #FACDCD;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.cancel-order-btn:hover {
  background: var(--danger);
  color: #FFFFFF;
}
/* Price & Riyal Icon */
.item-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--orange-text);
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.item-price .riyal-svg {
  height: 16px !important;
}

.riyal-icon {
  display: inline-block;
  vertical-align: middle;
  width: 14px;
  height: 14px;
  fill: currentColor;
}
/* Topbar Layout */
/* ==========================================================================
   STICKY HEADER, LOGO & STATUS PILL
   ========================================================================== */
html, body {
  overflow-x: clip !important;
}

#appRoot {
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  position: relative;
  box-shadow: 0 0 50px rgba(62, 47, 38, 0.12);
}

@media (min-width: 640px) {
  .menu-grid {
    max-width: 480px;
  }
}

/* ==========================================================================
   STICKY HEADER & LOGO (Locked at 54px - Zero Gaps)
   ========================================================================== */
header.topbar, .topbar {
  position: -webkit-sticky !important;
  position: sticky !important;
  top: 0 !important;
  height: 54px !important;
  box-sizing: border-box !important;
  z-index: 9999 !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 16px !important;
  background-color: var(--bg) !important;
  border-bottom: 1px solid var(--border) !important;
}

.brand {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  min-width: 0 !important;
}

.brand-logo {
  height: 38px !important;
  max-height: 38px !important;
  width: auto !important;
  max-width: 140px !important;
  object-fit: contain !important;
  display: block !important;
}

.lang-btn {
  background: #FFFFFF !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 999px !important;
  padding: 6px 14px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  cursor: pointer !important;
  line-height: 1 !important;
  box-shadow: var(--shadow-sm) !important;
}

/* Category Tabs: Locked directly against bottom of 54px Topbar */
.category-tabs {
  position: -webkit-sticky !important;
  position: sticky !important;
  top: 54px !important;
  z-index: 9990 !important;
  background: var(--bg) !important;
  margin: 0 !important;
}

/* ==========================================================================
   SEARCH BAR
   ========================================================================== */
.search-container {
  padding: 10px 16px 4px 16px !important;
  background: var(--bg) !important;
}

.search-box {
  display: flex !important;
  align-items: center !important;
  background: #FFFFFF !important;
  border: 1px solid var(--border) !important;
  border-radius: 999px !important;
  padding: 0 14px !important;
  height: 42px !important;
  box-sizing: border-box !important;
  box-shadow: var(--shadow-sm) !important;
}

.search-icon {
  font-size: 14px !important;
  opacity: 0.5 !important;
  margin-inline-end: 8px !important;
}

#itemSearchInput {
  flex: 1 !important;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  font-size: 14px !important;
  font-family: inherit !important;
  color: var(--text) !important;
}

#itemSearchInput::placeholder {
  color: var(--text-soft) !important;
}

.search-clear-btn {
  background: #EBE5DF !important;
  border: none !important;
  color: var(--text-soft) !important;
  width: 20px !important;
  height: 20px !important;
  border-radius: 50% !important;
  font-size: 10px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.search-clear-btn.hidden {
  display: none !important;
}
/* Hide cart button when any modal or drawer is open */
body.modal-open #cartBtn,
body.modal-open .fab-cart {
  display: none !important;
}

/* Ensure cart drawer sits on top */
#cartDrawer,
#checkoutScreen {
  z-index: 20000 !important;
}
.fab-cart .riyal-svg {
  filter: brightness(0) invert(1);
}
/* Offer Card Riyal SVGs */
.offer-prices .riyal-svg {
  display: inline-block;
  vertical-align: middle;
  margin-inline-start: 3px;
  filter: brightness(0) invert(1);
}

.offer-prices .riyal-svg-new {
  height: 20px;
  width: auto;
}

.offer-prices .riyal-svg-old {
  height: 12px;
  width: auto;
  opacity: 0.6;
}
/* Loading screen logo styling */
/* Center the loading screen and logo */
/* Center the loading screen and logo */
#loadingScreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  display: flex;
  align-items: center !important;
  justify-content: center !important;
  z-index: 99999 !important;
  background: var(--bg) !important;
  margin: 0 !important;
  padding: 20px !important;
  box-sizing: border-box !important;
}

/* Ensure the hidden class takes precedence when loading completes */
#loadingScreen.hidden {
  display: none !important;
}

#loadingScreen img {
  width: 65% !important;
  max-width: 240px !important;
  height: auto !important;
  display: block !important;
  object-fit: contain !important;
}
.cat-squircle .cat-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  opacity: 0.35;
}
.cat-squircle .cat-placeholder-icon {
  font-size: 24px;
  opacity: 0.35;
}
/* iOS Add to Home Screen Prompt */
.ios-prompt-banner {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  background-color: #1e1e1e;
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  direction: rtl;
  font-size: 13.5px;
  z-index: 9999;
}

.ios-prompt-banner p {
  margin: 0;
  line-height: 1.5;
  padding-left: 8px;
}

.ios-prompt-banner button {
  background: transparent;
  border: none;
  color: #aaaaaa;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
}
/* ==========================================================================
   PHASE 2: MOTION (modal/drawer slide, press feedback, badge pulse, card stagger)
   ========================================================================== */
.modal-overlay {
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: opacity 300ms var(--ease-drawer), display 300ms allow-discrete;
}
.modal-overlay .modal-sheet {
  transition: transform 300ms var(--ease-drawer);
}
.modal-overlay.hidden {
  opacity: 0;
  transition: opacity 300ms var(--ease-drawer), display 300ms allow-discrete;
}
.modal-overlay.hidden .modal-sheet {
  transform: translateY(100%);
}
@starting-style {
  .modal-overlay:not(.hidden) {
    opacity: 0;
  }
  .modal-overlay:not(.hidden) .modal-sheet {
    transform: translateY(100%);
  }
}

.qty-stepper button,
.modal-footer .qty-stepper button {
  transition: transform 120ms var(--ease-out);
}
.qty-stepper button:active {
  transform: scale(0.92);
}
.modal-footer .qty-stepper button:active {
  transform: scale(0.92);
}

.cart-bar-badge.pulse {
  animation: badge-pulse 280ms var(--ease-out);
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
#menuGrid.stagger .item-card {
  animation: card-in 280ms var(--ease-out) backwards;
}
#menuGrid.stagger .item-card:nth-child(1) { animation-delay: 0ms; }
#menuGrid.stagger .item-card:nth-child(2) { animation-delay: 35ms; }
#menuGrid.stagger .item-card:nth-child(3) { animation-delay: 70ms; }
#menuGrid.stagger .item-card:nth-child(4) { animation-delay: 105ms; }
#menuGrid.stagger .item-card:nth-child(5) { animation-delay: 140ms; }
#menuGrid.stagger .item-card:nth-child(6) { animation-delay: 175ms; }
#menuGrid.stagger .item-card:nth-child(7) { animation-delay: 210ms; }
#menuGrid.stagger .item-card:nth-child(8) { animation-delay: 245ms; }
#menuGrid.stagger .item-card:nth-child(n+9) { animation-delay: 245ms; }

@media (prefers-reduced-motion: reduce) {
  .modal-overlay, .modal-overlay .modal-sheet {
    transition-duration: 1ms !important;
  }
  .item-card {
    animation: none !important;
  }
  .cart-bar-badge.pulse {
    animation-duration: 1ms !important;
  }
  .qty-stepper button:active,
  .modal-footer .qty-stepper button:active {
    transform: none !important;
  }
}

/* Search clear button: keep the 20px look, add an invisible 44px tap area */
.search-clear-btn {
  position: relative;
}
.search-clear-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}

/* ==========================================================================
   POLISH: add-to-cart layout, checkout radios, cart qty pill, press feedback
   ========================================================================== */
#modalAddBtn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  white-space: nowrap;
}
#modalAddBtn .add-label { font-weight: 700; }
#modalAddBtn .add-price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-inline-start: 12px;
  border-inline-start: 1px solid rgba(36, 26, 20, 0.22);
  font-weight: 700;
}
@media (max-width: 340px) {
  #modalAddBtn { flex-direction: column; gap: 2px; padding: 8px 10px; }
  #modalAddBtn .add-price { padding-inline-start: 0; border-inline-start: none; }
}

.radio-opt { transition: border-color 0.15s ease, background 0.15s ease, transform 120ms var(--ease-out); }
.radio-opt input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid #C4C0B3;
  position: relative;
  background: transparent;
}
.radio-opt input[type="radio"]:checked { border-color: #E2A012; }
.radio-opt input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #E2A012;
}
.radio-opt:has(input:checked) { border-color: #E2A012; background: #FFFBF0; }

.cart-qty {
  display: inline-block;
  margin-inline-start: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(246, 184, 40, 0.18);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.offer-title, .offer-prices { text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35); }

.primary-btn, .secondary-btn, #modalAddBtn, .size-item, .segmented-btn, .opt-btn-grid, .master-sauce-btn, .radio-opt {
  transition: transform 120ms var(--ease-out), background 0.15s ease, border-color 0.15s ease;
}
.primary-btn:active, .secondary-btn:active, #modalAddBtn:active, .size-item:active, .segmented-btn:active, .opt-btn-grid:active, .master-sauce-btn:active, .radio-opt:active {
  transform: scale(0.98);
}
@media (prefers-reduced-motion: reduce) {
  .primary-btn:active, .secondary-btn:active, #modalAddBtn:active, .size-item:active, .segmented-btn:active, .opt-btn-grid:active, .master-sauce-btn:active, .radio-opt:active { transform: none !important; }
}

.form-group .radio-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}

/* Cart bar: larger riyal sign to match the bigger total */
.fab-cart .riyal-svg {
  height: 17px !important;
}

.cart-bar-start, .cart-bar-end { white-space: nowrap; }
@media (max-width: 340px) {
  .cart-bar-start { gap: 6px; }
  .cart-bar-total { font-size: 16px; }
  .cart-bar-end { font-size: 14px; gap: 6px; }
  .fab-cart { padding: 0 12px !important; }
}

/* Main action buttons share the cart bar's lighter, larger type */
.primary-btn,
.offer-add-btn,
#modalAddBtn {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.2px;
}
#modalAddBtn .add-label,
#modalAddBtn .add-price {
  font-weight: 500;
}
#modalAddBtn { padding-inline: 14px; }
@media (max-width: 380px) {
  #modalAddBtn { gap: 8px; padding-inline: 10px; }
  #modalAddBtn .add-price { padding-inline-start: 8px; }
}

/* ==========================================================================
   FAVORITES & ORDER HISTORY
   ========================================================================== */

/* --- Header actions ------------------------------------------------------ */
.topbar-actions {
  display: flex !important;
  align-items: center !important;
  gap: 2px !important;
}
.icon-btn {
  position: relative !important;
  width: 44px !important;
  height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  border-radius: 50% !important;
  color: var(--text) !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 120ms var(--ease-out), background-color 150ms ease;
}
.icon-btn svg,
.sheet-empty-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:active { transform: scale(0.96); background-color: rgba(62, 47, 38, 0.07) !important; }
.icon-btn:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }

/* Keep the language pill compact but give it a 44px touch area */
.topbar .lang-btn { position: relative !important; margin-inline-start: 6px !important; }
.topbar .lang-btn::after { content: ""; position: absolute; inset: -10px -4px; }
.topbar .lang-btn:active { transform: scale(0.96); }

/* Amber "order in progress" dot on the History icon */
.icon-dot {
  position: absolute;
  top: 9px;
  inset-inline-end: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 2px var(--bg);
  animation: dot-pulse 1.8s var(--ease-out) infinite;
}
@keyframes dot-pulse {
  0%   { box-shadow: 0 0 0 2px var(--bg), 0 0 0 0 rgba(246, 184, 40, 0.55); }
  70%, 100% { box-shadow: 0 0 0 2px var(--bg), 0 0 0 7px rgba(246, 184, 40, 0); }
}

/* --- Heart toggle on item cards ------------------------------------------ */
.item-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.fav-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  margin-block: -12px;
  margin-inline-end: -10px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-soft);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 120ms var(--ease-out), color 180ms ease;
}
.fav-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: fill 180ms ease, stroke 180ms ease;
}
.fav-btn:active { transform: scale(0.96); }
.fav-btn:focus-visible { outline: 2px solid var(--orange); outline-offset: -4px; }
.fav-btn.is-active { color: var(--orange-dark); }
.fav-btn.is-active svg { fill: var(--orange); stroke: var(--orange-dark); }
.fav-btn.pop svg { animation: fav-pop 340ms cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes fav-pop {
  0%   { transform: scale(0.78); }
  55%  { transform: scale(1.22); }
  100% { transform: scale(1); }
}

/* --- Sheets --------------------------------------------------------------- */
.modal-sheet.sheet-tall { min-height: 55vh; }
.sheet-title { margin: 6px 0 12px; padding-inline-end: 56px; font-size: 22px; }
.sheet-list { display: flex; flex-direction: column; }
#favoritesList .item-card { padding-inline: 0 !important; }
.sheet-note { margin: 40px 0; text-align: center; color: var(--text-soft); font-size: 14px; line-height: 1.6; }

.item-card.is-leaving {
  height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  opacity: 0;
  transform: translateX(14px);
  border-bottom-width: 0;
  overflow: hidden;
  pointer-events: none;
  transition:
    height 240ms var(--ease-out),
    padding 240ms var(--ease-out),
    opacity 180ms var(--ease-out),
    transform 240ms var(--ease-out) !important;
}
[dir="rtl"] .item-card.is-leaving { transform: translateX(-14px); }

.sheet-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 44px 12px 20px;
}
.sheet-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  background: var(--card);
  color: var(--orange-text);
  box-shadow: 0 0 0 1px var(--border), var(--shadow-sm);
}
.sheet-empty-icon svg { width: 28px; height: 28px; stroke-width: 1.6; }
.sheet-empty h3 { margin: 0 0 8px; font-size: 20px; line-height: 1.3; }
.sheet-empty p {
  margin: 0 0 26px;
  max-width: 290px;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.6;
}
.sheet-empty .primary-btn { min-height: 48px; padding-inline: 32px; }

/* --- Order cards ---------------------------------------------------------- */
.order-card {
  margin-bottom: 12px;
  padding: 16px;
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 1px var(--border), var(--shadow-sm);
}
.oc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.oc-num { font-size: 16px; font-weight: 600; letter-spacing: 0.2px; color: var(--text); }
.oc-date { margin-top: 3px; font-size: 12px; color: var(--text-soft); }
.oc-items {
  list-style: none;
  margin: 14px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  line-height: 1.4;
}
.oc-items li { display: flex; gap: 8px; }
.oc-qty { min-width: 26px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.oc-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.oc-total { font-size: 16px; font-weight: 700; }
.reorder-btn {
  min-height: 44px;
  padding-inline: 18px;
  background: rgba(246, 184, 40, 0.16);
  border: none;
  color: var(--orange-text);
  font-weight: 600;
}
.reorder-btn:active { transform: scale(0.96); }

/* Status pills: amber = in progress, neutral = completed, red = cancelled */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-active { background: rgba(246, 184, 40, 0.16); color: var(--orange-text); }
.status-active .status-dot {
  background: var(--orange);
  box-shadow: 0 0 0 3px rgba(246, 184, 40, 0.28);
  animation: dot-glow 1.8s ease-in-out infinite;
}
.status-done { background: rgba(62, 47, 38, 0.07); color: var(--text-soft); }
.status-done .status-dot { background: var(--green); }
.status-cancelled { background: rgba(216, 35, 42, 0.09); color: var(--danger-dark); }
.status-cancelled .status-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(216, 35, 42, 0.16); }
@keyframes dot-glow {
  0%, 100% { box-shadow: 0 0 0 3px rgba(246, 184, 40, 0.28); }
  50%      { box-shadow: 0 0 0 5px rgba(246, 184, 40, 0.12); }
}

/* Skeleton rows (same footprint as a real order card) */
.order-card.skeleton { box-shadow: 0 0 0 1px var(--border); }
.sk-line, .sk-btn {
  border-radius: 6px;
  background: linear-gradient(90deg, #EFE9DF 25%, #F7F3EC 50%, #EFE9DF 75%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.4s linear infinite;
}
.sk-line { height: 12px; margin-bottom: 12px; }
.sk-w40 { width: 40%; }
.sk-w55 { width: 55%; }
.sk-w70 { width: 70%; }
.sk-btn { width: 120px; height: 44px; margin-top: 18px; border-radius: var(--radius-sm); margin-inline-start: auto; }
@keyframes sk-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* --- Toast (sits above every sheet) --------------------------------------- */
.toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 50%;
  z-index: 30000;
  max-width: min(92vw, 420px);
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(30, 22, 17, 0.94);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -12px) scale(0.98);
  transition:
    opacity 200ms var(--ease-out),
    transform 260ms var(--ease-out),
    visibility 0s linear 260ms;
}
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0) scale(1);
  transition-delay: 0s;
}

/* --- Accessibility preferences -------------------------------------------- */
@media (prefers-reduced-transparency: reduce) {
  .modal-overlay {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(20, 25, 22, 0.78);
  }
  .toast { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .icon-dot, .status-active .status-dot, .sk-line, .sk-btn, .fav-btn.pop svg { animation: none !important; }
  .icon-btn:active, .fav-btn:active, .reorder-btn:active, .topbar .lang-btn:active { transform: none; }
  .item-card.is-leaving, .toast { transition-duration: 1ms !important; transition-delay: 0s !important; }
}

/* ==========================================================================
   FOOTER + LEGAL SHEETS (Privacy / Terms / Contact) + DELIVERY FEE
   ========================================================================== */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px 100px;
  flex-wrap: wrap;
}
.footer-link-btn {
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 12px 4px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: transform 120ms var(--ease-out), color 120ms ease;
}
.footer-link-btn:active { transform: scale(0.98); }
.footer-link-btn:hover { color: var(--orange-text); }
.footer-link-sep { color: var(--border-strong); font-size: 13px; }
.app-footer { padding: 0; }
.footer-card {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 32px 16px calc(110px + env(safe-area-inset-bottom)) 16px;
  display: flex; flex-direction: column; align-items: center;
}
.footer-brand-logo { width: 130px; max-width: 45%; height: auto; display: block; margin-bottom: 16px; }
.footer-social-row { display: flex; gap: 10px; margin-bottom: 16px; }
.footer-social-btn {
  width: 36px; height: 36px; border-radius: 50%; background: rgba(232, 167, 53, 0.12); border: none;
  display: flex; align-items: center; justify-content: center; color: var(--orange-text);
  transition: transform 120ms var(--ease-out);
}
.footer-social-btn:active { transform: scale(0.94); }
.footer-social-btn svg { width: 17px; height: 17px; fill: currentColor; }
.footer-vat-note { font-size: 11px; color: var(--text-soft); text-align: center; margin: 0 0 16px; }
.footer-legal-row {
  .footer-legal-row .footer-link-btn {
  white-space: nowrap; font-size: 11px; font-weight: 500;
}
.footer-legal-row .footer-link-btn::after {
  content: "•"; margin-inline-start: 12px; opacity: 0.4; color: var(--text-soft);
}
.footer-legal-row .footer-link-btn:last-child::after { content: none; margin: 0; }
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 0;
}
.footer-link-sep { display: none; }
.footer-copyright { font-size: 10px; color: var(--text-soft); opacity: 0.7; text-align: center; margin-top: 16px; }

.checkout-agreement {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-soft);
  text-align: center;
  margin: 12px 0 0;
}
.legal-link-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 700;
  color: var(--orange-text);
  text-decoration: underline;
  cursor: pointer;
  display: inline;
}

.legal-body {
  margin-top: 4px;
  padding-bottom: 24px;
}
.legal-intro {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 20px;
}
.legal-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.legal-item {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}
.legal-item strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.legal-official {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-soft);
}

.contact-row {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.contact-row strong { color: var(--text); font-weight: 700; }
.legal-inline-link {
  color: var(--orange-text);
  text-decoration: underline;
  word-break: break-all;
}
.wa-action-btn,
.maps-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms var(--ease-out);
}
.wa-action-btn:active,
.maps-action-btn:active { transform: scale(0.98); }
.wa-action-btn {
  background: #25D366;
  color: #fff;
}
.maps-action-btn {
  background: var(--card);
  color: var(--orange-text);
  border: 1.5px solid var(--orange);
}

.free-delivery-note {
  background: #FFF3E4;
  border: 1px solid #F0C27B;
  color: #8A5A1E;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.free-delivery-note .riyal-svg {
  height: 12px !important;
  margin: 0 1px;
}
.checkout-delivery-fee-row {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-soft);
  border-top: none;
  padding: 4px 0;
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .confirm-check { animation: none !important; }
  .confirm-check-path { animation: none !important; stroke-dashoffset: 0 !important; }
  .status-step.active .ts-dot { animation: none !important; }
  .status-track-fill { transition: none !important; }
}

/* Header crowding fix: 4 icon buttons + lang pill + logo don't all fit at
   narrow widths, so the decorative logo shrinks first (it's the only element
   here with slack; the icon buttons stay 44px for touch-target reasons). */
@media (max-width: 380px) {
  .brand-logo { max-width: 84px !important; }
  .topbar-actions { gap: 0 !important; }
  .topbar .lang-btn { margin-inline-start: 2px !important; padding: 6px 10px !important; }
}

/* ---------------- Item availability / live stock control ---------------- */
.item-card.is-soldout {
  opacity: 0.55;
  transition: opacity 200ms var(--ease-out);
}
.item-card.is-soldout .item-add-icon {
  opacity: 0.4;
  pointer-events: none;
}
.soldout-badge {
  position: absolute;
  inset: 0;
  margin: auto;
  width: max-content;
  height: max-content;
  align-self: center;
  justify-self: center;
  top: 0; bottom: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 22, 17, 0.82);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}

#modalAddBtn.is-disabled {
  background: var(--border-strong);
  color: var(--text-soft) !important;
  cursor: not-allowed;
  box-shadow: none;
}
#modalAddBtn.is-disabled:active { transform: none !important; }

.cart-line.is-soldout {
  background: rgba(216, 35, 42, 0.05);
  border-radius: var(--radius-sm);
  padding-inline: 8px;
  margin-inline: -8px;
}
.cart-line-soldout-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--danger);
  padding: 3px 10px;
  border-radius: 999px;
  margin-top: 6px;
}

.soldout-banner {
  background: #FFF1F1;
  border: 1px solid #F8D7DA;
  color: var(--danger-dark);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin: 10px 0;
  line-height: 1.5;
  animation: soldoutBannerIn 200ms var(--ease-out);
}
/* ---- Image-only offer banners (1 SAR + family deals) ---- */
:root { --offer-ratio: 16 / 9; --offer-gap: 12px; }
:is(#launchOfferBanner, #familySmallOfferCard, #familyLargeOfferCard).offer-banner {
  position: relative;
  width: 100%;
  aspect-ratio: var(--offer-ratio);
  margin: 0 0 var(--offer-gap);
  padding: 0 !important;
  border: 0 !important;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--border) !important;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s var(--ease-out);
}
.offer-banner::before, .offer-banner::after { content: none !important; }
.offer-banner:active { transform: scale(0.985); }
.offer-banner:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.offer-banner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
}
@keyframes soldoutBannerIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .item-card.is-soldout,
  .soldout-banner {
    animation: none !important;
    transition: opacity 150ms linear !important;
    transform: none !important;
  }
}
