/* ══════════════════════════════════════════════════
   Page récapitulatif commande (purchase_intent_show)
   ══════════════════════════════════════════════════ */

/* Header fixe — aligné sur la grille .container comme le contenu (détail événement) */
.pi-recap-header {
    min-height: 74px;
    border-bottom: 1px solid #f1f3f5;
    z-index: 1035;
}

/* Contenu scrollable avec espace pour header + footer */
.pi-recap-content {
    padding-top: 94px;
    padding-bottom: 112px;
}

/* Mobile / tablette : empilement simple (inchangé par rapport à l’original) */
.pi-recap-layout {
    display: block;
    width: 100%;
}

.pi-recap-summary,
.pi-recap-payment {
    width: 100%;
}

@media (max-width: 991.98px) {
    .pi-recap-content {
        max-width: 100%;
        padding-top: clamp(90px, 10vh, 112px);
        padding-bottom: 112px;
    }

    .pi-recap-header .container {
        max-width: 100%;
    }

    .pi-recap-layout {
        display: block !important;
    }

    .pi-recap-summary .pi-total-card {
        margin-bottom: 1.5rem !important;
    }
}

@media (min-width: 992px) {
    .pi-recap-content {
        padding-top: 118px;
        padding-bottom: 40px;
        max-width: 1140px;
    }

    .pi-recap-page .pi-recap-content {
        padding-bottom: 40px !important;
    }

    /* Même largeur que le contenu pour aligner le retour sur les cards */
    .pi-recap-header .container {
        max-width: 1140px;
    }

    /* Desktop uniquement : 2 colonnes — récap (gauche) | paiement (droite) */
    .pi-recap-layout {
        display: grid;
        grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
        gap: 2rem;
        align-items: start;
    }

    .pi-recap-payment {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
    }

    .pi-recap-summary {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }

    .pi-recap-summary .pi-total-card {
        margin-bottom: 0 !important;
    }

    .pi-recap-payment .pi-desktop-checkout > form > .shadow {
        position: sticky;
        top: 96px;
    }

    /* Carte événement plus haute, adresse sur plusieurs lignes */
    .pi-recap-summary .pi-event-card .pi-event-card-body {
        flex-direction: column;
        align-items: stretch;
        padding: 1.15rem !important;
    }

    .pi-recap-summary .pi-event-thumb,
    .pi-recap-summary .pi-event-thumb--placeholder {
        width: 100%;
        max-width: none;
        height: 120px;
    }

    .pi-recap-summary .pi-event-card {
        min-height: 12rem;
    }
}

.pi-recap-page {
    background: #fff;
    min-height: 100vh;
}

/* Renforce l'espace sous header même si d'autres utilitaires Bootstrap existent */
.pi-recap-page .pi-recap-content {
    padding-top: clamp(90px, 10vh, 112px) !important;
    padding-bottom: 112px;
}

.pi-recap-back {
    color: inherit;
}

.pi-recap-back:hover {
    color: #212529;
}

.pi-payment-legal-link {
    color: #212529 !important;
    text-decoration: underline;
    font-weight: inherit;
}

.pi-payment-legal-link:hover {
    color: #000 !important;
    opacity: 0.85;
}

.pi-recap-page .form-check-label {
    color: #212529;
}

.pi-success-page .pi-success-alert {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.pi-success-card {
    border-radius: 0.95rem;
    border-color: #f1f3f5 !important;
}

.pi-success-card .pi-success-important,
.pi-success-card .pi-success-important h2,
.pi-success-card .pi-success-important p {
    color: #000;
    text-align: left;
}

.pi-success-card .pi-success-important a:not(.btn) {
    font-weight: 700;
    color: #000;
}

.pi-success-info-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.pi-success-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: 50%;
    background-color: #f8f9fa;
    color: #6c757d;
    font-size: 0.95rem;
}

.pi-success-info-title {
    font-weight: 600;
}

.pi-success-product-img {
    object-fit: cover;
    flex-shrink: 0;
}

.pi-event-card,
.pi-order-card,
.pi-total-card {
    border-radius: 0.95rem;
    border-color: #f1f3f5 !important;
}

.pi-event-card .card-body,
.pi-order-card .card-body,
.pi-total-card .card-body {
    padding: 0.95rem !important;
}

.pi-order-card .h6 {
    font-size: clamp(1.05rem, 3.2vw, 1.32rem);
    line-height: 1.15;
}

.pi-order-item .fw-semibold {
    font-size: clamp(1.05rem, 3.2vw, 1.28rem);
    line-height: 1.15;
}

.pi-order-item .small {
    font-size: clamp(0.95rem, 3vw, 1.05rem) !important;
}

.pi-total-card .fw-semibold {
    font-size: clamp(1.05rem, 3.2vw, 1.24rem);
}

.pi-total-card .text-theme,
.pi-total-card .pi-total-amount {
    font-size: clamp(1.3rem, 4.2vw, 1.55rem) !important;
    color: var(--primary, #f0151f);
}

.pi-order-summary-stack {
    width: 100%;
}

.pi-order-summary-stack .pi-order-item:last-child {
    border-bottom: 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.pi-success-page .pi-success-heading {
    color: #198754;
}

.pi-success-page .pi-total-amount {
    color: #212529 !important;
}

.pi-success-page .pi-success-promo {
    background-color: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    color: #212529;
}

.pi-success-promo.pi-success-alert {
    text-align: left;
}

.pi-success-page .pi-success-promo-important {
    font-size: 1.125rem;
    line-height: 1.25;
    font-weight: 700;
    color: #198754;
}

.pi-success-page .pi-success-promo-icon {
    font-size: 1.25rem;
    line-height: 1;
    color: #198754;
    flex-shrink: 0;
}

.pi-success-page .pi-success-promo-notice,
.pi-success-promo-notice {
    color: #212529;
}

.pi-success-page .pi-success-promo-notice .text-theme,
.pi-success-promo-notice .text-theme {
    color: #198754 !important;
}

.pi-success-page .pi-success-promo-footnote,
.pi-success-page .pi-success-promo-footnote strong,
.pi-success-promo-footnote,
.pi-success-promo-footnote strong {
    color: #212529 !important;
}

.pi-success-actions {
    display: flex;
    flex-flow: column nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.75rem;
    width: 100%;
    max-width: 100%;
}

.pi-success-actions .btn {
    white-space: nowrap;
    flex: 0 0 auto;
    width: 100%;
    text-align: center;
}

.pi-success-actions .btn-lg {
    padding-left: 1rem;
    padding-right: 1rem;
    font-size: 1rem;
}

@media (min-width: 480px) {
    .pi-success-actions {
        flex-flow: row wrap;
    }

    .pi-success-actions .btn {
        width: auto;
    }
}

@media (max-width: 575.98px) {
    .pi-success-actions {
        gap: 0.5rem;
    }

    .pi-success-actions .btn {
        padding-left: 0.875rem;
        padding-right: 0.875rem;
        font-size: 0.9375rem;
    }
}

.pi-store-downloads {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 1.25rem 2rem;
    margin-bottom: 1rem;
}

.pi-store-download {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 8.75rem;
    max-width: 100%;
}

.pi-store-badge-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    margin-bottom: 0.5rem;
    text-decoration: none;
}

.pi-store-badge-img {
    display: block;
    height: 2.5rem;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.pi-store-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    font-size: 0.75rem;
    padding: 0.4rem 0.65rem;
    font-weight: 600;
    border-radius: 0.375rem;
    line-height: 1.2;
    white-space: nowrap;
}

.pi-store-btn .fab {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.pi-store-btn--apple {
    background-color: #f0151f;
    border-color: #f0151f;
    color: #ffffff;
}

.pi-store-btn--apple:hover,
.pi-store-btn--apple:focus {
    background-color: #c91219;
    border-color: #c91219;
    color: #ffffff;
}

.pi-store-btn--google {
    background-color: #01875f;
    border-color: #01875f;
    color: #ffffff;
}

.pi-store-btn--google:hover,
.pi-store-btn--google:focus {
    background-color: #016b4b;
    border-color: #016b4b;
    color: #ffffff;
}

/* Carte événement */
.pi-event-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
}

.pi-event-thumb--placeholder {
    background: #f8f9fa;
    border: 1px solid #eceff1;
    font-size: 1.1rem;
}

.pi-event-card .fw-bold {
    font-size: clamp(1.03rem, 3.2vw, 1.2rem);
    letter-spacing: 0.01em;
}

.pi-event-card .small {
    font-size: clamp(0.88rem, 2.8vw, 1rem);
}

.pi-event-card-body {
    align-items: flex-start;
}

.pi-event-card-body .min-w-0 {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}

.pi-event-address {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Carte commande */
.pi-order-item:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Bouton fixe en bas (mobile) */
.pi-recap-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    padding: 0.85rem 1.1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid #f1f3f5;
}

/* ── Bottom sheet paiement ── */
.pi-payment-sheet {
    position: fixed;
    inset: 0;
    z-index: 1055;
    pointer-events: none;
}

.pi-payment-sheet.pi-payment-sheet--open {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.25);
}

.pi-payment-sheet-inner {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 1.35rem 1.35rem 0 0;
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.18);
    overflow-y: auto;
    max-height: 92vh;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    transform: translate3d(0, 105%, 0);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.pi-payment-sheet.pi-payment-sheet--open .pi-payment-sheet-inner {
    transform: translate3d(0, 0, 0);
}

.pi-sheet-close-btn {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    line-height: 1;
}

/* Sélecteur de pays */
.pi-country-select-wrap {
    position: relative;
    overflow: visible;
}

.pi-country-select {
    padding-right: 0.75rem;
    border-radius: 0.75rem;
    border-color: #dee2e6;
    height: auto;
    position: relative;
    z-index: 2;
    background-color: #fff;
}

/* Le dropdown natif doit pouvoir dépasser et rester lisible */
#pi-payment-sheet .pi-payment-sheet-body {
    overflow-y: auto;
    max-height: calc(92vh - 68px);
    -webkit-overflow-scrolling: touch;
}

#pi-payment-sheet .pi-payment-sheet-body .pi-country-select {
    max-width: 100%;
    width: 100%;
}

/* Select2 pays (bottom sheet) */
#pi-payment-sheet .select2-container {
    width: 100% !important;
}

#pi-payment-sheet .select2-container .select2-selection--single {
    height: 3.1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    padding: 0 2.2rem 0 0.85rem;
}

#pi-payment-sheet .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: normal;
    padding-left: 0;
    padding-right: 0;
    color: #212529;
}

#pi-payment-sheet .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    right: 0.6rem;
}

#pi-payment-sheet .select2-dropdown {
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    overflow: hidden;
}

/* Grille moyens de paiement */
.pi-methods-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.pi-methods-grid.pi-methods-grid--few {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.pi-methods-grid--few .pi-method-tile {
    flex: 0 0 auto;
    width: 7.25rem;
    max-width: 7.25rem;
}

.pi-method-tile {
    border: 2px solid #e9ecef;
    border-radius: 1rem;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pi-method-tile.pi-method-tile--active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(240, 21, 31, 0.12);
}

.pi-method-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    margin: 0;
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #212529;
}

.pi-method-label img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 0.5rem;
}

.pi-method-tile--free .pi-free-method-icon--sheet {
    font-size: 2rem;
    color: #16a34a;
    line-height: 1;
}

@media (max-width: 991.98px) {
    .pi-method-tile--free {
        min-height: 6.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pi-payment-sheet-inner {
        transition-duration: 0.22s !important;
    }
}

.payment-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 10px;
    transition: background 0.3s, box-shadow 0.3s, border-color 0.3s;
    max-width: 144px;
    text-align: center;
    justify-content: flex-start; /* Aligner les éléments à gauche */
    padding: 10px;
    box-sizing: border-box; /* Inclure le padding dans la largeur totale */
    position: relative;
}

.payment-option:hover {
    background: #f8f9fa;
    box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.1);
}

/* Cacher le bouton radio */
.payment-option input[type="radio"] {
    display: none; 
}

/* Icône de validation */
.check-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 1.2rem;
    color: transparent; /* Masqué par défaut */
    transition: color 0.3s ease;
}

/* Afficher l'icône quand l'option est sélectionnée */
.payment-option:has(input[type="radio"]:checked) {
    border: 2px solid var(--primary); /* Changer la bordure */
}

.payment-option:has(input[type="radio"]:checked) .check-icon {
    color: var(--primary); /* Affiche l'icône */
}

/* Desktop : 4 moyens (ou plus) sur une seule ligne dans le récap commande */
@media (min-width: 992px) {
    .pi-desktop-checkout .pi-desktop-payment-methods {
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: stretch;
        gap: 0.45rem;
        width: 100%;
    }

    .pi-desktop-checkout .pi-desktop-payment-methods .payment-option {
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
        justify-content: center;
        padding-left: 0.35rem;
        padding-right: 0.35rem;
    }

    .pi-desktop-checkout .pi-desktop-payment-methods.pi-desktop-payment-methods--few {
        justify-content: flex-start;
        gap: 0.65rem;
    }

    .pi-desktop-checkout .pi-desktop-payment-methods.pi-desktop-payment-methods--few .payment-option {
        flex: 0 0 auto;
        width: 9rem;
        max-width: 9rem;
        min-width: 9rem;
    }

    .pi-desktop-checkout .pi-desktop-payment-methods .form-check-label {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
        width: 100%;
        text-align: center;
    }

    .pi-desktop-checkout .pi-desktop-payment-methods .form-check-label img {
        max-width: 40px !important;
        width: 40px;
        height: auto;
    }

    .pi-desktop-checkout .pi-desktop-payment-methods .form-check-label .fw-semibold {
        font-size: 0.68rem;
        line-height: 1.15;
        word-break: break-word;
    }

    .pi-desktop-checkout .pi-desktop-payment-methods .form-check-label .pi-free-method-icon {
        font-size: 1.75rem;
        color: #16a34a;
    }

    .pi-desktop-checkout .pi-desktop-payment-methods .payment-option--free {
        min-height: 5.5rem;
    }
}

/* ── Détail montant par moyen de paiement (quotes API) ── */
.pi-quote-notice {
    background-color: #e8f4fc;
    border: 1px solid #b8daf0;
    border-radius: 0.5rem;
    color: #0c5460;
    padding: 0.65rem 0.85rem;
    line-height: 1.4;
    text-align: left;
}

.pi-quote-table {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    border-collapse: collapse;
    background-color: #fff;
}

.pi-quote-table td {
    vertical-align: middle;
    padding: 0.55rem 0.75rem;
}

.pi-quote-table tbody tr + tr td {
    border-top: 1px solid #dee2e6;
}

.pi-desktop-checkout .js-pi-quote-breakdown {
    text-align: left;
}

@media (min-width: 992px) {
    .pi-desktop-checkout .js-pi-wallet-challenge-message {
        hyphens: none;
        white-space: nowrap;
        font-size: 0.9375rem;
    }
}

@media (max-width: 991.98px) {
    #pi-payment-sheet .pi-payment-sheet-body {
        padding-top: 0.65rem !important;
        padding-bottom: 0.65rem !important;
    }

    #pi-payment-sheet .pi-payment-sheet-body .form-group.mb-2,
    #pi-payment-sheet .pi-payment-sheet-body .form-group.mb-3,
    #pi-payment-sheet .pi-payment-sheet-body .mb-2,
    #pi-payment-sheet .pi-payment-sheet-body .mb-3,
    #pi-payment-sheet .pi-payment-sheet-body .mb-4 {
        margin-bottom: 0.55rem !important;
    }

    #pi-payment-sheet .pi-methods-grid {
        margin-bottom: 0.65rem !important;
    }

    #pi-payment-sheet .js-pi-checkout-footer .form-check {
        margin-top: 0.45rem !important;
        margin-bottom: 0.45rem !important;
    }

    .pi-checkout-submit-btn,
    .pi-recap-footer .btn {
        padding-top: 0.65rem !important;
        padding-bottom: 0.65rem !important;
        font-size: 0.95rem;
    }

    .pi-recap-footer {
        padding-top: 0.65rem;
        padding-bottom: calc(0.65rem + env(safe-area-inset-bottom, 0px));
    }
}
