/* Authentication dialogs use the marketing palette while keeping Bootstrap's
   native centering and allowing only the form content to scroll on short screens. */
.propia-auth-modal .modal-dialog {
    max-height: calc(100vh - var(--bs-modal-margin) - var(--bs-modal-margin));
    max-height: calc(100dvh - var(--bs-modal-margin) - var(--bs-modal-margin));
}

#loginModal .modal-dialog {
    max-width: 640px;
}

#registerModal .modal-dialog {
    max-width: 720px;
}

#forgotPasswordModal .modal-dialog {
    max-width: 560px;
}

.propia-auth-modal .modal-content {
    max-height: calc(100vh - var(--bs-modal-margin) - var(--bs-modal-margin));
    max-height: calc(100dvh - var(--bs-modal-margin) - var(--bs-modal-margin));
    overflow: hidden;
    border: 1px solid var(--propia-border);
    border-radius: var(--propia-radius-lg);
    background: var(--propia-surface-tinted);
    color: var(--propia-text);
    box-shadow: var(--propia-shadow-lg);
}

.propia-auth-modal .modal-header {
    flex-shrink: 0;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--propia-border);
    background: linear-gradient(120deg, var(--propia-primary-soft), var(--propia-surface-tinted) 74%);
}

.auth-modal__heading {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.auth-modal__eyebrow {
    color: var(--propia-primary);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .075em;
    line-height: 1.3;
    text-transform: uppercase;
}

.propia-auth-modal .modal-title {
    color: var(--propia-text);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.auth-modal__title-row {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
}

.auth-modal__title-icon {
    display: inline-grid;
    flex: 0 0 2.25rem;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    border: 1px solid var(--propia-primary-soft-border);
    border-radius: 50%;
    background: var(--propia-primary-soft);
    color: var(--propia-primary);
}

.auth-modal__title-icon svg {
    display: block;
    width: 1.2rem;
    height: 1.2rem;
    fill: currentColor;
}

.propia-auth-modal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: 1.5rem;
}

.propia-auth-modal .modal-content > form:not(.d-none),
.propia-auth-modal .modal-content > #registerSuccess:not(.d-none) {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.propia-auth-modal .form-control {
    min-height: 46px;
    border-color: color-mix(in srgb, var(--propia-primary) 28%, var(--propia-border));
    border-radius: var(--propia-radius-sm);
    background-color: var(--propia-bg-alt);
    color: var(--propia-text);
    box-shadow: 0 1px 2px color-mix(in srgb, var(--propia-text) 5%, transparent);
}

.propia-auth-modal .form-control:focus {
    border-color: var(--propia-primary);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--propia-primary) 22%, transparent);
}

.propia-auth-modal .form-control.is-invalid {
    border-color: var(--mud-palette-error, var(--bs-danger));
    background-image: none;
}

.propia-auth-modal .form-control.is-invalid:focus {
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--mud-palette-error, var(--bs-danger)) 16%, transparent);
}

.auth-field__error {
    margin-top: .25rem;
    color: var(--mud-palette-error, var(--bs-danger));
    font-size: .75rem;
    line-height: 1.4;
}

.propia-auth-modal .form-control:disabled,
.propia-auth-modal .form-control[readonly] {
    border-color: var(--propia-border);
    background-color: color-mix(in srgb, var(--propia-bg) 72%, var(--propia-surface));
    color: var(--propia-text-muted);
    box-shadow: none;
    cursor: not-allowed;
}

.auth-field .form-text,
.auth-modal__body .text-body-secondary,
.auth-modal__body .text-muted {
    color: var(--propia-text-muted) !important;
}

.propia-auth-modal .modal-footer {
    flex-shrink: 0;
    gap: .75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--propia-border);
    background: var(--propia-bg);
}

.propia-auth-modal .modal-footer .btn-marketing-primary {
    min-height: 44px;
    padding-inline: 1.25rem;
    border-radius: var(--propia-radius-sm);
    font-weight: 700;
}

.propia-auth-modal .modal-footer .btn-marketing-primary .auth-modal__button-icon {
    display: inline-block;
    width: 1.15rem;
    height: 1.15rem;
    margin-right: .35rem;
    fill: currentColor;
    vertical-align: -.2em;
}

.propia-auth-modal .modal-footer .btn-link {
    color: var(--propia-primary);
    font-weight: 600;
    text-decoration-color: color-mix(in srgb, var(--propia-primary) 35%, transparent);
}

.propia-auth-modal .modal-footer .btn-link:focus-visible,
.propia-auth-modal .modal-footer .btn:focus-visible,
.propia-auth-modal .btn-close:focus-visible {
    outline: 2px solid var(--propia-primary);
    outline-offset: 3px;
    box-shadow: none;
}

.register-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border: 1px solid color-mix(in srgb, var(--propia-success) 24%, var(--propia-border));
    border-radius: 50%;
    background: color-mix(in srgb, var(--propia-success) 10%, var(--propia-surface));
    color: var(--propia-success);
}

#registerAccessCodeKo {
    color: var(--propia-warning) !important;
}

@media (max-width: 575.98px) {
    .propia-auth-modal .modal-dialog {
        width: calc(100% - 1rem);
        max-width: none;
        margin: var(--bs-modal-margin) auto;
    }

    .propia-auth-modal .modal-header {
        padding: .75rem 1rem;
    }

    .propia-auth-modal .modal-body {
        padding: 1rem;
    }

    .propia-auth-modal .modal-footer {
        padding: .6rem 1rem;
    }

    .auth-form-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: .8rem;
    }

    .auth-field--wide {
        grid-column: auto;
    }

    #registerModal .modal-footer {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    #registerModal .modal-footer .me-auto {
        margin-right: 0 !important;
    }

    #registerModal .modal-footer > .btn {
        width: 100%;
    }
}

/* The congratulation of a checked access code: a narrow card whose body is the shared gift
   (AccessCodeSignupGift — the hero and the families of rights style themselves, and the hero gives
   back height on a short window). The close button sits over the hero, out of the flow, and leads
   back to the registration form like the footer action. The body scrolls (Bootstrap's
   modal-dialog-scrollable) when the plan lists many rights, and the footer stays pinned under it:
   eight open families are a tall body. */
#accessCodeGiftModal .modal-dialog {
    max-width: 30rem;
}

#accessCodeGiftModal .modal-content {
    position: relative;
}

/* The families of rights in this modal are the application's own cards (PlanFamilyCards, the
   markup of « Mon abonnement »), written against MudBlazor's palette tokens. The vitrine loads
   no MudBlazor and defines none, so the modal lends them from its own palette — and from here
   only: nothing outside this modal reads them (founder, 2026-10-08: « garde le même composant »). */
#accessCodeGiftModal {
    --mud-palette-primary: var(--propia-primary);
    --mud-palette-text-primary: var(--propia-text);
    --mud-palette-text-secondary: var(--propia-text-muted);
    --mud-palette-success: var(--propia-success);
    --mud-palette-info: var(--propia-info);
    --mud-palette-warning: var(--propia-warning);
    --mud-palette-surface: var(--propia-surface);
    --mud-palette-divider: var(--propia-border);
    --mud-default-borderradius: var(--propia-radius-md);
}

.access-code-gift-modal__close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    z-index: 2;
}

/* #id + class: it must beat ".propia-auth-modal .modal-body" (1.5rem), or the value declared here is never used. */
#accessCodeGiftModal .access-code-gift-modal__body {
    padding: 1rem;
}

#accessCodeGiftModal .modal-footer .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

/* « Découvrir Propia », offered ONLY after a promotional link (/inscription), in two places: under the form of the
   registration and under the way back of the congratulation. ONE button: both links carry
   `btn btn-outline-marketing auth-discover-link`, so the colours, the border and the hover are the header's own
   (neutral and outlined, design rule 5 — .btn-outline-marketing, marketing.css) and its SHAPE is declared once, here:
   full width, centred, the touch height of the form's controls, the brand's symbol at the size of the header's. */
.propia-auth-modal .auth-discover-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    min-height: var(--auth-control-height, 40px);
    border-radius: var(--propia-radius-sm);
    font-weight: 500;
    line-height: 1.35;
    text-decoration: none;
}

.propia-auth-modal .auth-discover-link__symbol {
    width: 18px;
    height: 18px;
}

.propia-auth-modal .auth-discover-link:focus-visible {
    outline: 2px solid var(--propia-primary);
    outline-offset: 3px;
    box-shadow: none;
}

/* Under the form it takes the form's own rhythm (the same gap as the action above); under the congratulation the
   footer's gap does it. */
#registerModal .auth-discover-link {
    margin-top: var(--auth-section-gap, 12px);
}
