/* ============================================================================
   DoudouPlanet V7 — fondation design
   Tokens + 5 thèmes + composants. Préfixe .v7- (zéro collision avec l'existant).
   Thème piloté par <html data-theme="…"> (switcher v7.js, localStorage).
   ========================================================================== */

/* ---------- 1. TOKENS PAR THÈME ------------------------------------------ */
:root, html[data-theme="heritage"] {
  --v7-bg: #f4f3fc;
  --v7-surface: #ffffff;
  --v7-surface-2: #eceaf9;
  --v7-ink: #2b2b3a;
  --v7-ink-soft: #6d6b85;
  --v7-primary: #8a7fe8;
  --v7-primary-soft: #ccccff;
  --v7-primary-ink: #ffffff;
  --v7-accent: #ffb3c7;
  --v7-cta: #6c5ce7;
  --v7-cta-ink: #ffffff;
  --v7-glass: rgba(255,255,255,.55);
  --v7-glass-border: rgba(255,255,255,.75);
  --v7-shadow: 0 10px 30px rgba(108,92,231,.18);
  --v7-radius: 18px;
  --water-deep: #6d79d8; --water-mid: #8f97e6; --water-light: #c3c6f5; --water-foam: #efeffc;
}
html[data-theme="lagon"] {
  --v7-bg: #eef7fb;
  --v7-surface: #ffffff;
  --v7-surface-2: #ddeef6;
  --v7-ink: #16344a;
  --v7-ink-soft: #56788e;
  --v7-primary: #2e7daf;
  --v7-primary-soft: #bfe2f2;
  --v7-primary-ink: #ffffff;
  --v7-accent: #f7e9d0;
  --v7-cta: #ff9f68;
  --v7-cta-ink: #40260f;
  --v7-glass: rgba(255,255,255,.5);
  --v7-glass-border: rgba(255,255,255,.7);
  --v7-shadow: 0 10px 30px rgba(46,125,175,.20);
  --v7-radius: 18px;
  --water-deep: #1e5f8e; --water-mid: #2e7daf; --water-light: #6fc3df; --water-foam: #eaf7fc;
}
html[data-theme="bonbon"] {
  --v7-bg: #fff7f2;
  --v7-surface: #ffffff;
  --v7-surface-2: #ffeef3;
  --v7-ink: #4a3540;
  --v7-ink-soft: #a3808f;
  --v7-primary: #ff8fae;
  --v7-primary-soft: #ffd3df;
  --v7-primary-ink: #5c2337;
  --v7-accent: #bff0db;
  --v7-cta: #ff6f91;
  --v7-cta-ink: #ffffff;
  --v7-glass: rgba(255,255,255,.6);
  --v7-glass-border: rgba(255,255,255,.85);
  --v7-shadow: 0 10px 30px rgba(255,111,145,.18);
  --v7-radius: 22px;
  --water-deep: #8fc4e8; --water-mid: #aedcf5; --water-light: #d6effb; --water-foam: #ffffff;
}
html[data-theme="nuit"] {
  --v7-bg: #1e1b33;
  --v7-surface: #2a2647;
  --v7-surface-2: #232049;
  --v7-ink: #efedff;
  --v7-ink-soft: #a9a4cd;
  --v7-primary: #b9b3f2;
  --v7-primary-soft: #565093;
  --v7-primary-ink: #191531;
  --v7-accent: #ccccff;
  --v7-cta: #ff7a6b;
  --v7-cta-ink: #ffffff;
  --v7-glass: rgba(42,38,71,.55);
  --v7-glass-border: rgba(185,179,242,.35);
  --v7-shadow: 0 12px 34px rgba(0,0,0,.45);
  --v7-radius: 18px;
  --water-deep: #12102a; --water-mid: #232055; --water-light: #4a4590; --water-foam: #b9b3f2;
}
html[data-theme="naturel"] {
  --v7-bg: #faf6ef;
  --v7-surface: #ffffff;
  --v7-surface-2: #f1ead9;
  --v7-ink: #3d3a33;
  --v7-ink-soft: #8b8577;
  --v7-primary: #a8c3a0;
  --v7-primary-soft: #d8e6d3;
  --v7-primary-ink: #2c3d28;
  --v7-accent: #ccccff;
  --v7-cta: #e07a5f;
  --v7-cta-ink: #ffffff;
  --v7-glass: rgba(255,255,255,.55);
  --v7-glass-border: rgba(255,255,255,.8);
  --v7-shadow: 0 10px 30px rgba(120,100,70,.18);
  --v7-radius: 16px;
  --water-deep: #4e7f8c; --water-mid: #7fa8b0; --water-light: #b7d3d3; --water-foam: #f4efe4;
}


/* ---------- 3. SWITCHER DE THÈME (dev, BAS GAUCHE — ne recouvre jamais le
   menu compte/panier du haut-droite) ------------------------------------- */
.v7-themer { position: fixed; bottom: 14px; left: 14px; z-index: 99999; font-family: 'Trebuchet MS', Verdana, sans-serif; }
.v7-themer__btn {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--v7-glass-border);
  background: var(--v7-glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--v7-shadow); cursor: pointer; font-size: 21px; line-height: 1;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
.v7-themer__btn:hover { transform: scale(1.12) rotate(12deg); }
.v7-themer__panel {
  position: absolute; bottom: 54px; left: 0; min-width: 172px; padding: 8px;
  border-radius: 14px; border: 1px solid var(--v7-glass-border);
  background: var(--v7-glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--v7-shadow); display: none;
}
.v7-themer.is-open .v7-themer__panel { display: block; animation: v7-pop .22s cubic-bezier(.34,1.56,.64,1); }
.v7-themer__item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px;
  border: 0; background: transparent; border-radius: 10px; cursor: pointer;
  font-size: 13px; color: var(--v7-ink); text-align: left;
}
.v7-themer__item:hover { background: var(--v7-surface-2); }
.v7-themer__item.is-active { background: var(--v7-primary-soft); font-weight: bold; }
.v7-themer__dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); flex: 0 0 auto; }
/* Groupes du panneau (Couleurs / Fond animé) — le panneau peut devenir haut : on borne */
.v7-themer__panel { max-height: min(72vh, 560px); overflow-y: auto; }
.v7-themer__titre {
  padding: 8px 10px 3px; font-size: 10px; font-weight: bold;
  letter-spacing: .09em; text-transform: uppercase; color: var(--v7-ink); opacity: .55;
}
.v7-themer__titre + .v7-themer__titre, .v7-themer__item + .v7-themer__titre { margin-top: 5px; border-top: 1px solid var(--v7-glass-border); }
@keyframes v7-pop { from { opacity: 0; transform: translateY(-8px) scale(.92); } to { opacity: 1; transform: none; } }

/* ---------- 4. BOUTONS ----------------------------------------------------- */
.v7-btn {
  --btn-bg: var(--v7-primary); --btn-ink: var(--v7-primary-ink);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 26px; border: 0; border-radius: 999px; cursor: pointer; overflow: hidden;
  background: var(--btn-bg); color: var(--btn-ink);
  font-size: 15px; font-weight: bold; letter-spacing: .02em; text-decoration: none;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--btn-bg) 45%, transparent);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s ease;
}
.v7-btn::before { /* balayage lumineux */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform .55s ease;
}
.v7-btn:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 12px 26px color-mix(in srgb, var(--btn-bg) 55%, transparent); }
.v7-btn:hover::before { transform: translateX(120%); }
.v7-btn:active { transform: translateY(0) scale(.96); transition-duration: .06s; }
.v7-btn--cta { --btn-bg: var(--v7-cta); --btn-ink: var(--v7-cta-ink); }
.v7-btn--ghost {
  --btn-bg: transparent; --btn-ink: var(--v7-ink);
  background: var(--v7-glass); border: 1px solid var(--v7-glass-border);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: none;
}

/* Ajouter au panier : morph texte -> spinner -> coche (réf davidicus, 1er à gauche) */
.v7-btn-cart { --btn-bg: var(--v7-cta); --btn-ink: var(--v7-cta-ink); min-width: 190px; }
.v7-btn-cart .v7-bc-label, .v7-btn-cart .v7-bc-spin, .v7-btn-cart .v7-bc-done { grid-area: 1/1; transition: opacity .2s, transform .3s; }
.v7-btn-cart { display: inline-grid; place-items: center; }
.v7-btn-cart .v7-bc-spin, .v7-btn-cart .v7-bc-done { opacity: 0; transform: scale(.4); }
.v7-btn-cart .v7-bc-spin { width: 20px; height: 20px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; animation: v7-rot 1s linear infinite; }
.v7-btn-cart.is-loading .v7-bc-label { opacity: 0; transform: scale(.6); }
.v7-btn-cart.is-loading .v7-bc-spin { opacity: 1; transform: scale(1); }
.v7-btn-cart.is-done .v7-bc-label, .v7-btn-cart.is-done .v7-bc-spin { opacity: 0; }
.v7-btn-cart.is-done { --btn-bg: #35c07e; }
.v7-btn-cart.is-done .v7-bc-done { opacity: 1; transform: scale(1); animation: v7-pop .3s cubic-bezier(.34,1.56,.64,1); }
@keyframes v7-rot { to { transform: rotate(360deg); } }

/* ---------- 5. CARTES PRODUIT ---------------------------------------------- */
.v7-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.v7-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--v7-surface); border-radius: var(--v7-radius);
  box-shadow: 0 4px 14px rgba(30,30,60,.08);
  transition: transform .3s cubic-bezier(.2,.7,.3,1), box-shadow .3s ease;
}
.v7-card:hover { transform: translateY(-6px); box-shadow: var(--v7-shadow); }
.v7-card__imgwrap { position: relative; aspect-ratio: 1/1; overflow: hidden; background: var(--v7-surface-2); }
.v7-card__imgwrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2,.7,.3,1); }
.v7-card:hover .v7-card__imgwrap img { transform: scale(1.07); }
.v7-card__badge {
  position: absolute; top: 12px; left: 12px; padding: 4px 12px; border-radius: 999px;
  background: var(--v7-cta); color: var(--v7-cta-ink); font-size: 11px; font-weight: bold;
}
.v7-card__body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.v7-card__brand { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--v7-ink-soft); }
.v7-card__name { font-size: 15px; font-weight: bold; color: var(--v7-ink); line-height: 1.3; margin: 0; }
.v7-card__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.v7-card__price { font-size: 19px; font-weight: bold; color: var(--v7-primary); }
.v7-card__price small { font-size: 12px; }
.v7-card__add {
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--v7-cta); color: var(--v7-cta-ink); font-size: 19px; line-height: 1;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--v7-cta) 45%, transparent);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1);
}
.v7-card__add:hover { transform: scale(1.16) rotate(8deg); }
.v7-card__add:active { transform: scale(.9); }

/* variante éditoriale (réf Margarita qEadERd) */
.v7-card--edito {
  flex-direction: row; align-items: stretch; min-height: 250px;
  background: linear-gradient(120deg, var(--v7-surface) 55%, var(--v7-surface-2));
}
.v7-card--edito .v7-card__imgwrap { aspect-ratio: auto; flex: 0 0 44%; }
.v7-card--edito .v7-card__imgwrap::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 78% 28%, color-mix(in srgb, var(--v7-primary-soft) 55%, transparent), transparent 55%);
}
.v7-card--edito .v7-card__body { justify-content: center; padding: 26px; gap: 10px; }
.v7-card--edito .v7-card__name { font-size: 21px; }
.v7-card--edito .v7-card__desc { font-size: 13px; color: var(--v7-ink-soft); line-height: 1.55; margin: 0; }
@media (max-width: 640px) { .v7-card--edito { flex-direction: column; } .v7-card--edito .v7-card__imgwrap { aspect-ratio: 4/3; } }

/* ---------- 6. GLASS / AERO ------------------------------------------------ */
.v7-glass {
  background: var(--v7-glass); border: 1px solid var(--v7-glass-border); border-radius: var(--v7-radius);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: var(--v7-shadow);
}
.v7-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  background: var(--v7-primary-soft); color: var(--v7-ink); font-size: 12px; font-weight: bold;
}
.v7-blob { position: absolute; border-radius: 50%; filter: blur(46px); opacity: .5; pointer-events: none; }

/* ---------- 7. LOADERS ----------------------------------------------------- */
.v7-skeleton { position: relative; overflow: hidden; background: var(--v7-surface-2); border-radius: 10px; }
.v7-skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.65) 50%, transparent 80%);
  transform: translateX(-100%); animation: v7-shimmer 1.4s ease infinite;
}
@keyframes v7-shimmer { to { transform: translateX(100%); } }
.v7-loader-dots { display: inline-flex; gap: 8px; align-items: flex-end; height: 34px; }
.v7-loader-dots i {
  width: 13px; height: 13px; border-radius: 50%; background: var(--v7-primary);
  animation: v7-bounce .9s cubic-bezier(.34,1.56,.64,1) infinite;
}
.v7-loader-dots i:nth-child(2) { background: var(--v7-cta); animation-delay: .12s; }
.v7-loader-dots i:nth-child(3) { background: var(--v7-accent); animation-delay: .24s; }
@keyframes v7-bounce { 0%,100% { transform: translateY(0) } 40% { transform: translateY(-16px) scale(1.1) } }
.v7-loader-teddy { font-size: 30px; display: inline-block; animation: v7-teddy 1.1s cubic-bezier(.34,1.56,.64,1) infinite; }
@keyframes v7-teddy { 0%,100% { transform: translateY(0) rotate(-6deg) } 50% { transform: translateY(-14px) rotate(6deg) } }

/* ---------- 8. VOL VERS LE PANIER ------------------------------------------ */
.v7-fly {
  position: fixed; z-index: 99998; width: 30px; height: 30px; border-radius: 50%;
  background: var(--v7-cta); color: var(--v7-cta-ink); display: grid; place-items: center;
  font-weight: bold; font-size: 14px; box-shadow: 0 6px 16px rgba(0,0,0,.3); pointer-events: none;
  transition: transform .8s cubic-bezier(.3,-0.2,.25,1), opacity .8s ease;
}
.v7-cart-bump { animation: v7-cartbump .5s cubic-bezier(.34,1.56,.64,1); }
@keyframes v7-cartbump { 30% { transform: scale(1.3) rotate(-8deg) } 60% { transform: scale(.92) } }

/* ---------- 9. TEXTE 3D BRILLANT (réf noahblon) ---------------------------- */
.v7-shine {
  --sx: 50%; --sy: 40%;
  position: relative; display: inline-block; font-weight: bold; letter-spacing: .01em;
  color: transparent; -webkit-background-clip: text; background-clip: text;
  background-image:
    radial-gradient(circle at var(--sx) var(--sy), #ffffff 0%, var(--v7-primary-soft) 22%, var(--v7-primary) 55%, color-mix(in srgb, var(--v7-primary) 55%, #000) 100%);
  text-shadow: 0 1px 0 rgba(255,255,255,.25), 0 3px 8px rgba(30,30,80,.28);
}

/* ---------- 10. CARROUSEL -------------------------------------------------- */
.v7-carousel { display: flex; gap: 20px; overflow-x: auto; padding: 26px 8px; scroll-snap-type: x mandatory; perspective: 900px; scrollbar-width: thin; }
.v7-carousel .v7-card { flex: 0 0 230px; scroll-snap-align: center; transition: transform .35s cubic-bezier(.2,.7,.3,1), box-shadow .35s; }

/* ---------- 11. DIVERS ----------------------------------------------------- */
.v7-section-title { font-size: 24px; font-weight: bold; color: var(--v7-ink); margin: 0 0 4px; }
.v7-section-sub { font-size: 13px; color: var(--v7-ink-soft); margin: 0 0 18px; }
@media (prefers-reduced-motion: reduce) {
  .v7-btn, .v7-card, .v7-card__imgwrap img, .v7-themer__btn { transition: none !important; }
  .v7-skeleton::after, .v7-loader-dots i, .v7-loader-teddy { animation: none !important; }
}
