.acantic-gift-card-form {
    display: grid;
    gap: 1.25rem;
    position: relative;
}

/* Formulaire masque tant qu'une carte n'a pas ete choisie (attribut pose par PHP, retire par la JS au clic sur « Choisir »). */
.acantic-gift-card-form[hidden] {
    display: none;
}

/* Barre d'étapes : en pile sur mobile, en ligne a partir de 768px. */
.acantic-gift-card-form .agc-stepper {
    align-items: stretch;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.acantic-gift-card-form .agc-stepper-item {
    align-items: center;
    color: #9ca3af;
    display: flex;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 0.45rem;
    letter-spacing: 0.01em;
    margin: 0;
    padding: 0;
    position: relative;
    transition: color 0.25s ease, opacity 0.25s ease;
}

/* Pastille vide pour les étapes a venir : la coche est affichée par la regle is-completed. */
.acantic-gift-card-form .agc-stepper-item::before {
    align-items: center;
    background-color: transparent;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    box-sizing: border-box;
    color: #6b7280;
    content: "";
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 700;
    height: 1.5rem;
    justify-content: center;
    line-height: 1;
    transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
    width: 1.5rem;
}

/* Fil de jointure : vertical en mobile (sous la pastille), horizontal en desktop (regle du media ci-dessous). */
.acantic-gift-card-form .agc-stepper-item::after {
    background-color: #d1d5db;
    bottom: -0.6rem;
    content: "";
    display: block;
    height: auto;
    left: 0.6875rem;
    min-width: 0;
    opacity: 0.65;
    position: absolute;
    top: 1.65rem;
    transition: background-color 0.25s ease, opacity 0.25s ease;
    width: 2px;
}

.acantic-gift-card-form .agc-stepper-item:last-of-type::after {
    display: none;
}

/* Étape non applicable (ex. montant figé) : retire de la barre et de l'arbre d'accessibilité. */
.acantic-gift-card-form .agc-stepper-item[hidden] {
    display: none;
}

.acantic-gift-card-form .agc-stepper-label {
    color: #6b7280;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Étape en cours : pastille évidée ourlée d'un anneau couleur. */
.acantic-gift-card-form .agc-stepper-item.is-active {
    color: var(--kampina--color--secondary);
}

.acantic-gift-card-form .agc-stepper-item.is-active::before {
    border-color: var(--kampina--color--secondary);
    box-shadow: 0 0 0 0.1875rem rgb(245 182 128 / 45%);
    color: var(--kampina--color--secondary);
}

/* Étapes franchies : pastille pleine marquée d'une coche. */
.acantic-gift-card-form .agc-stepper-item.is-completed {
    color: #374151;
}

.acantic-gift-card-form .agc-stepper-item.is-completed::before {
    background-color: var(--kampina--color--secondary);
    border-color: var(--kampina--color--secondary);
    color: #FFFFFF;
    content: "\2713";
    font-size: 0.8rem;
}

.acantic-gift-card-form .agc-stepper-item.is-completed::after {
    background-color: var(--kampina--color--secondary);
    opacity: 1;
}

.acantic-gift-card-form .agc-recap {
    color: #f5b680;
    display: flex;
    flex-basis: 100%;
    font-size: 1.25rem;
    font-weight: 700;
    justify-content: center;
    line-height: 1.3;
}

.acantic-gift-card-form .agc-recap-line {
    align-items: baseline;
    display: inline-flex;
    gap: 0.3rem;
}

.acantic-gift-card-form .agc-recap [hidden] {
    display: none;
}

.acantic-gift-card-form .agc-recap-separator {
    padding: 0 0.05rem;
}

.acantic-gift-card-form .agc-recap-shipping {
    margin-left: 0.15rem;
}

.acantic-gift-card-form .agc-recap-data {
    display: none;
}

.acantic-gift-card-form .agc-step {
    display: none;
    gap: 1rem;
}

.acantic-gift-card-form .agc-step.is-visible {
    display: grid;
}

.acantic-gift-card-form .agc-step-loader {
    align-items: center;
    background: rgb(255 255 255 / 78%);
    border-radius: 10px;
    display: none;
    inset: 0;
    justify-content: center;
    pointer-events: none;
    position: absolute;
    z-index: 10;
}

.acantic-gift-card-form .agc-step-loader.is-visible {
    display: flex;
}

.acantic-gift-card-form .agc-step-loader-icon {
    animation: agc-spin 0.85s linear infinite;
    border: 3px solid #d1d5db;
    border-radius: 50%;
    border-top-color: var(--kampina--color--secondary);
    display: inline-block;
    height: 36px;
    width: 36px;
}

.acantic-gift-card-form.is-loading .agc-step-actions button,
.acantic-gift-card-form.is-loading button[type="submit"] {
    cursor: wait;
    opacity: 0.7;
    pointer-events: none;
}

@keyframes agc-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.acantic-gift-card-form .agc-step-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.acantic-gift-card-form .agc-step-actions .agc-step-next,
.acantic-gift-card-form .agc-step-actions button[type="submit"] {
    margin-left: auto;
}

.acantic-gift-card-form .agc-section {
    border: 1px solid;
    border-radius: 10px;
    padding: 1rem;
    background: inherit;
    border-color: #d1d5db;
}

.acantic-gift-card-form .agc-section-title {
    margin: 0 0 0.75rem;
}

/* Les deux sélections (montant puis envoi) partagent le même cadre : un filet les sépare. */
.acantic-gift-card-form .agc-section-block:not([hidden]) + .agc-section-block {
    border-top: 1px solid #d1d5db;
    margin-top: 1rem;
    padding-top: 1rem;
}

/* Le bloc montant peut être retiré par la JS (carte sans option de montant) : règle explicite, le display du cadre l'emporterait sinon. */
.acantic-gift-card-form .agc-section-block[hidden] {
    display: none;
}

.acantic-gift-card-form .agc-radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.5rem;
}

.acantic-gift-card-form .agc-choice-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.acantic-gift-card-form .agc-choice-button {
    display: inline-flex;
    margin: 0;
    cursor: pointer;
}

.acantic-gift-card-form .agc-choice-button[hidden] {
    display: none;
}

.acantic-gift-card-form .agc-choice-button input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Options de montant : memes proportions que les boutons d'etapes (Suivant / Precédent), non remplis sauf selection. */
.acantic-gift-card-form .agc-choice-button span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.125rem;
    padding: 0.5rem 0.8125rem;
    border: 0.125rem solid var(--kampina--color--secondary);
    border-radius: 0.6875rem;
    color: var(--kampina--color--secondary);
    background-color: transparent;
    background-image: none;
    box-shadow: none;
    text-align: center;
    word-break: break-word;
    font-size: var(--kampina--font-size--button);
    font-family: var(--kampina--font-family--button);
    font-style: var(--kampina--font-style--button);
    font-weight: var(--kampina--font-weight--button);
    letter-spacing: var(--kampina--letter-spacing--button);
    line-height: var(--kampina--line-height--button);
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.acantic-gift-card-form .agc-choice-button input:checked + span {
    background-color: var(--kampina--color--secondary);
    border-color: var(--kampina--color--secondary);
    box-shadow: none;
    color: #FFFFFF;
}

.acantic-gift-card-form .agc-choice-button input:focus-visible + span {
    outline: 2px solid var(--kampina--color--secondary);
    outline-offset: 2px;
}

/* Variante « liste de choix » : options empilées, un libellé avec sa case à cocher, sans apparence bouton. */
.acantic-gift-card-form .agc-choice-native {
    display: grid;
    gap: 0.6rem;
}

.acantic-gift-card-form .agc-choice-native .agc-choice-button {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.acantic-gift-card-form .agc-choice-native .agc-choice-button[hidden] {
    display: none;
}

.acantic-gift-card-form .agc-choice-native .agc-choice-button input {
    appearance: auto;
    position: static;
    opacity: 1;
    pointer-events: auto;
    flex: 0 0 auto;
    box-sizing: border-box;
    width: 1.15rem;
    min-width: 1.15rem;
    max-width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    padding: 0;
    border: 0;
    background-color: transparent;
    accent-color: var(--kampina--color--secondary);
    cursor: pointer;
}

.acantic-gift-card-form .agc-choice-native .agc-choice-button span {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background-color: transparent;
    background-image: none;
    box-shadow: none;
    color: inherit;
    text-align: start;
    font-family: inherit;
    font-size: inherit;
    letter-spacing: inherit;
    line-height: inherit;
    transition: color 0.2s ease, font-weight 0.2s ease;
}

.acantic-gift-card-form .agc-choice-native .agc-choice-button input:checked + span {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--kampina--color--secondary);
    font-weight: 600;
}

.acantic-gift-card-form .agc-choice-native .agc-choice-button input:focus-visible {
    outline: 2px solid var(--kampina--color--secondary);
    outline-offset: 2px;
}

.acantic-gift-card-form .agc-choice-native .agc-choice-button input:focus-visible + span {
    outline: none;
}

/* Le champ montant personnalise est visible en permanence : il ne depend plus de l'option « Montant personnalisé ». */
.acantic-gift-card-form .agc-custom-amount-field {
    display: block;
    margin: 0.75rem 0 0;
}

.acantic-gift-card-form .agc-custom-amount-field #agc_custom_amount {
    width: auto;
    max-width: 12rem;
}

.acantic-gift-card-form .agc-block[hidden] {
    display: none;
}

/* Base commune : bouton « Choisir » du catalogue et boutons d'étapes (Suivant / Précédent / Envoyer). */
.agc-choose-button,
.acantic-gift-card-form button.button.alt {
    align-items: center;
    background-color: var(--kampina--color--secondary);
    background-image: none;
    border: 0.125rem solid var(--kampina--color--secondary);
    border-radius: 0.6875rem;
    box-shadow: none;
    color: #FFFFFF;
    cursor: pointer;
    display: inline-flex;
    font-family: var(--kampina--font-family--button);
    font-size: var(--kampina--font-size--button);
    font-style: var(--kampina--font-style--button);
    font-weight: var(--kampina--font-weight--button);
    justify-content: center;
    letter-spacing: var(--kampina--letter-spacing--button);
    line-height: var(--kampina--line-height--button);
    min-height: 2.125rem;
    padding: 0.5rem 0.8125rem;
    text-align: center;
    text-decoration: none;
    transition: background-color var(--kampina--transition-speed) var(--kampina--transition-timing-function), border-color var(--kampina--transition-speed) var(--kampina--transition-timing-function), color var(--kampina--transition-speed) var(--kampina--transition-timing-function);
    word-break: break-word;
}

/* Le « Choisir » est épinglé en bas de carte et se décline à la couleur orange du menu. */
.agc-choose-button {
    align-self: center;
    background-color: #f5b680;
    border-color: #f5b680;
    color: #ffffff;
    margin-top: auto;
}

.agc-choose-button:hover,
.acantic-gift-card-form button.button.alt:hover,
.acantic-gift-card-form button.button.alt:focus {
    background-color: transparent;
    border-color: var(--kampina--color--secondary);
    color: var(--kampina--color--secondary);
}

/* Survol/focus du « Choisir » : contour orange sur fond blanc, texe foncé conservé. */
.agc-choose-button:hover,
.agc-choose-button:focus {
    background-color: transparent;
    border-color: #f5b680;
    color: #f5b680;
}

/* Colonnes (cartes) qui contiennent directenent un bouton « Choisir » : on les rend flex en colonne pour que le bouton se colle en bas. */
.wp-block-kampina-column:has(> .agc-choose-button) {
    display: flex;
    flex-direction: column;
}

/* Liste des cartes cadeaux masquée une fois le type choisi : le thème impose display:grid, d'où la nécessité de !important. */
[data-agc-card-choice-list][hidden] {
    display: none !important;
}

/* Lien « Changer de carte » : révélé par la JS quand la liste devient masquée, aligné sur les boutons d'étapes. */
.acantic-gift-card-form .agc-choice-switcher {
    display: flex;
    justify-content: center;
}

/* Le [hidden] doit gagner sur la règle display:flex précédente (spécificité équivalente sans l'attribut). */
.acantic-gift-card-form .agc-choice-switcher[hidden] {
    display: none;
}

.acantic-gift-card-form .agc-field-label {
    font-weight: 600;
    margin: 0.25rem 0 0.35rem;
}

/* Libellé discret au-dessus des champs de saisie. */
.acantic-gift-card-form .agc-label {
    color: #6b7280;
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin: 0 0 0.3rem;
}

.acantic-gift-card-form .form-row .agc-label {
    margin-bottom: 0.3rem;
}

.acantic-gift-card-form .agc-variation-group select.input-text {
    background-color: #FFFFFF;
    border-color: #d1d5db;
    color: #000;
    padding: 0.55rem;
}

.acantic-gift-card-form .agc-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0 1rem;
}

.acantic-gift-card-form .agc-form-grid .form-row {
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.acantic-gift-card-form .form-row {
    margin-top: 0;
}

.acantic-gift-card-form .agc-col-full,
.acantic-gift-card-form .agc-col-1-2,
.acantic-gift-card-form .agc-col-1-3,
.acantic-gift-card-form .agc-col-2-3 {
    grid-column: span 1;
}

.acantic-gift-card-form .input-text,
.acantic-gift-card-form textarea {
    width: 100%;
    min-height: 40px;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    border-color: #d1d5db;
    color: #000;

    &:focus {
        border-color: #000;
    }
}

.acantic-gift-card-form textarea {
    min-height: 110px;
}

.acantic-gift-card-form .agc-step-actions button[type="submit"] {
    align-items: center;
    display: inline-flex;
    gap: 0.55rem;
}

.acantic-gift-card-form .agc-step-actions button[type="submit"] .icon-arrow {
    display: inline-block;
    flex: 0 0 auto;
    height: 1rem;
    transform: translateX(0);
    transition: transform 0.3s ease;
    width: 1rem;
}

.acantic-gift-card-form .agc-step-actions button[type="submit"]:hover .icon-arrow,
.acantic-gift-card-form .agc-step-actions button[type="submit"]:focus .icon-arrow {
    transform: translateX(0.5rem);
}

.acantic-gift-card-form button.button.alt:disabled,
.acantic-gift-card-form button.button.alt.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--kampina--color--secondary);
    color: #FFFFFF;
}

.acantic-gift-card-form .agc-field-group {
    margin-bottom: 1.25rem;
}

.acantic-gift-card-form .agc-field-group:last-child {
    margin-bottom: 0;
}

.acantic-gift-card-form .agc-field-group-title {
    color: #374151;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.65rem;
}

/* Libellés de groupe mis en avant : plus grands et soulignés de la couleur du menu. */
.acantic-gift-card-form .agc-field-group-title.agc-title-emphasis {
    border-bottom: 2px solid #f5b680;
    font-size: 1.125rem;
    padding-bottom: 0.4rem;
}

.acantic-gift-card-form .agc-help-text {
    color: #6b7280;
    font-size: 0.85rem;
    line-height: 1.35;
    margin: -0.35rem 0 0.85rem;
}

.acantic-gift-card-form .agc-field-highlight {
    border-radius: 8px;
    margin-bottom: 0.85rem;
    padding: 0.75rem;
}

.acantic-gift-card-form .agc-recipient-email-field.is-emphasized {
    background-color: rgb(245 182 128 / 10%);
    border: 1px solid #f5b680;
    box-shadow: 0 0 0 2px rgb(245 182 128 / 15%);
}

.acantic-gift-card-form .agc-recipient-address-fields[hidden] {
    display: none !important;
}

.acantic-gift-card-form .agc-recipient-email-note[hidden] {
    display: none !important;
}

@media (min-width: 768px) {
    .acantic-gift-card-form .agc-stepper {
        align-items: center;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0 0.5rem;
    }

    .acantic-gift-card-form .agc-stepper-item {
        flex: 1 1 0;
        min-width: 0;
    }

    .acantic-gift-card-form .agc-stepper-item::after {
        bottom: auto;
        display: block;
        flex: 1 1 0.75rem;
        height: 2px;
        left: auto;
        margin-left: 0.45rem;
        min-width: 0.75rem;
        position: static;
        top: auto;
        width: auto;
    }

    .acantic-gift-card-form .agc-form-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .acantic-gift-card-form .agc-col-full {
        grid-column: span 6;
    }

    .acantic-gift-card-form .agc-col-1-2 {
        grid-column: span 3;
    }

    .acantic-gift-card-form .agc-col-1-3 {
        grid-column: span 2;
    }

    .acantic-gift-card-form .agc-col-2-3 {
        grid-column: span 4;
    }
}