/**
    MON PETIT CADEAU — COUCHE APPLICATIVE / DESIGN SYSTEM (2026)
    -------------------------------------------------------------
    Chargée en dernier. Couvre la refonte du questionnaire :
    stepper + barre de progression, cartes d'options, boutons,
    résultats (chips + grille), liste de favoris (« hotte »),
    toasts et états loading/erreur.

    Design tokens (équivalents de l'échelle Tailwind, en CSS natif
    pour rester « buildless » et compatible avec la CSP stricte du
    site). Les couleurs réutilisent l'identité pêche/terracotta
    définie dans refresh.css (:root).
**/

:root {
    /* Espacement (échelle 4px, façon Tailwind : 1=4px … ) */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;

    /* Rayons */
    --r-sm: 12px;
    --r-md: 18px;
    --r-lg: 26px;
    --r-pill: 999px;

    /* Surfaces & couleurs additionnelles */
    --mpc-white: #ffffff;
    --mpc-success: #2f8f5b;
    --mpc-danger: #b23a2e;
    --mpc-danger-soft: #fce6e1;

    /* Profondeurs (réutilise les ombres de refresh.css quand dispo) */
    --z-toggle: 880;
    --z-overlay: 940;
    --z-panel: 950;
    --z-toast: 980;
}

/* ===============================================================
   QUESTIONNAIRE — CONTENEUR & PROGRESSION
   =============================================================== */

.quiz {
    max-width: 880px;
    margin: 0 auto;
    padding: var(--sp-6) var(--sp-5) var(--sp-10);
}

.quiz-progress {
    max-width: 620px;
    margin: 0 auto var(--sp-3);
}

.quiz-progress-track {
    height: 12px;
    border-radius: var(--r-pill);
    background: rgba(140, 74, 74, 0.18);
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(140, 74, 74, 0.18);
}

.quiz-progress-fill {
    display: block;
    height: 100%;
    width: 20%;
    border-radius: var(--r-pill);
    background: linear-gradient(90deg, var(--mpc-coral), var(--mpc-terracotta));
    transition: width 0.45s var(--mpc-ease);
}

.quiz-progress-label {
    text-align: center;
    color: var(--mpc-terracotta-d);
    font-family: var(--mpc-font-head);
    font-weight: 600;
    margin: 0 auto var(--sp-5);
}

/* ===============================================================
   ÉTAPES
   =============================================================== */

.quiz-step {
    border: 0;
    margin: 0 auto;
    padding: var(--sp-8) clamp(var(--sp-4), 4vw, var(--sp-10)) var(--sp-10);
    max-width: 820px;
    background: var(--mpc-cream);
    border-radius: var(--r-lg);
    box-shadow: var(--mpc-shadow-lg);
    animation: step-in 0.4s var(--mpc-ease);
}

@keyframes step-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quiz-question {
    display: block;
    width: 100%;
    text-align: center;
    font-family: var(--mpc-font-head);
    font-weight: 600;
    font-size: clamp(1.4rem, 1.1rem + 1.4vw, 1.9rem);
    line-height: 1.25;
    color: var(--mpc-terracotta-d);
    padding: 0;
    margin: 0 auto var(--sp-2);
}

.quiz-hint {
    text-align: center;
    color: var(--mpc-ink);
    opacity: 0.85;
    margin: 0 auto var(--sp-6);
    max-width: 40rem;
}

/* ===============================================================
   CARTES D'OPTIONS (radios / checkboxes stylés)
   =============================================================== */

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: var(--sp-4);
}

.option-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-5) var(--sp-3);
    text-align: center;
    cursor: pointer;
    background: linear-gradient(180deg, var(--mpc-white) 0%, var(--mpc-cream) 100%);
    border: 3px solid transparent;
    border-radius: var(--r-md);
    box-shadow: var(--mpc-shadow-sm);
    transition:
        transform 0.2s var(--mpc-ease),
        box-shadow 0.2s var(--mpc-ease),
        border-color 0.2s var(--mpc-ease);
}

.option-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--mpc-shadow-md);
    border-color: var(--mpc-peach);
}

/* l'input réel reste accessible mais invisible */
.option-card input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.option-card-media {
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    background: radial-gradient(
        circle at 30% 25%,
        var(--mpc-white) 0%,
        var(--mpc-cream) 55%,
        var(--mpc-cream-2) 100%
    );
    box-shadow: inset 0 0 0 1px rgba(140, 74, 74, 0.06);
    transition: transform 0.2s var(--mpc-ease);
}

.option-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.option-card-emoji {
    font-size: 2.6rem;
    line-height: 1;
}

.option-card-label {
    font-family: var(--mpc-font-head);
    font-weight: 600;
    font-size: 1.02rem;
    color: var(--mpc-terracotta-d);
    line-height: 1.2;
}

/* état sélectionné — anneau corail + pastille ✓ */
.option-card:has(input:checked) {
    border-color: var(--mpc-coral);
    box-shadow:
        0 0 0 4px rgba(211, 117, 107, 0.25),
        var(--mpc-shadow-md);
    background: linear-gradient(180deg, var(--mpc-white) 0%, var(--mpc-peach-soft) 100%);
}

.option-card:has(input:checked) .option-card-media {
    transform: scale(1.05);
}

.option-card:has(input:checked)::after {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--mpc-white);
    background: var(--mpc-coral);
    border-radius: 50%;
    box-shadow: var(--mpc-shadow-sm);
}

.option-card:has(input:focus-visible) {
    outline: 3px solid var(--mpc-terracotta-d);
    outline-offset: 3px;
}

/* Repli pour les navigateurs sans :has() — au moins un retour visuel */
.option-card input:checked ~ .option-card-media {
    transform: scale(1.05);
}

.option-card input:focus-visible ~ .option-card-media {
    outline: 3px solid var(--mpc-terracotta-d);
    outline-offset: 3px;
}

/* ===============================================================
   BOUTONS (système)
   =============================================================== */

.btn {
    font-family: var(--mpc-font-head);
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.3px;
    border: 0;
    border-radius: var(--r-pill);
    padding: 15px 30px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    transition:
        transform 0.18s var(--mpc-ease),
        box-shadow 0.18s var(--mpc-ease),
        filter 0.18s var(--mpc-ease);
}

.btn:focus-visible {
    outline: 3px solid var(--mpc-terracotta-d);
    outline-offset: 3px;
}

.btn-primary {
    color: var(--mpc-white);
    background: linear-gradient(180deg, var(--mpc-terracotta) 0%, var(--mpc-terracotta-d) 100%);
    box-shadow: var(--mpc-shadow-md);
}

.btn-primary:hover {
    filter: brightness(1.06);
    transform: translateY(-2px);
    box-shadow: var(--mpc-shadow-lg);
}

.btn-primary:active {
    transform: translateY(1px);
    box-shadow: var(--mpc-shadow-sm);
}

.btn-soft {
    color: var(--mpc-terracotta-d);
    background: var(--mpc-cream);
    box-shadow: var(--mpc-shadow-sm);
}

.btn-soft:hover {
    transform: translateY(-2px);
    box-shadow: var(--mpc-shadow-md);
}

.btn-ghost {
    color: var(--mpc-terracotta-d);
    background: transparent;
    box-shadow: inset 0 0 0 2px rgba(140, 74, 74, 0.3);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* ===============================================================
   NAVIGATION DU QUESTIONNAIRE + ERREUR
   =============================================================== */

.quiz-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--sp-4);
    margin-top: var(--sp-6);
}

.quiz-error {
    max-width: 540px;
    margin: var(--sp-4) auto 0;
    padding: 12px 18px;
    text-align: center;
    color: var(--mpc-danger);
    background: var(--mpc-danger-soft);
    border-radius: var(--r-sm);
    font-weight: 700;
    animation: step-in 0.25s var(--mpc-ease);
}

.quiz-error[hidden] {
    display: none;
}

/* ===============================================================
   RÉSULTATS
   =============================================================== */

.results {
    max-width: 1040px;
    margin: 0 auto;
    padding: var(--sp-4) var(--sp-2) 0;
    animation: step-in 0.4s var(--mpc-ease);
}

.results[hidden] {
    display: none;
}

.results-head {
    text-align: center;
    margin-bottom: var(--sp-8);
}

.results-title {
    font-family: var(--mpc-font-head);
    color: var(--mpc-white);
    margin: 0 0 var(--sp-4);
}

.result-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--sp-2) var(--sp-3);
    list-style: none;
    margin: 0 auto var(--sp-6);
    padding: 0;
    max-width: 48rem;
}

.result-chip {
    background: var(--mpc-cream);
    color: var(--mpc-terracotta-d);
    font-weight: 600;
    font-size: 0.92rem;
    padding: 7px 14px;
    border-radius: var(--r-pill);
    box-shadow: var(--mpc-shadow-sm);
}

.results-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-5);
}

.results-actions .btn {
    font-size: 1rem;
    padding: 12px 22px;
}

.results .affiliate-note {
    color: var(--mpc-on-dark);
    opacity: 0.92;
}

.results-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--mpc-terracotta-d);
    background: var(--mpc-cream);
    padding: var(--sp-8);
    border-radius: var(--r-md);
    font-weight: 600;
}

/* Grille de cartes (réutilise le style .gift-card de refresh.css) */
.result-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--sp-6);
    align-items: stretch;
}

.gift-card {
    position: relative;
}

/* « Pourquoi cette idée » — petites puces de justification qui
   rendent la recommandation transparente plutôt qu'opaque. */
.gift-reasons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    list-style: none;
    margin: 0 0 var(--sp-2);
    padding: 0;
}

.gift-reason {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    color: var(--mpc-terracotta-d);
    background: var(--mpc-peach-soft);
    border-radius: var(--r-pill);
    padding: 5px 10px;
}

.gift-reason-icon {
    font-size: 0.9rem;
}

/* Fourchette de prix indicative — repère concret de gamme de prix,
   affiché avant le clic vers Amazon (pas un prix de vente ferme). */
.gift-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 0 var(--sp-3);
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--mpc-terracotta-d);
}

.gift-price-icon {
    font-size: 0.9rem;
}

/* Utilitaire : visible pour les lecteurs d'écran, masqué à l'œil. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Bouton favori sur chaque carte */
.gift-fav {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    line-height: 1;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    background: var(--mpc-white);
    box-shadow: var(--mpc-shadow-sm);
    transition:
        transform 0.18s var(--mpc-ease),
        box-shadow 0.18s var(--mpc-ease);
}

.gift-fav:hover {
    transform: scale(1.12);
    box-shadow: var(--mpc-shadow-md);
}

.gift-fav.is-saved {
    background: var(--mpc-peach-soft);
}

.gift-fav:focus-visible {
    outline: 3px solid var(--mpc-terracotta-d);
    outline-offset: 2px;
}

/* Squelettes de chargement */
.gift-card--skeleton {
    min-height: 240px;
    border: 2px solid transparent;
    background: linear-gradient(180deg, var(--mpc-white) 0%, var(--mpc-cream) 100%);
    position: relative;
    overflow: hidden;
}

.gift-card--skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        100deg,
        transparent 20%,
        rgba(255, 255, 255, 0.6) 50%,
        transparent 80%
    );
    transform: translateX(-100%);
    animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
    to {
        transform: translateX(100%);
    }
}

/* ===============================================================
   HÉRO — surtitre
   =============================================================== */

.hero-eyebrow {
    display: inline-block;
    font-family: var(--mpc-font-head);
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--mpc-white);
    background: rgba(255, 255, 255, 0.16);
    border-radius: var(--r-pill);
    padding: 6px 16px;
    margin: 0 0 var(--sp-4);
}

/* ===============================================================
   LISTE DE FAVORIS — « MA HOTTE »
   =============================================================== */

.shortlist-toggle {
    position: fixed;
    right: calc(16px + env(safe-area-inset-right));
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: var(--z-toggle);
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-family: var(--mpc-font-head);
    font-weight: 600;
    font-size: 1rem;
    color: var(--mpc-white);
    background: linear-gradient(180deg, var(--mpc-terracotta) 0%, var(--mpc-terracotta-d) 100%);
    border: 0;
    border-radius: var(--r-pill);
    padding: 13px 20px;
    cursor: pointer;
    box-shadow: var(--mpc-shadow-lg);
    transition:
        transform 0.18s var(--mpc-ease),
        box-shadow 0.18s var(--mpc-ease);
}

.shortlist-toggle[hidden] {
    display: none;
}

.shortlist-toggle:hover {
    transform: translateY(-2px);
}

.shortlist-toggle:focus-visible {
    outline: 3px solid var(--mpc-white);
    outline-offset: 3px;
}

.shortlist-toggle-icon {
    font-size: 1.2rem;
}

.shortlist-count {
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--mpc-terracotta-d);
    background: var(--mpc-white);
    border-radius: var(--r-pill);
}

.shortlist-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-overlay);
    background: rgba(110, 59, 59, 0.5);
    opacity: 0;
    transition: opacity 0.25s var(--mpc-ease);
}

.shortlist-overlay.is-open {
    opacity: 1;
}

.shortlist-overlay[hidden] {
    display: none;
}

.shortlist-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: var(--z-panel);
    width: min(380px, 92vw);
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    padding: calc(var(--sp-6) + env(safe-area-inset-top)) var(--sp-6)
        calc(var(--sp-6) + env(safe-area-inset-bottom));
    background: var(--mpc-cream);
    box-shadow: var(--mpc-shadow-lg);
    transform: translateX(100%);
    transition: transform 0.28s var(--mpc-ease);
    overflow-y: auto;
}

.shortlist-panel.is-open {
    transform: translateX(0);
}

.shortlist-panel[hidden] {
    display: none;
}

.shortlist-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
}

.shortlist-heading {
    font-family: var(--mpc-font-head);
    color: var(--mpc-terracotta-d);
    margin: 0;
}

.shortlist-close {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--mpc-terracotta-d);
    background: var(--mpc-white);
    box-shadow: var(--mpc-shadow-sm);
}

.shortlist-close:focus-visible {
    outline: 3px solid var(--mpc-terracotta-d);
    outline-offset: 2px;
}

.shortlist-empty {
    color: var(--mpc-ink);
    line-height: 1.5;
}

.shortlist-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    flex: 1 1 auto;
}

.shortlist-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    background: var(--mpc-white);
    border-radius: var(--r-sm);
    box-shadow: var(--mpc-shadow-sm);
}

.shortlist-item-emoji {
    font-size: 1.6rem;
    line-height: 1;
    flex: 0 0 auto;
}

.shortlist-item-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}

.shortlist-item-title {
    font-weight: 700;
    color: var(--mpc-ink);
    font-size: 0.95rem;
}

.shortlist-item-price {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--mpc-terracotta);
}

.shortlist-item-link {
    color: var(--mpc-terracotta-d);
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
}

.shortlist-item-link:hover {
    text-decoration: underline;
}

.shortlist-item-remove {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    color: var(--mpc-terracotta-d);
    background: var(--mpc-cream-2);
}

.shortlist-item-remove:focus-visible {
    outline: 3px solid var(--mpc-terracotta-d);
    outline-offset: 2px;
}

.shortlist-actions {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.shortlist-actions[hidden] {
    display: none;
}

.shortlist-actions .btn {
    width: 100%;
    font-size: 1rem;
}

/* ===============================================================
   TOAST
   =============================================================== */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(28px + env(safe-area-inset-bottom));
    z-index: var(--z-toast);
    transform: translate(-50%, 16px);
    max-width: 90vw;
    padding: 13px 22px;
    color: var(--mpc-white);
    background: var(--mpc-ink);
    border-radius: var(--r-pill);
    box-shadow: var(--mpc-shadow-lg);
    font-weight: 600;
    opacity: 0;
    transition:
        opacity 0.25s var(--mpc-ease),
        transform 0.25s var(--mpc-ease);
}

.toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast[hidden] {
    display: none;
}

/* ===============================================================
   RESPONSIVE & MOTION
   =============================================================== */

@media only screen and (max-width: 768px) {
    .quiz {
        padding: var(--sp-4) var(--sp-3) var(--sp-8);
    }

    .quiz-step {
        padding: var(--sp-6) var(--sp-4) var(--sp-8);
    }

    .option-grid {
        grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
        gap: var(--sp-3);
    }

    .option-card-media {
        width: 80px;
        height: 80px;
    }

    .quiz-nav .btn,
    .results-actions .btn {
        flex: 1 1 auto;
    }

    .result-cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: var(--sp-4);
    }
}

@media (prefers-reduced-motion: reduce) {
    .quiz-step,
    .results,
    .quiz-error,
    .quiz-progress-fill,
    .option-card,
    .option-card-media,
    .gift-fav,
    .shortlist-panel,
    .shortlist-overlay,
    .shortlist-toggle,
    .toast {
        transition: none;
        animation: none;
    }

    .gift-card--skeleton::after {
        animation: none;
    }
}
