/* ------------------------------------------------------------------
   Customer app styles
   ------------------------------------------------------------------ */

/* ---------------- Header ---------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding-inline: var(--s-4);
  gap: var(--s-3);
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
  flex: 1;
}
.app-header .brand-logo {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}
.app-header .brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}
.app-header .brand-name {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header .brand-status {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.app-header .brand-status.is-open    { color: var(--color-success); }
.app-header .brand-status.is-closed  { color: var(--color-danger); }

.app-header .header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.app-header .cart-btn {
  position: relative;
}
.app-header .cart-count {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--brand-primary);
  color: #fff;
  font-size: 10px;
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ---------------- Hero ---------------- */
.hero {
  padding: var(--s-5) var(--s-4);
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero-inner {
  max-width: var(--container-max);
  margin-inline: auto;
}
.hero h1 {
  font-size: var(--fs-2xl);
  color: #fff;
  margin-bottom: var(--s-2);
}
.hero p {
  color: rgba(255,255,255,.92);
  font-size: var(--fs-sm);
  margin-bottom: var(--s-3);
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.hero-meta .chip {
  background: rgba(255,255,255,.16);
  color: #fff;
  border-color: rgba(255,255,255,.24);
  font-size: var(--fs-xs);
}
.hero-closed {
  background: linear-gradient(135deg, #4b5563 0%, #1f2937 100%);
}

/* ---------------- Search ---------------- */
.search-bar {
  position: relative;
  margin: var(--s-4) 0;
}
.search-bar input {
  width: 100%;
  height: 46px;
  padding: 0 44px 0 44px;
  font-size: var(--fs-base);
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  border: 1.5px solid transparent;
  color: var(--text);
}
.search-bar input:focus {
  outline: none;
  background: var(--bg-elevated);
  border-color: var(--brand-primary);
}
.search-bar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-bar .search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
}
.search-bar.has-query .search-clear { display: flex; }

/* Recent searches */
.recent-searches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.recent-searches .chip {
  cursor: pointer;
}

/* ---------------- Categories ---------------- */
.category-strip {
  position: sticky;
  top: var(--header-h);
  z-index: calc(var(--z-sticky) - 1);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  padding: var(--s-2) var(--s-4);
  margin-inline: calc(-1 * var(--s-4));
}
.category-strip::-webkit-scrollbar { display: none; }
.category-strip-inner {
  display: flex;
  gap: var(--s-2);
  min-width: max-content;
}

/* ---------------- Menu sections ---------------- */
.menu-section { margin-bottom: var(--s-6); }
.menu-section-header {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding-block: var(--s-3);
}
.menu-section-title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
}
.menu-section-count {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* ---------------- Menu item card ---------------- */
.menu-item {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: var(--s-3);
  padding: var(--s-4) 0;
  border-bottom: 1px dashed var(--border);
}
.menu-item:last-child { border-bottom: none; }
.menu-item-info { min-width: 0; }

.menu-item-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
  align-items: center;
}
.menu-item-flag {
  font-size: 10px;
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  color: #fff;
}
.menu-item-flag.bestseller { background: var(--color-bestseller); }
.menu-item-flag.spicy      { background: var(--color-spicy); }

.menu-item-name {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.3;
}
.menu-item-desc {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: var(--s-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.menu-item-price-row {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.menu-item-price {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text);
}
.menu-item-price-strike {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  text-decoration: line-through;
}
.menu-item-discount {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-success);
}
.menu-item-prep {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.menu-item-media {
  position: relative;
  width: 96px;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-muted);
}
.menu-item-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.menu-item-add-wrap {
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}
.menu-item-add,
.menu-item-qty {
  min-width: 84px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--brand-primary);
  border: 1.5px solid var(--brand-primary);
  box-shadow: var(--shadow-sm);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.menu-item-qty {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
  display: flex;
  gap: 0;
  padding: 0;
}
.menu-item-qty button {
  width: 28px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: var(--fw-bold);
}
.menu-item-qty .qty-num {
  min-width: 26px;
  text-align: center;
  font-size: var(--fs-sm);
}
.menu-item-unavailable {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15,23,42,.62);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ---------------- Bottom nav ---------------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--bottom-nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: var(--z-bottom-nav);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: var(--fw-medium);
  padding: 8px 0;
  transition: color var(--dur-fast);
  position: relative;
}
.bottom-nav a[aria-current="page"] { color: var(--brand-primary); }
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a .badge-dot {
  position: absolute;
  top: 6px;
  right: calc(50% - 16px);
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #fff;
  font-size: 9px;
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------- Floating cart bar ---------------- */
.cart-bar {
  position: fixed;
  left: var(--s-4);
  right: var(--s-4);
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + var(--s-2));
  z-index: var(--z-cart-bar);
  height: var(--cart-bar-h);
  border-radius: var(--radius-lg);
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 var(--s-4);
  gap: var(--s-3);
  box-shadow: var(--shadow-lg);
  animation: cart-bar-in var(--dur-base) var(--ease-out);
  cursor: pointer;
  border: none;
  width: auto;
  text-align: left;
}
@keyframes cart-bar-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.cart-bar .cart-bar-info { flex: 1; min-width: 0; }
.cart-bar .cart-bar-count {
  font-size: var(--fs-xs);
  opacity: .92;
}
.cart-bar .cart-bar-total {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
}
.cart-bar .cart-bar-cta {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* ---------------- Product sheet ---------------- */
.product-sheet {
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.product-sheet .product-hero {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-muted);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.product-sheet .product-hero img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.product-sheet .product-body {
  padding: var(--s-4);
  overflow-y: auto;
  flex: 1;
}
.product-sheet h3 {
  font-size: var(--fs-xl);
  margin-bottom: var(--s-2);
}
.product-sheet .product-desc {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: var(--s-4);
}
.product-sheet .option-group {
  margin-bottom: var(--s-5);
}
.product-sheet .option-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-2);
}
.product-sheet .option-group-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
}
.product-sheet .option-group-hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.option-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-bottom: 6px;
  transition: border-color var(--dur-fast);
}
.option-row:has(input:checked) {
  border-color: var(--brand-primary);
  background: rgba(230,57,70,.04);
}
.option-row input[type="radio"],
.option-row input[type="checkbox"] {
  accent-color: var(--brand-primary);
  width: 18px; height: 18px;
  flex-shrink: 0;
}
.option-row .option-label { flex: 1; font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.option-row .option-price { font-size: var(--fs-sm); color: var(--text-muted); }
.product-sheet .product-footer {
  padding: var(--s-4);
  padding-bottom: calc(var(--s-4) + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  position: sticky;
  bottom: 0;
}
.product-sheet .product-footer .pf-qty {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  height: 44px;
}
.product-sheet .product-footer .pf-qty button {
  width: 40px; height: 40px;
  font-size: 18px;
  font-weight: var(--fw-bold);
  color: var(--brand-primary);
}
.product-sheet .product-footer .pf-qty .pf-qty-num {
  min-width: 30px;
  text-align: center;
  font-weight: var(--fw-semibold);
}

/* ---------------- Cart drawer ---------------- */
.cart-drawer-inner {
  padding: var(--s-4);
  padding-bottom: calc(var(--s-4) + var(--safe-bottom));
}
.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-2);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--border);
}
.cart-line-info { min-width: 0; }
.cart-line-name { font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.cart-line-meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.cart-line-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.cart-line-price { font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.cart-line-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  height: 28px;
}
.cart-line-qty button {
  width: 28px; height: 26px;
  font-size: 14px;
  font-weight: var(--fw-bold);
  color: var(--brand-primary);
}
.cart-line-qty .qty-num {
  min-width: 24px;
  text-align: center;
  font-size: var(--fs-sm);
}

/* Bill summary */
.bill {
  padding: var(--s-4) 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  margin: var(--s-4) 0;
  font-size: var(--fs-sm);
}
.bill-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  color: var(--text);
}
.bill-row.bill-total {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  padding-top: var(--s-2);
  border-top: 1px solid var(--border);
  margin-top: var(--s-2);
}
.bill-row.bill-savings { color: var(--color-success); }

/* ---------------- Order timeline ---------------- */
.order-timeline {
  padding: var(--s-4) 0;
}
.timeline-step {
  display: flex;
  gap: var(--s-3);
  position: relative;
  padding-bottom: var(--s-4);
}
.timeline-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-step.done:not(:last-child)::before { background: var(--color-success); }
.timeline-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-muted);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
  color: var(--text-muted);
}
.timeline-step.done .timeline-dot {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}
.timeline-step.active .timeline-dot {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(230,57,70,.18);
}
.timeline-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.timeline-time {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------------- Order card ---------------- */
.order-card {
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--s-3);
  background: var(--bg-elevated);
}
.order-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}
.order-card-id {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.order-card-date {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.order-card-items {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-block: var(--s-2);
}
.order-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: var(--s-3);
  margin-top: var(--s-2);
}
.order-card-total { font-size: var(--fs-md); font-weight: var(--fw-bold); }

/* ---------------- Account menu ---------------- */
.account-menu {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.account-menu-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4);
  background: var(--bg-elevated);
  font-size: var(--fs-md);
  cursor: pointer;
}
.account-menu-item:active { background: var(--bg-muted); }
.account-menu-item svg {
  width: 20px; height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.account-menu-item .acc-label { flex: 1; }
.account-menu-item .acc-meta { font-size: var(--fs-xs); color: var(--text-muted); }