/* Palette condivisa dal gradiente di brand */
:root {
    --iren-gradient-stops:
        #f7c948, #f59023, #ea3d2f, #d81e5b,
        #a3268f, #4f4fbf, #1f9bd6, #14a06a;
}

.login_page {
    width: 100vw;
    height: 100vh;
    display: flex;
    /* il brand occupa lo spazio libero, il form resta ancorato a destra */
    justify-content: space-between;
    align-items: center;
    font-family: 'Exo 2', sans-serif;
    overflow: hidden;
    position: relative;
    background-color: #d81e5b;
    isolation: isolate;
}

/* Livello colorato separato: sfocato e in movimento avanti/indietro,
   così il ciclo non "riparte" mai di scatto. */
.login_page::before {
    content: '';
    position: absolute;
    /* deborda oltre il viewport: il blur non scopre i bordi */
    inset: -12%;
    z-index: -1;
    background: linear-gradient(100deg,
        var(--iren-gradient-stops),
        #f7c948);
    background-size: 220% 220%;
    background-position: 0% 50%;
    filter: blur(48px) saturate(1.15);
    transform: scale(1.06);
    animation: iren_gradient_drift 26s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
    pointer-events: none;
}

/* alternate + easing simmetrico: nessun reset brusco a fine ciclo */
@keyframes iren_gradient_drift {
    from { background-position: 0% 50%; }
    to   { background-position: 100% 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .login_page::before,
    .login_button.login,
    .hub_house, .orbit_item,
    .window, .house_roof {
        animation: none;
    }
    .orbit_item { opacity: 0.95; }
    /* i dot SMIL restano fermi sul punto di partenza: meglio nasconderli */
    .net_dot { display: none; }
}

.image_container {
    /* prende lo spazio residuo senza comprimere il margine del form */
    min-width: 0;
    height: 100%;
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Nessuno sfondo proprio: lascia trasparire il gradiente animato della pagina */
    background: transparent;
    position: relative;
}

.image_container h4 {
    font-size: 3.2rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    letter-spacing: 6px;
    margin: 0;
    padding: 0;
}

.login_container {
    /* si adatta al contenuto invece di riempire tutta la colonna */
    width: auto;
    max-width: 490px;
    /* altezza piena: così i 24px di margine valgono su tutti e quattro i lati */
    height: calc(100% - 48px);
    background-color: white;
    padding: 34px 32px;
    margin: 24px;
    display: flex;
    /* non si comprime: il margine resta uguale a destra */
    flex: 0 0 auto;
    justify-content: center;
    align-items: center;
    border-radius: 24px;
    border: none;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
    overflow-y: auto;
}

.login_form {
    background-color: white;
    /* larghezza fissa del contenuto: il pannello resta largo, i campi no */
    width: 380px;
    max-width: 100%;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login_inputs {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 20px;
}

.login_input_container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.login_input_container h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-text-darker);
    margin: 0;
}

.login_input_container h5 {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--color-text-muted);
    margin: 0;
}

.login_input_container label {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    margin-left: 5px;
}

.login_input_container input {
    border: none;
    /* grigio freddo appena virato, non azzurro */
    background-color: #eef0f4;
    padding: 13px 20px;
    border-radius: var(--radius-md);
    width: 100%;
    outline: none;
    font-size: 1rem;
    color: var(--color-text-darker, #0f172a);
    transition: background-color 0.25s;
}

.login_input_container input::placeholder {
    color: #9aa1ad;
}

.login_input_container input:focus {
    /* nessun bordo/anello: il focus si legge dal solo cambio di tono */
    background-color: #e4e8ee;
    box-shadow: none;
}

.login_buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.login_button_row {
    display: flex;
    flex-direction: row;
    gap: 12px;
    width: 100%;
}

.login_button_row .login_button {
    flex: 1;
}

.login_button {
    border: none;
    width: 100%;
    height: 48px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.3s, box-shadow 0.3s, background-color 0.3s;
}

.login_button.login {
    color: white;
    background: linear-gradient(100deg,
        #0b1220, #16305c, #1e4a8f, #16305c, #0b1220);
    background-size: 220% 100%;
    background-position: 0% 50%;
    animation: iren_button_flow 11s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
    box-shadow: 0 6px 18px rgba(11, 18, 32, 0.35);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

@keyframes iren_button_flow {
    from { background-position: 0% 50%; }
    to   { background-position: 100% 50%; }
}

.login_button.login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(11, 18, 32, 0.45);
}

.login_button.secondary {
    background-color: var(--color-bg-light);
    color: var(--color-text-dark);
    border: 1px solid var(--color-border);
}

.login_button.secondary:hover {
    background-color: var(--color-bg-gray);
}

#forgotPasswordLink {
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

#forgotPasswordLink a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

/* ========================================= */
/* === Mobile Responsiveness === */
/* ========================================= */

@media (max-width: 992px) {
    .image_container h4 {
        font-size: 2.4rem;
        letter-spacing: 4px;
    }
}

@media (max-width: 768px) {
    .login_page {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: visible;
        background-attachment: fixed;
    }

    .image_container {
        flex: none;
        height: 120px;
        margin: 0;
    }

    .image_container h4 {
        font-size: 1.9rem;
        letter-spacing: 3px;
    }

    .login_container {
        flex: 1;
        padding: 26px 18px;
        margin: 16px;
        height: auto;
        align-items: flex-start;
        border-radius: 20px;
    }

    .login_form {
        max-width: 100%;
    }

    .login_input_container h1 {
        font-size: 1.6rem;
    }
}
/* ===== TOTP / 2FA steps ===== */
.totp_steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.totp_step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #475569;
}

.totp_step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #1e293b;
    color: white;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.totp_qr_box {
    display: flex;
    justify-content: center;
    padding: 16px;
    background: white;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    margin-bottom: 4px;
}

.totp_qr_box img {
    width: 220px;
    height: 220px;
    display: block;
    image-rendering: -webkit-optimize-contrast;
}

.totp_code_input {
    letter-spacing: 0.35em;
    font-size: 1.5rem !important;
    text-align: center;
    font-weight: 700;
}

.totp_setup_instructions {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.totp_fallback_link {
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    display: block;
    margin-top: -8px;
}

.totp_fallback_link a {
    color: #64748b;
    text-decoration: underline;
    cursor: pointer;
}

.totp_fallback_link a:hover {
    color: #1e293b;
}

/* ===== Toggle visibilità password ===== */
.login_pw_wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.login_pw_wrapper input {
    width: 100%;
    padding-right: 44px;
}

.login_pw_toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.login_pw_toggle:hover { color: #1e293b; }

.login_pw_toggle svg {
    width: 18px;
    height: 18px;
}

/* ===== Button loading state ===== */
.login_button.btn_loading {
    opacity: 0.82;
    cursor: not-allowed;
    pointer-events: none;
}

.btn_spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn_spin 0.65s linear infinite;
    flex-shrink: 0;
}

.login_button.secondary .btn_spinner {
    border-color: rgba(0, 0, 0, 0.15);
    border-top-color: var(--color-primary, #1d4ed8);
}

@keyframes btn_spin {
    to { transform: rotate(360deg); }
}

/* Reset password message */
.reset_message{margin-top:10px;padding:10px 12px;border-radius:8px;font-size:13px;line-height:1.4;text-align:center;}
.reset_message.is-ok{background:#ecfdf5;color:#047857;border:1px solid #6ee7b7;}
.reset_message.is-err{background:#fef2f2;color:#b91c1c;border:1px solid #fca5a5;}

/* Password policy hint box */
.password_policy_box{background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;padding:10px 12px;}
.ppb_title{font-size:11px;font-weight:700;color:#0f172a;text-transform:uppercase;letter-spacing:.06em;margin-bottom:6px;}
.ppb_list{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:4px;}
.ppb_list li{font-size:12px;color:#64748b;line-height:1.35;display:flex;gap:8px;align-items:flex-start;}
.ppb_list li i{flex-shrink:0;margin-top:2px;font-size:10px;color:#cbd5e1;}
.ppb_list li.is-ok,
.ppb_list li.is-ok strong{color:#059669;}
.ppb_list li.is-ok i{color:#059669;font-size:12px;}
.ppb_list code{background:#fff;border:1px solid #e2e8f0;border-radius:4px;padding:0 4px;font-size:11px;}

/* ===== Descrizione commerciale sotto il titolo ===== */
.login_tagline {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--color-text-muted, #64748b);
    margin: 2px 0 0;
}

.login_tagline strong {
    color: var(--color-text-darker, #0f172a);
    font-weight: 700;
}

.login_highlights {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login_highlights li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--color-text-muted, #64748b);
}

.login_highlights li i {
    font-size: 0.72rem;
    color: #14a06a;
}

/* ===== Claim sul pannello colorato ===== */
.brand_block {
    display: flex;
    flex-direction: column;
    /* testo allineato a sinistra, animazione centrata sotto */
    align-items: flex-start;
    gap: 14px;
    padding: 0 24px;
    text-align: left;
    max-width: 560px;
    width: 100%;
}

.brand_claim {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.05rem;
    font-weight: 500;
    max-width: 420px;
    line-height: 1.55;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    margin: 0;
}

@media (max-width: 768px) {
    .brand_claim { display: none; }
    .brand_block { gap: 0; padding: 0 16px; }
    .login_highlights { display: none; }
}


/* Su mobile il pannello colorato è una fascia bassa: niente spazio */
@media (max-width: 768px) {
    .energy_viz { display: none; }
}

/* --- Casa: finestre che si accendono, tetto che respira --- */
.window {
    animation: house_window 4s ease-in-out infinite;
}

.window.w2 { animation-delay: 1.3s; }

@keyframes house_window {
    0%, 100% { opacity: 0.35; }
    40%      { opacity: 1; }
    70%      { opacity: 0.75; }
}

.house_roof {
    animation: house_glow 4s ease-in-out infinite;
}

@keyframes house_glow {
    0%, 100% { opacity: 0.75; }
    45%      { opacity: 1; }
}

/* seconda tratta più lenta, così i due flussi non vanno a tempo */

/* Placeholder a pallini della password: leggermente ingrandito
   e distanziato, altrimenti risulta minuto rispetto al testo. */
#password::placeholder {
    font-size: 1.15rem;
    letter-spacing: 0.12em;
    line-height: 1;
    vertical-align: middle;
}

/* =========================================
   === Hub radiale: la casa al centro,
   === i servizi in orbita attorno
   ========================================= */
/* l'animazione resta centrata nella colonna, sotto al testo allineato a sinistra */
.energy_viz {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 18px;
}

.energy_hub {
    position: relative;
    width: 500px;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* raggio dell'orbita, usato dalle posizioni */
    --r: 195px;
}

/* rete esagonale: linee di collegamento + dot in transito */
.hub_net {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    z-index: 1;
}

.net_lines line,
.net_hex line {
    stroke: rgba(255, 255, 255, 0.32);
    stroke-width: 1.4;
    stroke-linecap: round;
    fill: none;
}

.net_hex line {
    stroke: rgba(255, 255, 255, 0.42);
}

.net_dot {
    fill: #fff;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.85));
}

.ray_dot { fill: #fff8dc; }
/* --- Casa al centro --- */
.hub_house {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    animation: hub_breathe 6s ease-in-out infinite alternate;
}

.hub_house svg {
    width: 152px;
    height: 152px;
    overflow: visible;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.28));
}

@keyframes hub_breathe {
    from { transform: scale(1); }
    to   { transform: scale(1.04); }
}


/* --- Servizi in orbita --- */
.orbit_item {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 116px;
    margin: -38px 0 0 -58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: #fff;
    /* sopra le linee della rete */
    z-index: 2;
    animation: orbit_pulse 4.5s ease-in-out infinite;
}

.orbit_item i {
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.3rem;
    /* le linee si fermano prima del disco; il blur maschera comunque
       ciò che passa dietro senza fissare un colore che stonerebbe
       sul gradiente animato */
    background: rgba(255, 255, 255, 0.24);
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
}

.orbit_item span {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
    white-space: nowrap;
}

/* i sei servizi a 60° l'uno dall'altro, partendo da ore 12 */
.orbit_item.pos1 { transform: translate(0, calc(var(--r) * -1)); }
.orbit_item.pos2 { transform: translate(calc(var(--r) * 0.866), calc(var(--r) * -0.5)); }
.orbit_item.pos3 { transform: translate(calc(var(--r) * 0.866), calc(var(--r) * 0.5)); }
.orbit_item.pos4 { transform: translate(0, var(--r)); }
.orbit_item.pos5 { transform: translate(calc(var(--r) * -0.866), calc(var(--r) * 0.5)); }
.orbit_item.pos6 { transform: translate(calc(var(--r) * -0.866), calc(var(--r) * -0.5)); }

/* l'onda "accende" ogni servizio quando lo raggiunge */
.orbit_item.pos1 { animation-delay: 0s; }
.orbit_item.pos2 { animation-delay: 0.75s; }
.orbit_item.pos3 { animation-delay: 1.5s; }
.orbit_item.pos4 { animation-delay: 2.25s; }
.orbit_item.pos5 { animation-delay: 3s; }
.orbit_item.pos6 { animation-delay: 3.75s; }

@keyframes orbit_pulse {
    0%, 100% { opacity: 0.78; }
    45%      { opacity: 1; }
}

@media (max-width: 1200px) {
    .energy_hub { width: 400px; height: 400px; --r: 156px; }
    .hub_house svg { width: 120px; height: 120px; }
    .orbit_item { width: 96px; margin-left: -48px; }
    .orbit_item i { width: 48px; height: 48px; font-size: 1.08rem; }
    .orbit_item span { font-size: 0.68rem; }
    /* le etichette laterali non devono toccare il bordo colonna */
    .brand_block { padding: 0 40px; }
}

/* colonna sinistra stretta: hub ridotto per restare dentro */
@media (max-width: 1000px) {
    .energy_hub { width: 250px; height: 250px; --r: 98px; }
    .hub_house svg { width: 76px; height: 76px; }
    .orbit_item { width: 76px; margin-left: -38px; }
    .orbit_item i { width: 34px; height: 34px; font-size: 0.82rem; }
    .orbit_item span { font-size: 0.58rem; letter-spacing: 0.04em; }
    .brand_claim { font-size: 0.92rem; }
}
