* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 18% 18%, rgba(13, 202, 240, 0.16), transparent 48%),
        radial-gradient(circle at 82% 82%, rgba(111, 66, 193, 0.18), transparent 48%),
        #0d1117;
    color: #ffffff;
    font-family: "Poppins", "Inter", "Segoe UI", Arial, sans-serif;
    overflow: hidden;
}

.login-page {
    min-height: 100vh;
    padding: 28px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.login-logo {
    width: 88px;
    height: 88px;
    object-fit: contain;
    margin-bottom: 42px;
    filter: drop-shadow(0 0 14px rgba(13, 202, 240, .55));
}

.login-card {
    width: 420px;
    max-width: calc(100vw - 32px);
    padding: 28px 24px 26px;
    border-radius: 18px;
    background: rgba(30, 33, 36, 0.82);
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: 0 0 25px rgba(13,202,240,.08);
}

.login-title {
    margin: 0 0 20px;
    text-align: center;
    color: #ffffff;
    font-size: 29px;
    font-weight: 800;
    text-shadow: 0 0 10px rgba(255,255,255,.22);
}

.login-card form {
    background: rgba(18, 20, 24, 0.82);
    border-radius: 16px;
    padding: 28px 26px 26px;
}

label {
    display: block;
    margin: 0 0 8px;
    color: rgba(255,255,255,.42);
    font-size: 14px;
    font-weight: 800;
}

.form-control {
    width: 100%;
    height: 40px;
    margin-bottom: 22px;
    padding: 0 14px;
    border-radius: 10px;
    background: rgba(25,28,31,.78);
    border: 1px solid rgba(255,255,255,.12);
    color: #ffffff !important;
    outline: none;
    font-size: 15px;
    font-weight: 700;
}

.form-control::placeholder {
    color: rgba(255,255,255,.42);
}

.form-control:focus {
    border-color: #0dcaf0;
    box-shadow: 0 0 8px rgba(13,202,240,.35);
}

.btn-primary {
    width: 100%;
    height: 40px;
    margin-top: 2px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #0dcaf0, #0b8fc2);
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 0 18px rgba(13,202,240,.22);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 24px rgba(13,202,240,.38);
}

.footer-login {
    margin-top: 20px;
    text-align: center;
    color: rgba(255,255,255,.58);
    font-size: 12px;
    font-weight: 700;
}

.footer-login p {
    margin: 6px 0 0;
}

.footer-login a {
    color: #0dcaf0;
    text-decoration: none;
    font-weight: 800;
}

.errore-msg,
.successo-msg,
.avviso-msg {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    text-align: center;
    font-weight: 800;
    font-size: 13px;
}

.errore-msg {
    background: rgba(239,68,68,.14);
    color: #fecaca;
    border: 1px solid rgba(239,68,68,.28);
}

.successo-msg {
    background: rgba(34,197,94,.14);
    color: #bbf7d0;
    border: 1px solid rgba(34,197,94,.28);
}

.avviso-msg {
    background: rgba(14,165,233,.14);
    color: #bae6fd;
    border: 1px solid rgba(14,165,233,.30);
}

#intro-loader {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #0d1117 40%, #000 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
    animation: loaderFadeOut 1.5s ease forwards;
    animation-delay: 3s;
}

#intro-loader.hidden {
    display: none;
}

.loader-block {
    width: 80px;
    height: 80px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    transform: rotate(45deg);
}

.loader-square {
    width: 35px;
    height: 35px;
    background: rgba(13, 202, 240, 0.4);
    border: 2px solid rgba(13, 202, 240, 0.6);
    box-shadow: 0 0 20px rgba(13, 202, 240, 0.6);
    animation: buildBlock 1.2s infinite ease-in-out;
}

.loader-square:nth-child(1) { animation-delay: 0s; }
.loader-square:nth-child(2) { animation-delay: .15s; }
.loader-square:nth-child(3) { animation-delay: .3s; }
.loader-square:nth-child(4) { animation-delay: .45s; }

.login-subtitle {
    margin: -8px 0 18px;
    text-align: center;
    color: rgba(255,255,255,.62);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

.twofa-input {
    text-align: center;
    letter-spacing: 3px;
}

@media (max-width: 480px) {

    .twofa-wrapper {
        width: 100%;
    }

    .twofa-floating-logo {
        top: -40px;
    }

    .twofa-floating-logo img {
        width: 80px;
        height: 80px;
    }

    .twofa-card {
        margin-top: 40px;
        padding: 62px 20px 22px;
    }

    .twofa-title {
        font-size: 28px;
    }

    .twofa-subtitle {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .twofa-logo-wrapper {
        width: 76px !important;
        height: 76px !important;
        margin-bottom: 22px !important;
    }

    .twofa-logo-wrapper img {
        max-width: 76px !important;
        max-height: 76px !important;
    }

    .twofa-title {
        font-size: 25px !important;
    }

    .twofa-card {
        padding: 24px 20px !important;
    }
}

@keyframes buildBlock {
    0%, 100% {
        transform: scale(.7);
        opacity: .5;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }
}

.intro-text {
    margin-top: 25px;
    font-size: 1.1rem;
    color: #0dcaf0;
    text-shadow: 0 0 12px rgba(13,202,240,.7);
    letter-spacing: 1px;
}

@keyframes loaderFadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

@media (max-width: 480px) {
    body {
        overflow: auto;
    }

    .login-logo {
        width: 76px;
        height: 76px;
        margin-bottom: 26px;
    }

    .login-card {
        padding: 24px 20px;
    }

    .login-title {
        font-size: 25px;
    }
}

/* Accesso e 2FA */
body {
    background: linear-gradient(145deg, #07111f 0%, #0c1930 52%, #101827 100%);
    overflow-x: hidden;
    overflow-y: auto;
}

.login-page {
    padding: 36px 16px;
}

.login-logo {
    width: 76px;
    height: 76px;
    margin-bottom: 24px;
    filter: drop-shadow(0 10px 18px rgba(59, 130, 246, 0.34));
    animation: authLogoIn 0.72s 0.12s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-card {
    position: relative;
    width: 440px;
    padding: 30px 28px 26px;
    border-radius: 20px;
    background: rgba(13, 24, 43, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 24px 56px rgba(2, 6, 23, 0.36);
    animation: authCardIn 0.78s 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 28px;
    right: 28px;
    height: 3px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, #2563eb, #38bdf8);
}

.auth-kicker {
    display: block;
    margin-bottom: 10px;
    color: #93c5fd;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-align: center;
    text-transform: uppercase;
}

.login-title {
    margin: 0 0 7px;
    font-size: 30px;
    text-shadow: none;
}

.login-subtitle {
    margin: 0;
    color: #94a3b8;
}

.login-card form {
    margin-top: 22px;
    padding: 22px 20px 20px;
    background: rgba(5, 12, 25, 0.48);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 14px;
}

.login-card label {
    color: #cbd5e1;
    font-size: 13px;
}

.form-control {
    height: 46px;
    margin-bottom: 18px;
    border-radius: 11px;
    background: rgba(15, 23, 42, 0.82);
    border-color: rgba(148, 163, 184, 0.24);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.form-control:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.btn-primary {
    height: 46px;
    border-radius: 11px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.btn-primary:hover {
    box-shadow: 0 14px 26px rgba(37, 99, 235, 0.36);
}

.twofa-input {
    letter-spacing: 6px;
    font-size: 20px;
}

#intro-loader {
    background: #07111f;
    animation: none;
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transition: opacity 0.42s ease, visibility 0.42s ease;
}

#intro-loader.hidden {
    display: flex;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.errore-msg,
.successo-msg,
.avviso-msg {
    width: min(360px, 100%);
    margin: 18px auto 20px;
    animation: loginAlertIn 0.42s 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-notice-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(8px);
    animation: loginNoticeIn 0.32s ease both;
}

.login-notice-modal.is-closing {
    animation: loginNoticeOut 0.18s ease both;
}

.login-notice-modal.is-closing .login-notice-box {
    animation: loginNoticeBoxOut 0.18s ease both;
}

.login-notice-box {
    width: min(390px, 100%);
    padding: 30px 28px 26px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 18px;
    background: #101b2f;
    box-shadow: 0 28px 70px rgba(2, 6, 23, 0.48);
    text-align: center;
    animation: loginNoticeBoxIn 0.48s 0.04s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.login-notice-mark {
    width: 52px;
    height: 52px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.18);
    border: 1px solid rgba(96, 165, 250, 0.32);
    animation: loginNoticeMarkIn 0.38s 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.login-notice-mark::before {
    content: "";
    width: 15px;
    height: 8px;
    margin-top: -3px;
    border-left: 3px solid #bfdbfe;
    border-bottom: 3px solid #bfdbfe;
    transform: rotate(-45deg);
}

.login-notice-timeout .login-notice-mark {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(251, 191, 36, 0.34);
}

.login-notice-timeout .login-notice-mark::before {
    width: 3px;
    height: 17px;
    margin: 0;
    border: 0;
    border-radius: 999px;
    background: #fde68a;
    box-shadow: 0 12px 0 -1px #fde68a;
    transform: none;
}

.login-notice-box h2 {
    margin: 0;
    color: #f8fafc;
    font-size: 24px;
    animation: loginNoticeContentIn 0.32s 0.29s ease both;
}

.login-notice-box p {
    margin: 11px 0 22px;
    color: #aebed3;
    font-weight: 650;
    line-height: 1.5;
    animation: loginNoticeContentIn 0.32s 0.35s ease both;
}

.login-notice-close {
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 11px;
    background: #2563eb;
    color: #ffffff;
    font-size: 15px;
    font-weight: 850;
    cursor: pointer;
    animation: loginNoticeContentIn 0.32s 0.41s ease both;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.login-notice-close:hover {
    transform: translateY(-2px);
    background: #1d4ed8;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.32);
}

@keyframes loginNoticeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes loginNoticeOut {
    to { opacity: 0; }
}

@keyframes authLogoIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes authCardIn {
    from { opacity: 0; transform: translateY(14px) scale(0.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes loginNoticeBoxIn {
    from { opacity: 0; transform: translateY(28px) scale(0.94); }
    70% { transform: translateY(-3px) scale(1.01); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes loginNoticeBoxOut {
    to { opacity: 0; transform: translateY(8px) scale(0.98); }
}

@keyframes loginAlertIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes loginNoticeMarkIn {
    from { opacity: 0; transform: scale(0.6) rotate(-12deg); }
    to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes loginNoticeContentIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
    .login-page { padding: 28px 14px; }
    .login-logo { margin-bottom: 20px; }
    .login-card { padding: 28px 20px 20px; }
    .login-card form { padding: 20px 16px 16px; }
    .login-title { font-size: 27px; }
}

@media (prefers-reduced-motion: reduce) {
    .login-logo,
    .login-card,
    .login-notice-modal,
    .login-notice-box {
        animation: none !important;
    }
}
