/* Variabili CSS */
:root {
    --primary-gradient: linear-gradient(135deg, #763895 0%, #5a2b6f 100%);
    --secondary-gradient: linear-gradient(135deg, #F7956C 0%, #F15B22 100%);
    --accent-color: #763895;
    --accent-secondary: #F7956C;
    --accent-orange: #F15B22;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --text-light: #a0aec0;
    --white: #ffffff;
    --error-color: #e53e3e;
    --success-color: #38a169;
    --border-color: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-light: 0 4px 6px rgba(118, 56, 149, 0.1);
    --shadow-medium: 0 10px 25px rgba(118, 56, 149, 0.15);
    --shadow-heavy: 0 25px 50px rgba(0, 0, 0, 0.25);
}

/* Body / Html: Sfondo Globale a tutto schermo con griglia */
body, html {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    /* Background fisso con gradient e griglia */
    background: 
        linear-gradient(rgba(255,255,255,0.14) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.14) 1px, transparent 1px),
        var(--primary-gradient);
    background-size: 50px 50px, 50px 50px, cover;
    background-position: 0 0, 0 0, center center;
    background-attachment: fixed, fixed, fixed;
    background-repeat: repeat, repeat, no-repeat;
    font-family: 'Nunito', sans-serif;
}

/* Container principale: Centra la card perfettamente */
.login-page-container {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

/* MAIN CARD - Form Centrato */
.login-card-wrapper {
    width: 100%;
    max-width: 450px;
    background: var(--white);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--shadow-heavy);
    position: relative;
    z-index: 10;
}

/* Form Side - Occupa tutto lo spazio */
.form-side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2.5rem 3rem;
    position: relative;
    background: var(--white);
}

.login-form-wrapper {
    width: 100%;
    max-width: 420px;
}

.form-header-section {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-img {
    height: 65px;
    width: auto;
    margin-bottom: 0.875rem;
}

.brand-title {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    letter-spacing: -0.5px;
}

.form-title {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Form Inputs */
.form-group { 
    margin-bottom: 1.375rem; 
    display: block;
    position: relative;
} 

.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 1.25rem;
    color: var(--text-light);
    font-size: 1.1rem;
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.input-wrapper:focus-within i {
    color: var(--accent-color);
    transform: scale(1.1);
}

.input-wrapper input {
    width: 100%;
    padding: 1rem 1rem 1rem 3.5rem;
    border: 2px solid #edf2f7;
    border-radius: 12px;
    font-size: 1rem;
    background: #f8fafc;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-primary);
    font-weight: 500;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(118, 56, 149, 0.1);
    transform: translateY(-1px);
}

.input-wrapper input.error {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.input-wrapper input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f1f5f9;
}

.toggle-password {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.toggle-password:hover {
    color: var(--accent-color);
    background: rgba(118, 56, 149, 0.08);
    transform: scale(1.1);
}

.toggle-password:active {
    transform: scale(0.95);
}

.toggle-password:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Buttons */
.login-button {
    width: 100%;
    padding: 1rem;
    background: var(--primary-gradient);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(118, 56, 149, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    position: relative;
    overflow: hidden;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(118, 56, 149, 0.35);
}

.login-button .button-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: opacity 0.3s ease;
    position: relative;
    z-index: 1;
}

.divider {
    position: relative;
    margin: 2rem 0;
    text-align: center;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    background: var(--white);
    padding: 0 1rem;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* Platform Button - Stile Professionale (identico al Checkpoint Button) */
.platform-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    border: none;
    font-weight: 600;
    border-radius: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.25);
    position: relative;
    overflow: hidden;
}

.platform-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.platform-button:hover::before {
    left: 100%;
}

.platform-button i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.platform-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(118, 75, 162, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.platform-button:hover i {
    transform: scale(1.1) rotate(5deg);
}

.platform-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.3);
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: block;
}

/* Alert Box */
.alert-box {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: #fee2e2;
    border: 1px solid #fc8181;
    color: var(--error-color);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-content-wrapper {
    flex: 1;
}

.alert-content-wrapper h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--error-color);
}

.error-list {
    margin: 0;
    padding-left: 1.2rem;
    list-style: disc;
    font-size: 0.9rem;
}

.error-list li {
    margin-bottom: 0.25rem;
}

.close-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--error-color);
    font-size: 1.2rem;
    cursor: pointer;
}

/* Button Loader */
.login-button.loading .button-content {
    opacity: 0;
}

.button-loader {
    position: absolute;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.login-button.loading .button-loader {
    display: flex;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top: 2.5px solid var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive - Tablet (10" e superiori) */
@media (min-width: 768px) {
    .login-page-container {
        padding: 2.5rem !important;
    }

    .login-card-wrapper {
        max-width: 480px !important;
        border-radius: 28px !important;
    }

    .form-side {
        padding: 2.5rem 3rem !important;
    }

    .logo-img {
        height: 70px !important;
    }

    .brand-title {
        font-size: 2rem !important;
    }

    .form-title {
        font-size: 1.05rem !important;
    }

    .input-wrapper input {
        padding: 1.1rem 1.1rem 1.1rem 3.75rem !important;
        font-size: 1.05rem !important;
    }

    .login-button {
        padding: 1.1rem !important;
        font-size: 1.15rem !important;
    }
}

/* Tablet grandi (oltre 1024px) */
@media (min-width: 1025px) {
    .login-card-wrapper {
        max-width: 500px !important;
    }

    .form-side {
        padding: 3rem 3.5rem !important;
    }
}

/* Responsive - Mobile e Tablet piccoli */
@media (max-width: 767px) {
    .login-page-container {
        align-items: flex-start;
        padding: 1rem;
        height: auto;
    }

    .login-card-wrapper {
        max-width: 100%;
        border-radius: 24px;
    }

    .form-side {
        padding: 2rem;
    }
}
