/*
 * Accesso homepage moderno.
 * Il motore PHP, il CAPTCHA e il flusso 2FA rimangono invariati.
 */
.ait-home-honeypot {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}

body.ait-login-modal-open {
    overflow: hidden;
}

.ait-login-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    padding: clamp(12px, 3vw, 32px);
    box-sizing: border-box;
}

.ait-login-modal.is-open {
    display: grid;
    place-items: center;
}

.ait-login-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 17, 32, 0.78);
    backdrop-filter: blur(6px);
}

.ait-login-modal-card {
    position: relative;
    z-index: 1;
    width: min(100%, 640px);
    max-height: calc(100vh - clamp(24px, 6vw, 64px));
    overflow-y: auto;
    box-sizing: border-box;
    padding: clamp(24px, 4vw, 38px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: clamp(18px, 2.5vw, 26px);
    background:
        radial-gradient(circle at top right, rgba(40, 114, 190, 0.24), transparent 38%),
        linear-gradient(145deg, #102f53 0%, #06182b 100%);
    color: #ffffff;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
}

.ait-login-modal-card form {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.ait-login-modal-close {
    position: absolute;
    top: clamp(10px, 2vw, 16px);
    right: clamp(12px, 2vw, 18px);
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: transform 180ms ease, background-color 180ms ease;
}

.ait-login-modal-close:hover,
.ait-login-modal-close:focus-visible {
    background: rgba(255, 255, 255, 0.16);
    transform: rotate(4deg) scale(1.04);
}

.ait-login-modal-title {
    padding-right: 48px;
    color: #ffffff;
    font-size: clamp(1.55rem, 3vw, 2.15rem);
    font-weight: 800;
    line-height: 1.12;
    text-align: left;
}

.ait-login-modal-intro {
    margin: 10px 0 clamp(20px, 3vw, 28px);
    color: #dbe7f3;
    font-size: clamp(0.92rem, 1.6vw, 1.02rem);
    line-height: 1.55;
    text-align: left;
}

.ait-home-login-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(12px, 2vw, 18px);
    width: 100%;
    min-width: 0;
}

.ait-home-login-field {
    display: grid;
    min-width: 0;
    gap: 7px;
}

.ait-home-login-field span,
.ait-home-security-title {
    color: #dbe7f3;
    font-size: clamp(0.76rem, 1.3vw, 0.86rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ait-home-login-field input,
.ait-home-captcha input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: clamp(50px, 6vw, 58px);
    box-sizing: border-box;
    border: 1px solid #9eb1c5;
    border-radius: 10px;
    background: #ffffff;
    color: #10253d;
    font-size: clamp(0.98rem, 1.8vw, 1.08rem);
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.ait-home-login-field input {
    padding: 0 clamp(14px, 2vw, 18px);
}

.ait-home-login-field input:focus,
.ait-home-captcha input:focus {
    border-color: #2d83d5;
    box-shadow: 0 0 0 3px rgba(45, 131, 213, 0.22);
}

.ait-home-security-title {
    margin: clamp(20px, 3vw, 28px) 0 9px;
}

.ait-home-captcha {
    display: grid;
    grid-template-columns: minmax(160px, 190px) minmax(0, 1fr) 58px;
    gap: 10px;
    align-items: center;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.ait-home-captcha img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 190 / 64;
    border-radius: 9px;
    background: #ffffff;
    object-fit: cover;
}

.ait-home-captcha input {
    padding: 0 12px;
    text-align: center;
    text-transform: uppercase;
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 800;
    letter-spacing: 0.12em;
}

.ait-home-refresh {
    width: 58px;
    max-width: 100%;
    height: clamp(50px, 6vw, 58px);
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: linear-gradient(180deg, #ffb942 0%, #db6500 100%);
    color: #ffffff;
    font-size: 1.35rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 0 #8a3c00;
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.ait-home-refresh:hover,
.ait-home-refresh:focus-visible {
    filter: brightness(1.07);
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #8a3c00;
}

.ait-home-submit {
    width: 100%;
    max-width: 100%;
    min-height: clamp(50px, 6vw, 56px);
    margin-top: 14px;
    padding: 12px 20px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffae32 0%, #e65200 100%);
    color: #ffffff;
    font-size: clamp(0.95rem, 1.7vw, 1.08rem);
    font-weight: 800;
    letter-spacing: 0.03em;
    cursor: pointer;
    box-shadow: 0 5px 0 #8d3500, 0 12px 24px rgba(0, 0, 0, 0.2);
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.ait-home-submit:not(:disabled):hover,
.ait-home-submit:not(:disabled):focus-visible {
    filter: brightness(1.06);
    transform: translateY(-2px);
    box-shadow: 0 7px 0 #8d3500, 0 16px 30px rgba(0, 0, 0, 0.24);
}

.ait-home-submit:not(:disabled):active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #8d3500, 0 8px 16px rgba(0, 0, 0, 0.2);
}

.ait-home-submit:disabled {
    opacity: 0.48;
    cursor: not-allowed;
    box-shadow: none;
}

.ait-home-login-error {
    margin: 0 0 16px;
    padding: 11px 13px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9px;
    background: #7e1721;
    color: #ffffff;
    font-size: 0.84rem;
    line-height: 1.45;
}

.ait-home-captcha-message {
    min-height: 20px;
    margin-top: 8px;
    color: #ffd06b;
    font-size: 0.78rem;
    line-height: 1.4;
}

.ait-home-captcha input.is-valid {
    border-color: #279b37;
    box-shadow: 0 0 0 3px rgba(39, 155, 55, 0.22);
}

.ait-home-captcha input.is-invalid {
    border-color: #cc0000;
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.2);
}

.ait-home-captcha-message.is-valid {
    color: #7ee397;
    font-weight: 700;
}

.ait-home-captcha-message.is-invalid {
    color: #ff9b9b;
    font-weight: 700;
}

.ait-home-captcha-message.is-checking {
    color: #ffd06b;
}

.ait-login-register-link {
    margin-top: clamp(18px, 3vw, 24px);
    color: #cbd9e7;
    font-size: clamp(0.84rem, 1.5vw, 0.94rem);
    line-height: 1.5;
    text-align: center;
}

.ait-login-register-link a {
    color: #ffb23c;
    font-weight: 800;
    text-decoration: none;
}

.ait-login-register-link a:hover,
.ait-login-register-link a:focus-visible {
    text-decoration: underline;
}

@media (max-width: 680px) {
    .ait-login-modal-card {
        width: 100%;
        padding: 22px 18px;
        border-radius: 18px;
    }

    .ait-home-login-fields {
        grid-template-columns: minmax(0, 1fr);
    }

    .ait-home-captcha {
        grid-template-columns: minmax(0, 1fr) 58px;
    }

    .ait-home-captcha img {
        grid-column: 1 / -1;
        width: min(100%, 280px);
        justify-self: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ait-login-modal-close,
    .ait-home-refresh,
    .ait-home-submit {
        transition-duration: 1ms;
    }
}