/* ===== PWA Client App ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f5f5f5; color: #1a1a2e; overscroll-behavior: none; }

:root {
  --primary: #e84545;
  --primary-dark: #c73232;
  --text: #1a1a2e;
  --text-muted: #888;
  --border: #e0e0e0;
  --bg: #f5f5f5;
  --white: #fff;
  --radius: 12px;
  --header-h: 56px;
  --hours-h: 0px;
  --top-offset: var(--header-h);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
body.has-hours {
  --hours-h: 42px;
  --top-offset: calc(var(--header-h) + var(--hours-h));
}

/* ===== App Header ===== */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h); background: var(--white);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; box-shadow: 0 1px 8px rgba(0,0,0,0.08);
}
.app-logo { height: 60px; width: auto; object-fit: contain; }
.app-name { font-size: 20px; font-weight: 900; color: var(--primary); }
.app-header-actions { display: flex; align-items: center; gap: 8px; }
.install-btn {
  border: 1px solid var(--primary);
  background: #fff5f5;
  color: var(--primary);
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.cart-btn {
  position: relative;
  background: linear-gradient(135deg, var(--primary) 0%, #ff6a5f 100%);
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  width: 52px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(232, 69, 69, 0.34), 0 0 0 3px rgba(232, 69, 69, 0.12);
  color: #fff;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.cart-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(232, 69, 69, 0.42), 0 0 0 4px rgba(232, 69, 69, 0.16);
  filter: brightness(1.03);
}
.cart-btn:active {
  transform: translateY(0) scale(0.98);
}
.cart-icon {
  font-size: 20px;
  line-height: 1;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.15));
}
.cart-count {
  position: absolute;
  top: -6px;
  right: -5px;
  background: #101827;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(16, 24, 39, 0.22);
  padding: 0 5px;
}

/* ===== Combos client ===== */
.combos-section { padding: 12px 0 4px; }
.combos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding: 8px 16px 16px; }
.combo-card-client { position: relative; background: var(--white); border-radius: var(--radius); overflow: hidden; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.06); transition: transform .15s; }
.combo-card-client:active { transform: scale(.97); }
.combo-card-img { height: 130px; width: 100%; object-fit: cover; display: block; background: #f5f5f5; }
.combo-card-img--empty { height: 130px; display: flex; align-items: center; justify-content: center; font-size: 40px; color: #ddd; background: #f9f9f9; }
.combo-card-body { padding: 10px 12px 12px; }
.combo-card-name { font-weight: 700; font-size: 15px; }
.combo-card-desc { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.combo-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.combo-card-price { font-weight: 900; font-size: 16px; color: var(--primary); }

/* ===== Promotions client ===== */
.promotions-section { padding: 12px 0 4px; }
.promotions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding: 8px 16px 16px; }
@media (min-width: 600px) { .promotions-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }
.promo-card-client {
  position: relative;
  overflow: hidden;
  min-height: 150px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fff 0%, #fff5f5 100%);
  box-shadow: 0 10px 24px rgba(232,69,69,.14);
  border: 1px solid #ffd6d6;
  animation: promo-pop .55s ease both, promo-glow 2.6s ease-in-out infinite;
}
.promo-card-client::after {
  content: "";
  position: absolute;
  inset: -40% auto auto -20%;
  width: 80px;
  height: 220%;
  background: rgba(255,255,255,.45);
  transform: rotate(25deg);
  animation: promo-shine 3s ease-in-out infinite;
}
.promo-card-img { width: 100%; height: 130px; object-fit: cover; display: block; }
.promo-card-body { position: relative; z-index: 1; padding: 14px; }
.promo-card-kicker {
  display: inline-flex;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 900;
  margin-bottom: 8px;
}
.promo-card-body h3 { font-size: 18px; line-height: 1.15; margin-bottom: 6px; }
.promo-card-body p { font-size: 13px; color: #555; line-height: 1.35; }
.cat-tab--promo { color: var(--primary); animation: promo-tab-pulse 1.8s ease-in-out infinite; }
.cat-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}
.promo-product-card {
  position: relative;
  border: 1px solid #ffd2d2;
  box-shadow: 0 8px 20px rgba(232,69,69,.14);
  animation: promo-pop .45s ease both;
}
.promo-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
}
.price-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.promo-price { color: var(--primary); }
.old-price {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: line-through;
}
@keyframes promo-pop {
  from { transform: translateY(10px) scale(.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes promo-glow {
  0%, 100% { box-shadow: 0 10px 24px rgba(232,69,69,.14); }
  50% { box-shadow: 0 14px 30px rgba(232,69,69,.26); }
}
@keyframes promo-shine {
  0%, 45% { left: -30%; opacity: 0; }
  60% { opacity: 1; }
  100% { left: 120%; opacity: 0; }
}
@keyframes promo-tab-pulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}

/* Combo selection panel */
.combo-panel-client {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 400;
  background: #fff; border-radius: 20px 20px 0 0;
  max-height: 92vh; overflow-y: auto;
  box-shadow: 0 -4px 24px rgba(0,0,0,.12);
  transform: translateY(100%); transition: transform .3s ease;
  padding-bottom: calc(16px + var(--safe-bottom));
}
.combo-panel-client.open { transform: translateY(0); }
.combo-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 16px 12px; position: sticky; top: 0; background: #fff; z-index: 1; border-bottom: 1px solid #f0f0f0; }
.combo-panel-header h2 { font-size: 18px; }
.combo-panel-footer { padding: 12px 16px; border-top: 1px solid #f0f0f0; background: #fff; position: sticky; bottom: 0; }

.cpanel-group { padding: 16px 16px 8px; border-bottom: 1px solid #f5f5f5; }
.cpanel-group-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cpanel-hint { font-size: 12px; font-weight: 400; color: var(--text-muted); background: #f0f0f0; border-radius: 20px; padding: 2px 8px; }
.cpanel-items { display: flex; flex-direction: column; gap: 6px; }
.cpanel-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 2px solid #f0f0f0; border-radius: 10px; cursor: pointer; transition: border-color .15s; }
.cpanel-item:has(input:checked) { border-color: var(--primary); background: #fff5f5; }
.cpanel-item input { accent-color: var(--primary); flex-shrink: 0; }
.cpanel-item img, .cpanel-item-nophoto { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.cpanel-item-nophoto { display: flex; align-items: center; justify-content: center; font-size: 18px; background: #f5f5f5; }
.cpanel-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cpanel-item-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.cpanel-item-desc { font-size: 12px; color: var(--text-muted); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cpanel-item-mod { color: var(--primary); font-size: 12px; margin-left: 4px; }

.cart-item-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== Cart add animation ===== */
@keyframes pill-float {
  0%   { opacity: 1; transform: translateY(0)   scale(1);    }
  60%  { opacity: 1; transform: translateY(-32px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-56px) scale(0.85); }
}
@keyframes cart-pop {
  0%,100% { transform: scale(1); }
  35%     { transform: scale(1.35); }
  65%     { transform: scale(0.92); }
}
@keyframes badge-pop {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.6); }
}
@keyframes card-flash {
  0%,100% { box-shadow: none; }
  50%     { box-shadow: 0 0 0 3px var(--primary); }
}

.cart-add-pill {
  position: fixed;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: 20px;
  pointer-events: none;
  z-index: 9999;
  animation: pill-float .65s ease-out forwards;
  white-space: nowrap;
}
.cart-btn--pop   { animation: cart-pop   .4s ease !important; }
.cart-count--pop { animation: badge-pop  .35s ease !important; }
.menu-card--flash { animation: card-flash .4s ease; }

/* ===== Opening hours ===== */
.hours-bar {
  position: fixed; top: var(--header-h); left: 0; right: 0;
  z-index: 95;
  background: #fff; border-bottom: 1px solid #f0f0f0;
}
/* Collapsed state — only show the badge row */
.hours-bar:not(.hours-bar--open) { height: var(--hours-h); overflow: hidden; }
/* Expanded state — let the dropdown show over page content */
.hours-bar--open { height: auto; box-shadow: 0 4px 16px rgba(0,0,0,0.10); }
.hours-badge {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: none; border: none; cursor: pointer;
  font-size: 13px; font-weight: 600; text-align: left;
}
.hours-badge--open  { color: #27ae60; }
.hours-badge--closed { color: #e74c3c; }
.hours-chevron { font-size: 12px; transition: transform .2s; display: inline-block; }
.hours-dropdown { padding: 4px 16px 12px; }
.hours-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; color: #555; border-bottom: 1px solid #f5f5f5; }
.hours-row--today { font-weight: 700; color: #1a1a2e; }
.hours-day { flex: 1; }
.hours-time { color: #333; }
.hours-time--closed { color: #e74c3c; }
.hours-row--address .hours-time,
.hours-row--phone .hours-time { flex: 1; text-align: right; }
.hours-directions {
  display: block; margin-top: 8px; padding: 8px 12px; border-radius: 8px;
  background: #f5f5f7; color: #1a1a2e; text-align: center;
  font-size: 13px; font-weight: 600; text-decoration: none;
}

/* ===== News banner ===== */
.news-banner { margin-top: var(--top-offset); background: #fff5f5; border-bottom: 2px solid var(--primary); overflow-x: auto; display: flex; gap: 0; scroll-snap-type: x mandatory; }
.news-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-width: 280px; scroll-snap-align: start; flex-shrink: 0; border-right: 1px solid #f0d0d0; }
.news-item img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.news-item strong { display: block; font-size: 14px; }
.news-item p { font-size: 12px; color: #666; margin-top: 2px; }

/* ===== Category tabs ===== */
.cat-tabs { position: sticky; top: var(--top-offset); z-index: 90; background: #fff; display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; border-bottom: 2px solid var(--border); padding: 0 8px; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab { background: none; border: none; padding: 12px 16px; font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: .15s; }
.cat-tab.active, .cat-tab:hover { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== Menu container ===== */
.menu-container { padding: 16px; padding-bottom: calc(80px + var(--safe-bottom)); }
/* When there is no news banner the menu must clear the fixed bars */
.menu-container:first-child,
.cat-tabs + .menu-container { margin-top: 0; }
.no-news .cat-tabs { margin-top: var(--top-offset); }
.no-news:not(.has-tabs) .menu-container { margin-top: var(--top-offset); }
.menu-section { margin-bottom: 24px; }
.menu-section-title { font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 12px; }

/* ===== Menu grid ===== */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
@media (min-width: 600px) { .menu-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }

.menu-card { position: relative; background: var(--white); border-radius: var(--radius); overflow: hidden; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.06); transition: transform .15s, box-shadow .15s; active-state: scale(.98); }
.menu-card:active { transform: scale(.97); }
.menu-card-img { height: 130px; width: 100%; object-fit: cover; display: block; background: #f5f5f5; }
.menu-card-img--placeholder { display: flex; align-items: center; justify-content: center; font-size: 40px; color: #ddd; }
.menu-card-body { padding: 10px 12px 12px; }
.menu-card-name { font-size: 15px; font-weight: 700; line-height: 1.2; }
.menu-card-desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.menu-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.menu-card-price { font-weight: 900; font-size: 16px; color: var(--primary); }
.add-btn { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; border: none; font-size: 20px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ===== Cart overlay + panel ===== */
.cart-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 300; }
.cart-panel {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 400;
  background: #fff; border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(20px + var(--safe-bottom));
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  transform: translateY(100%); transition: transform .3s ease;
}
.cart-panel.open { transform: translateY(0); }
.cart-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cart-panel-header h2 { font-size: 20px; }
.cart-close { background: none; border: none; font-size: 28px; cursor: pointer; color: #888; }

/* ===== Cart items ===== */
.cart-items { margin-bottom: 16px; }
.cart-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.cart-item-name { flex: 1; font-weight: 600; font-size: 15px; }
.cart-item-price { color: var(--primary); font-weight: 700; }
.cart-item-qty { display: flex; align-items: center; gap: 8px; }
.qty-btn { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); background: #fff; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.qty-btn:active { background: var(--primary); color: #fff; border-color: var(--primary); }
.qty-val { font-weight: 700; min-width: 20px; text-align: center; }

.cart-total-row { display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; padding: 12px 0; border-top: 2px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 16px; }

/* ===== Customer form ===== */
#customer-form { margin-bottom: 16px; }
#customer-form h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
#customer-form input { width: 100%; padding: 10px 14px; border: 2px solid var(--border); border-radius: 8px; font-size: 15px; margin-bottom: 8px; }
#customer-form input:focus { border-color: var(--primary); outline: none; }
.customer-hello { font-size: 15px; color: #555; margin-bottom: 16px; }

/* ===== Notes ===== */
.cart-notes { margin-bottom: 16px; }
.cart-notes textarea { width: 100%; border: 2px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 14px; resize: none; }
.cart-notes textarea:focus { border-color: var(--primary); outline: none; }

/* ===== Payment methods ===== */
.payment-methods { margin-bottom: 16px; }
.payment-methods h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.payment-options { display: flex; gap: 10px; }
.payment-option { flex: 1; border: 2px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; transition: .15s; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.payment-option:has(input:checked) { border-color: var(--primary); background: #fff5f5; }
.payment-option input { accent-color: var(--primary); }

/* ===== Checkout button ===== */
#checkout-btn { margin-top: 8px; padding: 16px; font-size: 17px; }

/* ===== Buttons (app) ===== */
.btn { display: inline-block; padding: 10px 20px; border-radius: 10px; font-size: 15px; font-weight: 700; border: none; cursor: pointer; transition: .15s; text-align: center; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-block { display: block; width: 100%; }

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.modal-box { position: relative; background: #fff; border-radius: 16px; width: 100%; max-width: 440px; padding: 24px; box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; }
#stripe-element { border: 2px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 8px; }

.order-status-popup {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 450;
  background: #fff;
  border: 1px solid #f0d0d0;
  border-left: 5px solid var(--primary);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,.16);
  padding: 14px 44px 14px 14px;
}
.order-status-title { font-size: 12px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; }
.order-status-number { font-size: 16px; font-weight: 900; margin-top: 2px; }
.order-status-label { font-size: 14px; color: #555; margin-top: 4px; }
.order-status-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: none;
  font-size: 24px;
  color: #888;
  cursor: pointer;
}

.confetti-piece {
  position: fixed;
  top: -12px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  z-index: 9999;
  pointer-events: none;
  animation: confetti-fall 900ms ease-out forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(70vh) rotate(420deg); opacity: 0; }
}

/* ===== Responsive ===== */
@media (max-width: 380px) {
  .menu-grid { grid-template-columns: 1fr 1fr; }
  .menu-card-img { height: 100px; }
}
