/* ============================================================
   Carte cadeau — CSS (tokens ConvertForms #cf_3 à l'identique)
   + bloc paiement Stripe. Aucune dépendance Joomla.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: transparent;               /* transparent pour l'iframe */
    font-family: Roboto, sans-serif;
    padding: 16px;
}

.cf-demo-wrap {
    max-width: 640px;
    margin: 0 auto;
}

/* ---- Variables d'instance (identiques à l'origine) ---- */
#cf_3 {
    --font: Roboto, sans-serif;
    --control-gap: 10px;
    --label-color: #383838;
    --label-size: 16px;
    --label-weight: 500;
    --input-color: #888888;
    --input-placeholder-color: #88888870;
    --input-text-align: left;
    --input-background-color: #F4F4F4;
    --input-border-color: #E9E9E9;
    --input-border-radius: 999px;
    --input-size: 16px;
    --input-padding: 8px 8px;
    --color-primary: #4285F4;
    --color-danger: #d73e31;
}

#cf_3 { font-family: var(--font); container-type: inline-size; }

/* ---- Grille ---- */
#cf_3 .cf-fields { display: flex; flex-wrap: wrap; gap: var(--control-gap); }
#cf_3 .cf-control-group { flex: 0 0 100%; min-width: 0; }
#cf_3 .cf-control-group.cf-one-half { flex: 0 0 calc(50% - (var(--control-gap) / 2)); }
#cf_3 .cf-control-group.cf-hide { display: none; }

/* ---- Labels ---- */
#cf_3 .cf-control-label { margin-bottom: 5px; }
#cf_3 .cf-label {
    display: block;
    font-family: var(--font);
    color: var(--label-color);
    font-size: var(--label-size);
    font-weight: var(--label-weight);
    line-height: 1.3;
}
#cf_3 .cf-required-label { color: var(--color-danger); margin-left: 3px; }

/* ---- Inputs / select ---- */
#cf_3 .cf-input {
    width: 100%;
    font-family: var(--font);
    font-size: var(--input-size);
    color: var(--input-color);
    text-align: var(--input-text-align);
    background-color: var(--input-background-color);
    border: 1px solid var(--input-border-color);
    border-radius: var(--input-border-radius);
    padding: var(--input-padding);
    line-height: 1;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
#cf_3 .cf-input::placeholder { color: var(--input-placeholder-color); }
#cf_3 .cf-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(66,133,244,.15);
}
#cf_3 .cf-input.cf-error { border-color: var(--color-danger); }

/* ---- Select ---- */
#cf_3 .cf-select { position: relative; }
#cf_3 .cf-select select.cf-input {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    padding-right: 36px; cursor: pointer;
}
#cf_3 .cf-select::after {
    content: ""; position: absolute; top: 50%; right: 16px;
    width: 8px; height: 8px;
    border-right: 2px solid #888; border-bottom: 2px solid #888;
    transform: translateY(-70%) rotate(45deg); pointer-events: none;
}

/* ---- Compteur de caractères (messages, limite 31) ---- */
#cf_3 .cf-char-counter {
    display: block; text-align: right;
    font-family: var(--font); font-size: 11px; color: #b0b0b0;
    margin-top: 3px; padding-right: 12px;
}
#cf_3 .cf-char-counter.cf-limit { color: var(--color-danger); }

/* ---- Bloc paiement Stripe ---- */
#cf_3 .cf-payment-block { margin-top: 6px; }
#cf_3 #payment-element {
    background: #fff;
    border: 1px solid var(--input-border-color);
    border-radius: 14px;
    padding: 16px;
}
#cf_3 .cf-payment-message {
    color: var(--color-danger);
    font-size: 13px;
    margin-top: 8px;
    min-height: 0;
}
#cf_3 .cf-payment-message:empty { display: none; }
#cf_3 .cf-secure-hint {
    font-size: 12px; color: #8a8a8a; margin: 8px 0 0; text-align: center;
}

/* ---- Bouton (override .cf-btn d'origine, italique Ancizar Sans) ---- */
#cf_3 .cf-btn {
    border-radius: 999px;
    padding: 14px 28px;
    background-color: rgba(156, 175, 133, 1);
    color: #FFF6E6;
    width: fit-content;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: none;
    cursor: pointer;
    font-family: "Ancizar Sans", Roboto, sans-serif;
    font-style: italic;
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    transition: background-color .15s ease, transform .05s ease, opacity .15s ease;
}
#cf_3 .cf-btn:hover { background-color: rgba(140, 158, 118, 1); }
#cf_3 .cf-btn:active { transform: translateY(1px); }
#cf_3 .cf-btn[disabled] { opacity: .6; cursor: not-allowed; }
#cf_3 .cf-text-left { text-align: left; }

/* Spinner (affiché pendant le traitement) */
#cf_3 .cf-spinner-container { display: none; }
#cf_3 .cf-btn.cf-loading .cf-spinner-container { display: inline-flex; }
#cf_3 .cf-spinner { display: inline-flex; gap: 4px; }
#cf_3 .cf-spinner > span {
    width: 7px; height: 7px; border-radius: 50%;
    background: currentColor; display: inline-block;
    animation: cf-bounce 1.4s infinite ease-in-out both;
}
#cf_3 .cf-spinner .bounce1 { animation-delay: -0.32s; }
#cf_3 .cf-spinner .bounce2 { animation-delay: -0.16s; }
@keyframes cf-bounce { 0%,80%,100% { transform: scale(0); } 40% { transform: scale(1); } }

/* Honeypot */
#cf_3 .cf-field-hp { display: none; position: absolute; left: -9000px; }

/* ---- Messages personnalisés en 2 colonnes (ligne1|ligne2, ligne3|ligne4) ---- */
#cf_3 .cf-control-group[data-key="11"],
#cf_3 .cf-control-group[data-key="12"],
#cf_3 .cf-control-group[data-key="13"],
#cf_3 .cf-control-group[data-key="14"] {
    flex: 0 0 calc(50% - (var(--control-gap) / 2));
}

/* ---- Responsive ----
   Basé sur la largeur DU FORMULAIRE (container query), pas sur le viewport :
   indispensable en iframe, où le viewport = largeur de l'iframe/colonne SPPB.
   Deux colonnes tant que le form fait > 480px ; empilées en dessous. */
@container (max-width: 480px) {
    #cf_3 .cf-control-group.cf-one-half,
    #cf_3 .cf-control-group[data-key="11"],
    #cf_3 .cf-control-group[data-key="12"],
    #cf_3 .cf-control-group[data-key="13"],
    #cf_3 .cf-control-group[data-key="14"] { flex: 0 0 100%; }
}

/* Fallback navigateurs sans container queries (anciens) */
@supports not (container-type: inline-size) {
    @media (max-width: 519.98px) {
        #cf_3 .cf-control-group.cf-one-half,
        #cf_3 .cf-control-group[data-key="11"],
        #cf_3 .cf-control-group[data-key="12"],
        #cf_3 .cf-control-group[data-key="13"],
        #cf_3 .cf-control-group[data-key="14"] { flex: 0 0 100%; }
    }
}