/* public/css/login.css - VERSIONE DEFINITIVA COMPLETA */

/* --- VARIABILI GLOBALI --- */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --danger-red: #ef4444;
}

/* Reset di base */
* { box-sizing: border-box; }

/* --- LAYOUT GENERALE --- */
.auth-wrapper { 
    min-height: 100vh; 
    min-height: 100dvh; /* Fix per mobile browser bars */
    display: flex; 
    align-items: center; 
    justify-content: center; 
    background: var(--bg-gradient); 
    padding: 20px; 
}

/* --- CARD DI ACCESSO --- */
.auth-card { 
    background: white; 
    padding: 40px; 
    border-radius: 24px; 
    box-shadow: var(--card-shadow); 
    width: 100%; 
    max-width: 420px; 
    border: 1px solid rgba(255,255,255,0.7);
}

/* Logo o Icona sopra il titolo (Opzionale, se presente) */
.auth-logo {
    display: block;
    margin: 0 auto 20px auto;
    max-width: 150px;
    height: auto;
}

.auth-card h1 { 
    font-size: 1.75rem; 
    margin: 0 0 8px 0;
    color: #0f172a; 
    text-align: center; 
    font-weight: 800; 
    letter-spacing: -0.025em;
}

.auth-subtitle {
    text-align: center;
    color: #64748b;
    font-size: 0.95rem;
    margin: 0 0 32px 0;
}

/* --- MESSAGGI DI ERRORE --- */
.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-danger::before {
    content: "⚠️"; /* Icona warning automatica */
}

/* --- FORM --- */
label { 
    font-weight: 600; 
    color: #475569; 
    font-size: 0.85rem; 
    margin-bottom: 6px; 
    display: block; 
}

.form-group { margin-bottom: 20px; position: relative; }

.form-control { 
    width: 100%; 
    padding: 12px 16px; 
    border: 1px solid #e2e8f0; 
    border-radius: 12px; 
    outline: none; 
    transition: all 0.2s ease; 
    font-size: 1rem; /* 16px evita lo zoom automatico su iOS */
    background: #f8fafc;
    
    /* FIX COMPATIBILITÀ */
    -webkit-appearance: none; /* Per Safari/iOS vecchi */
    appearance: none;         /* Standard Moderno */
}

.form-control:focus { 
    border-color: var(--primary); 
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1); 
}

/* FIX AUTOFILL CHROME: Evita lo sfondo giallo fastidioso */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active{
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: #0f172a !important;
    border-radius: 12px;
}

/* --- TOGGLE PASSWORD (Occhio) --- */
.password-wrapper { position: relative; }

.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s;
    padding: 10px; 
}
.toggle-password:hover { color: var(--primary); }

/* --- CHECKBOX REMEMBER ME --- */
.options-row {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    font-size: 0.9rem;
    color: #64748b;
    cursor: pointer;
}
.options-row input { 
    margin-right: 10px; 
    cursor: pointer; 
    width: 18px; height: 18px; 
    accent-color: var(--primary); 
}

/* --- BOTTONE ACCEDI --- */
.btn-auth { 
    width: 100%; 
    background: var(--primary); 
    color: white; 
    padding: 14px; 
    border: none; 
    border-radius: 12px; 
    font-weight: 700; 
    font-size: 1rem;
    cursor: pointer; 
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-auth:hover { 
    background: var(--primary-hover); 
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

/* --- OTTIMIZZAZIONE MOBILE --- */
@media (max-width: 768px) {
    .auth-wrapper {
        padding: 15px; 
    }

    .auth-card {
        padding: 25px; 
        border-radius: 20px;
    }

    .auth-card h1 {
        font-size: 1.5rem; 
    }

    .auth-subtitle {
        font-size: 0.9rem;
        margin-bottom: 25px;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .btn-auth {
        padding: 16px; 
    }
}