/* ============================================================
   SOS Docenti — DEMO statica
   Foglio di stile condiviso (nessun backend, solo dati finti)
   Riprende l'identità visiva dell'app reale:
   - sidebar scura stile WordPress (#1d2327 / accento #2271b1)
   - titoli blu scuro (#22304a)
   - card dashboard a gradiente
   ============================================================ */

:root {
    --sb-width: 220px;
    --sb-bg: #1d2327;
    --sb-hover-bg: #2c3338;
    --sb-active-bg: #2271b1;
    --sb-text: #f0f0f1;
    --sb-muted: #a7aaad;
    --accent: #2271b1;
    --ink: #22304a;
    --page-bg: #eef1f5;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --demo-bar-h: 40px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--page-bg);
    color: #1f2937;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Banner DEMO ===== */
.demo-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--demo-bar-h);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 1px 6px rgba(0,0,0,0.2);
    padding: 0 12px;
}
.demo-bar a {
    color: #fff;
    text-decoration: underline;
    font-weight: 700;
}
.demo-bar .demo-pill {
    background: rgba(255,255,255,0.25);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
}

/* ===== Layout ===== */
.layout { display: flex; align-items: flex-start; min-height: 100vh; padding-top: var(--demo-bar-h); }

.sidebar {
    width: var(--sb-width);
    flex: 0 0 var(--sb-width);
    background: var(--sb-bg);
    color: var(--sb-text);
    position: sticky;
    top: var(--demo-bar-h);
    align-self: flex-start;
    max-height: calc(100vh - var(--demo-bar-h));
    overflow-y: auto;
    font-size: 0.86rem;
    z-index: 20;
    transition: transform 0.25s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-header .logo-badge {
    width: 34px; height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2271b1, #135e96);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.sidebar-header .name { font-weight: 700; font-size: 0.9rem; line-height: 1.15; }
.sidebar-header .role-tag {
    display: block;
    font-size: 0.7rem;
    color: var(--sb-muted);
    font-weight: 500;
    margin-top: 2px;
}

.sidebar nav { padding: 8px 0; }
.sidebar .section-title {
    padding: 12px 16px 4px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sb-muted);
}
.sidebar a.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--sb-text);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.sidebar a.nav-link:hover { background: var(--sb-hover-bg); text-decoration: none; }
.sidebar a.nav-link.active {
    background: var(--sb-active-bg);
    border-left-color: #72aee6;
    font-weight: 600;
}
.sidebar a.nav-link .ico { width: 20px; text-align: center; }

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 10px 0;
}

/* ===== Contenuto principale ===== */
.main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 24px 28px 60px;
    max-width: 100%;
}

.page-head { margin-bottom: 20px; }
.page-head h1 {
    margin: 0 0 4px;
    font-size: 1.9rem;
    color: var(--ink);
    font-weight: 800;
}
.page-head .subtitle { color: #6b7280; margin: 0; font-size: 0.92rem; }

/* ===== Griglia dashboard card colorate ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
    margin-top: 8px;
}
.dash-box {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.dash-box-header {
    padding: 13px 18px;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}
.dash-box-header .count {
    background: rgba(255,255,255,0.28);
    padding: 2px 11px;
    border-radius: 12px;
    font-size: 0.82rem;
    margin-left: auto;
}
.dash-box-body { padding: 4px 0; max-height: 320px; overflow-y: auto; }
.dash-item {
    padding: 11px 18px;
    border-bottom: 1px solid #f1f2f4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.dash-item:last-child { border-bottom: none; }
.dash-item-name { font-weight: 600; color: var(--ink); }
.dash-item-meta { font-size: 0.82rem; color: #6b7280; }
.subheader {
    padding: 7px 18px;
    font-weight: 700;
    font-size: 0.8rem;
    background: #f8fafc;
    color: #475569;
    border-bottom: 1px solid #eef0f3;
}

/* Colori card (allineati all'app) */
.box-prima-ora  .dash-box-header { background: linear-gradient(135deg, #ef4444, #dc2626); }
.box-sostituzioni .dash-box-header { background: linear-gradient(135deg, #f97316, #ea580c); }
.box-curriculari .dash-box-header { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.box-sostegno   .dash-box-header { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.box-classi     .dash-box-header { background: linear-gradient(135deg, #f59e0b, #d97706); }
.box-disponibili .dash-box-header { background: linear-gradient(135deg, #10b981, #059669); }
.box-laboratori .dash-box-header { background: linear-gradient(135deg, #ec4899, #db2777); }
.box-supplenze  .dash-box-header { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.box-orario     .dash-box-header { background: linear-gradient(135deg, #22304a, #1e3a5f); }
.box-assemblee  .dash-box-header { background: linear-gradient(135deg, #4CAF50, #2d7a31); }
.box-colloqui   .dash-box-header { background: linear-gradient(135deg, #14b8a6, #0d9488); }

/* ===== Card generica ===== */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    padding: 20px 22px;
    margin-bottom: 20px;
}
.card h2 {
    margin: 0 0 14px;
    font-size: 1.15rem;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Statistiche mini ===== */
.stat-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.stat-card {
    flex: 1 1 180px;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    border-left: 5px solid var(--accent);
}
.stat-card .value { font-size: 1.9rem; font-weight: 800; color: var(--ink); }
.stat-card .label { color: #6b7280; font-size: 0.85rem; margin-top: 2px; }
.stat-card.green { border-left-color: #10b981; }
.stat-card.orange { border-left-color: #f59e0b; }
.stat-card.red { border-left-color: #ef4444; }
.stat-card.purple { border-left-color: #8b5cf6; }

/* ===== Tabelle ===== */
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: #fff;
}
table.data th {
    background: var(--ink);
    color: #fff;
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    position: sticky;
    top: 0;
}
table.data td {
    padding: 10px 12px;
    border-bottom: 1px solid #eef0f3;
}
table.data tr:hover td { background: #f8fafc; }

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge.green { background: #dcfce7; color: #166534; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.orange { background: #ffedd5; color: #9a3412; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.gray { background: #f1f5f9; color: #475569; }

/* ===== Bottoni ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
    text-decoration: none;
}
.btn:hover { background: #135e96; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #64748b; }
.btn.secondary:hover { background: #475569; }
.btn.green { background: #10b981; }
.btn.green:hover { background: #059669; }
.btn.small { padding: 5px 11px; font-size: 0.8rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

/* ===== Form ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 0.85rem; color: #374151; }
.field input, .field select, .field textarea {
    padding: 9px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(34,113,177,0.15);
}
.field.full { grid-column: 1 / -1; }

/* ===== Orario (griglia settimanale) ===== */
.timetable { width: 100%; border-collapse: collapse; font-size: 0.82rem; background: #fff; }
.timetable th, .timetable td {
    border: 1px solid #e2e8f0;
    padding: 8px 6px;
    text-align: center;
    vertical-align: middle;
}
.timetable th { background: var(--ink); color: #fff; }
.timetable td.hour { background: #f1f5f9; font-weight: 700; color: var(--ink); }
.timetable td .subj { font-weight: 700; color: var(--ink); }
.timetable td .cls { font-size: 0.72rem; color: #64748b; }
.tt-mat { background: #dbeafe; }
.tt-ita { background: #fef9c3; }
.tt-sto { background: #dcfce7; }
.tt-eng { background: #fae8ff; }
.tt-sci { background: #ffe4e6; }
.tt-art { background: #ffedd5; }
.tt-free { background: #f8fafc; color: #94a3b8; font-style: italic; }

/* ===== Slot colloqui ===== */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.slot {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.slot:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(34,113,177,0.15); }
.slot .time { font-weight: 700; color: var(--ink); }
.slot .status { font-size: 0.78rem; margin-top: 4px; }
.slot.booked { background: #f1f5f9; cursor: not-allowed; opacity: 0.7; }
.slot.free .status { color: #059669; }
.slot.booked .status { color: #94a3b8; }

/* ===== Alert / info ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}
.alert.warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert.info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert.success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

/* ===== Hamburger mobile ===== */
.hamburger {
    display: none;
    position: fixed;
    top: calc(var(--demo-bar-h) + 8px);
    left: 8px;
    z-index: 30;
    background: var(--sb-bg);
    color: #fff;
    border: none;
    width: 42px; height: 42px;
    border-radius: 8px;
    font-size: 1.3rem;
    cursor: pointer;
}

/* ===== Landing ===== */
.landing { padding-top: var(--demo-bar-h); }
.hero {
    text-align: center;
    padding: 60px 20px 40px;
    background: linear-gradient(135deg, #22304a, #1e3a5f);
    color: #fff;
}
.hero .logo-big {
    width: 72px; height: 72px;
    margin: 0 auto 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, #2271b1, #135e96);
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem;
}
.hero h1 { font-size: 2.6rem; margin: 0 0 10px; font-weight: 900; }
.hero p { font-size: 1.1rem; opacity: 0.9; margin: 0; }
.roles {
    max-width: 1000px;
    margin: -30px auto 40px;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 22px;
}
.role-card {
    background: #fff;
    border-radius: 16px;
    padding: 30px 26px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.role-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.15); text-decoration: none; }
.role-card .r-ico {
    width: 64px; height: 64px;
    margin: 0 auto 16px;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
    color: #fff;
}
.role-card.admin .r-ico { background: linear-gradient(135deg, #2271b1, #135e96); }
.role-card.docente .r-ico { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.role-card.genitore .r-ico { background: linear-gradient(135deg, #10b981, #059669); }
.role-card h2 { color: var(--ink); margin: 0 0 8px; font-size: 1.4rem; }
.role-card p { color: #6b7280; font-size: 0.9rem; margin: 0 0 16px; min-height: 40px; }
.role-card .enter { color: var(--accent); font-weight: 700; }
.landing-features {
    max-width: 900px;
    margin: 0 auto 60px;
    padding: 0 20px;
    text-align: center;
    color: #6b7280;
}

/* ===== Responsive ===== */
@media (max-width: 860px) {
    .sidebar {
        position: fixed;
        top: var(--demo-bar-h);
        left: 0;
        bottom: 0;
        max-height: none;
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; padding: 20px 16px 60px; }
    .hamburger { display: block; }
}
