/* ============================================================
   BEKOFRESH – ORDER SYSTEM STYLES
   ============================================================ */

/* ── Cart Button in Header ─────────────────────────────── */
.cart-btn {
  position: relative;
  display: none; /* shown by JS when ordering enabled */
  align-items: center;
  gap: 6px;
  padding: 8px 18px 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--orange);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(243,156,18,.35);
  transition: all var(--transition);
}
.cart-btn:hover { background: var(--orange-dark); box-shadow: 0 5px 18px rgba(243,156,18,.45); transform: translateY(-1px); }
.cart-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--orange-dark);
  font-size: 11px;
  font-weight: 800;
  border-radius: 50%;
  width: 18px; height: 18px;
  flex-shrink: 0;
}

/* ── Menu Item – Add to Cart / Qty Controls ───────────── */
.atc-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  flex-shrink: 0;
}
.atc-btn:hover { background: var(--green-dark); }
.qty-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green-light);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  flex-shrink: 0;
}
.qty-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid var(--green);
  font-size: 15px; font-weight: 700;
  color: var(--green-dark);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  line-height: 1;
}
.qty-btn:hover { background: var(--green); color: #fff; }
.qty-num { font-size: 14px; font-weight: 700; min-width: 18px; text-align: center; color: var(--dark); }

/* Discount pricing */
.price-original {
  font-size: 12px;
  text-decoration: line-through;
  color: var(--muted);
  font-weight: 400;
  display: block;
  line-height: 1.2;
}
.price-discounted { color: var(--green); font-weight: 700; }
.discount-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #FEF9EE;
  border: 1px solid var(--orange);
  color: var(--orange-dark);
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 600;
  margin-left: 6px;
}

/* Menu item image */
.menu-item-img {
  width: 56px; height: 56px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

/* ── Cart Sidebar ──────────────────────────────────────── */
.cart-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0);
  z-index: 955;
  pointer-events: none;
  transition: background var(--transition);
}
.cart-backdrop.visible { background: rgba(0,0,0,.45); pointer-events: all; }

.cart-sidebar {
  position: fixed;
  top: 0; right: -110%;
  width: min(420px, 100%);
  height: 100%;
  background: var(--surface);
  z-index: 960;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transition: right var(--transition);
}
.cart-sidebar.open { right: 0; }
html[dir="rtl"] .cart-sidebar { right: auto; left: -110%; transition: left var(--transition); }
html[dir="rtl"] .cart-sidebar.open { left: 0; right: auto; }

.cart-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.cart-sidebar-header h2 { font-size: 1.15rem; }

.cart-items-list { flex: 1; overflow-y: auto; padding: 12px 20px; }
.cart-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; height: 200px;
  color: var(--muted); font-size: 14px; text-align: center;
}
.cart-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cart-item-thumb {
  width: 50px; height: 50px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.cart-item-icon {
  width: 50px; height: 50px;
  border-radius: 10px;
  background: var(--green-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 14px; font-weight: 600; color: var(--dark); }
.cart-item-price { font-size: 13px; color: var(--green); font-weight: 600; margin-top: 2px; }

.cart-sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.cart-total-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 16px; font-weight: 700; color: var(--dark);
  margin-bottom: 14px;
}
.cart-checkout-btn {
  width: 100%;
  padding: 13px;
  border-radius: var(--radius-sm);
  background: var(--green);
  color: #fff;
  font-size: 15px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 3px 12px rgba(39,174,96,.3);
}
.cart-checkout-btn:hover { background: var(--green-dark); }
.cart-checkout-btn:disabled { background: var(--muted); cursor: not-allowed; box-shadow: none; }

/* ── Order Modal ───────────────────────────────────────── */
.order-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 975;
  display: none;
}
.order-backdrop.visible { display: block; }

.order-modal {
  position: fixed; inset: 0;
  z-index: 980;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
}
.order-modal.open { opacity: 1; pointer-events: all; }

.order-modal-card {
  background: var(--surface);
  border-radius: 18px;
  width: 100%; max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.order-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
  border-radius: 18px 18px 0 0;
}
.order-modal-header h3 { font-size: 1.1rem; }
.step-dots { display: flex; gap: 6px; align-items: center; }
.step-dot {
  width: 8px; height: 8px; border-radius: 4px;
  background: var(--border);
  transition: all var(--transition);
}
.step-dot.active { background: var(--green); width: 22px; }
.step-dot.done   { background: var(--green-light); }

#checkoutContent { padding: 20px 24px 24px; }

/* Order type selection */
.order-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.order-type-card {
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
  padding: 20px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  color: var(--dark);
}
.order-type-card:hover { border-color: var(--green); }
.order-type-card.selected { border-color: var(--green); background: #f0fdf4; }
.order-type-card strong { font-size: 14px; font-weight: 700; }
.order-type-card span   { font-size: 12px; color: var(--muted); line-height: 1.4; }
.order-type-card svg    { color: var(--green); }

/* Checkout nav */
.checkout-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.checkout-nav > .btn-primary:disabled { background: var(--muted); cursor: not-allowed; box-shadow: none; }

/* Order summary */
.order-summary-mini {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 16px;
}
.osm-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.osm-row.total { font-weight: 700; color: var(--dark); border-top: 1px solid var(--border); padding-top: 8px; }

/* Phone input */
.phone-input-row {
  display: flex; align-items: stretch;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition);
}
.phone-input-row:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(39,174,96,.12); }
.phone-prefix {
  padding: 0 14px;
  background: var(--bg);
  border-right: 1.5px solid var(--border);
  font-weight: 600; font-size: 14px; color: var(--dark);
  display: flex; align-items: center;
  white-space: nowrap;
}
.phone-input-row input { border: none; padding: 11px 14px; font-size: 14px; flex: 1; outline: none; background: var(--surface); }

/* OTP */
.otp-inputs { display: flex; gap: 8px; justify-content: center; margin: 24px 0 10px; }
.otp-box {
  width: 46px; height: 56px;
  text-align: center;
  font-size: 22px; font-weight: 700;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all var(--transition);
  font-family: 'Poppins', monospace;
  color: var(--dark);
}
.otp-box:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(39,174,96,.15); }
.otp-box.error  { border-color: #E74C3C; animation: shakeBox 0.4s ease; }
.otp-error { text-align: center; color: #E74C3C; font-size: 13px; margin-top: 4px; }

.demo-otp-badge {
  display: inline-block;
  margin-top: 10px; padding: 6px 16px;
  background: #FEF9EE; border: 1px solid var(--orange);
  border-radius: var(--radius-sm);
  font-size: 13px; color: var(--orange-dark);
}

/* Confirmation */
.confirm-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--green-light);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  animation: popIn .5s cubic-bezier(.17,.89,.32,1.28) both;
}

@keyframes shakeBox {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-6px); }
  75%       { transform: translateX(6px); }
}
@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Leaflet delivery map in checkout */
#customerDeliveryMap { border-radius: var(--radius-sm); margin-bottom: 10px; }
.delivery-note { font-size: 13px; min-height: 1.4em; }

/* ── Premium Theme Overrides ───────────────────────────── */
body.theme-premium .atc-btn {
  background: linear-gradient(135deg, #C41E3A 0%, #8B0000 100%);
}
body.theme-premium .atc-btn:hover { background: linear-gradient(135deg, #d62a48 0%, #a30808 100%); }
body.theme-premium .qty-row { background: rgba(184,115,51,.15); }
body.theme-premium .qty-btn { border-color: #B87333; color: #B87333; }
body.theme-premium .qty-btn:hover { background: #B87333; color: #fff; }
body.theme-premium .qty-num { color: #F5E6D3; }
body.theme-premium .cart-sidebar { background: #1A1212; }
body.theme-premium .cart-sidebar-header { border-color: rgba(184,115,51,.2); background: #1A1212; }
body.theme-premium .cart-item-row { border-color: rgba(184,115,51,.15); }
body.theme-premium .cart-item-icon { background: rgba(184,115,51,.15); }
body.theme-premium .cart-item-name { color: #F5E6D3; }
body.theme-premium .cart-item-price { color: #D4A574; }
body.theme-premium .cart-sidebar-footer { border-color: rgba(184,115,51,.2); background: #1A1212; }
body.theme-premium .cart-total-row { color: #F5E6D3; }
body.theme-premium .cart-checkout-btn {
  background: linear-gradient(135deg, #C41E3A 0%, #8B0000 100%);
}
body.theme-premium .order-modal-card { background: #1A1212; }
body.theme-premium .order-modal-header { background: #1A1212; border-color: rgba(184,115,51,.2); }
body.theme-premium .order-modal-header h3 { color: #F5E6D3; }
body.theme-premium .order-type-card { background: #221816; border-color: rgba(184,115,51,.2); color: #F5E6D3; }
body.theme-premium .order-type-card.selected { background: rgba(184,115,51,.1); border-color: #B87333; }
body.theme-premium .order-summary-mini { background: #0F0808; }
body.theme-premium .osm-row.total { color: #F5E6D3; }
body.theme-premium .phone-input-row { border-color: rgba(184,115,51,.3); background: #1A1212; }
body.theme-premium .phone-input-row input { background: #1A1212; color: #F5E6D3; }
body.theme-premium .otp-box { background: #1A1212; color: #F5E6D3; border-color: rgba(184,115,51,.3); }

/* Responsive */
@media (max-width: 480px) {
  .order-type-grid { grid-template-columns: 1fr; }
  .otp-box { width: 40px; height: 50px; font-size: 20px; }
}
