/* ==========================================================================
   SurpriMoi — pages applicatives (compte, surprise, avis, loterie, 404…)
   MOBILE-FIRST. N'utilise que les variables définies dans style.css.
   ========================================================================== */

/* ----- boîtes + formulaires ----- */
.box { position: relative; z-index: 1; width: calc(100% - 28px); max-width: 480px; margin: 22px auto; padding: 22px 18px; background: #fff; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.08); }
.box.wide { max-width: 900px; }
.box h1, .box h2 { margin-bottom: 14px; color: var(--dark); line-height: 1.25; }
.box h1 { font-size: clamp(22px, 5.5vw, 28px); }
.box label { display: block; margin: 14px 0 5px; font-weight: 600; font-size: 14px; }
.box input, .box textarea, .box select {
  width: 100%; min-height: 48px; padding: 12px 14px; font: inherit; font-size: 16px; /* 16px : évite le zoom auto sur iPhone */
  border: 2px solid var(--gold-light); border-radius: 12px; background: #fff;
}
.box input[type=checkbox], .box input[type=radio] { width: auto; min-height: 0; }
.box input[type=file] { padding: 10px; }
.box input:focus, .box textarea:focus { outline: none; border-color: var(--gold); }
.box form button.cta { display: flex; margin: 18px auto 0; }
.box summary { padding: 8px 0; color: var(--h); font-weight: 600; cursor: pointer; }
.err { margin-bottom: 12px; padding: 10px 14px; border-radius: 10px; background: #ffe9ec; color: #a12; font-size: 14px; }
.flash { position: relative; z-index: 2; width: calc(100% - 28px); max-width: 900px; margin: 14px auto 0; padding: 12px 16px; text-align: center; background: var(--gold-light); border-radius: 12px; font-size: 14.5px; }
.small { color: #777; font-size: 13px; }
@media (min-width: 600px) { .box { margin: 40px auto; padding: 28px; } }

/* ----- grille de cartes ----- */
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.item { padding: 16px; background: #fffbe9; border: 2px solid var(--gold-light); border-radius: 16px; }
.item h3 { margin-bottom: 6px; }
.item button { cursor: pointer; }
.lot { padding: 3px 0; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; } .item { padding: 18px; } }

/* ----- chips / prix / boutons d'achat ----- */
.chip { display: inline-block; margin: 2px; padding: 4px 12px; background: var(--gold-light); color: var(--gold-dark); border-radius: 20px; font-size: 13px; font-weight: 600; text-decoration: none; }
.price { margin: 8px 0; color: var(--gold-dark); font-weight: 800; }
.old { margin-right: 8px; color: #999; text-decoration: line-through; }
.buy { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; margin: 10px 0 0; padding: 12px 22px; border-radius: 30px; font-weight: 700; text-align: center; text-decoration: none; }
.buy.aff { background: #ff9cb0; color: #2a2a2a; }
.buy.nonaff { background: #2f7de1; color: #fff; }
.buy.other { background: var(--gold-light); color: var(--gold-dark); }
@media (min-width: 600px) { .buy { display: inline-flex; width: auto; margin: 10px 8px 0 0; } }

/* ----- page Surprise ----- */
.gift { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }
.gift img, .gift .noimg { display: flex; align-items: center; justify-content: center; width: 100%; max-width: 320px; margin: 0 auto; aspect-ratio: 1; object-fit: cover; border-radius: 16px; background: var(--gold-light); font-size: 80px; }
@media (min-width: 700px) { .gift { grid-template-columns: minmax(0, 260px) 1fr; gap: 24px; } .gift img, .gift .noimg { max-width: none; margin: 0; } }

/* ----- avis ----- */
.rate { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.rate input { display: none; }
.rate label { margin: 0; color: #ccc; font-size: 34px; line-height: 1; cursor: pointer; }
.rate input:checked ~ label, .rate label:hover, .rate label:hover ~ label { color: #f5b301; }
.reply { margin-top: 10px; padding: 10px 14px; background: var(--gold-light); border-left: 4px solid var(--gold); border-radius: 8px; font-size: 14px; }

/* ----- annonces ----- */
.ad-slot { position: relative; z-index: 1; width: 100%; max-width: 900px; margin: 24px auto; padding: 0 14px; text-align: center; }
.ad-slot small { color: #777; }

/* ----- page 404 ----- */
.e404 { text-align: center; }
.e404 .big { margin-bottom: 8px; font-size: clamp(64px, 20vw, 84px); font-weight: 900; line-height: 1; background: linear-gradient(90deg, var(--gold), var(--gold-dark)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.e404 .big span { display: inline-block; color: initial; -webkit-text-fill-color: initial; animation: wob 2.4s ease-in-out infinite; }
@keyframes wob { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg) translateY(-4px); } }
.e404 .cta { margin: 6px 4px 0; }
.cta.alt { background: var(--gold-light); color: var(--gold-dark); border-color: transparent; box-shadow: none; }

.ok { margin-bottom: 12px; padding: 10px 14px; border-radius: 10px; background: #e6f6ec; color: #1a6b3a; font-size: 14px; }
.box .links { margin-top: 14px; font-size: 14px; line-height: 1.9; }

/* ----- cœur « favori » (le symbole est dessiné en CSS : aria-pressed pilote l'état) ----- */
.fav-btn { width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; padding: 0; background: rgba(255,255,255,.95); color: var(--gold-dark); border: 0; border-radius: 50%; box-shadow: 0 4px 12px rgba(0,0,0,.15); font-size: 22px; line-height: 1; cursor: pointer; transition: transform .2s; }
.fav-btn::before { content: '♡'; }
.fav-btn[aria-pressed="true"]::before { content: '♥'; color: #e53935; }
.fav-btn:active { transform: scale(.9); }
.fav-btn:disabled { opacity: .6; }
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.title-row h2 { margin: 0; }
.cta.mini { min-height: 40px; padding: 8px 18px; font-size: 14px; }
@media (hover: hover) { .fav-btn:hover { transform: scale(1.1); } }

/* ----- bande défilante « Idées cadeaux » : 2 cadeaux visibles sur téléphone, 3 sur ordinateur ----- */
.gifts { padding-left: 12px; padding-right: 12px; }
.gift-carousel { position: relative; }
.car-track { display: flex; gap: 12px; padding: 8px 2px 16px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; } /* pas de scroll-snap : il bloquerait le défilement continu */
.car-track::-webkit-scrollbar { display: none; }
.gift-card { position: relative; flex: 0 0 calc((100% - 12px) / 2); min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--surface-line); border-radius: 16px; box-shadow: 0 8px 20px var(--surface-shadow); }
.gc-img { display: block; aspect-ratio: 4 / 3; background: var(--gold-light); }
.gc-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gc-img .noimg { display: grid; place-items: center; height: 100%; font-size: 44px; }
.gift-card .fav-btn { position: absolute; top: 8px; right: 8px; z-index: 2; width: 40px; height: 40px; font-size: 20px; } /* cœur en haut à droite */
.gc-body { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 10px 10px 12px; }
.gc-body h3 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.6em; overflow: hidden; color: var(--h); font-size: 13.5px; line-height: 1.3; }
.gc-tags { display: none; }
.gc-tags .chip { padding: 2px 9px; font-size: 12px; }
.gc-foot { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: auto; padding-top: 4px; }
.gc-price { color: var(--gold-dark); font-size: 14px; font-weight: 800; }
.gc-foot .cta.mini { width: 100%; }
.car-controls { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 4px; }
.car-btn { width: 46px; height: 46px; display: grid; place-items: center; padding: 0; background: #fff; color: var(--ghost); border: 2px solid var(--ghost-line); border-radius: 50%; font-size: 24px; line-height: 1; cursor: pointer; transition: transform .2s, background .2s; }
.car-btn:active { transform: scale(.92); }
@media (min-width: 768px) {
  .gifts { padding-left: 25px; padding-right: 25px; }
  .car-track { gap: 16px; }
  .gift-card { flex-basis: calc((100% - 32px) / 3); border-radius: 20px; }
  .gc-img .noimg { font-size: 56px; }
  .gift-card .fav-btn { top: 10px; right: 10px; width: 44px; height: 44px; font-size: 22px; }
  .gc-tags { display: block; }
  .gc-body { gap: 6px; padding: 14px 16px 16px; }
  .gc-body h3 { font-size: 16px; }
  .gc-foot { flex-direction: row; align-items: center; justify-content: space-between; }
  .gc-price { font-size: 16px; }
  .gc-foot .cta.mini { width: auto; }
}
@media (hover: hover) { .car-btn:hover { background: var(--ghost-hover); transform: scale(1.08); } }

/* ----- cadeaux affichés sur le résultat du quiz ----- */
.quiz-gifts { margin: 0 0 20px; text-align: left; }
.qg-title { margin-bottom: 8px; color: var(--h); font-size: 16px; }
.qg-item { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 10px; background: #fff; border: 2px solid var(--opt-line); border-radius: 14px; }
.qg-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; color: var(--dark); text-decoration: none; }
.qg-main img, .qg-noimg { width: 52px; height: 52px; flex-shrink: 0; display: grid; place-items: center; background: var(--gold-light); border-radius: 10px; object-fit: cover; font-size: 24px; }
.qg-main span:last-child { min-width: 0; }
.qg-main strong { display: block; overflow: hidden; font-size: 14.5px; text-overflow: ellipsis; white-space: nowrap; }
.qg-main small { color: #777; }

/* ----- cœur sur l'image de la page Surprise ----- */
.gift-media { position: relative; width: 100%; max-width: 320px; margin: 0 auto; }
.gift-media img, .gift-media .noimg { max-width: none; margin: 0; }
.gift-media .fav-btn { position: absolute; top: 10px; right: 10px; }
@media (min-width: 700px) { .gift-media { max-width: none; } }

/* ----- « Mes favoris » (page profil) ----- */
.favs-panel .empty { margin: 4px 0 12px; color: #777; font-size: 14px; }
.fav-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0 0 16px; list-style: none; }
.fav-card { position: relative; display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 2px solid var(--gold-light); border-radius: 16px; }
.fc-img { display: block; aspect-ratio: 4 / 3; background: var(--gold-light); }
.fc-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.fc-img .noimg { display: grid; place-items: center; height: 100%; font-size: 40px; }
.fav-card .fav-btn { position: absolute; top: 8px; right: 8px; width: 38px; height: 38px; font-size: 19px; }
.fc-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }
.fc-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--dark); font-size: 14px; font-weight: 600; line-height: 1.3; text-decoration: none; }
.fc-price { color: var(--gold-dark); font-size: 14px; font-weight: 800; }
.favs-panel label { display: block; margin: 6px 0 4px; font-size: 14px; font-weight: 600; }
@media (min-width: 700px) { .fav-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }

/* ----- message de retour (ajout / retrait d'un favori, connexion requise) ----- */
.toast { position: fixed; left: 50%; bottom: 18px; z-index: 300; display: flex; align-items: center; gap: 14px; max-width: calc(100% - 28px); padding: 12px 16px; background: #2a2a2a; color: #fff; border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.3); font-size: 14px; transform: translateX(-50%); animation: toastIn .3s cubic-bezier(.34,1.56,.64,1); }
.toast a { flex-shrink: 0; color: var(--gold); font-weight: 700; text-decoration: none; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
