/* =========================================================
   Area Genitori - SOS Docenti
   Stile mobile-first, semplice e amichevole
   ========================================================= */
:root {
    --g-primary: #4f46e5;
    --g-primary-dark: #4338ca;
    --g-primary-soft: #eef2ff;
    --g-success: #16a34a;
    --g-success-soft: #f0fdf4;
    --g-danger: #dc2626;
    --g-danger-soft: #fef2f2;
    --g-warning: #d97706;
    --g-warning-soft: #fffbeb;
    --g-info: #2563eb;
    --g-info-soft: #eff6ff;
    --g-text: #1f2937;
    --g-muted: #6b7280;
    --g-border: #e5e7eb;
    --g-bg: #f1f5f9;
    --g-card: #ffffff;
    --g-radius: 16px;
    --g-shadow: 0 6px 24px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    margin: 0;
    background: var(--g-bg);
    color: var(--g-text);
    font-size: 17px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 84px; /* spazio per la bottom nav su mobile */
}

/* ---------- Barra superiore ---------- */
.g-appbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--g-primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(79, 70, 229, .25);
}
.g-appbar__logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #fff;
    object-fit: contain;
    padding: 3px;
    flex: 0 0 auto;
}
.g-appbar__titles { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.g-appbar__institute {
    font-size: .8rem;
    opacity: .85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.g-appbar__page { font-size: 1.05rem; font-weight: 700; }
.g-appbar__spacer { flex: 1 1 auto; }
.g-appbar__logout {
    color: #fff;
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    white-space: nowrap;
}
.g-appbar__logout:active { background: rgba(255, 255, 255, .3); }

/* ---------- Menu hamburger ---------- */
.g-appbar__menu-btn {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 42px;
    height: 42px;
    padding: 0 9px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, .18);
    cursor: pointer;
    flex: 0 0 auto;
    -webkit-tap-highlight-color: transparent;
}
.g-appbar__menu-btn span {
    display: block;
    height: 3px;
    border-radius: 3px;
    background: #fff;
    transition: transform .25s, opacity .2s;
}
.g-appbar__menu-btn.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.g-appbar__menu-btn.is-open span:nth-child(2) { opacity: 0; }
.g-appbar__menu-btn.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.g-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s;
    z-index: 70;
}
.g-drawer-overlay.is-open { opacity: 1; visibility: visible; }

.g-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 78%;
    max-width: 320px;
    background: #fff;
    box-shadow: -8px 0 30px rgba(15, 23, 42, .18);
    transform: translateX(100%);
    transition: transform .28s ease;
    z-index: 80;
    display: flex;
    flex-direction: column;
    padding: 14px;
    overflow-y: auto;
}
.g-drawer.is-open { transform: translateX(0); }
.g-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 6px 14px;
    border-bottom: 1px solid var(--g-border);
    margin-bottom: 8px;
}
.g-drawer__title { font-weight: 700; color: var(--g-primary); }
.g-drawer__close {
    border: 0;
    background: var(--g-primary-soft);
    color: var(--g-primary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}
.g-drawer a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--g-text);
    font-weight: 600;
    font-size: 1.05rem;
}
.g-drawer a .g-ico { font-size: 1.4rem; }
.g-drawer a:active { background: var(--g-bg); }
.g-drawer a.is-active { background: var(--g-primary-soft); color: var(--g-primary); }
.g-drawer__sep { height: 1px; background: var(--g-border); margin: 8px 4px; }
.g-drawer a.g-drawer__logout { color: var(--g-danger); }

/* ---------- Contenitore ---------- */
.g-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 18px 16px 24px;
}

/* ---------- Saluto ---------- */
.g-hello {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    border-radius: var(--g-radius);
    padding: 20px;
    box-shadow: var(--g-shadow);
    margin-bottom: 18px;
}
.g-hello h1 { margin: 0 0 4px; font-size: 1.4rem; }
.g-hello p { margin: 0; opacity: .92; }

/* ---------- Card ---------- */
.g-card {
    background: var(--g-card);
    border: 1px solid var(--g-border);
    border-radius: var(--g-radius);
    padding: 18px;
    box-shadow: var(--g-shadow);
    margin-bottom: 16px;
}
.g-card h2 {
    margin: 0 0 12px;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.g-card h2 .g-ico { font-size: 1.3rem; }
.g-card p { margin: 0 0 8px; }
.g-card p:last-child { margin-bottom: 0; }
.g-muted { color: var(--g-muted); }

/* ---------- Info figlio / righe ---------- */
.g-detail {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--g-border);
}
.g-detail:last-child { border-bottom: 0; }
.g-detail__label { color: var(--g-muted); }
.g-detail__value { font-weight: 600; text-align: right; }

/* ---------- Pulsanti ---------- */
.g-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px 18px;
    margin-top: 12px;
    border: 0;
    border-radius: 14px;
    background: var(--g-primary);
    color: #fff;
    font-size: 1.02rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, transform .05s;
    -webkit-tap-highlight-color: transparent;
}
.g-btn:active { transform: scale(.98); }
.g-btn:hover { background: var(--g-primary-dark); }
.g-btn--secondary { background: #eef2ff; color: var(--g-primary); }
.g-btn--secondary:hover { background: #e0e7ff; }
.g-btn--danger { background: #fee2e2; color: var(--g-danger); }
.g-btn--danger:hover { background: #fecaca; }
.g-btn--ghost { background: transparent; color: var(--g-primary); border: 2px solid var(--g-primary-soft); }
.g-btn:disabled, .g-btn[disabled] { background: #cbd5e1; color: #fff; cursor: not-allowed; }
.g-btn-row { display: flex; flex-direction: column; gap: 0; }

/* ---------- Avvisi ---------- */
.g-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
    font-weight: 500;
    border: 1px solid transparent;
}
.g-alert .g-ico { font-size: 1.25rem; line-height: 1.2; }
.g-alert--success { background: var(--g-success-soft); border-color: #86efac; color: #166534; }
.g-alert--error { background: var(--g-danger-soft); border-color: #fca5a5; color: #991b1b; }
.g-alert--warning { background: var(--g-warning-soft); border-color: #fcd34d; color: #92400e; }
.g-alert--info { background: var(--g-info-soft); border-color: #93c5fd; color: #1e40af; }

/* ---------- Slot colloquio ---------- */
.g-slot {
    border: 1px solid var(--g-border);
    border-left: 5px solid var(--g-primary);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fff;
}
.g-slot--booked { border-left-color: var(--g-success); background: var(--g-success-soft); }
.g-slot__date {
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.g-slot__time {
    display: inline-block;
    background: var(--g-primary-soft);
    color: var(--g-primary);
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .95rem;
    margin-bottom: 8px;
}
.g-slot--booked .g-slot__time { background: #dcfce7; color: #166534; }
.g-slot__info { margin: 3px 0; color: #374151; }
.g-slot__info b { color: var(--g-text); }

/* ---------- Form ---------- */
.g-field { margin-top: 14px; }
.g-field label,
.g-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: .98rem;
}
.g-form input,
.g-form select {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 1.5px solid var(--g-border);
    font-size: 1rem;
    background: #fff;
    color: var(--g-text);
    box-sizing: border-box;
}
.g-form input:focus,
.g-form select:focus {
    outline: none;
    border-color: var(--g-primary);
    box-shadow: 0 0 0 3px var(--g-primary-soft);
}
.g-form fieldset {
    margin: 16px 0 0;
    border: 1px solid var(--g-border);
    border-radius: var(--g-radius);
    padding: 8px 16px 18px;
    background: #fff;
}
.g-form legend {
    font-weight: 700;
    color: var(--g-primary);
    padding: 0 8px;
    font-size: 1.02rem;
}
.g-hint { font-size: .85rem; color: var(--g-muted); font-weight: 400; }

/* ---------- Link secondario ---------- */
.g-backlink {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    color: var(--g-primary);
    text-decoration: none;
    font-weight: 600;
}

/* ---------- Stato vuoto ---------- */
.g-empty {
    text-align: center;
    padding: 24px 12px;
    color: var(--g-muted);
}
.g-empty .g-ico { font-size: 2.4rem; display: block; margin-bottom: 8px; }

/* ---------- Passi guida ---------- */
.g-steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.g-steps li {
    position: relative;
    padding: 10px 0 10px 46px;
    border-bottom: 1px dashed var(--g-border);
}
.g-steps li:last-child { border-bottom: 0; }
.g-steps li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 10px;
    width: 30px;
    height: 30px;
    background: var(--g-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .95rem;
}

/* ---------- FAQ ---------- */
.g-faq { border: 1px solid var(--g-border); border-radius: 14px; overflow: hidden; margin-bottom: 12px; background: #fff; }
.g-faq summary {
    list-style: none;
    cursor: pointer;
    padding: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    -webkit-tap-highlight-color: transparent;
}
.g-faq summary::-webkit-details-marker { display: none; }
.g-faq summary::after {
    content: "▾";
    margin-left: auto;
    transition: transform .2s;
    color: var(--g-primary);
}
.g-faq[open] summary::after { transform: rotate(180deg); }
.g-faq__body { padding: 0 16px 16px; color: #374151; }
.g-faq__body p { margin: 0 0 8px; }

/* ---------- Navigazione inferiore (mobile) ---------- */
.g-bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    background: #fff;
    border-top: 1px solid var(--g-border);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, .06);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.g-bottomnav a {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 9px 4px;
    text-decoration: none;
    color: var(--g-muted);
    font-size: .72rem;
    font-weight: 600;
}
.g-bottomnav a .g-ico { font-size: 1.35rem; line-height: 1; }
.g-bottomnav a.is-active { color: var(--g-primary); }

/* ---------- Desktop ---------- */
@media (min-width: 768px) {
    body { padding-bottom: 24px; }
    .g-bottomnav { display: none; }
    .g-btn { width: auto; }
    .g-btn-row { flex-direction: row; flex-wrap: wrap; }
}
