/* Identity login styles (shared across Account pages)
   Consolidated to avoid duplicates and keep a single source of truth.
*/

:root {
    --login-primary: #4A90E2;
    --login-primary-dark: #357ABD;
    --login-border: #e8e8e8;
    --login-muted: #6c757d;
    --login-text: #495057;
    --login-bg: #f8f9fa;
    --login-danger: #dc3545;
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background: white;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center; /* ? RIPRISTINATO a center per centrare verticalmente */
    justify-content: center;
    background: white;
    padding: 1.25rem; /* ? RIPRISTINATO padding normale */
    position: fixed;
    inset: 0;
    overflow-y: auto;
}

.login-card {
    background: white;
    border-radius: 18px;
    box-shadow: 0 16px 55px rgba(0, 0, 0, 0.14);
    overflow: hidden;
    width: 100%;
    max-width: 560px;
    animation: fadeInUp 0.6s ease-out;
    margin: auto; /* ? RIPRISTINATO margin auto */
    border: 1px solid var(--login-border);
}

.login-grid {
    display: block;
}

.login-form-pane {
    background: white;
}

.login-aside {
    display: none;
}

.login-aside-inner {
    padding: 2rem 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    color: white;
    background: linear-gradient(135deg, var(--login-primary) 0%, var(--login-primary-dark) 100%);
}

.login-aside-inner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

.login-aside-content {
    position: relative;
    z-index: 1;
    text-align: left;
}

.login-aside-title {
    margin: 0.5rem 0 0;
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.login-aside-subtitle {
    margin: 0.75rem 0 0;
    opacity: 0.95;
    line-height: 1.45;
}

.login-header {
    background: linear-gradient(135deg, var(--login-primary) 0%, var(--login-primary-dark) 100%);
    padding: 1.5rem 2rem; /* ? RIDOTTO da 1.75rem */
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

.login-logo {
    width: 85px; /* ? RIDOTTO da 92px */
    height: 85px;
    margin: 0 auto 0.7rem; /* ? RIDOTTO da 0.9rem */
    background: white;
    border-radius: 50%;
    padding: 0.75rem; /* ? RIDOTTO da 0.85rem */
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.login-logo:hover {
    transform: scale(1.05) rotate(4deg);
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-title {
    color: white;
    font-size: 1.5rem; /* ? RIDOTTO da 1.6rem */
    font-weight: 650;
    margin: 0;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.login-body {
    padding: 1.75rem 2rem; /* ? RIDOTTO da 2rem */
}

.form-group {
    margin-bottom: 1rem; /* ? RIDOTTO da 1.15rem */
    position: relative;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 0.85rem 3rem 0.85rem 0.95rem;
    font-size: 0.98rem;
    transition: all 0.3s ease;
    background: var(--login-bg);
    width: 100%;
}

.input-wrapper.has-toggle input {
    padding-right: 3.5rem;
}

.input-wrapper input:focus {
    border-color: var(--login-primary);
    background: white;
    box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.14);
    outline: 0;
}

.input-wrapper input::placeholder {
    color: #adb5bd;
}

.input-label {
    margin-bottom: 0.45rem;
    color: var(--login-text);
    font-weight: 600;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.label-icon {
    color: var(--login-primary);
    font-size: 1.25rem;
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    user-select: none;
}

.toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--login-muted);
    cursor: pointer;
    padding: 0.35rem;
    font-size: 1.25rem;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password:hover {
    color: var(--login-primary);
    transform: translateY(-50%) scale(1.08);
}

.toggle-password:focus {
    outline: none;
}

.remember-me-container {
    display: flex;
    align-items: center;
    margin-bottom: 1rem; /* ? RIDOTTO da 1.1rem */
}

.custom-checkbox {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 22px;
    width: 22px;
    background-color: var(--login-bg);
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    margin-right: 0.65rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.custom-checkbox input:checked ~ .checkmark {
    background: linear-gradient(135deg, var(--login-primary) 0%, var(--login-primary-dark) 100%);
    border-color: var(--login-primary);
}

.checkmark .material-symbols-outlined {
    color: white;
    font-size: 16px;
    display: none;
}

.custom-checkbox input:checked ~ .checkmark .material-symbols-outlined {
    display: block;
}

.checkbox-label {
    color: var(--login-text);
    font-size: 0.92rem;
    margin: 0;
    font-weight: 500;
}

.btn-login {
    width: 100%;
    padding: 0.95rem;
    font-size: 1.05rem;
    font-weight: 650;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--login-primary) 0%, var(--login-primary-dark) 100%);
    color: white;
    transition: all 0.2s ease;
    box-shadow: 0 6px 18px rgba(74, 144, 226, 0.35);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
    transition: left 0.45s ease;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(74, 144, 226, 0.42);
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:active {
    transform: translateY(0);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.1rem 0 0.75rem; /* ? RIDOTTO da 1.25rem 0 0.9rem */
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e6e6e6;
}

.divider span {
    padding: 0 0.9rem;
    color: var(--login-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-links {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.4rem; /* ? RIDOTTO da 0.45rem */
    margin-top: 0.25rem;
}

/* ─── Provider di login esterni ─────────────────────────────────────────────
   Volutamente secondari rispetto al pulsante principale: contorno invece che
   pieno, così la gerarchia della pagina resta leggibile anche con più provider. */
.external-providers {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-provider {
    width: 100%;
    padding: 0.8rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1.5px solid #dcdcdc;
    border-radius: 12px;
    background: #fff;
    color: var(--login-text, #333);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
}

.btn-provider:hover {
    border-color: var(--login-primary);
    box-shadow: 0 4px 14px rgba(74, 144, 226, 0.18);
    transform: translateY(-1px);
}

.btn-provider:active {
    transform: translateY(0);
}

.btn-provider .material-symbols-outlined {
    font-size: 20px;
    color: var(--login-primary);
}

/* ─── Esito di un accesso esterno non riuscito ─────────────────────────────── */
.login-card-narrow {
    max-width: 480px;
}

.outcome-box {
    text-align: center;
    padding: 0.5rem 0 1.25rem;
}

.outcome-icon {
    font-size: 44px;
    color: var(--login-primary);
}

.outcome-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0.6rem 0 0.5rem;
}

.outcome-detail {
    color: var(--login-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.btn-login-secondary {
    background: #fff;
    color: var(--login-primary);
    border: 1.5px solid var(--login-primary);
    box-shadow: none;
    text-decoration: none;
}

.btn-login-secondary:hover {
    box-shadow: 0 6px 18px rgba(74, 144, 226, 0.22);
    color: var(--login-primary);
}

.login-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    color: var(--login-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    position: relative;
    padding: 0.3rem 0; /* ? RIDOTTO da 0.35rem */
}

.login-link .material-symbols-outlined {
    font-size: 1.05rem;
}

.login-link::after {
    content: '';
    position: absolute;
    bottom: 0.15rem;
    left: 50%;
    width: 0;
    height: 1.5px;
    background: linear-gradient(135deg, var(--login-primary) 0%, var(--login-primary-dark) 100%);
    transition: all 0.2s ease;
    transform: translateX(-50%);
}

.login-link:hover {
    color: var(--login-primary-dark);
}

.login-link:hover::after {
    width: 100%;
}

.footer-text {
    text-align: center;
    margin-top: 1rem; /* ? RIDOTTO da 1.2rem */
    padding-top: 0.9rem; /* ? RIDOTTO da 1.1rem */
    border-top: 1px solid #e6e6e6;
    color: var(--login-muted);
    font-size: 0.82rem;
}

.alert {
    border-radius: 12px;
    border: none;
    margin-bottom: 1rem; /* ? RIDOTTO da 1.15rem */
    animation: slideInDown 0.4s ease-out;
}

.text-danger {
    font-size: 0.85rem;
    margin-top: 0.4rem;
    display: block;
    animation: shake 0.4s ease-out;
    color: var(--login-danger);
}

.validation-summary-valid {
    display: none;
}

.validation-summary-errors {
    display: block;
}

@media (max-width: 576px) {
    .login-wrapper {
        padding: 1.5rem 0.9rem; /* ? RIDOTTO padding verticale */
    }

    .login-card {
        border-radius: 16px;
    }

    .login-body {
        padding: 1.4rem 1.35rem; /* ? RIDOTTO da 1.6rem */
    }

    .login-logo {
        width: 70px; /* ? RIDOTTO da 74px */
        height: 70px;
    }

    .login-title {
        font-size: 1.35rem; /* ? RIDOTTO da 1.4rem */
    }
}

@media (min-width: 992px) {
    .login-card {
        max-width: 980px;
    }

    .login-grid {
        display: grid;
        grid-template-columns: 0.95fr 1.05fr;
        min-height: 520px;
    }

    .login-aside {
        display: block;
    }

    .login-header {
        display: none;
    }

    .login-body {
        padding: 2.25rem 2.5rem; /* ? RIDOTTO da 2.5rem */
    }

    .login-links {
        text-align: left;
    }

    .login-link {
        justify-content: flex-start;
    }

    .footer-text {
        text-align: left;
    }

    .login-aside-content {
        text-align: center;
    }

    .login-aside .login-logo {
        width: 128px;
        height: 128px;
        padding: 1rem;
        margin: 0 auto 1rem;
    }

    .login-aside-title {
        font-size: 2rem;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
