/* ═══════════════════════════════════════════════════════
   ZAYTOON — In-App Sheets & Tabs
   No page reloads. Everything slides in from bottom.
═══════════════════════════════════════════════════════ */

/* ── BOTTOM SHEET BASE ──────────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 800;
  background: rgba(0,0,0,0); 
  pointer-events: none;
  transition: background .35s ease;
}
.sheet-backdrop.open {
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  pointer-events: all;
}

.bottom-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 900;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  max-height: 92vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  transform: translateY(110%);
  transition: transform .4s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -8px 40px rgba(0,0,0,.18);
}
.bottom-sheet.open {
  transform: translateY(0);
}

/* Drag handle */
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--beige-dark);
  border-radius: 99px;
  margin: .75rem auto .25rem;
  flex-shrink: 0;
  cursor: grab;
}
.sheet-handle:active { cursor: grabbing; }

.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1.25rem 1rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--beige-dark);
}
.sheet-title {
  font-weight: 800; font-size: 1rem;
  display: flex; align-items: center; gap: .5rem;
}
.sheet-close {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--beige); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; color: var(--text-secondary);
  transition: all .18s;
}
.sheet-close:hover { background: var(--red); color: white; }

.sheet-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom, 16px);
}
.sheet-footer {
  padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--beige-dark);
  flex-shrink: 0;
  background: var(--surface);
}

/* ═══════════════════════════════════════════════════════
   PRODUCT QUICK-ADD SHEET
═══════════════════════════════════════════════════════ */
#productSheet { max-height: 88vh; }

.psheet-hero {
  display: flex; gap: 1rem; align-items: flex-start;
  padding: 1rem 1.25rem;
}
.psheet-img {
  width: 88px; height: 88px; border-radius: 14px;
  overflow: hidden; flex-shrink: 0;
  background: var(--beige);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
}
.psheet-img img { width: 100%; height: 100%; object-fit: cover; }
.psheet-brand  { font-size: .7rem; font-weight: 700; color: var(--gold); letter-spacing: .08em; text-transform: uppercase; margin-bottom: .2rem; }
.psheet-name   { font-weight: 800; font-size: 1rem; line-height: 1.3; margin-bottom: .4rem; }
.psheet-price  { font-size: 1.2rem; font-weight: 900; color: var(--gold); }
.psheet-old    { font-size: .82rem; color: var(--text-secondary); text-decoration: line-through; margin-inline-start: .4rem; }

.psheet-section { padding: .85rem 1.25rem; border-top: 1px solid var(--beige-dark); }
.psheet-section-label {
  font-size: .78rem; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: .65rem;
  display: flex; align-items: center; justify-content: space-between;
}
.psheet-section-selected { color: var(--text-primary); font-weight: 800; }

/* Variant chips in sheet */
.sheet-variant-wrap { display: flex; flex-wrap: wrap; gap: .45rem; }
.sv-btn {
  padding: .4rem .95rem; border-radius: 50px;
  border: 1.5px solid var(--beige-dark); background: var(--surface);
  font-size: .82rem; font-weight: 600; cursor: pointer; transition: all .18s;
  color: var(--text-primary);
}
.sv-btn:hover  { border-color: var(--gold); }
.sv-btn.active { border-color: var(--gold); background: var(--gold); color: white; }
.sv-btn.oos    { opacity: .35; text-decoration: line-through; cursor: not-allowed; }

/* Color swatch in sheet */
.sv-color {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2.5px solid transparent; cursor: pointer;
  transition: all .18s;
}
.sv-color.active { box-shadow: 0 0 0 2.5px white, 0 0 0 4.5px var(--gold); }
.sv-color.oos { opacity: .3; cursor: not-allowed; }

/* Qty row */
.sheet-qty-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.25rem; border-top: 1px solid var(--beige-dark);
}
.sheet-qty-label { font-size: .88rem; font-weight: 700; }
.sheet-qty-ctrl {
  display: flex; align-items: center; gap: 0;
  border: 1.5px solid var(--beige-dark); border-radius: 50px;
  overflow: hidden; background: var(--surface);
}
.sqb {
  width: 40px; height: 36px; background: none; border: none;
  cursor: pointer; font-size: .85rem; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.sqb:hover { background: var(--beige); color: var(--gold); }
.sqb:active { transform: scale(.88); }
.sqn {
  min-width: 36px; text-align: center; font-weight: 800; font-size: .95rem;
  border-left: 1px solid var(--beige-dark); border-right: 1px solid var(--beige-dark);
  user-select: none;
}

/* Stock info */
.sheet-stock-info {
  padding: .5rem 1.25rem;
  font-size: .78rem; font-weight: 600;
  display: flex; align-items: center; gap: .4rem;
}

/* ═══════════════════════════════════════════════════════
   CART SHEET (in-app — no page reload)
═══════════════════════════════════════════════════════ */
#cartSheet { max-height: 90vh; }

.cart-sheet-item {
  display: flex; gap: .85rem; align-items: flex-start;
  padding: .85rem 1.25rem; border-bottom: 1px solid var(--beige-dark);
  animation: slideInItem .25s ease;
}
@keyframes slideInItem { from{opacity:0;transform:translateX(-8px)} to{opacity:1;transform:none} }
.cart-sheet-item:last-child { border-bottom: none; }
.csi-img {
  width: 64px; height: 64px; border-radius: 12px; flex-shrink: 0;
  overflow: hidden; background: var(--beige);
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
}
.csi-img img { width: 100%; height: 100%; object-fit: cover; }
.csi-name  { font-weight: 700; font-size: .87rem; margin-bottom: .18rem; line-height: 1.35; }
.csi-brand { font-size: .72rem; color: var(--text-secondary); margin-bottom: .4rem; }
.csi-row   { display: flex; align-items: center; gap: .5rem; }
.csi-price { font-weight: 900; color: var(--gold); font-size: .9rem; }
.csi-del   { background: none; border: none; cursor: pointer; color: var(--text-secondary); font-size: .8rem; padding: .2rem .4rem; border-radius: 6px; margin-inline-start: auto; transition: all .15s; }
.csi-del:hover { color: var(--red); background: rgba(239,68,68,.1); }

.cart-reco-zone {
  padding: .85rem 1.25rem 1.1rem;
  border-top: 1px solid var(--beige-dark);
  background: linear-gradient(180deg, rgba(201,169,97,.06), transparent);
}

.cart-reco-loading {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}

.cart-reco-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .65rem;
}

.cart-reco-head span {
  font-size: .9rem;
  font-weight: 900;
}

.cart-reco-head small {
  color: var(--text-secondary);
  font-size: .7rem;
  font-weight: 700;
}

.cart-reco-scroll {
  display: flex;
  gap: .65rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: .15rem;
}

.cart-reco-scroll::-webkit-scrollbar {
  display: none;
}

.cart-reco-card {
  flex: 0 0 238px;
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 32px;
  gap: .55rem;
  align-items: center;
  padding: .55rem;
  background: var(--surface);
  border: 1px solid var(--beige-dark);
  border-radius: 14px;
  box-shadow: var(--shadow-xs);
}

.cart-reco-media {
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: 11px;
  overflow: hidden;
  background: var(--beige);
  cursor: pointer;
}

.cart-reco-media img,
.cart-reco-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
}

.cart-reco-info {
  min-width: 0;
}

.cart-reco-name {
  min-height: 2.6em;
  max-height: 4.1em;
  overflow: hidden;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.cart-reco-meta {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-top: .28rem;
  font-size: .78rem;
  font-weight: 900;
  color: var(--gold);
}

.cart-reco-meta b {
  padding: .06rem .28rem;
  border-radius: 999px;
  background: rgba(239,68,68,.1);
  color: #dc2626;
  font-size: .62rem;
}

.cart-reco-add {
  position: static;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(201,169,97,.25);
}

.cart-reco-add:disabled {
  opacity: .75;
  cursor: wait;
}

.cart-reco-add.is-added {
  background: var(--green, #22c55e) !important;
  color: #fff !important;
  opacity: 1;
}

/* Checkout inline */
#checkoutSheet { max-height: 96vh; z-index: 950; }
.checkout-step {
  display: none; animation: fadeInStep .25s ease;
}
.checkout-step.active { display: block; }
@keyframes fadeInStep { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

/* Step indicators */
.checkout-steps-nav {
  display: flex; gap: 0; padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--beige-dark);
  flex-shrink: 0;
}
.csn-step {
  flex: 1; text-align: center; font-size: .74rem; font-weight: 700;
  color: var(--text-secondary); position: relative; padding-bottom: .6rem;
}
.csn-step.active   { color: var(--gold); }
.csn-step.done     { color: var(--green); }
.csn-step::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 2.5px; background: var(--beige-dark); border-radius: 99px;
}
.csn-step.active::after { background: var(--gold); }
.csn-step.done::after   { background: var(--green); }
.csn-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--beige-dark); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800; margin: 0 auto .3rem;
  transition: all .25s;
}
.csn-step.active .csn-num { background: var(--gold); color: white; }
.csn-step.done .csn-num   { background: var(--green); color: white; }

/* Free shipping bar */
.free-ship-bar {
  background: var(--beige); padding: .55rem 1.25rem;
  display: flex; align-items: center; gap: .75rem;
  font-size: .78rem; flex-shrink: 0;
}
.free-ship-progress {
  flex: 1; height: 5px; background: var(--beige-dark); border-radius: 99px; overflow: hidden;
}
.free-ship-fill {
  height: 100%; background: linear-gradient(90deg,var(--gold),var(--gold-light));
  border-radius: 99px; transition: width .5s ease;
}

/* ── PRODUCT CARD: + BUTTON VISIBLE ALWAYS ON MOBILE ── */
@media (max-width: 768px) {
  .product-quick-add {
    opacity: 1 !important; transform: scale(1) !important;
    width: 34px !important; height: 34px !important;
    font-size: .85rem !important;
    bottom: .45rem !important; right: .45rem !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.15) !important;
  }
  .product-card-actions { opacity: 1 !important; }
}

/* Remove old-style full-width add button on cards */
.product-info .add-to-cart-btn:not(.product-quick-add) { display: none !important; }

/* ── SWIPE DOWN TO CLOSE ── */
.sheet-swipe-zone { touch-action: none; }

/* Product sheet v2 */
.psheet-loading {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: .75rem;
  color: var(--gold);
  font-weight: 700;
}

.psheet-skeleton {
  padding: 1rem 1.25rem 1.2rem;
}

.psk-hero,
.psk-line,
.psk-chips span,
.psheet-footer-loading span,
.psheet-footer-loading strong {
  position: relative;
  overflow: hidden;
  background: var(--beige);
}

.psk-hero::after,
.psk-line::after,
.psk-chips span::after,
.psheet-footer-loading span::after,
.psheet-footer-loading strong::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.62), transparent);
  animation: psheetShimmer 1.25s ease-in-out infinite;
}

.psk-hero {
  aspect-ratio: 1 / .82;
  border-radius: 20px;
}

.psk-body {
  padding-top: 1rem;
}

.psk-line {
  height: 12px;
  border-radius: 999px;
  margin-bottom: .65rem;
}

.psk-line.short {
  width: 34%;
}

.psk-line.title {
  width: 82%;
  height: 18px;
}

.psk-line.price {
  width: 48%;
  height: 22px;
}

.psk-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
  margin-top: .9rem;
}

.psk-chips span {
  height: 54px;
  border-radius: 16px;
}

@keyframes psheetShimmer {
  100% {
    transform: translateX(100%);
  }
}

.psheet-gallery {
  padding: 1rem 1.25rem .75rem;
}

.psheet-main-img {
  aspect-ratio: 1 / .82;
  border-radius: 18px;
  background: var(--beige);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.psheet-main-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.psheet-main-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.psheet-main-placeholder span {
  font-size: 4rem;
  color: rgba(255,255,255,.82);
}

.psheet-thumbs {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding: .65rem .1rem .1rem;
  scrollbar-width: none;
}

.psheet-thumbs::-webkit-scrollbar {
  display: none;
}

.psheet-thumb {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--beige);
  padding: 0;
  overflow: hidden;
  flex: 0 0 auto;
  cursor: pointer;
}

.psheet-thumb.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,169,97,.18);
}

.psheet-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.psheet-info {
  padding: .35rem 1.25rem 1rem;
}

.psheet-price-row {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
}

.psheet-discount {
  background: var(--red);
  color: white;
  font-size: .66rem;
  font-weight: 900;
  padding: .16rem .45rem;
  border-radius: 999px;
}

.psheet-stock {
  gap: .4rem;
  padding: 0;
}

.psheet-stock span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.psheet-decision-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
  margin-top: .85rem;
}

.psheet-decision-btn {
  min-width: 0;
  min-height: 44px;
  border: 1px solid rgba(201,169,97,.22);
  border-radius: 15px;
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: 0 8px 22px rgba(26,20,16,.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: 0 .65rem;
  font-family: inherit;
  font-size: .78rem;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.psheet-decision-btn i {
  color: var(--gold);
}

.psheet-desc {
  color: var(--text-secondary);
  font-size: .88rem;
  line-height: 1.85;
}

.psheet-trust-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--beige-dark);
}

.psheet-trust-row div {
  min-width: 0;
  background: var(--beige);
  border: 1px solid var(--beige-dark);
  border-radius: 14px;
  padding: .6rem .45rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .28rem;
  text-align: center;
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.psheet-trust-row i {
  color: var(--gold);
  font-size: .95rem;
}

.psheet-reco-scroll {
  display: flex;
  gap: .75rem;
  overflow-x: auto;
  padding-bottom: .25rem;
  scrollbar-width: none;
}

.psheet-reco-scroll::-webkit-scrollbar {
  display: none;
}

.psheet-reco-loading {
  width: 100%;
  text-align: center;
  padding: 1rem;
  color: var(--gold);
}

.psheet-reco-card {
  width: 118px;
  flex: 0 0 auto;
  border: 1px solid var(--beige-dark);
  background: var(--surface);
  border-radius: 14px;
  padding: .45rem;
  text-align: inherit;
  cursor: pointer;
}

.psheet-reco-img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 11px;
  background: var(--beige);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .45rem;
}

.psheet-reco-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.psheet-reco-name {
  font-size: .74rem;
  font-weight: 800;
  line-height: 1.35;
  min-height: 2.7em;
  overflow: hidden;
}

.psheet-reco-price {
  font-size: .8rem;
  font-weight: 900;
  color: var(--gold);
  margin-top: .25rem;
}

.psheet-footer-row {
  display: grid;
  grid-template-columns: minmax(110px, .8fr) minmax(0, 1.2fr);
  gap: .75rem;
  align-items: center;
}

.psheet-footer-total {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.psheet-footer-total span {
  font-size: .72rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.psheet-footer-total strong {
  color: var(--gold);
  font-size: 1.05rem;
  font-weight: 900;
}

.psheet-footer-row .btn {
  height: 52px;
  border-radius: 14px;
  font-size: .95rem;
}

@media (min-width: 769px) {
  #productSheet {
    width: min(720px, calc(100vw - 32px));
    left: 50%;
    right: auto;
    transform: translate(-50%, 110%);
    border-radius: 24px 24px 0 0;
  }

  #productSheet.open {
    transform: translate(-50%, 0);
  }

  .psheet-gallery {
    padding-inline: 1.5rem;
  }

  .psheet-main-img {
    aspect-ratio: 16 / 9;
  }
}

/* Keep the product sheet action visible above long content and mobile safe areas. */
#productSheet {
  max-height: min(92vh, 820px);
}

#productSheet .sheet-body {
  min-height: 0;
  padding-bottom: .85rem;
}

#productSheetFooter {
  position: relative;
  z-index: 4;
  display: block;
  padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom, 0px));
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), var(--surface) 34%),
    var(--surface);
  box-shadow: 0 -12px 28px rgba(0,0,0,.08);
}

#productSheetFooter:empty {
  display: none;
}

.psheet-footer-loading {
  display: grid;
  grid-template-columns: minmax(82px, .7fr) minmax(0, 1.45fr);
  gap: .65rem;
}

.psheet-footer-loading span,
.psheet-footer-loading strong {
  height: 54px;
  border-radius: 16px;
}

.psheet-footer-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
  margin-bottom: .55rem;
}

.psheet-mini-action {
  min-width: 0;
  min-height: 38px;
  border: 1px solid rgba(201,169,97,.2);
  border-radius: 14px;
  background: rgba(201,169,97,.08);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  font-family: inherit;
  font-size: .76rem;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.psheet-mini-action i {
  color: var(--gold);
}

#productSheetFooter .psheet-footer-row {
  grid-template-columns: minmax(82px, .7fr) minmax(0, 1.45fr);
  gap: .65rem;
}

#productSheetFooter .psheet-footer-total {
  min-width: 0;
}

#productSheetFooter .psheet-footer-total span,
#productSheetFooter .psheet-footer-total strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#productSheetFooter .psheet-footer-row .btn,
#productSheetFooter > .btn {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  height: 54px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-weight: 900;
}

@media (max-width: 430px) {
  #productSheet {
    max-height: 94vh;
  }

  #productSheetFooter {
    padding-inline: .75rem;
  }

  #productSheetFooter .psheet-footer-row {
    grid-template-columns: minmax(74px, .62fr) minmax(0, 1.5fr);
  }

  #productSheetFooter .psheet-footer-total span {
    font-size: .66rem;
  }

  #productSheetFooter .psheet-footer-total strong {
    font-size: .95rem;
  }

  #productSheetFooter .psheet-footer-row .btn {
    font-size: .9rem;
    padding-inline: .65rem;
  }

  .psheet-decision-row {
    gap: .45rem;
  }

  .psheet-decision-btn {
    font-size: .72rem;
    padding-inline: .5rem;
  }
}
