/* ==========================================================================
   Paiement intégré au tunnel de RDV (étape 4)
   --------------------------------------------------------------------------
   Balisage : element/patient/tunnel/recapitulatif_paiement.php
   Comportement : js/paiement-tunnel.js
   Variables de la DA (site-shell.css / espace-patient.css) avec valeurs de
   repli : la feuille fonctionne sur la fiche publique comme dans l'espace patient.

   Les champs numéro / expiration / cryptogramme sont des iframes Stripe posées
   dans des div.pt-input : le cadre (bordure, focus, erreur) vient d'ici, le
   texte saisi est stylé côté JS (style_champ).
   ========================================================================== */
.paiement-tunnel {
    margin-top: 28px;
    padding: 22px 20px 18px;
    background: var(--blanc, #fff);
    border: 1px solid var(--ligne, #E3ECEC);
    border-radius: var(--rayon, 18px);
    box-shadow: var(--ombre-sm, 0 2px 8px -2px rgba(11, 87, 104, .12));
    font-family: var(--ff, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    color: var(--encre, #12333a);
}

@media (min-width: 576px) {
    .paiement-tunnel {
        padding: 26px 28px 22px;
    }
}

/* --- En-tête : titre + montant --- */
.paiement-tunnel .pt-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.paiement-tunnel .pt-titre {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--teal, #0B5768);
}

.paiement-tunnel .pt-titre .fa-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--vert-clair, #e6f5f3);
    color: var(--vert-fonce, #1e7f77);
    font-size: .8rem;
}

.paiement-tunnel .pt-montant {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--encre, #12333a);
    white-space: nowrap;
}

/* --- Apple Pay / Google Pay --- */
.paiement-tunnel .pt-express {
    margin-bottom: 4px;
}

/* En attente de la réponse de Stripe : invisible mais à sa place, comme dans la doc Stripe.
   Ni display: none (boutons de largeur nulle) ni hauteur 0 / overflow hidden : l'Express
   Checkout Element peut attendre d'être réellement à l'écran pour s'afficher et répondre. */
.paiement-tunnel .pt-express--attente {
    visibility: hidden;
}

.paiement-tunnel .pt-separateur {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 18px 0 16px;
    font-size: .8rem;
    font-weight: 500;
    color: var(--gris-clair, #8a9b9d);
    text-transform: none;
}

.paiement-tunnel .pt-separateur::before,
.paiement-tunnel .pt-separateur::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ligne, #E3ECEC);
}

/* --- Champs --- */
.paiement-tunnel .pt-champ {
    margin-bottom: 14px;
    min-width: 0;
}

.paiement-tunnel .pt-ligne {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.paiement-tunnel .pt-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--gris, #5c6f72);
    cursor: pointer;
}

.paiement-tunnel .pt-aide {
    color: var(--gris-clair, #8a9b9d);
    cursor: help;
}

.paiement-tunnel .pt-input {
    display: block;
    width: 100%;
    height: 50px;
    padding: 14px 14px;
    background: var(--doux, #F5FAFA);
    border: 1.5px solid var(--ligne, #E3ECEC);
    border-radius: var(--rayon-sm, 12px);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

/* Champ natif (titulaire) : même rendu que les iframes Stripe */
.paiement-tunnel .pt-input-natif {
    padding: 0 14px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    color: var(--encre, #12333a);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.paiement-tunnel .pt-input-natif::placeholder {
    color: var(--gris-clair, #8a9b9d);
    font-weight: 400;
}

.paiement-tunnel .pt-input:hover {
    border-color: #cfdede;
}

.paiement-tunnel .pt-input--focus,
.paiement-tunnel .pt-input-natif:focus {
    background: var(--blanc, #fff);
    border-color: var(--vert, #31a99f);
    box-shadow: 0 0 0 4px rgba(49, 169, 159, .14);
}

.paiement-tunnel .pt-input--invalide {
    background: #fdf5f4;
    border-color: #c0392b;
    box-shadow: none;
}

.paiement-tunnel .pt-input--invalide.pt-input--focus,
.paiement-tunnel .pt-input-natif.pt-input--invalide:focus {
    box-shadow: 0 0 0 4px rgba(192, 57, 43, .12);
}

.paiement-tunnel .pt-input--complet:not(.pt-input--focus) {
    background: var(--blanc, #fff);
}

/* --- Erreur --- */
.paiement-tunnel .pt-erreur {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 2px 0 14px;
    padding: 10px 12px;
    border-radius: var(--rayon-sm, 12px);
    background: #fdf1ef;
    color: #a33224;
    font-size: .86rem;
    font-weight: 500;
    line-height: 1.4;
}

.paiement-tunnel .pt-erreur.d-none {
    display: none;
}

.paiement-tunnel .pt-erreur .fa-circle-exclamation {
    margin-top: 2px;
}

/* --- Bouton payer --- */
.paiement-tunnel .pt-bouton {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    margin-top: 6px;
    padding: 12px 18px;
    border: 0;
    border-radius: var(--rayon-pill, 999px);
    background: var(--vert-fonce, #1e7f77);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -.005em;
    box-shadow: 0 10px 24px -12px rgba(30, 127, 119, .7);
    transition: background-color .15s ease, transform .1s ease, box-shadow .15s ease;
    cursor: pointer;
}

.paiement-tunnel .pt-bouton:hover:not(:disabled) {
    background: var(--teal, #0B5768);
}

.paiement-tunnel .pt-bouton:active:not(:disabled) {
    transform: translateY(1px);
}

.paiement-tunnel .pt-bouton:focus-visible {
    outline: 3px solid rgba(49, 169, 159, .45);
    outline-offset: 2px;
}

.paiement-tunnel .pt-bouton:disabled {
    cursor: default;
    opacity: .6;
    box-shadow: none;
}

.paiement-tunnel .pt-bouton .fa-lock {
    margin-right: 8px;
    font-size: .85em;
}

.paiement-tunnel .pt-bouton-chargement {
    display: none;
    align-items: center;
    gap: 10px;
}

.paiement-tunnel .pt-bouton--chargement {
    opacity: 1 !important;
}

.paiement-tunnel .pt-bouton--chargement .pt-bouton-libelle {
    display: none;
}

.paiement-tunnel .pt-bouton--chargement .pt-bouton-chargement {
    display: inline-flex;
}

.paiement-tunnel .pt-rond {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pt-rotation .7s linear infinite;
}

@keyframes pt-rotation {
    to {
        transform: rotate(360deg);
    }
}

/* Pendant le paiement, le formulaire ne réagit plus (la validation 3D Secure s'ouvre par-dessus) */
.paiement-tunnel.pt-en-cours .pt-carte .pt-champ,
.paiement-tunnel.pt-en-cours .pt-express {
    opacity: .55;
    pointer-events: none;
}

/* --- Réassurance --- */
.paiement-tunnel .pt-reassurance {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 14px;
    font-size: .78rem;
    line-height: 1.45;
    color: var(--gris, #5c6f72);
}

.paiement-tunnel .pt-reassurance .fa-shield-halved {
    margin-top: 2px;
    color: var(--vert, #31a99f);
}

.paiement-tunnel .pt-logos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
    font-size: 1.6rem;
    color: #a9b8ba;
}

.paiement-tunnel .pt-logo-cb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    padding: 0 6px;
    border: 1.5px solid currentColor;
    border-radius: 4px;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .02em;
    line-height: 1;
}

@media (max-width: 380px) {
    .paiement-tunnel .pt-ligne {
        gap: 10px;
    }

    .paiement-tunnel .pt-label {
        font-size: .78rem;
    }
}

/* Panneau de diagnostic (?diagnostic_paiement=1) */
.paiement-tunnel .pt-diagnostic {
    max-height: 320px;
    margin: 0 0 16px;
    padding: 10px 12px;
    overflow: auto;
    background: #12333a;
    border-radius: 10px;
    color: #e6f5f3;
    font-size: .7rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-all;
}
