/* =====================================================================
   PAGINA PRINCIPALE: LOGIN + DASHBOARD  (usa css/theme.css)
   ===================================================================== */

/* ==================== LOGIN ==================== */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 38px 34px 30px;
    box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(229, 56, 59, 0.08);
    position: relative;
    overflow: hidden;
}
.login-card::before {
    content: '';
    position: absolute; inset: 0 0 auto 0; height: 160px;
    background: radial-gradient(260px 120px at 50% 0%, rgba(229, 56, 59, 0.28), transparent 70%);
    pointer-events: none;
}

.login-header { text-align: center; position: relative; margin-bottom: 26px; }
.login-logo {
    width: 96px; height: 96px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--line-2);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 30px -10px rgba(229, 56, 59, 0.6);
}
.login-logo img { width: 74px; height: 74px; object-fit: contain; }
.login-header h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: 0.06em; }
.login-header p { color: var(--text-3); font-size: 0.86rem; margin-top: 4px; }

.login-form .input-group { margin-bottom: 16px; }
.input-group label {
    display: block;
    font-size: 0.7rem; font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.09em;
    margin-bottom: 7px;
}

.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper > i:first-child, .input-wrapper .icon-left {
    position: absolute; left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-3); font-size: 0.9rem;
    pointer-events: none; z-index: 2;
}
.input-wrapper input {
    width: 100%;
    background: var(--sunken);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 13px 42px 13px 40px;
    border-radius: 11px;
    font: 500 0.92rem var(--font);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input-wrapper input:hover { border-color: var(--line-2); }
.input-wrapper input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(229, 56, 59, 0.22); }

.toggle-codice {
    position: absolute !important;
    right: 14px !important; left: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    cursor: pointer !important;
    color: var(--text-3) !important;
    z-index: 10 !important;
    font-size: 0.95rem !important;
    transition: color 0.15s;
}
.toggle-codice:hover { color: var(--amber) !important; }

.btn-login {
    width: 100%;
    margin-top: 8px;
    min-height: 50px;
    background: linear-gradient(180deg, #ee4447 0%, #c1272d 100%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
    border-radius: 11px;
    font: 700 0.95rem var(--font);
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: 0 12px 26px -10px rgba(229, 56, 59, 0.85);
    transition: filter 0.15s, transform 0.15s;
}
.btn-login:hover { filter: brightness(1.1); transform: translateY(-1px); }

.error-message, .success-message {
    display: none;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 0.86rem;
    margin-bottom: 16px;
}
.error-message { background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.4); color: #fca5a5; }
.success-message { background: rgba(34, 197, 94, 0.12); border: 1px solid rgba(34, 197, 94, 0.4); color: #86efac; }

.login-card .disclaimer { margin-top: 24px; font-size: 0.68rem; }
.disclaimer-site { max-width: 1000px; margin: 34px auto 26px; padding: 14px 20px 0; }

/* ==================== NAVBAR ==================== */
#dashboard-section { display: none; }

.navbar {
    position: sticky; top: 3px; z-index: 50;
    background: rgba(15, 11, 11, 0.88);
    backdrop-filter: blur(14px);
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    padding: 12px 28px;
    border-bottom: 1px solid var(--line);
}
.logo-section { display: flex; align-items: center; gap: 12px; }
.logo-img { height: 38px; width: 38px; object-fit: contain; }
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-title { font-weight: 800; letter-spacing: 0.06em; font-size: 0.95rem; }
.logo-sub { font-size: 0.66rem; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; }

.nav-links { display: flex; gap: 6px; }
.nav-links a {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--text-2); text-decoration: none;
    font-size: 0.82rem; font-weight: 700; letter-spacing: 0.05em;
    padding: 9px 16px; border-radius: 10px;
    transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.nav-links a.active { background: rgba(229, 56, 59, 0.18); color: #ff8a8c; box-shadow: inset 0 0 0 1px rgba(229, 56, 59, 0.4); }

.user-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255, 157, 77, 0.12);
    border: 1px solid rgba(255, 157, 77, 0.35);
    color: #ffb877;
    padding: 7px 14px; border-radius: 999px;
    font-size: 0.76rem; font-weight: 700;
}

.top-banner {
    background: linear-gradient(90deg, rgba(143, 29, 33, 0.55), rgba(193, 39, 45, 0.35), rgba(143, 29, 33, 0.55));
    border-bottom: 1px solid rgba(229, 56, 59, 0.3);
    padding: 8px 20px;
    font-size: 0.8rem; color: var(--text);
    display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 32px;
}
.top-banner i { color: var(--amber); margin-right: 4px; }

/* ==================== DASHBOARD ==================== */
.dashboard-container { max-width: 1280px; margin: 26px auto 0; padding: 0 24px; }

.dashboard-header {
    background: linear-gradient(135deg, rgba(229, 56, 59, 0.14), rgba(21, 16, 16, 0.95) 55%);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 22px 26px;
    display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}
.user-welcome { display: flex; align-items: center; gap: 18px; }
.logo-icon-wrap {
    width: 58px; height: 58px; border-radius: 16px;
    background: linear-gradient(145deg, #ee4447, #8f1d21);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 12px 26px -10px rgba(229, 56, 59, 0.9);
    flex-shrink: 0;
}
.logo-icon { font-size: 1.6rem; color: #fff; }
.user-welcome h2 { font-size: 0.78rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; }
.user-welcome p { font-size: 1.35rem; margin: 2px 0 8px; }
.user-welcome p strong { font-weight: 800; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Stato servizio */
.status-badge {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 0.74rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 5px 12px; border-radius: 999px;
    border: 1px solid transparent;
}
.status-badge i { font-size: 0.5rem; }
.status-badge.off-duty { background: rgba(255, 255, 255, 0.07); color: #bdb0ae; border-color: var(--line-2); }
.status-badge.on-duty  { background: rgba(34, 197, 94, 0.14); color: #4ade80; border-color: rgba(34, 197, 94, 0.4); }
.status-badge.on-break { background: rgba(245, 158, 11, 0.14); color: #fbbf24; border-color: rgba(245, 158, 11, 0.4); }

.dashboard-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 22px; align-items: start; }

/* Scheda profilo */
.profile-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 22px;
    box-shadow: var(--shadow);
}
.card-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 18px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.card-title i { color: var(--amber); margin-right: 8px; }
.card-title small { display: block; color: var(--text-3); font-weight: 500; font-size: 0.76rem; margin-top: 3px; }

.avatar-container { text-align: center; margin-bottom: 22px; }
.avatar-wrapper { position: relative; width: 170px; height: 170px; margin: 0 auto; }
.avatar-img {
    width: 100%; height: 100%;
    border-radius: 50%; object-fit: cover;
    border: 3px solid var(--brand);
    box-shadow: 0 0 0 6px rgba(229, 56, 59, 0.14), 0 16px 30px -12px rgba(0, 0, 0, 0.8);
    background: var(--surface-3);
}
.edit-avatar-btn {
    position: absolute; bottom: 6px; right: 6px;
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--brand); color: #fff;
    border: 3px solid var(--surface);
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}
.edit-avatar-btn:hover { background: var(--brand-2); transform: scale(1.08); }

.foto-controls { margin-top: 16px; }
.btn-toggle-pos {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--surface-3); color: var(--text-2);
    border: 1px solid var(--line); border-radius: 9px;
    padding: 8px 14px; font: 600 0.78rem var(--font); cursor: pointer;
}
.btn-toggle-pos:hover { border-color: var(--line-2); color: var(--text); }
.foto-pos-box {
    display: none;
    background: var(--sunken); border: 1px solid var(--line);
    border-radius: 12px; padding: 14px; margin-top: 10px; text-align: left;
}
.pos-control-group { margin-bottom: 12px; }
.pos-control-group label { display: block; font-size: 0.72rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 6px; }
.pos-control-group input[type="range"] { width: 100%; accent-color: var(--brand); }
.btn-reset-pos {
    width: 100%; padding: 8px 12px;
    background: var(--surface-3); color: var(--text);
    border: 1px solid var(--line); border-radius: 8px;
    font: 600 0.78rem var(--font); cursor: pointer;
}
.btn-reset-pos:hover { background: #33262a; }

.avatar-container h3 { margin-top: 18px; font-size: 1.2rem; font-weight: 800; }
.grado-sub { color: var(--text-2); font-size: 0.86rem; margin-top: 2px; }
.badge-matricola {
    display: inline-block; margin-top: 12px;
    background: rgba(245, 158, 11, 0.12); color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 6px 14px; border-radius: 999px;
    font-size: 0.78rem; font-weight: 600; letter-spacing: 0.03em;
}

.profile-fields { display: flex; flex-direction: column; gap: 12px; }
.field-group label { display: block; font-size: 0.68rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.09em; margin-bottom: 5px; }
.field-group input {
    width: 100%;
    background: var(--sunken); border: 1px solid var(--line);
    color: var(--text-2); padding: 10px 12px; border-radius: 9px;
    font: 500 0.88rem var(--font);
}
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255, 157, 77, 0.13); color: #ffb877;
    border: 1px solid rgba(255, 157, 77, 0.35);
    padding: 4px 10px; border-radius: 8px;
    font-size: 0.74rem; font-weight: 700;
}

/* Contenuto principale */
.status-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: var(--r-md);
    padding: 16px 20px;
    display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
    margin-bottom: 26px;
    box-shadow: var(--shadow);
}
.status-box strong { font-size: 1.05rem; }
.status-user { font-size: 0.82rem; color: var(--text-3); }

.section-label {
    font-size: 0.72rem; font-weight: 700; color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.12em;
    margin-bottom: 14px;
}

/* Schede sezione: icona a sinistra, testo, freccia */
.modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.module-card {
    display: grid;
    grid-template-columns: 54px 1fr 18px;
    grid-template-rows: auto auto;
    column-gap: 16px; row-gap: 2px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 18px 18px;
    text-decoration: none; color: inherit;
    cursor: pointer;
    transition: transform 0.18s, border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.module-card::after {
    content: '\f054';
    font-family: 'Font Awesome 6 Free'; font-weight: 900;
    grid-column: 3; grid-row: 1 / span 2;
    color: var(--text-3); font-size: 0.8rem;
    transition: transform 0.18s, color 0.18s;
}
.module-card:hover { transform: translateY(-3px); border-color: rgba(229, 56, 59, 0.6); background: var(--surface-2); box-shadow: 0 16px 30px -16px rgba(229, 56, 59, 0.55); }
.module-card:hover::after { transform: translateX(3px); color: var(--amber); }
.module-icon {
    grid-column: 1; grid-row: 1 / span 2;
    width: 54px; height: 54px; border-radius: 15px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(145deg, rgba(229, 56, 59, 0.28), rgba(229, 56, 59, 0.1));
    border: 1px solid rgba(229, 56, 59, 0.35);
    color: #ff8a8c; font-size: 1.35rem;
}
.module-card h4 { grid-column: 2; font-size: 0.98rem; font-weight: 700; align-self: end; }
.module-card p { grid-column: 2; font-size: 0.8rem; color: var(--text-3); align-self: start; }

/* ==================== FINESTRE MODALI ==================== */
.modal-card {
    width: 100%; max-width: 470px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 4px solid var(--brand);
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.9);
}
.modal-card .input-group { margin-bottom: 16px; }
.modal-card .input { width: 100%; }
.modal-title { font-size: 1.2rem; font-weight: 800; display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.modal-title i { color: var(--amber); }
.codice-hint { display: flex; gap: 10px; align-items: flex-start; font-size: 0.78rem; line-height: 1.5; color: #ffc995; background: rgba(255, 157, 77, 0.1); border: 1px solid rgba(255, 157, 77, 0.3); border-radius: 10px; padding: 10px 12px; margin-bottom: 18px; }
.codice-hint i { margin-top: 2px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal-actions.center { justify-content: center; }
.modal-center { text-align: center; max-width: 420px; }
.modal-center .modal-title { justify-content: center; border: none; padding: 0; margin-bottom: 10px; }
.modal-icon-big { font-size: 2.6rem; color: var(--danger); margin-bottom: 12px; }
.modal-text { color: var(--text-2); font-size: 0.95rem; margin-bottom: 24px; line-height: 1.5; }
.btn-danger-solid { background: linear-gradient(180deg, #ef4444, #b91c1c); border-color: rgba(255, 255, 255, 0.14); color: #fff; }
.btn-danger-solid:hover:not(:disabled) { filter: brightness(1.12); }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 980px) {
    .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .navbar { padding: 10px 14px; flex-wrap: wrap; }
    .user-badge { display: none; }
    .dashboard-container { padding: 0 14px; }
    .dashboard-header { padding: 18px; }
    .login-card { padding: 30px 22px 24px; }
}
