/*
Theme Name: Star Network Food Order
Theme URI: https://star-network.shop
Author: Star Network
Description: Persian RTL food ordering theme — Elementor Pro compatible, modern, mobile-first
Version: 4.0.1
Text Domain: star-network
Tags: rtl-language, custom-menu, persian, food, ordering, elementor
*/

/* ══════════════════════════════════════════════════
   DESIGN TOKENS
══════════════════════════════════════════════════ */
:root {
  /* Brand */
  --primary:      #ef4123;
  --primary-dk:   #d03010;
  --primary-lt:   #fff1ee;
  --primary-ring: rgba(239,65,35,.18);

  /* Neutral */
  --dark:    #1c1917;
  --dark-2:  #292524;
  --text:    #1c1917;
  --text-2:  #6b7280;
  --text-3:  #a8adb8;
  --bg:      #f5f5f4;
  --card:    #ffffff;
  --border:  #e7e5e4;
  --border2: #f0efee;

  /* Semantic */
  --green:  #16a34a;
  --gold:   #d97706;
  --purple: #7c3aed;
  --sky:    #0ea5e9;

  /* Radius */
  --r-xs:   5px;
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   20px;
  --r-pill: 999px;

  /* Shadow */
  --sh-xs: 0 1px 2px rgba(0,0,0,.05);
  --sh-sm: 0 1px 3px rgba(0,0,0,.07), 0 1px 8px rgba(0,0,0,.04);
  --sh-md: 0 4px 12px rgba(0,0,0,.09), 0 1px 4px rgba(0,0,0,.05);
  --sh-lg: 0 8px 28px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);

  /* Motion */
  --ease:   cubic-bezier(.4,0,.2,1);
  --spring: cubic-bezier(.34,1.56,.64,1);
  --dur:    180ms;

  /* Layout */
  --cart-w:   272px;
  --header-h: 112px;
  --font:     'IRANSans', 'Vazirmatn', Tahoma, Arial, sans-serif;
}

/* ══════════════════════════════════════════════════
   RESET  (scoped — don't fight Elementor global)
══════════════════════════════════════════════════ */
.sn-ordering-wrap *,
.sn-header *,
.sn-footer *,
.cart-overlay *,
.modal-bg *,
.float-bar,
.toast {
  box-sizing: border-box;
}

html { font-size: 15px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background:  var(--bg);
  color:        var(--text);
  direction:    rtl;
  min-height:   100vh;
  overflow-x:   hidden;
  -webkit-font-smoothing: antialiased;
}

/* Elementor inherits body direction — no conflicts needed */
.elementor-widget-container { direction: rtl; }

a  { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

button {
  cursor: pointer;
  font-family: var(--font);
  border: none;
  background: none;
}
button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

input, select, textarea {
  font-family: var(--font);
  border: none;
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* ══════════════════════════════════════════════════
   PAGE LOADER
══════════════════════════════════════════════════ */
.page-loader {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9999; gap: 16px;
  transition: opacity .4s var(--ease);
}
.page-loader.done { opacity: 0; pointer-events: none; }

.loader-ring {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-name { font-size: .8rem; color: var(--text-3); font-weight: 500; }

/* ══════════════════════════════════════════════════
   HEADER — Gelato-style, Elementor-compatible
══════════════════════════════════════════════════ */
.sn-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
  /* Elementor Theme Builder will replace this when a header template is assigned */
}

.header-top {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
}

/* Logo */
.header-logo {
  width: 52px; height: 52px;
  border-radius: var(--r-md);
  overflow: hidden; flex-shrink: 0;
  background: linear-gradient(135deg, #fde8e0, #ef4123);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--sh-sm);
}
.header-logo img { width: 100%; height: 100%; object-fit: cover; }

/* Info block */
.header-info { flex: 1; min-width: 0; }
.header-name {
  font-size: 1rem; font-weight: 800; color: var(--text);
  line-height: 1.2; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-meta {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.header-chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .7rem; color: var(--text-2);
}
.header-chip.green { color: var(--green); font-weight: 700; }
.header-chip.red   { color: var(--primary); }
.header-sep {
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--border); flex-shrink: 0;
}

/* Cart button in header */
.btn-hcart {
  position: relative; flex-shrink: 0;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--primary-lt);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  transition: background var(--dur) var(--ease),
              transform  var(--dur) var(--ease);
}
.btn-hcart:hover  { background: #ffddd6; transform: scale(1.05); }
.btn-hcart:active { transform: scale(.93); }
.btn-hcart svg    { flex-shrink: 0; }

.hcart-badge {
  position: absolute; top: -3px; left: -3px;
  min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--primary); color: #fff;
  border: 2px solid var(--card);
  border-radius: var(--r-pill);
  font-size: .58rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--dur) var(--spring);
}
.hcart-badge.hidden { display: none; }
.hcart-badge.pop    { animation: badgePop .25s var(--spring); }
@keyframes badgePop { 0% { transform: scale(1.8) } 100% { transform: scale(1) } }

/* Info bar (sub-header) */
.header-infobar {
  border-top: 1px solid var(--border2);
  display: flex; overflow-x: auto; scrollbar-width: none;
  padding: 0 8px;
  -webkit-overflow-scrolling: touch;
}
.header-infobar::-webkit-scrollbar { display: none; }
.hinfo-item {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 5px;
  padding: 7px 12px;
  border-left: 1px solid var(--border2);
  font-size: .72rem; color: var(--text-2);
  white-space: nowrap;
}
.hinfo-item:last-child { border: none; }
.hinfo-item .hi-val    { font-weight: 700; color: var(--text); }
.hinfo-item .hi-icon   { flex-shrink: 0; }
.hinfo-item.open .hi-val { color: var(--green); }

/* ══════════════════════════════════════════════════
   ORDERING LAYOUT
   Cart is on the RIGHT side (direction:ltr on wrap,
   direction:rtl on children preserves Persian text)
══════════════════════════════════════════════════ */
.sn-ordering-wrap {
  display: flex;
  direction: ltr;         /* layout direction: content LEFT → cart RIGHT */
  align-items: flex-start;
  max-width: 1280px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-h));
}

/* Content column */
.sn-content-col {
  flex: 1;
  min-width: 0;
  direction: rtl;         /* restore RTL for Persian text */
  padding-bottom: 100px;
}

/* When sidebar is hidden, content takes full width */
.sn-ordering-wrap.no-sidebar .sn-content-col { max-width: 800px; margin: 0 auto; }

/* ══════════════════════════════════════════════════
   BANNER
══════════════════════════════════════════════════ */
.sn-banner {
  position: relative; overflow: hidden;
  height: 190px;
  background: linear-gradient(135deg, #2c1a16 0%, #3d2318 60%, #1a0f0c 100%);
}
.banner-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: .35; transition: opacity .3s;
}
.banner-pattern {
  position: absolute; inset: 0; opacity: .04;
  background-image: radial-gradient(circle, #ef4123 1px, transparent 1px);
  background-size: 18px 18px;
}
.banner-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(28,25,23,.88) 0%, rgba(28,25,23,.15) 100%);
}
.banner-content {
  position: relative; z-index: 1; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 16px;
}
.banner-title {
  font-size: 1.25rem; font-weight: 800; color: #fff; margin-bottom: 9px;
  text-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.banner-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.banner-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  backdrop-filter: blur(8px);
  border-radius: var(--r-pill);
  padding: 4px 10px;
  font-size: .68rem; color: rgba(255,255,255,.92);
}
.banner-chip svg { flex-shrink: 0; opacity: .8; }

/* ══════════════════════════════════════════════════
   SEARCH
══════════════════════════════════════════════════ */
.sn-search-wrap { padding: 14px 14px 0; }
.sn-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--r-pill); padding: 0 14px; height: 42px;
  box-shadow: var(--sh-xs);
  transition: border-color var(--dur), box-shadow var(--dur);
}
.sn-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.sn-search input {
  flex: 1; background: transparent; font-size: .86rem;
  color: var(--text); direction: rtl; outline: none;
}
.sn-search input::placeholder { color: var(--text-3); }
.search-icon { color: var(--text-3); flex-shrink: 0; }

/* ══════════════════════════════════════════════════
   CATEGORIES
══════════════════════════════════════════════════ */
.sn-cats {
  padding: 12px 14px 0;
  overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.sn-cats::-webkit-scrollbar { display: none; }
.cats-row { display: flex; gap: 7px; width: max-content; }

.cat-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 13px; border-radius: var(--r-pill);
  border: 1.5px solid var(--border); background: var(--card);
  font-size: .77rem; font-weight: 600; color: var(--text-2);
  white-space: nowrap; box-shadow: var(--sh-xs);
  transition: all var(--dur) var(--ease);
  cursor: pointer; user-select: none;
}
.cat-pill:hover {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-lt);
}
.cat-pill.active {
  background: var(--dark); border-color: var(--dark); color: #fff;
  box-shadow: 0 3px 10px rgba(28,25,23,.2);
}
.cat-em { font-size: .9rem; line-height: 1; }

/* ══════════════════════════════════════════════════
   SECTION HEADER
══════════════════════════════════════════════════ */
.sn-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 8px;
}
.sn-section-title {
  font-size: .87rem; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 7px;
}
.sn-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--primary); flex-shrink: 0;
}
.sn-count { font-size: .72rem; color: var(--text-3); }

/* ══════════════════════════════════════════════════
   PRODUCTS GRID
══════════════════════════════════════════════════ */
.sn-products { padding: 0 10px; }
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 680px)  { .products-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .products-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .products-grid { grid-template-columns: repeat(3, 1fr); } }

/* ══════════════════════════════════════════════════
   PRODUCT CARD
══════════════════════════════════════════════════ */
.product-card {
  background: var(--card);
  border-radius: var(--r-md); overflow: hidden;
  box-shadow: var(--sh-sm);
  display: flex; flex-direction: column;
  transition: box-shadow var(--dur) var(--ease),
              transform  var(--dur) var(--ease);
  animation: cardIn .28s var(--ease) both;
  border: 1px solid transparent;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.product-card:hover {
  box-shadow: var(--sh-md);
  transform: translateY(-2px);
  border-color: var(--border);
}

/* Image */
.prod-img-wrap {
  position: relative; aspect-ratio: 3/2; overflow: hidden; flex-shrink: 0;
}
.prod-img-bg {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.prod-img-bg img {
  position: relative; z-index: 1;
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s var(--ease);
}
.product-card:hover .prod-img-bg img { transform: scale(1.06); }
.prod-emoji { font-size: 2rem; line-height: 1; }

/* Badges */
.prod-badge {
  position: absolute; top: 7px; right: 7px; z-index: 2;
  padding: 2px 7px; border-radius: var(--r-pill);
  font-size: .6rem; font-weight: 700; color: #fff;
  letter-spacing: .02em;
}
.prod-badge.bestseller { background: var(--primary); }
.prod-badge.new        { background: var(--gold); }
.prod-badge.special    { background: var(--sky); }
.prod-badge.vegan      { background: var(--green); }
.prod-badge.diet       { background: var(--purple); }

/* Unavailable overlay */
.prod-unavail {
  position: absolute; inset: 0; z-index: 3;
  background: rgba(28,25,23,.52);
  display: flex; align-items: center; justify-content: center;
}
.prod-unavail span {
  background: var(--dark); color: #fff;
  padding: 4px 11px; border-radius: var(--r-pill);
  font-size: .7rem; font-weight: 700;
}

/* Body */
.prod-body {
  padding: 9px 10px 11px;
  display: flex; flex-direction: column; gap: 3px; flex: 1;
}
.prod-name {
  font-size: .84rem; font-weight: 700; color: var(--text);
  line-height: 1.35;
}
.prod-desc {
  font-size: .7rem; color: var(--text-2); line-height: 1.55; flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.prod-footer {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-top: 8px; gap: 6px;
}
.prod-price-wrap { display: flex; flex-direction: column; line-height: 1.2; }
.prod-price {
  font-size: .88rem; font-weight: 800; color: var(--primary);
  direction: ltr; display: inline-block;
}
.prod-unit { font-size: .62rem; color: var(--text-3); }

/* ── Add-to-cart button → qty morph ────────────── */
.prod-add-btn {
  height: 30px; padding: 0 11px;
  background: var(--primary); color: #fff;
  border-radius: var(--r-pill);
  font-size: .76rem; font-weight: 700;
  white-space: nowrap; flex-shrink: 0;
  display: flex; align-items: center; gap: 4px;
  transition: background var(--dur), transform 120ms;
  min-width: 44px; /* touch target */
}
.prod-add-btn:hover  { background: var(--primary-dk); }
.prod-add-btn:active { transform: scale(.92); }
.prod-add-btn .plus-icon {
  font-size: .95rem; font-weight: 300;
  transition: transform var(--dur) var(--spring);
}
.prod-add-btn:hover .plus-icon { transform: rotate(90deg); }

/* Qty control (replaces button inline) */
.prod-qty {
  display: flex; align-items: center;
  background: var(--primary-lt);
  border: 1.5px solid var(--primary-ring);
  border-radius: var(--r-pill);
  padding: 2px 3px; gap: 1px;
  animation: qtyAppear .2s var(--spring);
}
@keyframes qtyAppear {
  from { transform: scale(.7); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}
.qty-btn {
  min-width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700; line-height: 1;
  color: var(--primary); flex-shrink: 0;
  transition: background 120ms, transform 100ms;
  cursor: pointer;
}
.qty-btn:hover  { background: rgba(239,65,35,.14); }
.qty-btn:active { transform: scale(.82); }
.qty-btn.minus  { color: var(--text-2); }
.qty-btn.minus:hover { background: rgba(0,0,0,.06); color: var(--dark); }
.qty-num {
  min-width: 22px; text-align: center;
  font-size: .8rem; font-weight: 800; color: var(--primary);
  user-select: none;
}

/* ══════════════════════════════════════════════════
   NO RESULTS
══════════════════════════════════════════════════ */
.no-results {
  display: none; text-align: center; padding: 60px 20px;
  flex-direction: column; align-items: center; gap: 10px;
}
.no-results.show { display: flex; }
.no-results-icon-svg { opacity: .3; }
.no-results p { font-size: .84rem; color: var(--text-2); }

/* ══════════════════════════════════════════════════
   CART SIDEBAR — RIGHT side, compact, sticky
══════════════════════════════════════════════════ */
.sn-cart-sidebar,
.cart-sidebar {            /* alias — JS uses #cartSidebar */
  width: var(--cart-w);
  flex-shrink: 0;
  direction: rtl;          /* RTL text inside LTR layout container */
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--border);   /* separator: left-side of cart (right edge of content) */
  background: var(--card);
}
@media (max-width: 767px) {
  .sn-cart-sidebar, .cart-sidebar { display: none; }
}

/* Cart head */
.cs-head {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  gap: 8px;
}
.cs-title {
  font-size: .88rem; font-weight: 800; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.cs-title svg { color: var(--text-2); flex-shrink: 0; }
.cs-badge {
  background: var(--primary-lt); color: var(--primary);
  padding: 2px 8px; border-radius: var(--r-pill);
  font-size: .68rem; font-weight: 700;
  white-space: nowrap; flex-shrink: 0;
  transition: all var(--dur);
}

/* Cart body */
.cs-body {
  flex: 1; overflow-y: auto; position: relative;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.cs-body::-webkit-scrollbar { width: 3px; }
.cs-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Empty state */
.cs-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 20px;
}
.cs-empty-svg  { width: 80px; height: 90px; opacity: .85; }
.cs-empty-text { font-size: .82rem; color: var(--text-3); }

/* Item list */
.cs-items { padding: 4px 0; }
.cs-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border2);
  animation: itemIn .18s var(--ease);
}
@keyframes itemIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: none; }
}
.cs-item-thumb {
  width: 38px; height: 38px; border-radius: var(--r-xs);
  flex-shrink: 0; overflow: hidden;
  background: var(--bg); display: flex; align-items: center;
  justify-content: center; font-size: 1.15rem;
}
.cs-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cs-item-info { flex: 1; min-width: 0; }
.cs-item-name {
  font-size: .76rem; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 2px;
}
.cs-item-price {
  font-size: .7rem; color: var(--primary); font-weight: 600;
  direction: ltr; display: inline-block;
}
/* Qty controls inside sidebar use same .prod-qty/.qty-btn classes
   but scaled down slightly */
.cs-items .prod-qty { padding: 1px 2px; }
.cs-items .qty-btn  { min-width: 24px; height: 24px; font-size: .9rem; }
.cs-items .qty-num  { min-width: 18px; font-size: .76rem; }

/* Cart foot */
.cs-foot {
  border-top: 1px solid var(--border);
  flex-shrink: 0; padding: 12px 14px;
  background: var(--card);
}
.cs-total-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; font-size: .8rem;
}
.cs-total-row .ct-lbl { color: var(--text-2); }
.cs-total-row .ct-val {
  font-weight: 800; color: var(--text); font-size: .9rem;
  direction: ltr; display: inline-block;
}

/* Checkout button (shared by sidebar, drawer, modal) */
.btn-checkout {
  width: 100%; height: 44px;
  background: var(--primary); color: #fff;
  border-radius: var(--r-md); font-size: .88rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: background var(--dur), transform 120ms;
  cursor: pointer;
}
.btn-checkout svg     { flex-shrink: 0; }
.btn-checkout:hover   { background: var(--primary-dk); }
.btn-checkout:active  { transform: scale(.98); }
.btn-checkout:disabled,
.btn-checkout[aria-disabled="true"] {
  background: var(--border); color: var(--text-3);
  cursor: not-allowed; transform: none;
}

/* SN Cart Widget (Elementor widget context) */
.sn-cart-widget {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 400px;
  box-shadow: var(--sh-sm);
}
.sn-cart-widget .cs-body { min-height: 200px; }

/* ══════════════════════════════════════════════════
   FLOATING CART BAR (mobile only)
══════════════════════════════════════════════════ */
.float-bar {
  position: fixed; bottom: 16px; left: 50%;
  transform: translateX(-50%) translateY(24px);
  z-index: 300; min-width: 260px; max-width: calc(100vw - 32px);
  background: var(--dark); border-radius: var(--r-pill);
  padding: 9px 14px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 24px rgba(28,25,23,.4);
  cursor: pointer; opacity: 0; visibility: hidden;
  transition: opacity .28s var(--ease),
              visibility .28s,
              transform .28s var(--spring);
  user-select: none;
}
.float-bar.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.fbar-cnt {
  background: var(--primary); min-width: 22px; height: 22px;
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: .68rem; font-weight: 800;
  color: #fff; flex-shrink: 0;
}
.fbar-lbl  { flex: 1; font-size: .82rem; font-weight: 700; color: #fff; }
.fbar-tot  { font-size: .74rem; color: rgba(255,255,255,.7); direction: ltr; }
.fbar-icon { font-size: .75rem; color: rgba(255,255,255,.5); }
@media (min-width: 768px) { .float-bar { display: none; } }

/* ══════════════════════════════════════════════════
   MOBILE CART DRAWER (slides from RIGHT)
══════════════════════════════════════════════════ */
.cart-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden;
  transition: opacity .24s var(--ease), visibility .24s;
  display: none;
}
@media (max-width: 767px) { .cart-overlay { display: block; } }
.cart-overlay.open { opacity: 1; visibility: visible; }

.cart-drawer {
  position: absolute; top: 0; right: 0;
  width: min(340px, 92vw); height: 100%;
  background: var(--card); display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s var(--ease);
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
  direction: rtl;
}
.cart-overlay.open .cart-drawer { transform: translateX(0); }

.drawer-head {
  background: var(--dark); padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.drawer-title {
  font-size: .9rem; font-weight: 700; color: #fff;
  display: flex; align-items: center; gap: 7px;
}
.drawer-title svg { flex-shrink: 0; opacity: .8; }
.drawer-cnt {
  background: var(--primary); padding: 1px 8px;
  border-radius: var(--r-pill); font-size: .65rem;
  font-weight: 700; color: #fff;
}

.btn-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; transition: background var(--dur); cursor: pointer;
  flex-shrink: 0;
  min-width: 44px; min-height: 44px; /* touch target */
  border-radius: var(--r-sm);
}
.btn-close:hover { background: rgba(255,255,255,.22); }
.btn-close:focus-visible { outline: 2px solid rgba(255,255,255,.5); outline-offset: 2px; }

.drawer-items { flex: 1; overflow-y: auto; }

.drawer-empty {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; padding: 32px;
}
.drawer-empty svg { width: 80px; height: 90px; }
.drawer-empty-text { font-size: .84rem; color: var(--text-3); }

.drawer-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border2);
}
.di-thumb {
  width: 46px; height: 46px; border-radius: var(--r-xs);
  flex-shrink: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; overflow: hidden;
}
.di-thumb img { width: 100%; height: 100%; object-fit: cover; }
.di-info { flex: 1; min-width: 0; }
.di-name  {
  font-size: .8rem; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px;
}
.di-price { font-size: .74rem; color: var(--primary); font-weight: 600; direction: ltr; display: inline-block; }

.drawer-foot {
  border-top: 1.5px solid var(--border); padding: 13px 16px; flex-shrink: 0;
}
.drawer-total {
  display: flex; justify-content: space-between; margin-bottom: 10px; font-size: .83rem;
}
.drawer-total .dl { color: var(--text-2); }
.drawer-total .dv { font-weight: 800; color: var(--text); direction: ltr; display: inline-block; }

/* ══════════════════════════════════════════════════
   ORDER MODAL
══════════════════════════════════════════════════ */
.modal-bg {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity .24s var(--ease), visibility .24s;
}
@media (min-width: 600px) { .modal-bg { align-items: center; } }
.modal-bg.open { opacity: 1; visibility: visible; }

.order-modal {
  background: var(--card); width: 100%; max-width: 480px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  max-height: 92vh; overflow-y: auto;
  transform: translateY(50px); opacity: 0;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
  direction: rtl;
}
@media (min-width: 600px) {
  .order-modal { border-radius: var(--r-xl); transform: scale(.94) translateY(12px); }
  .modal-bg.open .order-modal { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-bg.open .order-modal { transform: translateY(0); opacity: 1; }

.modal-handle {
  width: 32px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 10px auto 0;
}
@media (min-width: 600px) { .modal-handle { display: none; } }

.modal-head {
  padding: 14px 18px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
.modal-title { font-size: .9rem; font-weight: 700; color: var(--text); }
.modal-body  { padding: 16px 18px 20px; }

.order-summary-box {
  background: var(--bg); border-radius: var(--r-md);
  padding: 12px; margin-bottom: 16px;
  border: 1px solid var(--border);
}
.order-summary-box h4 { font-size: .78rem; font-weight: 700; margin-bottom: 8px; }
.summary-item {
  display: flex; justify-content: space-between;
  font-size: .75rem; padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}
.summary-item:last-child { border: none; }
.summary-total {
  display: flex; justify-content: space-between;
  font-weight: 800; font-size: .84rem;
  margin-top: 9px; padding-top: 9px;
  border-top: 2px solid var(--border);
}
.summary-total .tv { color: var(--primary); direction: ltr; display: inline-block; }

/* Form */
.form-group { margin-bottom: 13px; }
.form-label {
  display: block; font-size: .76rem; font-weight: 700;
  margin-bottom: 5px; color: var(--text);
}
.form-label .req { color: var(--primary); }
.form-ctrl {
  display: block; width: 100%; height: 42px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: .85rem; color: var(--text);
  background: var(--card); direction: rtl;
  transition: border-color var(--dur), box-shadow var(--dur);
  outline: none;
}
.form-ctrl:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-ctrl.error { border-color: #dc2626; }
.form-ctrl::placeholder { color: var(--text-3); }
textarea.form-ctrl { height: 72px; padding: 10px 12px; resize: none; }

.btn-submit {
  width: 100%; height: 46px;
  background: var(--primary); color: #fff;
  border-radius: var(--r-md); font-size: .9rem; font-weight: 700;
  margin-top: 6px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: background var(--dur), transform 120ms;
  cursor: pointer;
}
.btn-submit:hover  { background: var(--primary-dk); }
.btn-submit:active { transform: scale(.98); }
.btn-submit:disabled { background: var(--border); color: var(--text-3); cursor: not-allowed; transform: none; }

/* Success state */
.order-success {
  text-align: center; padding: 44px 24px;
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
}
.success-circle {
  width: 76px; height: 76px; border-radius: 50%;
  background: #dcfce7; display: flex; align-items: center;
  justify-content: center; font-size: 2.3rem;
  animation: successPop .5s var(--spring);
}
@keyframes successPop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.success-title { font-size: 1.05rem; font-weight: 800; }
.success-sub   { font-size: .82rem; color: var(--text-2); line-height: 1.65; }
.btn-back {
  margin-top: 4px; padding: 10px 26px;
  background: var(--dark); color: #fff;
  border-radius: var(--r-pill); font-size: .85rem; font-weight: 700;
  transition: background var(--dur); cursor: pointer;
}
.btn-back:hover { background: var(--dark-2); }

/* ══════════════════════════════════════════════════
   TOAST NOTIFICATION
══════════════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--dark); color: #fff;
  padding: 8px 18px; border-radius: var(--r-pill);
  font-size: .8rem; font-weight: 600; box-shadow: var(--sh-md);
  opacity: 0; pointer-events: none; z-index: 600;
  transition: opacity .2s, transform .2s var(--spring);
  white-space: nowrap; max-width: 88vw;
  direction: rtl;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ══════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════ */
.sn-footer {
  background: var(--dark); padding: 18px 16px;
  text-align: center; font-size: .71rem;
  color: rgba(255,255,255,.35); line-height: 1.8;
}

/* ══════════════════════════════════════════════════
   SKELETON LOADING
══════════════════════════════════════════════════ */
.skel {
  background: linear-gradient(90deg, var(--border2) 25%, var(--border) 50%, var(--border2) 75%);
  background-size: 200% 100%;
  animation: skelAnim 1.5s ease-in-out infinite;
  border-radius: 4px;
}
@keyframes skelAnim {
  from { background-position: 200%; }
  to   { background-position: -200%; }
}

/* ══════════════════════════════════════════════════
   PRODUCT CARD GRADIENT BACKGROUNDS
══════════════════════════════════════════════════ */
.grad-1 { background: linear-gradient(135deg, #fde8e0, #fed7cd); }
.grad-2 { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.grad-3 { background: linear-gradient(135deg, #d1fae5, #a7f3d0); }
.grad-4 { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.grad-5 { background: linear-gradient(135deg, #ede9fe, #ddd6fe); }
.grad-6 { background: linear-gradient(135deg, #fce7f3, #fbcfe8); }
.grad-7 { background: linear-gradient(135deg, #ecfdf5, #bbf7d0); }
.grad-8 { background: linear-gradient(135deg, #fff7ed, #fed7aa); }

/* ══════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 1024px) {
  :root { --cart-w: 256px; }
  .header-meta .header-chip:nth-child(n+5) { display: none; }
}

/* Mobile */
@media (max-width: 767px) {
  html { font-size: 14px; }

  .sn-ordering-wrap {
    flex-direction: column;
    direction: rtl; /* restore RTL on mobile (single column) */
  }

  .sn-content-col { padding-bottom: 90px; }

  .sn-banner { height: 160px; }
  .banner-title { font-size: 1.1rem; }

  .header-infobar .hinfo-item:nth-child(n+4) { display: none; }

  .products-grid { gap: 8px; }

  .prod-body { padding: 8px 9px 10px; }
  .prod-name { font-size: .82rem; }

  .toast { bottom: 90px; }
}

/* Very small */
@media (max-width: 380px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 7px; }
  .sn-search-wrap { padding: 10px 10px 0; }
  .sn-cats { padding: 10px 10px 0; }
}

/* ══════════════════════════════════════════════════
   ELEMENTOR INTEGRATION
   These rules handle overlap / conflict prevention
   when Elementor is building pages with our widgets.
══════════════════════════════════════════════════ */

/* Inside Elementor widget container, remove outer max-width */
.elementor-widget-sn_ordering .sn-ordering-wrap,
.elementor-widget-sn_ordering .sn-content-col {
  max-width: none;
}

/* Cart widget (standalone Elementor widget) */
.elementor-widget-sn_cart_panel .sn-cart-widget {
  position: sticky;
  top: var(--header-h, 112px);
}

/* Elementor page: hide our custom header/footer if Elementor TB is active */
body.elementor-template-canvas .sn-header,
body.elementor-template-canvas .sn-footer { display: none; }

/* Elementor editor: ensure our widgets are visible */
.elementor-editor-active .sn-ordering-wrap { min-height: 300px; }

/* Prevent Elementor's global styles from breaking our card layout */
.elementor-widget-container .product-card { list-style: none; }
.elementor-widget-container .prod-img-wrap img { display: block; }

/* Woocommerce inside Elementor */
.elementor .woocommerce-cart-form,
.elementor .woocommerce-checkout { direction: rtl; }

/* ══════════════════════════════════════════════════
   ELEMENTOR EDITOR SAFETY NETS
   Hide our page-loader in the editor so it can never
   block the Elementor panel (JS guard is primary fix,
   this is a belt-and-suspenders fallback).
══════════════════════════════════════════════════ */
body.elementor-editor-active #pageLoader,
body.elementor-editor-preview #pageLoader { display: none !important; }

/* Elementor safe mode hides everything — show a minimal placeholder */
body.elementor-editor-active .sn-ordering-wrap {
  min-height: 200px;
  background: #f9fafb;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ══════════════════════════════════════════════════
   REDUCED MOTION
══════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .skel { animation: none; background: var(--border); }
}
