/* =========================================================
   ÉLAN — shop.css
   Styles for the functional layer: assistant chat, cart drawer,
   search/category sheet, product detail and toasts.
   ========================================================= */
:root {
  --elan-wine: #8E2A4E;
  --elan-wine-d: #6f1f3d;
  --elan-ink: #1d1620;
  --elan-ink-2: #5b5160;
  --elan-line: #e8e2e6;
  --elan-surface: #faf7f8;
  --elan-ok: #1f7a4d;
  --elan-no: #b42318;
  --elan-gold: #b08948;
  --shop-shadow: 0 18px 60px rgba(29,22,32,.22);
}

/* ---------- overlay shared ---------- */
.shop-overlay {
  position: fixed; inset: 0; background: rgba(29,22,32,.46);
  opacity: 0; pointer-events: none; transition: opacity .28s ease; z-index: 1200;
  backdrop-filter: blur(2px);
}
.shop-overlay.is-open { opacity: 1; pointer-events: auto; }

/* =========================================================
   ASSISTANT CHAT  (inside #aiPanel .ai-panel__body)
   ========================================================= */
.ai-panel__body.chat {
  display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; padding-right: 4px; scroll-behavior: smooth;
}
.ai-panel__body.chat .ai-panel__msg { margin: 0; }
.chat .msg {
  max-width: 84%; padding: 10px 13px; border-radius: 16px; font-size: 14px;
  line-height: 1.45; word-wrap: break-word; animation: msgIn .22s ease both;
}
.chat .msg b { font-weight: 700; }
.chat .msg--ai {
  align-self: flex-start; background: var(--elan-surface);
  border: 1px solid var(--elan-line); color: var(--elan-ink); border-bottom-left-radius: 5px;
}
.chat .msg--user {
  align-self: flex-end; background: var(--elan-wine); color: #fff; border-bottom-right-radius: 5px;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.chat .typing { display: inline-flex; gap: 4px; align-items: center; padding: 13px 15px; }
.chat .typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #c8b9c0; display: inline-block;
  animation: blink 1.2s infinite ease-in-out;
}
.chat .typing span:nth-child(2) { animation-delay: .18s; }
.chat .typing span:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%,80%,100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* product mini-cards inside chat */
.msg-cards { display: flex; flex-direction: column; gap: 8px; align-self: flex-start; width: 90%; }
.mc {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center;
  background: #fff; border: 1px solid var(--elan-line); border-radius: 12px; padding: 8px 10px;
}
.mc__img { width: 46px; height: 56px; border-radius: 8px; background-size: cover; background-position: center; }
.mc__n { font-size: 13px; font-weight: 600; color: var(--elan-ink); line-height: 1.2; }
.mc__p { font-size: 13px; font-weight: 700; color: var(--elan-wine); margin-top: 2px; }
.mc__s { font-size: 10.5px; margin-top: 2px; font-weight: 600; }
.mc__s.ok { color: var(--elan-ok); } .mc__s.no { color: var(--elan-no); }
.mc__add {
  border: 0; background: var(--elan-wine); color: #fff; font-weight: 600; font-size: 12px;
  padding: 7px 11px; border-radius: 999px; cursor: pointer; white-space: nowrap; align-self: center;
}
.mc__add:hover { background: var(--elan-wine-d); }

/* =========================================================
   CART DRAWER
   ========================================================= */
.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 92vw;
  background: #fff; z-index: 1300; box-shadow: var(--shop-shadow);
  transform: translateX(102%); transition: transform .32s cubic-bezier(.16,1,.3,1);
  display: flex; flex-direction: column; font-family: 'Manrope', sans-serif;
}
.cart-drawer.is-open { transform: none; }
.cart-drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px; border-bottom: 1px solid var(--elan-line);
}
.cart-drawer__title { font-family: 'Bodoni Moda', serif; font-size: 20px; font-weight: 700; color: var(--elan-ink); }
.cart-drawer__close { border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--elan-ink-2); }
.cart-drawer__body { flex: 1; overflow-y: auto; padding: 14px 22px; }
.cart-empty { text-align: center; color: var(--elan-ink-2); font-size: 14px; margin-top: 40px; line-height: 1.6; }
.cart-row { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--elan-line); align-items: center; }
.cart-row__img { width: 54px; height: 66px; border-radius: 8px; background-size: cover; background-position: center; }
.cart-row__n { font-size: 14px; font-weight: 600; color: var(--elan-ink); line-height: 1.25; }
.cart-row__m { font-size: 12px; color: var(--elan-ink-2); margin-top: 3px; }
.cart-row__q { font-size: 12px; color: var(--elan-ink-2); margin-top: 3px; }
.cart-row__rm { border: 0; background: none; cursor: pointer; color: #b9adc0; font-size: 14px; align-self: flex-start; }
.cart-row__rm:hover { color: var(--elan-no); }
.cart-drawer__foot { padding: 18px 22px 22px; border-top: 1px solid var(--elan-line); }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.cart-total span { font-size: 14px; color: var(--elan-ink-2); }
.cart-total__v { font-family: 'Bodoni Moda', serif; font-size: 22px; font-weight: 700; color: var(--elan-ink); }
.cart-drawer__foot .btn { width: 100%; margin-top: 8px; }

.bag-glyph.pulse { animation: bagpulse .4s ease; }
@keyframes bagpulse { 0%,100% { transform: scale(1); } 40% { transform: scale(1.28); } }

/* =========================================================
   SEARCH / CATEGORY SHEET  +  PDP
   ========================================================= */
.shop-sheet {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -46%) scale(.98);
  width: 980px; max-width: 94vw; max-height: 88vh; background: #fff; border-radius: 18px;
  z-index: 1300; box-shadow: var(--shop-shadow); opacity: 0; pointer-events: none;
  visibility: hidden;
  transition: opacity .26s ease, transform .26s cubic-bezier(.16,1,.3,1), visibility .26s;
  display: flex; flex-direction: column; overflow: hidden; font-family: 'Manrope', sans-serif;
}
.shop-sheet.is-open { opacity: 1; pointer-events: auto; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.shop-sheet__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 26px; border-bottom: 1px solid var(--elan-line);
}
.shop-sheet__title { font-family: 'Bodoni Moda', serif; font-size: 21px; font-weight: 700; color: var(--elan-ink); }
.shop-sheet__close { border: 0; background: none; font-size: 19px; cursor: pointer; color: var(--elan-ink-2); }
.shop-sheet__grid {
  padding: 22px 26px; overflow-y: auto;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
}
.shop-sheet__empty { grid-column: 1/-1; text-align: center; color: var(--elan-ink-2); padding: 40px 0; }

.pcard { cursor: pointer; border: 1px solid var(--elan-line); border-radius: 12px; overflow: hidden; background: #fff; transition: box-shadow .2s ease, transform .2s ease; }
.pcard:hover { box-shadow: 0 10px 28px rgba(29,22,32,.12); transform: translateY(-2px); }
.pcard__img { position: relative; aspect-ratio: 4/5; background-size: cover; background-position: center; background-color: var(--elan-surface); }
.pcard__out, .pcard__no { font-size: 11px; font-weight: 700; color: var(--elan-no); }
.pcard__out { position: absolute; top: 10px; left: 10px; background: #fff; padding: 3px 8px; border-radius: 999px; }
.pcard__b { padding: 11px 12px 13px; }
.pcard__cat { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--elan-ink-2); font-weight: 600; }
.pcard__n { font-size: 13.5px; font-weight: 600; color: var(--elan-ink); margin-top: 4px; line-height: 1.25; min-height: 34px; }
.pcard__row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.pcard__p { font-family: 'Bodoni Moda', serif; font-size: 16px; font-weight: 700; color: var(--elan-wine); }
.pcard__add { border: 0; background: var(--elan-wine); color: #fff; font-weight: 600; font-size: 12px; padding: 7px 12px; border-radius: 999px; cursor: pointer; }
.pcard__add:hover { background: var(--elan-wine-d); }

/* PDP */
.pdp { grid-column: 1/-1; display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.pdp__img { position: relative; aspect-ratio: 4/5; border-radius: 14px; background-size: cover; background-position: center; background-color: var(--elan-surface); }
.pdp__cat { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--elan-ink-2); font-weight: 600; }
.pdp__name { font-family: 'Bodoni Moda', serif; font-size: 28px; font-weight: 700; color: var(--elan-ink); margin: 8px 0 0; line-height: 1.1; }
.pdp__price { font-family: 'Bodoni Moda', serif; font-size: 26px; font-weight: 700; color: var(--elan-wine); margin: 12px 0; }
.pdp__stock { font-size: 13px; font-weight: 600; }
.pdp__stock.ok { color: var(--elan-ok); } .pdp__stock.no { color: var(--elan-no); }
.pdp__sizes { display: flex; align-items: center; gap: 8px; margin: 20px 0; flex-wrap: wrap; }
.pdp__sizes > span { font-size: 12px; color: var(--elan-ink-2); margin-right: 4px; font-weight: 600; }
.pdp__size { border: 1px solid var(--elan-line); background: #fff; width: 40px; height: 40px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--elan-ink); }
.pdp__size.is-sel { border-color: var(--elan-wine); background: var(--elan-wine); color: #fff; }
.pdp__note { font-size: 12px; color: var(--elan-ink-2); margin: 0 0 16px; line-height: 1.5; }
.pdp__info .btn { width: 100%; margin-top: 8px; }

/* =========================================================
   TOAST
   ========================================================= */
.shop-toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: var(--elan-ink); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-family: 'Manrope', sans-serif; font-size: 14px; font-weight: 600; z-index: 1400;
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
  box-shadow: var(--shop-shadow);
}
.shop-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .shop-sheet__grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .pdp { grid-template-columns: 1fr; gap: 18px; }
  .pdp__img { max-width: 70%; }
}
