/* ============================================================
   FizzyNow — IceDraw editorial style
   Palette: Ink #0e0e0e · Gold #c9a96e · Cream #fafaf7 · Border #e8e4dc
   Typefaces: Didot/Bodoni (serif) · Optima (sans)
   ============================================================ */

:root {
  --ink:    #0e0e0e;
  --text:   #1a1a1a;
  --text-2: #5a5550;
  --text-3: #9a9590;
  --gold:   #c9a96e;
  --gold-d: #a87f30;
  --cream:  #fafaf7;
  --white:  #ffffff;
  --border: #e8e4dc;
  --red:    #cc3333;
  --serif:  'Didot', 'Bodoni 72', 'Bodoni MT', Georgia, serif;
  --sans:   'Optima', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
  --header-h: 66px;
  --bar-h:    68px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body { font-family: var(--sans); background: var(--cream); color: var(--text); min-height: 100dvh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
img  { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea { font-family: inherit; font-size: 1rem; }
a { color: inherit; text-decoration: none; }

/* ── Loading ── */
#loading {
  position: fixed; inset: 0; background: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  z-index: 9999; transition: opacity .3s;
}
#loading .brand-load {
  font-family: var(--serif); font-size: 2rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--gold);
}
#loading .spinner {
  width: 32px; height: 32px; border: 1px solid rgba(201,169,110,.3);
  border-top-color: var(--gold); border-radius: 50%; animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading.hidden { opacity: 0; pointer-events: none; }

/* ── Error banner ── */
#errorBanner {
  display: none; background: #fdf0f0; border-bottom: 2px solid var(--red);
  padding: 14px 20px; text-align: center; font-size: .88rem; color: var(--red);
  letter-spacing: .04em;
}
#errorBanner.show { display: block; }

/* ── Top safe-area cover (keeps status-bar zone filled once header scrolls off) ── */
body::before {
  content: ''; position: fixed; top: 0; left: 0; right: 0;
  height: env(safe-area-inset-top);
  background: var(--ink); z-index: 70; pointer-events: none;
}

/* ── Header (scrolls away on scroll) ── */
.app-header {
  position: relative; z-index: 80;
  background: var(--ink);
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 20px;
  padding-top: env(safe-area-inset-top);
  height: calc(var(--header-h) + env(safe-area-inset-top));
  border-bottom: 1px solid #1f1f1f;
}
.app-header::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--gold) 30%, var(--gold) 70%, transparent 100%);
  opacity: .8;
}
.brand {
  position: absolute; left: 50%; transform: translateX(-50%);
  text-align: center;
  font-family: var(--serif); font-size: 1.45rem; letter-spacing: .2em;
  color: var(--gold); line-height: 1; user-select: none;
  pointer-events: none;
}
.brand span {
  color: rgba(255,255,255,.38); font-size: .6rem; letter-spacing: .2em;
  display: block; margin-top: 4px; font-family: var(--sans); text-transform: uppercase;
}
.brand span + span { margin-top: 2px; }
.lang-btn {
  position: absolute; inset-inline-start: 20px;
  background: transparent; border: 1px solid rgba(201,169,110,.35);
  padding: 8px 10px; color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 44px; transition: border-color .2s, color .2s;
}
.lang-btn:hover { border-color: var(--gold); color: #e8c86a; }
.lang-btn svg { width: 18px; height: 18px; }

.cart-icon-btn {
  position: relative;
  background: transparent; border: 1px solid rgba(201,169,110,.35);
  padding: 8px 14px; color: var(--gold);
  font-family: var(--sans); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
  min-height: 44px; transition: border-color .2s, color .2s;
}
.cart-icon-btn:hover { border-color: var(--gold); color: #e8c86a; }
.cart-icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.cart-badge {
  position: absolute; top: -7px; right: -7px;
  background: var(--gold-d); color: white; font-size: .65rem; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 4px;
  display: none; align-items: center; justify-content: center;
  border: 1.5px solid var(--ink);
}
.cart-badge.show { display: flex; }

/* ── Search bar (scrolls away) ── */
.top-search {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}

/* ── Install + category filter (sticky under status bar) ── */
.search-filter {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 12px 16px 0;
  padding-bottom: 10px;
  position: sticky; top: env(safe-area-inset-top); z-index: 90;
}
.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; fill: var(--text-3); pointer-events: none;
}
#searchInput {
  width: 100%; height: 40px; padding: 0 36px 0 36px;
  border: 1px solid var(--border); border-radius: 0;
  background: var(--cream); font-size: .88rem; color: var(--text);
  letter-spacing: .02em; outline: none; transition: border-color .2s;
}
#searchInput:focus { border-color: var(--ink); background: white; }
#searchInput::placeholder { color: var(--text-3); font-style: italic; }
.search-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; background: var(--text-3);
  color: white; font-size: .85rem; display: none; align-items: center; justify-content: center;
}
.search-clear.show { display: flex; }

/* Category tabs — every pill has all 4 borders; negative margin collapses doubles */
.cat-scroll {
  display: flex; flex-wrap: wrap;
  border-top: 1px solid var(--border);
}
.cat-pill {
  padding: 10px 16px;
  border: 1px solid var(--border);
  margin-right: -1px;
  margin-bottom: -1px;
  outline-offset: -2px;
  position: relative;
  background: transparent;
  font-family: var(--sans); font-size: .68rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--text-3); white-space: nowrap;
  transition: color .15s, background .15s;
}
.cat-pill:hover { color: var(--text); background: rgba(232,228,220,.25); }
.cat-pill.active { color: var(--ink); box-shadow: inset 0 -2px 0 var(--gold); background: var(--white); z-index: 1; }

/* ── Install banner ── */
#installBanner {
  padding: 0 0 12px; display: none;
}
.install-btn {
  width: 100%; background: var(--ink); color: var(--gold);
  padding: 20px 24px;
  font-family: var(--serif); font-size: 1.1rem; letter-spacing: .06em;
  text-align: center; transition: background .18s;
  border: none; cursor: pointer;
}
.install-btn:hover { background: #1c1c1c; }

/* ── Install modals ── */
.install-modal {
  position: fixed; inset: 0;
  background: rgba(14,14,14,.78);
  z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.install-modal-card {
  background: var(--white); width: 100%; max-width: 380px;
  padding: 44px 32px 32px; position: relative;
}
.install-modal-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent 0%, var(--gold) 30%, var(--gold) 70%, transparent 100%);
}
.install-modal-title {
  font-family: var(--serif); font-size: 1.3rem; letter-spacing: .04em;
  text-align: center; margin-bottom: 28px; color: var(--ink);
}
.install-steps { display: flex; flex-direction: column; gap: 18px; margin-bottom: 32px; }
.install-step {
  display: flex; align-items: flex-start; gap: 14px;
  font-size: .88rem; color: var(--text-2); line-height: 1.55;
}
.step-num {
  width: 22px; height: 22px; flex-shrink: 0;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; letter-spacing: .08em; color: var(--text-3);
  margin-top: 2px; font-family: var(--sans);
}
.install-modal-done {
  width: 100%; background: var(--gold); color: var(--ink);
  padding: 15px; font-size: .75rem; letter-spacing: .16em; text-transform: uppercase;
  font-family: var(--sans); font-weight: 700; border: none; cursor: pointer;
  transition: background .18s;
}
.install-modal-done:hover { background: #e8c86a; }

/* ── Main ── */
main { padding: 0 0 calc(var(--bar-h) + 20px + env(safe-area-inset-bottom)); }

/* Repeat order banner */
#repeatBanner {
  display: none; margin: 16px 16px 0; padding: 14px 16px;
  background: white; border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  flex-direction: column; gap: 10px;
}
#repeatBanner.show { display: flex; }
#repeatBanner p { font-size: .82rem; color: var(--text-2); letter-spacing: .02em; }
#repeatBanner strong { color: var(--text); }
.repeat-actions { display: flex; gap: 10px; }
#repeatLoadBtn {
  background: var(--ink); color: var(--gold);
  padding: 8px 16px; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase;
  font-family: var(--sans);
}
#repeatDismissBtn { color: var(--text-3); font-size: .8rem; padding: 8px; }

/* ── Product list — one product per full-width row ── */
#productGrid {
  display: flex; flex-direction: column;
  gap: 1px; background: var(--border);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-top: 16px;
}

/* Product card — horizontal: image left, details right */
.p-card {
  background: var(--white);
  display: flex; flex-direction: row; align-items: flex-start; gap: 16px;
  padding: 16px;
  transition: background .15s;
}
.p-card:hover { background: #fcfbf7; }

.p-img-wrap {
  background: var(--cream);
  width: 88px; min-width: 88px; height: 112px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.p-img-wrap img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.p-img-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem; opacity: .25;
}

.p-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.p-title { line-height: 1.3; }
.p-name {
  font-family: var(--serif); font-size: 1.3rem; color: var(--text); font-weight: 400;
}
.p-format {
  font-family: var(--serif); font-style: italic;
  font-size: .95rem; color: var(--text-3); text-transform: lowercase;
}
.p-format::before { content: " • "; font-style: normal; }

.p-packages {
  padding-top: 10px;
  display: flex; flex-direction: column; gap: 12px;
}

/* Package row — label + price on the left, plus box on the right */
.pkg-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.pkg-meta { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.pkg-label {
  font-family: var(--sans); font-size: 1.15rem; font-weight: 600;
  letter-spacing: .01em; color: var(--text);
}
.pkg-price {
  font-family: var(--serif); font-size: 1rem; color: var(--text-3); font-weight: 400;
}

/* Plus box */
.pkg-add-btn {
  width: 48px; height: 48px; padding: 0; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--gold);
  border: 1px solid var(--ink);
  font-family: var(--sans); font-size: 1.7rem; line-height: 1;
  transition: background .15s;
}
.pkg-add-btn:hover { background: #1c1c1c; }

/* Stepper */
.pkg-stepper {
  display: flex; align-items: center; border: 1px solid var(--ink); flex-shrink: 0;
}
.pkg-stepper button {
  width: 48px; height: 48px; font-size: 1.5rem; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.pkg-stepper button:hover { background: var(--cream); }
.pkg-stepper .qty {
  min-width: 44px; text-align: center;
  font-family: var(--serif); font-size: 1.25rem; color: var(--ink);
  border-left: 1px solid var(--ink); border-right: 1px solid var(--ink);
  padding: 0 6px; line-height: 48px;
}

/* ── Empty state ── */
#emptyState { display: none; text-align: center; padding: 80px 24px; }
#emptyState .empty-icon { font-size: 2.5rem; margin-bottom: 14px; opacity: .3; }
#emptyState p { color: var(--text-3); font-size: .88rem; letter-spacing: .08em; }
#emptyState.show { display: block; }

/* ── Sticky cart bar ── */
#stickyBar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--ink); padding: 10px 16px 14px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  display: none; align-items: center; justify-content: space-between; gap: 12px;
  border-top: 1px solid #2a2a2a;
}
#stickyBar::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
#stickyBar.show { display: flex; }
#stickyBarCount { color: rgba(255,255,255,.45); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; flex-shrink: 0; }
#stickyBarBtn {
  flex: 1; background: var(--gold); color: var(--ink);
  padding: 12px 20px; font-size: .72rem; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase; font-family: var(--sans);
  display: flex; align-items: center; justify-content: space-between;
  transition: background .2s;
}
#stickyBarBtn:hover { background: #e8c86a; }
#stickyBarPrice { font-family: var(--serif); font-size: .95rem; font-weight: 400; letter-spacing: .03em; }

/* ── Overlay backdrop ── */
.overlay-bg {
  position: fixed; inset: 0; background: rgba(14,14,14,0.72); z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.overlay-bg.show { opacity: 1; pointer-events: all; }

/* ── Sheet ── */
.sheet {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 300;
  background: var(--white); border-radius: 0;
  max-height: 92dvh; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -12px 48px rgba(0,0,0,0.28);
}
.sheet::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent 0%, var(--gold) 30%, var(--gold) 70%, transparent 100%);
}
.sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 36px; height: 3px; background: var(--border);
  margin: 12px auto 0;
}
.sheet-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px 14px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sheet-title {
  font-family: var(--serif); font-size: 1.2rem; font-weight: 400;
  letter-spacing: .04em; flex: 1;
}
.sheet-back {
  color: var(--gold-d); font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; font-family: var(--sans); padding: 4px 0;
}
.sheet-close {
  width: 30px; height: 30px; background: transparent; border: 1px solid var(--border);
  color: var(--text-2); font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sheet-close:hover { border-color: var(--ink); color: var(--ink); }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-footer {
  padding: 14px 20px; border-top: 1px solid var(--border); flex-shrink: 0;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

/* ── Cart sheet ── */
.cart-empty-msg { text-align: center; padding: 56px 24px; color: var(--text-3); }
.cart-empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: .3; }

.cart-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.cart-item-img {
  width: 52px; height: 52px; background: var(--cream);
  object-fit: contain; padding: 4px; flex-shrink: 0;
}
.cart-item-img-placeholder {
  width: 52px; height: 52px; background: var(--cream);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; opacity: .4; flex-shrink: 0;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
  font-family: var(--serif); font-size: .95rem; font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cart-item-detail { font-size: .72rem; color: var(--text-3); margin-top: 2px; font-style: italic; }
.cart-item-sub {
  font-family: var(--serif); font-size: .88rem; color: var(--ink); margin-top: 4px;
}
.cart-item-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.cart-stepper {
  display: flex; align-items: center; border: 1px solid var(--border);
}
.cart-stepper button {
  width: 28px; height: 28px; font-size: 1rem; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.cart-stepper button:hover { background: var(--cream); }
.cart-stepper .qty {
  min-width: 24px; text-align: center; font-size: .85rem;
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  padding: 0 4px; line-height: 28px;
}
.cart-remove {
  width: 26px; height: 26px; color: var(--text-3); font-size: .95rem;
  display: flex; align-items: center; justify-content: center;
}
.cart-remove:hover { color: var(--red); }

.cart-totals { padding: 16px 20px; border-top: 1px solid var(--border); }
.cart-total-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .8rem; color: var(--text-2); letter-spacing: .06em; margin-bottom: 6px;
}
.cart-total-row span:first-child { text-transform: uppercase; }
.cart-total-row.main {
  font-size: .88rem; color: var(--text);
  margin-top: 10px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.cart-total-row.main .total-price { font-family: var(--serif); font-size: 1.1rem; color: var(--ink); font-weight: 400; }

.min-order-note {
  font-size: .75rem; color: var(--gold-d); text-align: center;
  margin: 0 20px 4px; padding: 10px 14px;
  border: 1px solid rgba(168,127,48,.3); background: rgba(201,169,110,.06);
  letter-spacing: .04em;
}

/* ── Info form ── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: .65rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--text-2); margin-bottom: 7px; font-family: var(--sans);
}
.form-input, .form-textarea {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: 0;
  font-size: .92rem; color: var(--text); background: var(--cream);
  transition: border-color .2s; outline: none; appearance: none;
}
.form-input:focus, .form-textarea:focus { border-color: var(--ink); background: white; }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-3); font-style: italic; }
.form-textarea { resize: vertical; min-height: 70px; }
.form-hint { font-size: .7rem; color: var(--text-3); margin-top: 5px; font-style: italic; }
.form-section-sub { font-size: .8rem; color: var(--text-2); margin-bottom: 18px; }

/* ── Order preview ── */
.order-preview-box {
  background: var(--ink); color: rgba(255,255,255,.85);
  padding: 20px; font-size: .82rem; line-height: 1.6;
  white-space: pre-wrap; font-family: 'Menlo', 'Courier New', monospace;
  word-break: break-word; letter-spacing: .01em;
}
.order-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.order-note {
  font-size: .72rem; color: var(--text-3); text-align: center;
  margin-top: 14px; padding: 0 16px; line-height: 1.6; font-style: italic;
}

/* ── Buttons ── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px; font-size: .75rem; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; font-family: var(--sans);
  width: 100%; transition: background .18s; border: none;
}
.btn-primary { background: var(--gold); color: var(--ink); }
.btn-primary:hover { background: #e8c86a; }
.btn-navy { background: var(--ink); color: var(--gold); }
.btn-navy:hover { background: #1a1a1a; }
.btn-outline { background: transparent; border: 1px solid var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: var(--gold); }
.btn:disabled { opacity: .35; cursor: not-allowed; }

/* ── Copy feedback toast ── */
#copyFeedback {
  position: fixed; bottom: calc(110px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--gold);
  padding: 10px 20px; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  opacity: 0; pointer-events: none; transition: opacity .25s;
  z-index: 9999; white-space: nowrap;
}
#copyFeedback.show { opacity: 1; }

/* ── Language sheet ── */
.lang-list { padding: 8px 0; }
.lang-option {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; background: transparent; border: none;
  font-family: var(--sans); font-size: .95rem; color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.lang-option:last-child { border-bottom: none; }
.lang-option:hover { background: var(--cream); }
.lang-option.active { color: var(--ink); }
.lang-native { font-size: 1rem; letter-spacing: .01em; }
.lang-check { width: 18px; height: 18px; color: var(--gold-d); flex-shrink: 0; }

/* ── RTL layout overrides ── */
[dir="rtl"] .sheet-back { letter-spacing: .06em; }
[dir="rtl"] #stickyBarBtn { direction: rtl; }

/* ── Desktop centering ── */
@media (min-width: 768px) {
  .sheet {
    max-width: 500px; left: 50%; right: auto;
    transform: translateX(-50%) translateY(100%);
    bottom: 20px;
  }
  .sheet.open { transform: translateX(-50%) translateY(0); }
  #stickyBar {
    max-width: 500px; left: 50%; right: auto; transform: translateX(-50%);
  }
  .overlay-bg { backdrop-filter: blur(2px); }
}
