/* ============================================================
   کافه لاین — صفحه محصولات (Menu)
   Requires: theme.css
   ============================================================ */
body{padding-bottom:96px}

/* ---------- Topbar ---------- */
.topbar{position:sticky;top:0;z-index:60;
  background:color-mix(in srgb,var(--bg) 88%,transparent);
  backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);
  border-bottom:1px solid var(--line)}
.topbar-inner{max-width:1180px;height:60px;margin:auto;padding:0 12px;
  display:grid;grid-template-columns:44px 1fr 44px;align-items:center;gap:10px}
.icon-btn{position:relative;width:44px;height:44px;border:1px solid var(--line);
  border-radius:13px;background:var(--surface);display:grid;place-items:center;
  box-shadow:var(--shadow-xs);transition:transform .15s}
.icon-btn:active{transform:scale(.94)}
.back-btn{font-size:26px;line-height:1;padding-bottom:2px}
.mini-brand{justify-self:center;display:flex;align-items:center;gap:9px}
.mini-mark{position:relative;width:34px;height:34px;border-radius:11px;background:#050505;
  flex:0 0 auto;overflow:hidden;border:1px solid rgba(255,255,255,.1)}
.mini-mark img{position:absolute;left:50%;top:50%;width:235%;height:auto;max-width:none;
  transform:translate(-50%,-51.6%)}
.mini-brand>span:last-child{display:flex;flex-direction:column;gap:1px}
.mini-brand b{font-size:13px;font-weight:800}
.mini-brand small{font-size:8px;letter-spacing:1.4px;color:var(--ink-3);direction:ltr;text-align:right}
.bag{position:relative;width:17px;height:16px;border:2px solid var(--ink);border-radius:4px 4px 6px 6px;margin-top:3px}
.bag::before{content:"";position:absolute;width:9px;height:6px;border:2px solid var(--ink);
  border-bottom:0;border-radius:7px 7px 0 0;right:2px;top:-8px}
.cart-btn em{position:absolute;top:-6px;left:-6px;min-width:20px;height:20px;padding:0 5px;
  border-radius:var(--r-pill);background:var(--brand);color:#fff;border:2px solid var(--bg);
  display:grid;place-items:center;font-size:11px;font-weight:700;font-style:normal;
  font-variant-numeric:tabular-nums}
.cart-btn:not(.has-items) em{background:var(--ink-3)}

/* ---------- Heading ---------- */
.menu-shell{max-width:1180px;margin:auto;padding:14px 12px 24px}
.menu-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;padding:4px 2px 10px}
.menu-heading>div span{font-size:11px;color:var(--accent);font-weight:800}
.menu-heading h1{font-size:26px;line-height:1.2;margin:5px 0 0}
.menu-heading>small{font-size:12px;color:var(--ink-2);white-space:nowrap;padding-bottom:3px}

/* ---------- Sticky category chips ---------- */
.category-strip{position:sticky;top:60px;z-index:45;display:flex;gap:8px;overflow-x:auto;
  scrollbar-width:none;padding:10px 0;
  background:linear-gradient(var(--bg) 72%,transparent);margin:0 -2px}
.category-strip::-webkit-scrollbar{display:none}
.category-chip{flex:0 0 auto;white-space:nowrap;padding:9px 15px;border-radius:var(--r-pill);
  border:1px solid var(--line);background:var(--surface);font-size:13px;font-weight:500;
  color:var(--ink-2);transition:background .2s,color .2s,border-color .2s;box-shadow:var(--shadow-xs)}
.category-chip.active{background:var(--ink);border-color:var(--ink);color:#fff;font-weight:700;
  box-shadow:var(--shadow-sm)}
/* هنگام جستجوی سراسری، هیچ دسته‌ای «فعال» نشان داده نمی‌شود */
body.is-searching .category-chip.active{background:var(--surface);border-color:var(--line);
  color:var(--ink-2);font-weight:500;box-shadow:var(--shadow-xs)}

/* ---------- Search ---------- */
.search-section{padding:2px 0 12px}
.search-box{height:50px;display:flex;align-items:center;gap:10px;background:var(--surface);
  border:1px solid var(--line);border-radius:var(--r);padding:0 14px;box-shadow:var(--shadow-xs);
  transition:border-color .18s,box-shadow .18s}
.search-box:focus-within{border-color:color-mix(in srgb,var(--brand) 55%,transparent);
  box-shadow:0 0 0 4px rgba(149,99,63,.08)}
.search-icon{position:relative;width:17px;height:17px;border:2px solid var(--ink-3);border-radius:50%;flex:0 0 auto}
.search-icon::after{content:"";position:absolute;width:7px;height:2px;background:var(--ink-3);
  left:-4px;bottom:-2px;transform:rotate(45deg);border-radius:4px}
.search-box input{width:100%;min-width:0;border:0;outline:0;background:transparent;
  color:var(--ink);font-size:15px}
.search-box input::placeholder{color:var(--ink-3)}
/* hide native search clear/decoration; we provide our own button */
.search-box input::-webkit-search-cancel-button,
.search-box input::-webkit-search-decoration{-webkit-appearance:none;appearance:none;display:none}
.search-box button{width:30px;height:30px;border:0;border-radius:50%;background:var(--surface-2);
  color:var(--ink-2);font-size:18px;line-height:1;display:none;place-items:center;flex:0 0 auto}
.search-box.has-value button{display:grid}

/* ---------- Product cards ---------- */
.product-grid{display:grid;gap:11px}
.product-card{display:grid;grid-template-columns:108px minmax(0,1fr);gap:12px;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);
  padding:9px;box-shadow:var(--shadow-xs);transition:box-shadow .2s,transform .2s}
.product-media{position:relative;aspect-ratio:1;border-radius:var(--r);overflow:hidden;background:var(--surface-3)}
.product-media img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.product-badge{position:absolute;top:8px;right:8px;padding:5px 9px;border-radius:var(--r-pill);
  background:rgba(255,252,247,.92);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);
  font-size:10px;font-weight:800;color:var(--brand);box-shadow:var(--shadow-xs)}
.lowstock-badge{position:absolute;top:8px;right:8px;padding:5px 9px;border-radius:var(--r-pill);
  background:rgba(255,252,247,.92);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);
  font-size:10px;font-weight:800;color:#a06a1f;box-shadow:var(--shadow-xs)}
.soldout-badge{position:absolute;top:8px;right:8px;padding:5px 10px;border-radius:var(--r-pill);
  background:rgba(28,23,18,.82);color:#fff;font-size:10px;font-weight:800;backdrop-filter:blur(4px)}
/* محصول ناموجود: عکس کم‌رنگ، بدون دکمهٔ افزودن */
.product-card.sold-out .product-media img{filter:grayscale(.7);opacity:.72}
.product-card.sold-out .product-info h2{color:var(--ink-2)}
.unavailable-tag{font-size:12px;font-weight:700;color:var(--ink-2);background:var(--surface-2);
  border-radius:var(--r-pill);padding:9px 14px}
.product-info{min-width:0;padding:4px 2px 2px;display:flex;flex-direction:column}
/* برچسب دسته، فقط در حالت جستجوی سراسری */
.product-cat{align-self:flex-start;font-size:10px;font-weight:700;color:var(--accent);
  background:color-mix(in srgb,var(--accent) 10%,transparent);border-radius:var(--r-pill);
  padding:3px 8px;margin-bottom:4px}
/* برچسب دستی مدیر کافه (مثلاً «پیشنهاد باریستا») */
.staff-tag{align-self:flex-start;display:inline-flex;align-items:center;gap:4px;
  font-size:10.5px;font-weight:800;color:#fff;letter-spacing:-.01em;
  background:linear-gradient(120deg,var(--gold),var(--brand));
  border-radius:var(--r-pill);padding:4px 10px;margin-bottom:5px;
  max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  box-shadow:0 1px 4px rgba(149,99,63,.28)}
.staff-tag svg{width:11px;height:11px;fill:currentColor;flex:0 0 auto}
.product-card.sold-out .staff-tag{filter:grayscale(.75);opacity:.7}

.product-title-row{display:flex;justify-content:space-between;align-items:flex-start;gap:8px}
.product-info h2{font-size:16px;font-weight:700;line-height:1.4;margin:0}
.calorie{white-space:nowrap;font-size:10px;font-weight:700;color:var(--ink-3);background:var(--surface-2);
  border:1px solid color-mix(in srgb,var(--line) 70%,transparent);border-radius:var(--r-pill);
  padding:3px 6px;flex:0 0 auto;margin-top:1px;line-height:1.1;font-variant-numeric:tabular-nums}
.calorie small{font-size:8px;font-weight:500;margin-right:2px;color:inherit}
.product-info p{margin:5px 0 9px;color:var(--ink-2);font-size:13px;line-height:1.65;
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
.product-bottom{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:auto}
.price{display:flex;align-items:baseline;gap:4px}
.price b{font-size:17px;font-weight:800}
.price small{font-size:11px;color:var(--ink-2)}
.add-btn{width:44px;height:44px;flex:0 0 auto;border:0;border-radius:14px;background:var(--ink);
  color:#fff;font-size:24px;line-height:1;display:grid;place-items:center;
  box-shadow:var(--shadow-sm);transition:transform .12s}
.add-btn:active{transform:scale(.9)}

/* ---------- Empty state ---------- */
.empty-state{display:none;min-height:240px;align-items:center;justify-content:center;
  flex-direction:column;text-align:center;color:var(--ink-2);gap:8px;padding:20px}
.empty-state.show{display:flex}
.empty-state b{font-size:17px;color:var(--ink);font-weight:800}
.empty-state small{font-size:13px}
.empty-icon{position:relative;width:52px;height:52px;border:1px solid var(--line);
  border-radius:50%;margin-bottom:4px;background:var(--surface)}
.empty-icon::before{content:"";position:absolute;width:16px;height:16px;border:2px solid var(--ink-3);
  border-radius:50%;right:15px;top:13px}
.empty-icon::after{content:"";position:absolute;width:9px;height:2px;background:var(--ink-3);
  left:13px;bottom:14px;transform:rotate(45deg);border-radius:4px}

/* ---------- Sticky cart bar ---------- */
.cart-bar{position:fixed;z-index:90;right:12px;left:12px;bottom:max(12px,env(safe-area-inset-bottom));
  max-width:760px;margin:auto;min-height:64px;padding:10px 12px;border-radius:var(--r-lg);
  background:var(--ink);color:#fff;display:grid;grid-template-columns:46px 1fr auto 20px;
  align-items:center;gap:11px;box-shadow:var(--shadow-lg);
  transform:translateY(0);opacity:1;transition:transform .28s var(--ease),opacity .2s}
.cart-bar.empty-cart{transform:translateY(160%);opacity:0;pointer-events:none}
.cart-bar-count{width:46px;height:46px;border-radius:13px;background:rgba(255,255,255,.12);
  display:grid;place-items:center;font-size:16px;font-weight:800;font-variant-numeric:tabular-nums}
.cart-bar-copy{min-width:0;display:flex;flex-direction:column;gap:2px}
.cart-bar-copy b{font-size:14px;font-weight:700}
.cart-bar-copy small{font-size:11px;color:rgba(255,255,255,.66);white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis}
.cart-bar>strong{font-size:14px;font-weight:800;white-space:nowrap}
.cart-bar>i{font-style:normal;color:var(--gold);font-size:18px}

/* toast position for this page */
.toast{top:72px}

/* ---------- Responsive ---------- */
@media(min-width:700px){
  body{padding-bottom:104px}
  .topbar-inner{height:66px;padding:0 20px}
  .category-strip{top:66px}
  .menu-shell{padding:22px 20px 36px}
  .menu-heading h1{font-size:32px}
  .product-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
  .product-card{grid-template-columns:124px minmax(0,1fr);padding:10px}
  .cart-bar{bottom:18px}
}
@media(min-width:1050px){
  .product-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
  .product-card:hover{transform:translateY(-2px);box-shadow:var(--shadow)}
}
@media(max-width:359px){
  .menu-shell{padding-left:10px;padding-right:10px}
  .product-card{grid-template-columns:96px minmax(0,1fr);gap:10px}
  .product-info h2{font-size:15px}
  .cart-bar{right:9px;left:9px;grid-template-columns:42px 1fr auto 18px}
}
