﻿*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --navy: #1a2744; --navy-2: #243560; --navy-3: #0f1a2e;
  --gold: #c8a84b; --gold-2: #e8c96a; --gold-light: #f5edd6;
  --cream: #faf8f3; --white: #fff;
  --text: #1a2744; --text-2: #4a5568; --text-3: #8a96a8;
  --green: #25a244; --red: #e0574e; --border: #eee;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;
  --nav-bar: 58px;
  --safe-bottom: env(safe-area-inset-bottom, 16px);
  --nav-total: calc(var(--nav-bar) + var(--safe-bottom));
}

html { height: 100%; }
body { height: 100%; overflow: hidden; overscroll-behavior: none; font-family: var(--font-body); background: var(--cream); color: var(--text); }

/* ── App ── */
.app {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; height: 100%;
  display: flex; flex-direction: column; background: var(--cream); overflow: hidden;
}

/* ── Header FIXE ── */
.header { background: var(--navy); flex-shrink: 0; }

.header-brand {
  padding: 10px 14px 8px;
  overflow: hidden; max-height: 72px;
  transition: max-height .28s ease, padding .28s ease, opacity .22s ease;
  opacity: 1;
}
.header-brand.hidden { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; }

/* Padding top sur la search quand le brand est caché */
.search-bar {
  background: rgba(15,26,46,.6); border: 1px solid rgba(200,168,75,.3);
  border-radius: 10px; display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; margin: 0 12px 10px;
  transition: margin-top .28s ease;
}
.header-brand.hidden + .search-bar { margin-top: 10px; }

.logo-row { display: flex; align-items: center; gap: 10px; }
.logo-img { width: 44px; height: 44px; border-radius: 10px; object-fit: contain; background: var(--navy-3); flex-shrink: 0; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.brand { display: flex; flex-direction: column; gap: 1px; }
.brand-name { color: #fff; font-size: 13px; font-weight: 600; font-family: var(--font-display); font-style: italic; }
.brand-sub { color: rgba(200,168,75,.75); font-size: 9px; }
.brand-tel { color: rgba(200,168,75,.55); font-size: 9px; }
.search-bar svg { color: rgba(200,168,75,.7); flex-shrink: 0; }
.search-bar input { background: none; border: none; outline: none; color: #fff; font-size: 12px; width: 100%; font-family: var(--font-body); }
.search-bar input::placeholder { color: rgba(255,255,255,.35); }
.search-clear { background: none; border: none; color: rgba(255,255,255,.4); font-size: 12px; cursor: pointer; }

/* ── Barre catégories FIXE ── */
.cats-bar { display: flex; gap: 7px; padding: 8px 12px 6px; overflow-x: auto; scrollbar-width: none; background: var(--white); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.cats-bar::-webkit-scrollbar { display: none; }
.cp { padding: 5px 13px; border-radius: 20px; font-size: 11px; font-weight: 500; cursor: pointer; border: 1px solid var(--border); background: var(--cream); color: var(--text-2); white-space: nowrap; flex-shrink: 0; transition: all .15s; font-family: var(--font-body); }
.cp.active { background: var(--navy); color: var(--gold); border-color: var(--navy); }

/* ── Filtres prix ── */
.price-filters { display: flex; align-items: center; gap: 6px; padding: 7px 12px; background: var(--gold-light); border-bottom: 1px solid #e8d48a; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.price-filters::-webkit-scrollbar { display: none; }
.pf-label { font-size: 10px; font-weight: 600; color: #7a5c00; white-space: nowrap; text-transform: uppercase; letter-spacing: .5px; }
.pf { padding: 4px 10px; border-radius: 14px; font-size: 10px; font-weight: 500; cursor: pointer; border: 1px solid #e8d48a; background: transparent; color: #7a5c00; white-space: nowrap; flex-shrink: 0; font-family: var(--font-body); transition: all .15s; }
.pf.active { background: var(--navy); color: var(--gold); border-color: var(--navy); }

/* ── Main content — PAS de padding-bottom ici, géré par pb-page ── */
.main-content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  /* Stabiliser le scroll — empêche le "danse" */
  will-change: scroll-position;
}
.page { display: none; padding-bottom: var(--nav-total); }
.page.active { display: block; }

/* ── Titres ── */
.section-title { font-family: var(--font-display); font-size: 17px; color: var(--text); padding: 12px 14px 8px; font-weight: 600; }
.page-heading { font-family: var(--font-display); font-size: 20px; color: var(--text); padding: 14px 14px 10px; font-weight: 600; font-style: italic; }

/* ── Section catégories (visible au début, scroll la fait monter naturellement) ── */
.cat-section { padding: 0 0 4px; }
.cat-row { display: flex; gap: 8px; padding: 4px 14px 10px; overflow-x: auto; scrollbar-width: none; }
.cat-row::-webkit-scrollbar { display: none; }
.cat-pill { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; cursor: pointer; background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; min-width: 70px; transition: all .15s; text-align: center; }
.cat-pill:active { transform: scale(.95); }
.cat-pill.active { background: var(--navy); border-color: var(--navy); }
.cat-pill-emoji { font-size: 22px; line-height: 1; }
.cat-pill-name { font-size: 9px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.cat-pill.active .cat-pill-name { color: var(--gold); }

/* ── Grille produits ── */
.prod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 14px 12px; }
.prod-card { background: var(--white); border-radius: 14px; overflow: hidden; border: 1px solid var(--border); cursor: pointer; transition: transform .15s; }
.prod-card:active { transform: scale(.97); }

/* Image pleine — PAS d'emoji flottant sur l'image */
.prod-img { width: 100%; aspect-ratio: 1/1; position: relative; overflow: hidden; background: var(--cream); }
.prod-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* Fallback emoji centré SEULEMENT si pas d'image */
.prod-img-fallback { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 44px; background: var(--cream); }

.prod-badge { position: absolute; top: 7px; left: 7px; background: var(--gold); color: var(--navy); font-size: 8px; font-weight: 700; padding: 2px 7px; border-radius: 8px; z-index: 2; letter-spacing: .3px; }
/* Pas d'emoji catégorie sur les cartes */
.prod-info { padding: 9px 10px; }
.prod-cat { font-size: 8px; color: var(--text-3); text-transform: uppercase; letter-spacing: .8px; }
.prod-name { font-size: 11px; font-weight: 600; color: var(--text); line-height: 1.35; margin: 2px 0 6px; }
.prod-row { display: flex; align-items: center; justify-content: space-between; }
.prod-price { font-size: 12px; font-weight: 700; color: var(--navy); font-family: var(--font-mono); }
.prod-price span { font-size: 8px; color: var(--text-3); font-weight: 400; font-family: var(--font-body); }
.prod-add { width: 26px; height: 26px; background: var(--navy); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--gold); font-size: 16px; font-weight: 700; cursor: pointer; border: none; }

/* ── Empty ── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 60px 30px; text-align: center; color: var(--text-3); }
.empty-ico { font-size: 44px; opacity: .4; }
.empty-state p { font-size: 14px; font-family: var(--font-display); font-style: italic; }
.empty-state small { font-size: 11px; color: #bbb; }
.no-results { grid-column: 1/-1; text-align: center; padding: 40px 20px; color: var(--text-3); font-size: 13px; font-family: var(--font-display); font-style: italic; }

/* ── Panier ── */
.cart-item { background: var(--white); border-radius: 12px; padding: 12px; display: flex; gap: 12px; margin: 0 14px 8px; border: 1px solid var(--border); }
.ci-img { width: 60px; height: 60px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.ci-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.ci-body { flex: 1; }
.ci-name { font-size: 12px; font-weight: 600; color: var(--text); }
.ci-cat { font-size: 9px; color: var(--text-3); margin-top: 1px; }
.ci-price { font-size: 12px; font-weight: 700; color: var(--navy); margin-top: 5px; font-family: var(--font-mono); }
.ci-qty { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.ci-qty-btn { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); background: var(--cream); color: var(--text); font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ci-qty-val { font-size: 12px; font-weight: 600; min-width: 16px; text-align: center; }
.ci-del { color: #ddd; font-size: 16px; cursor: pointer; align-self: flex-start; background: none; border: none; padding: 0; }

/* ── Footer panier ── */
.cart-footer { position: fixed; bottom: var(--nav-total); left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: var(--white); border-top: 1px solid var(--border); padding: 12px 14px; z-index: 45; box-shadow: 0 -4px 20px rgba(0,0,0,.08); }
.cart-total-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.ct-label { font-size: 12px; color: var(--text-2); }
.ct-value { font-size: 18px; font-weight: 700; color: var(--navy); font-family: var(--font-mono); }
.wa-order-btn { background: #25d366; color: #fff; border: none; width: 100%; padding: 12px; border-radius: 12px; font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-body); }

/* ── Contact ── */
.contact-hero { background: var(--navy); margin: 14px 14px 10px; border-radius: 16px; padding: 24px 20px; text-align: center; }
.contact-logo-img { width: 90px; height: 90px; object-fit: contain; border-radius: 16px; margin: 0 auto 10px; display: block; }
.ch-name { color: #fff; font-size: 16px; font-family: var(--font-display); font-style: italic; }
.ch-sub { color: rgba(200,168,75,.75); font-size: 10px; margin-top: 3px; }
.info-card { background: var(--white); border-radius: 12px; margin: 0 14px 10px; border: 1px solid var(--border); overflow: hidden; }
.info-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid #f5f5f5; }
.info-row:last-child { border-bottom: none; }
.info-ico { font-size: 18px; width: 32px; text-align: center; flex-shrink: 0; }
.info-lbl { font-size: 9px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; }
.info-val { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.open { color: var(--green); font-weight: 600; }
.wa-contact-btn { background: #25d366; color: #fff; border: none; width: calc(100% - 28px); margin: 0 14px 14px; padding: 13px; border-radius: 12px; font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-body); }

/* ══ BOTTOM NAV ══ */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: var(--white);
  border-top: 2px solid var(--border); display: flex; z-index: 1000;
  height: var(--nav-total); padding-bottom: var(--safe-bottom);
  box-shadow: 0 -2px 12px rgba(0,0,0,.1);
}
.ni { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; background: none; border: none; font-family: var(--font-body); position: relative; padding: 6px 0 2px; min-height: 44px; }
.ni svg { stroke: var(--text-3); transition: stroke .15s; flex-shrink: 0; }
.ni span:not(.cart-badge) { font-size: 9px; color: var(--text-3); line-height: 1; }
.ni.active svg { stroke: var(--navy); }
.ni.active span:not(.cart-badge) { color: var(--navy); font-weight: 600; }
.ni.active::after { content: ''; position: absolute; top: 4px; width: 4px; height: 4px; background: var(--gold); border-radius: 50%; }
.cart-badge { position: absolute; top: 2px; right: calc(50% - 20px); background: var(--red); color: #fff; font-size: 8px; font-weight: 700; min-width: 15px; height: 15px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }

/* ── Toast ── */
.toast { position: fixed; bottom: calc(var(--nav-total) + 8px); left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 9px 18px; border-radius: 24px; font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 7px; white-space: nowrap; opacity: 0; transition: opacity .2s; z-index: 200; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; }
.toast-ico { color: var(--gold); font-size: 14px; }

/* ── Modal produit ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(10,16,35,.6); z-index: 400; display: none; align-items: flex-end; justify-content: center; }
.modal-overlay.open { display: flex; }

/* Sheet : image en haut + bande blanche en bas */
.modal-sheet { background: #fff; border-radius: 22px 22px 0 0; width: 100%; max-width: 480px; height: 92vh; overflow: hidden; animation: slideUp .25s ease; display: flex; flex-direction: column; }

/* Zone image : 65% de la hauteur du sheet */
.modal-img-wrap { position: relative; width: 100%; flex: 0 0 65%; min-height: 0; overflow: hidden; background: #100d07; border-radius: 22px 22px 0 0; }
.modal-img-wrap::before { content: ""; position: absolute; inset: -16px; background-image: var(--thumb-src); background-size: cover; background-position: center; filter: blur(22px) brightness(0.35) saturate(0.4); z-index: 0; }
/* Image centrée avec padding pour ne pas coller les bords */
.modal-img-wrap > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center center; padding: 16px 0 8px; box-sizing: border-box; z-index: 1; }

/* Croix en overlay sur l'image, coin haut gauche */
.modal-close-btn { position: absolute; top: 12px; left: 14px; z-index: 3; width: 32px; height: 32px; border-radius: 50%; background: rgba(0,0,0,.55); border: none; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }

.modal-img-emoji { font-size: 80px; }

/* Bande blanche inférieure */
.modal-info-panel { flex: 1; overflow-y: auto; padding: 14px 16px 16px; display: flex; flex-direction: column; background: #fff; }

/* Ligne haut : infos gauche + boutons droite */
.modal-info-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.modal-info-left { flex: 1; min-width: 0; }
.modal-info-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; padding-top: 2px; }

/* Textes infos */
.modal-cat { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 3px; }
.modal-name { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--text); font-style: italic; line-height: 1.2; }
.modal-price { font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--gold); margin-top: 3px; }
.modal-badge { background: var(--gold); color: var(--navy); font-size: 9px; font-weight: 700; padding: 3px 8px; border-radius: 8px; display: inline-block; margin-bottom: 5px; }

/* Boutons WA + favori dans la bande blanche */
.modal-share-overlay { width: 36px; height: 36px; border-radius: 50%; background: rgba(37,211,102,.12); border: 1.5px solid rgba(37,211,102,.7); color: #25d366; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.modal-fav-overlay { width: 36px; height: 36px; min-width: 36px; min-height: 36px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--cream); color: var(--text-2); font-size: 17px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; box-sizing: border-box; line-height: 1; }
.modal-fav-overlay.liked { color: var(--red); border-color: #fcc; background: #fff0f0; }

/* Description */
.modal-desc { font-size: 13px; color: var(--text); line-height: 1.7; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }

/* Bouton panier */
.modal-btns { display: flex; justify-content: center; padding-top: 2px; }
.modal-back-btn { display: none; }
.modal-add-btn { width: 70%; padding: 14px; background: var(--navy); color: #fff; border: none; border-radius: 16px; font-family: var(--font-body); font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 16px rgba(8,12,28,.25); }

/* Anciens sélecteurs inutilisés (gardés pour compat) */
.modal-body { display: none; }
.modal-img-overlay { display: none; }
.modal-img-overlay-top { display: none; }
.modal-img-overlay-bottom { display: none; }

@media (min-width: 480px) {
  .app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}

/* ── Carousel variantes ── */
.modal-variants { margin-bottom: 14px; }
.variants-label { font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px; }
.variants-scroll { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.variants-scroll::-webkit-scrollbar { display: none; }
.variant-thumb { flex-shrink: 0; width: 58px; cursor: pointer; border-radius: 10px; overflow: hidden; border: 2px solid transparent; transition: border-color .15s, transform .15s; background: var(--cream); }
.variant-thumb:active { transform: scale(.95); }
.variant-thumb.active { border-color: var(--navy); }
.variant-thumb img { width: 100%; aspect-ratio: 1/1; object-fit: contain; display: block; background: var(--cream); }
.variant-thumb span { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1/1; font-size: 22px; }
.variant-label { font-size: 8px; text-align: center; color: var(--text-2); padding: 3px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* ── Flèches navigation variantes ── */
.modal-nav-prev, .modal-nav-next { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; background: rgba(0,0,0,.45); border: none; color: #fff; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: none; align-items: center; justify-content: center; }
.modal-nav-prev { left: 10px; }
.modal-nav-next { right: 10px; }
.modal-nav-prev.visible, .modal-nav-next.visible { display: flex; }
.modal-overlay-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }

/* ── Carousel images produit dans le modal ── */
.img-nav-btn { position: absolute; top: 50%; transform: translateY(-50%); z-index: 4; background: rgba(0,0,0,.5); border: none; color: #fff; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); left: 10px; }
.img-nav-btn.img-nav-next { left: auto; right: 10px; }
.img-nav-btn:active { background: rgba(0,0,0,.75); transform: translateY(-50%) scale(.92); }

/* Dots indicateurs en bas de l'image */
.img-dots { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); z-index: 4; display: flex; gap: 5px; }
.img-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.4); transition: background .2s, transform .2s; }
.img-dot.active { background: #fff; transform: scale(1.3); }

/* Bouton favori : rond, fond clair, bien visible */
.modal-fav-overlay { width: 36px; height: 36px; min-width: 36px; min-height: 36px; border-radius: 50% !important; border: 1.5px solid #e0b060; background: #fffbf0; color: var(--gold); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; box-sizing: border-box; line-height: 1; }
.modal-fav-overlay.liked { color: var(--red); border-color: #fcc; background: #fff0f0; }
