/* ══════════════════════════════════════════════════════════════════
   loginStyle.css — Variante C: card con header accent
   Usa le stesse variabili CSS di dashboard.css per coerenza con
   il resto dell'applicativo. Dark mode via [data-theme="dark"].
══════════════════════════════════════════════════════════════════ */

/* ── Variabili (stesso set di dashboard.css) ── */
:root {
    --bg-page:    linear-gradient(135deg, #f0f2f5, #e4e7ec);
    --bg-card:    #ffffff;
    --bg-input:   #f5f7fa;
    --border:     #e5e7eb;
    --text-main:  #111827;
    --text-sub:   #6b7280;
    --accent:     #0077ff;
    --accent-dark:#005edb;
    --shadow-card:0 8px 32px rgba(0,0,0,0.10);
    --error-bg:   #fef2f2;
    --error-border:#fca5a5;
    --error-text: #dc2626;
}

[data-theme="dark"] {
    --bg-page:    linear-gradient(135deg, #0f1117, #161b27);
    --bg-card:    #1a1d27;
    --bg-input:   #252836;
    --border:     #2e3244;
    --text-main:  #f3f4f6;
    --text-sub:   #9ca3af;
    --accent:     #3b82f6;
    --accent-dark:#2563eb;
    --shadow-card:0 8px 32px rgba(0,0,0,0.40);
    --error-bg:   #2d1515;
    --error-border:#7f1d1d;
    --error-text: #fca5a5;
}

/* ── Reset ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Layout pagina ── */
body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-page);
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--text-main);
    padding: 1.5rem;
}

/* ── Card ── */
.login-wrapper {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

/* ── Header colorato ── */
.login-header {
    background: var(--accent);
    padding: 2rem 1.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.login-logo {
    width: 140px;
    height: auto;
    /* Il logo ha sfondo trasparente: su sfondo blu resta leggibile.
       Un filtro brightness garantisce visibilità ottimale su dark mode. */
    filter: brightness(0) invert(1);
}

.login-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 400;
    letter-spacing: 0.3px;
    text-align: center;
}

/* ── Body ── */
.login-body {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

/* ── Messaggio errore ── */
.login-error {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-radius: 10px;
    color: var(--error-text);
    font-size: 13px;
    line-height: 1.4;
    animation: fadeSlideIn 0.25s ease;
}

.login-error svg {
    flex-shrink: 0;
    color: var(--error-text);
}

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

/* ── Campi ── */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.field-group + .field-group {
    margin-top: 10px;
}

.field-group label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-sub);
}

.field-group input[type="email"],
.field-group input[type="password"],
.field-group input[type="text"] {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--bg-input);
    color: var(--text-main);
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field-group input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(0, 119, 255, 0.12);
}

[data-theme="dark"] .field-group input:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

/* ── Toggle password ── */
.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 46px;
}

/* Nasconde l'occhio nativo di Edge/Chrome che si sovrapporrebbe al bottone custom */
.password-wrapper input::-ms-reveal,
.password-wrapper input::-ms-clear { display: none; }

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--text-sub);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.password-toggle:hover {
    color: var(--accent);
    background: rgba(0, 119, 255, 0.08);
}

.password-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.password-toggle .icon-eye-off { display: none; }
.password-toggle.is-visible .icon-eye     { display: none; }
.password-toggle.is-visible .icon-eye-off { display: block; }

/* ── Bottone accedi ── */
.btn-login {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    margin-top: 16px;
}

.btn-login:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 119, 255, 0.30);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ── Link password dimenticata ── */
.forgot-link {
    display: block;
    text-align: center;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
    margin-top: 2px;
}

.forgot-link:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}

/* ── Messaggi info / successo (forgot_password) ── */
.login-info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--info-bg, rgba(0,119,255,0.08));
    border: 1px solid var(--info-border, rgba(0,119,255,0.20));
    border-radius: 10px;
    color: var(--accent);
    font-size: 13px;
    line-height: 1.55;
    animation: fadeSlideIn 0.25s ease;
}

.login-success {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--success-bg, rgba(22,163,74,0.08));
    border: 1px solid var(--success-border, rgba(22,163,74,0.25));
    border-radius: 10px;
    color: var(--success-text, #15803d);
    font-size: 13px;
    line-height: 1.55;
    animation: fadeSlideIn 0.25s ease;
}

[data-theme="dark"] .login-info {
    background: rgba(59,130,246,0.12);
    border-color: rgba(59,130,246,0.25);
}
[data-theme="dark"] .login-success {
    color: #4ade80;
    background: rgba(74,222,128,0.08);
    border-color: rgba(74,222,128,0.20);
}

.login-info svg, .login-success svg { flex-shrink: 0; margin-top: 1px; }

/* ── Link torna al login ── */
.back-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-sub);
    text-decoration: none;
    transition: color 0.2s;
    justify-content: center;
    margin-top: 2px;
}
.back-link:hover { color: var(--accent); }
.back-link svg { transition: transform 0.2s; }
.back-link:hover svg { transform: translateX(-3px); }

/* ── Responsive mobile ── */
@media (max-width: 440px) {
    .login-card { border-radius: 16px; }
    .login-header { padding: 1.5rem 1.25rem 1.25rem; }
    .login-body { padding: 1.25rem; }
    .login-logo { width: 120px; }
}

/* ── Chrome autofill dark mode fix ── */
.field-group input {
    color-scheme: dark;
    -webkit-appearance: none;
    appearance: none;
}

/* ── Fix autofill browser ── */
.field-group input:-webkit-autofill,
.field-group input:-webkit-autofill:hover,
.field-group input:-webkit-autofill:focus,
.field-group input:autofill {
    -webkit-box-shadow: 0 0 0px 1000px var(--bg-input) inset;
    box-shadow: 0 0 0px 1000px var(--bg-input) inset;
    -webkit-text-fill-color: var(--text-main);
    transition: background-color 5000s ease-in-out 0s;
}