/**
 * auth.css — Stili Modulari Schermate di Autenticazione AstaCerta
 * Usato da: accedi.php, registrati.php, attiva-account.php
 * Brand Identity: Navy Blue AstaCerta (#153050 / #0f2238) con accenti Oro (#d4b24e)
 */

.auth-container {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 130px 20px 70px;
    margin-top: -70px; /* Annulla il padding-top di 70px del body per far toccare la navbar direttamente */
    background: linear-gradient(180deg, #f0f6ff 0%, #edf2f7 45%, #e2e8f0 100%);
    position: relative;
    margin-bottom: 0 !important;
}

/* Rimuove lo stacco bianco generato da mt-5 di Bootstrap sul footer nelle schermate di auth */
.auth-container + footer,
main.auth-container ~ footer {
    margin-top: 0 !important;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 380px;
    background: linear-gradient(135deg, #0f2238 0%, #153050 60%, #1e426d 100%);
    clip-path: ellipse(120% 70% at 50% 0%);
    z-index: 0;
}

.auth-card {
    position: relative;
    z-index: 1;
    max-width: 480px;
    width: 100%;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 45px -10px rgba(15, 34, 56, 0.22), 0 10px 20px -5px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(226, 232, 240, 0.9);
    padding: 44px 38px;
}

.auth-brand-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
}

.auth-brand-header img {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.auth-brand-title {
    font-size: 26px;
    font-weight: 800;
    color: #153050;
    letter-spacing: -0.5px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-floating > .form-control {
    border-radius: 12px;
    border: 1.5px solid #cbd5e1;
    height: 56px;
    padding: 16px 14px 6px;
    font-size: 15px;
    font-weight: 500;
    color: #153050;
    background: #ffffff;
    transition: all 0.2s ease;
}

.form-floating > .form-control:focus {
    border-color: #153050;
    box-shadow: 0 0 0 4px rgba(21, 48, 80, 0.15);
    background: #ffffff;
}

.form-floating > label {
    padding: 16px 14px;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

.btn-auth-primary {
    background: linear-gradient(135deg, #153050 0%, #1e426d 100%);
    border: none;
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
    border-radius: 12px;
    height: 52px;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(21, 48, 80, 0.28);
    position: relative;
    letter-spacing: -0.2px;
}

.btn-auth-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #0f2238 0%, #153050 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(21, 48, 80, 0.4);
    color: #ffffff;
}

.btn-auth-primary:active:not(:disabled) {
    transform: translateY(0);
}

/* Stato caricamento / disabilitato moderno e armonico */
.btn-auth-primary:disabled {
    background: linear-gradient(135deg, #153050 0%, #1e426d 100%) !important;
    opacity: 0.88 !important;
    color: #ffffff !important;
    cursor: not-allowed;
    box-shadow: 0 4px 14px rgba(21, 48, 80, 0.2) !important;
    transform: none !important;
}

.btn-auth-primary .spinner-border {
    width: 1.15rem;
    height: 1.15rem;
    border-width: 2.2px;
    color: #ffffff !important;
    opacity: 1 !important;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 28px 0 20px;
    color: #94a3b8;
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}

.auth-divider:not(:empty)::before {
    margin-right: 14px;
}

.auth-divider:not(:empty)::after {
    margin-left: 14px;
}

.auth-link {
    color: #153050;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-link:hover {
    color: #0f2238;
    text-decoration: underline;
}

/* Alert Errore Rosso AstaCerta (.alert-danger / .alert-rosso) con gradiente, text-shadow e bordo cesellato */
.auth-card .alert.alert-danger,
.auth-card .alert.alert-rosso,
.alert.alert-rosso {
    color: #ffffff !important;
    background: linear-gradient(to bottom, #ee5f5b, #c43c35) repeat-x !important;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25) !important;
    border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25) !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 14px rgba(196, 60, 53, 0.32) !important;
    padding: 12px 16px !important;
}

.auth-card .alert.alert-danger a,
.auth-card .alert.alert-rosso a,
.alert.alert-rosso a {
    color: #ffffff !important;
    text-decoration: underline !important;
    font-weight: 700 !important;
}

/* Evidenziazione Bordo Rosso per campi e checkbox con errore (.is-invalid) */
.auth-card .form-control.is-invalid,
.auth-card .form-select.is-invalid {
    border-color: #dc2626 !important;
    background-color: #fffafb !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18) !important;
}

.auth-card .form-check-input.is-invalid {
    border-color: #dc2626 !important;
    border-width: 2px !important;
    background-color: #fef2f2 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25) !important;
}

/* Toggle Password Occhiolino AstaCerta */
.auth-password-wrapper {
    position: relative;
}

.auth-password-wrapper .form-control {
    padding-right: 48px !important;
}

.auth-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    z-index: 6;
    padding: 6px 8px;
    line-height: 1;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.auth-toggle-password .material-icons-outlined {
    font-size: 21px;
    user-select: none;
}

.auth-toggle-password:hover {
    color: #153050;
    background-color: rgba(21, 48, 80, 0.05);
}

.auth-toggle-password:focus {
    outline: none;
    color: #153050;
}

.ac-hp-field {
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
}

.activation-container {
    min-height: calc(100vh - 180px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 15px 40px;
    background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
}

.activation-card {
    max-width: 480px;
    width: 100%;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    padding: 40px 32px;
    text-align: center;
}

.status-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 24px;
}

.status-icon.success {
    background: #DEF7EC;
    color: #0E9F6E;
}

.status-icon.error {
    background: #FDE8E8;
    color: #F05252;
}

/* Gestione etichette lunghe in form-floating (es. Referente facoltativo) */
.form-floating > label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

@media (max-width: 576px) {
    .auth-card {
        padding: 32px 20px;
    }
}
