/* ============================================================
   CHECKOUT — Leavah Paris
   Fond crème, serif, gold — cohérent avec la DA du site
   ============================================================ */

.checkout-grid {
    display: flex;
    gap: 3rem;
    padding-top: 2rem;
    align-items: flex-start;
}

.checkout-form-col {
    flex: 3;
    min-width: 0;
}

.checkout-summary-col {
    flex: 2;
    position: sticky;
    top: 100px;
    background: #faf8f5;
    padding: 1.5rem;
    border: 1px solid #e8dcc8;
}

.checkout-summary-col h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.75rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #1a1a1a;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e8dcc8;
}

/* ----- Sections du formulaire ----- */

.checkout-section {
    margin-bottom: 2rem;
}

.checkout-section h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.75rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #1a1a1a;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e8dcc8;
}

/* ----- Adresses enregistrées ----- */

.address-radio {
    display: block;
    padding: 0.75rem;
    border: 1px solid #e8dcc8;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s;
    font-size: 0.875rem;
}

.address-radio:hover {
    border-color: var(--gold, #b8973a);
}

.address-radio input[type="radio"] {
    margin-right: 0.5rem;
}

/* ----- Code promo ----- */

.promo-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.promo-row .form-group,
.promo-row > div {
    flex: 1;
}

.promo-feedback--success {
    color: #2a7a2a;
    font-size: 0.85rem;
    margin-top: 0.4rem;
}

.promo-feedback--error {
    color: #c00;
    font-size: 0.85rem;
    margin-top: 0.4rem;
}

/* ----- Récapitulatif articles ----- */

.checkout-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0e8d8;
}

.checkout-item__img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f5f0e8;
}

.checkout-item__info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.checkout-item__name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #1a1a1a;
}

.checkout-item__meta {
    font-size: 0.75rem;
    color: #888;
}

.checkout-item__qty {
    font-size: 0.75rem;
    color: #aaa;
}

.checkout-item__price {
    font-size: 0.9rem;
    color: var(--gold, #b8973a);
    white-space: nowrap;
}

/* ----- Totaux ----- */

.checkout-totals {
    margin-top: 1rem;
}

.checkout-total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.9rem;
    color: #444;
}

.checkout-total-row--total {
    font-weight: 700;
    font-size: 1rem;
    color: var(--gold, #b8973a);
    border-top: 1px solid #e8dcc8;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

/* ----- Erreur checkout ----- */

.checkout-error {
    background: #fee;
    color: #c00;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-left: 3px solid #c00;
    font-size: 0.9rem;
}

/* ----- Utilitaires ----- */

.hidden {
    display: none !important;
}

/* ----- Email connecté ----- */

.checkout-user-email {
    font-size: 0.9rem;
    color: #555;
    padding: 0.5rem 0;
    font-style: italic;
}

/* ----- Section checkout page (padding-top réduit) ----- */

.checkout-page {
    padding-top: 40px;
    padding-bottom: 80px;
}

/* ----- Form check transporteur (espacement entre options) ----- */

.checkout-carrier-option {
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    row-gap: 0;
}

/* Description du transporteur (Admin › Transporteurs) : sous le libellé, alignée sur lui
   (largeur du bouton radio + écart du .form-check). */
.checkout-carrier-desc {
    flex-basis: 100%;
    margin: 0;
    padding-left: calc(13px + 10px);
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-muted);
    opacity: 0.8;
}

/* ----- Champs nouvelle adresse (espacement quand adresses sauvegardées existent) ----- */

.new-address-fields--mt {
    margin-top: 1rem;
}

/* ----- Grille code postal + ville ----- */

.checkout-postal-city {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1rem;
}

/* ----- Bouton promo (empêche le rétrécissement) ----- */

.checkout-promo-btn {
    flex-shrink: 0;
    margin-top: 0;
}

/* ----- Adresse sauvegardée — espacement ----- */

.checkout-save-address {
    margin-top: 1rem;
}

/* ----- Widget Turnstile ----- */

.checkout-turnstile {
    margin-bottom: 1.5rem;
}

/* ----- Bouton soumettre pleine largeur ----- */

.checkout-submit {
    width: 100%;
    margin-top: 0;
}

/* ----- Note sécurité sous le bouton ----- */

.checkout-secure-note {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

/* ----- Responsive mobile ----- */

@media (max-width: 768px) {
    .checkout-postal-city {
        grid-template-columns: 1fr;
    }

    .checkout-grid {
        flex-direction: column;
    }

    .checkout-summary-col {
        position: static;
        order: -1;
    }
}

/* ==========================================================================
   Bloc paiement Stripe (Payment Element)
   ========================================================================== */
.checkout-payment-section { padding-top: 8px; }
#stripe-payment-element {
    background: #fff;
    border: 1px solid #ede8df;
    padding: 18px;
    margin-bottom: 12px;
}
.checkout-stripe-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 14px;
    line-height: 1.5;
}

.checkout-timer {
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 14px;
    color: #6c757d;
    margin: 0 0 10px;
    letter-spacing: 0.02em;
}
.checkout-timer--warning { color: #b8960c; font-weight: 600; }
.checkout-timer--expired { color: #dc3545; font-weight: 600; }

/* Spinner du bouton submit pendant les appels async */
.checkout-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 10px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    vertical-align: -3px;
    animation: checkout-spin 0.8s linear infinite;
}
@keyframes checkout-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Overlay "Paiement en cours" — affiché pendant stripe.confirmPayment()
   ========================================================================== */
.checkout-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: checkout-overlay-fade-in 0.25s ease-out;
}
.checkout-overlay[hidden] { display: none; }
/* Scroll de la page bloqué tant que l'overlay de paiement est affiché (checkout.js) */
body.checkout-overlay-open { overflow: hidden; }

.checkout-overlay__panel {
    background: #faf8f5;
    padding: 48px 56px;
    max-width: 460px;
    width: 100%;
    text-align: center;
    border: 1px solid #d4cfc4;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}

.checkout-overlay__spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 28px;
    border: 2px solid rgba(184, 150, 12, 0.2);
    border-top-color: #b8960c;
    border-radius: 50%;
    animation: checkout-spin 0.9s linear infinite;
}

.checkout-overlay__title {
    margin: 0 0 12px;
    font-family: 'Linux Libertine', Georgia, serif;
    font-size: 1.4rem;
    font-style: italic;
    font-weight: 400;
    color: #1a1a1a;
    letter-spacing: 0.02em;
}

.checkout-overlay__subtitle {
    margin: 0 0 18px;
    color: #444;
    font-size: 0.95rem;
    line-height: 1.5;
}

.checkout-overlay__hint {
    margin: 18px 0 0;
    padding-top: 14px;
    border-top: 1px solid rgba(184, 150, 12, 0.25);
    color: #777;
    font-size: 0.85rem;
}

@keyframes checkout-overlay-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@media (max-width: 480px) {
    .checkout-overlay__panel {
        padding: 36px 24px;
    }
    .checkout-overlay__title {
        font-size: 1.2rem;
    }
}

/* ──────────────────────────────────────────────────────────────────────
   Champ "Informations complémentaires" pour la livraison
   ────────────────────────────────────────────────────────────────────── */
.checkout-section h2 .checkout-optional {
    font-size: 0.7em;
    font-style: italic;
    color: #888;
    font-weight: 400;
    margin-left: 4px;
    letter-spacing: 0;
}
.checkout-help {
    font-size: 0.85rem;
    color: #666;
    margin: -4px 0 12px;
    line-height: 1.5;
}
.checkout-section textarea.form-control {
    width: 100%;
    min-height: 78px;
    resize: vertical;
    padding: 10px 14px;
    border: 1px solid #d4cfc4;
    border-radius: 0;
    background: #fff;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.95rem;
    color: #1a1a1a;
    line-height: 1.5;
    transition: border-color 0.18s ease;
}
.checkout-section textarea.form-control:focus {
    outline: none;
    border-color: #b8960c;
}

/* Mode de livraison offert (libellé réécrit par checkout.js) */
.checkout-carrier-free { color: #2e7d32; font-weight: 600; }

/* Choix « J'ai déjà un compte / Commander sans compte / Créer mon compte » (visiteur non connecté) */
.checkout-account-choice {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 1.25rem;
}

.checkout-account-option {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 14px 14px 38px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.checkout-account-option input {
    position: absolute;
    left: 14px;
    top: 17px;
    accent-color: var(--gold);
}

.checkout-account-option:has(input:checked) {
    border-color: var(--gold);
    background: var(--bg-card-hover);
}

.checkout-account-option__title {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.checkout-account-option__text {
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.checkout-account-panel {
    margin-bottom: 1rem;
}

.checkout-account-panel__text {
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

@media (max-width: 640px) {
    .checkout-account-choice { grid-template-columns: 1fr; }
}
