/* ══════════════════════════════════════════════════════════════════════
   ZECO ON-CALL — Design System
   Brand color: #1565C0 (estratto dal logo)
   ══════════════════════════════════════════════════════════════════════ */

:root {
    --blue:        #1565C0;
    --blue-dark:   #0D47A1;
    --blue-mid:    #1976D2;
    --blue-light:  #E3F2FD;
    --blue-pale:   #F0F6FF;
    --success:     #2E7D32;
    --danger:      #C62828;
    --warning:     #F57F17;
    --info:        #00838F;
    --bg:          #EEF2F8;
    --surface:     #FFFFFF;
    --text:        #1A1A2E;
    --text-muted:  #6B7280;
    --border:      #E2E8F0;
    --radius:      14px;
    --radius-sm:   8px;
    --radius-pill: 100px;
    --shadow:      0 2px 12px rgba(21, 101, 192, 0.10);
    --shadow-md:   0 4px 24px rgba(21, 101, 192, 0.14);
    --shadow-lg:   0 8px 40px rgba(21, 101, 192, 0.18);
}

/* ── Reset / Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    /* spazio per bottom nav su mobile */
    padding-bottom: 72px;
}
@media (min-width: 768px) { body { padding-bottom: 0; } }

/* ══ APP HEADER ═══════════════════════════════════════════════════════════ */
.app-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 16px rgba(21,101,192,0.10);
    z-index: 1030;
}

.app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 62px;
    max-width: 960px;
    margin: 0 auto;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.header-logo {
    height: 40px;
    width: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.header-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.header-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--blue-dark);
    letter-spacing: -0.01em;
}

.header-sub {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Desktop nav links */
.header-nav { gap: 4px; }

.hnav-link {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.hnav-link:hover { background: var(--blue-pale); color: var(--blue); }
.hnav-link.active { background: var(--blue); color: #fff; }

/* ══ BOTTOM NAV (mobile) ══════════════════════════════════════════════════ */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 62px;
    background: #fff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 16px rgba(21,101,192,0.10);
    z-index: 1040;
    justify-content: space-around;
    align-items: center;
}

.bnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1;
    height: 100%;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: color .15s;
}
.bnav-item i { font-size: 1.3rem; line-height: 1; }
.bnav-item.active { color: var(--blue); }
.bnav-item.active i { color: var(--blue); }

/* ══ PAGE CONTAINER ═══════════════════════════════════════════════════════ */
.page-wrap {
    max-width: 680px;
    margin: 0 auto;
    padding: 20px 14px;
}
.page-wrap-wide {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 14px;
}

/* ══ PAGE HEADER STRIP ════════════════════════════════════════════════════ */
.page-hero {
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 20px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-md);
}
.page-hero-icon {
    font-size: 2rem;
    opacity: .9;
    flex-shrink: 0;
}
.page-hero-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
}
.page-hero-sub {
    font-size: 0.8rem;
    opacity: .8;
    margin: 0;
}

/* ══ CARDS ════════════════════════════════════════════════════════════════ */
.card {
    background: var(--surface);
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow);
}

.card-header-blue {
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
    color: #fff;
    border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0 !important;
    padding: 14px 18px;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 18px; }

/* Intervento card (lista) */
.card-intervento {
    border-left: 4px solid var(--blue) !important;
    border-radius: var(--radius-sm) !important;
    transition: box-shadow .15s;
}
.card-intervento:hover { box-shadow: var(--shadow-md); }

/* ══ FORM ═════════════════════════════════════════════════════════════════ */
.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.required-label::after { content: ' *'; color: var(--danger); }

.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    padding: 10px 14px;
    background: #fff;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
    /* prevent iOS zoom */
    font-size: max(16px, 1rem);
}

.form-control:focus, .form-select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(21,101,192,0.15);
    outline: none;
}

textarea.form-control { min-height: 82px; resize: vertical; }

.input-group-text {
    background: var(--blue-pale);
    border: 1.5px solid var(--border);
    color: var(--blue);
    font-size: 1rem;
}

/* ── Sezione form ─────────────────────────────────────────────── */
.form-section {
    background: var(--blue-pale);
    border-radius: var(--radius-sm);
    padding: 14px 16px 4px;
    margin-bottom: 16px;
}
.form-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--blue);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ══ DURATA BUTTONS ═══════════════════════════════════════════════════════ */
.dur-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.btn-dur {
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 7px 15px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .15s;
    min-height: 40px;
    min-width: 56px;
    white-space: nowrap;
    line-height: 1;
}
.btn-dur:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: var(--blue-pale);
    transform: translateY(-1px);
}
.btn-dur.active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
    box-shadow: 0 2px 8px rgba(21,101,192,0.35);
}

/* ══ RISOLTO TOGGLE ═══════════════════════════════════════════════════════ */
.risolto-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.risolto-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 1.05rem;
    transition: all .15s;
    background: #fff;
}
.risolto-label-si:hover { border-color: var(--success); color: var(--success); background: #f0faf0; }
.risolto-label-no:hover { border-color: var(--danger); color: var(--danger); background: #fff5f5; }

input[name="risolto"]:checked + .risolto-label-si {
    border-color: var(--success);
    background: #E8F5E9;
    color: var(--success);
    box-shadow: 0 2px 8px rgba(46,125,50,0.20);
}
input[name="risolto"]:checked + .risolto-label-no {
    border-color: var(--danger);
    background: #FFEBEE;
    color: var(--danger);
    box-shadow: 0 2px 8px rgba(198,40,40,0.20);
}

/* ══ BUTTONS ══════════════════════════════════════════════════════════════ */
.btn-primary-zeco {
    background: linear-gradient(135deg, var(--blue-dark), var(--blue-mid));
    color: #fff;
    border: none;
    border-radius: var(--radius-pill);
    padding: 13px 28px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 14px rgba(21,101,192,0.30);
    transition: all .18s;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}
.btn-primary-zeco:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(21,101,192,0.40);
    color: #fff;
}
.btn-primary-zeco:disabled { opacity: .65; cursor: not-allowed; }

.btn-outline-zeco {
    background: transparent;
    color: var(--blue);
    border: 2px solid var(--blue);
    border-radius: var(--radius-pill);
    padding: 7px 18px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all .15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-outline-zeco:hover { background: var(--blue); color: #fff; }

.btn-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all .15s;
    padding: 0;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.btn-icon:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-pale); }
.btn-icon.danger:hover { border-color: var(--danger); color: var(--danger); background: #fff5f5; }

/* ══ STAT CARDS ═══════════════════════════════════════════════════════════ */
.stat-card {
    border-radius: var(--radius) !important;
    border: none !important;
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.stat-card-blue   { background: linear-gradient(135deg,#1565C0,#1976D2); color:#fff; }
.stat-card-green  { background: linear-gradient(135deg,#2E7D32,#388E3C); color:#fff; }
.stat-card-teal   { background: linear-gradient(135deg,#00695C,#00897B); color:#fff; }
.stat-card-orange { background: linear-gradient(135deg,#E65100,#F57C00); color:#fff; }

.stat-num {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}
.stat-lbl {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: .85;
}
.stat-icon { font-size: 1.4rem; opacity: .7; }

/* ══ BADGES ══════════════════════════════════════════════════════════════ */
.badge-risolto {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.badge-si { background: #E8F5E9; color: #2E7D32; }
.badge-no { background: #FFEBEE; color: #C62828; }

/* ══ TABLE ════════════════════════════════════════════════════════════════ */
.table { font-size: 0.9rem; }
.table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 700;
    border-bottom: 2px solid var(--border);
    background: var(--blue-pale);
}
.table td { vertical-align: middle; border-color: var(--border); }
.table-hover tbody tr:hover { background: var(--blue-pale); }

/* ══ FILTER CARD ══════════════════════════════════════════════════════════ */
.filter-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}

/* ══ ALERT ════════════════════════════════════════════════════════════════ */
#alert-box {
    position: sticky;
    top: 62px;
    z-index: 1020;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    animation: slideDown .2s ease;
    border: none;
    font-weight: 600;
}
.alert-success { background: #E8F5E9; color: #2E7D32; }
.alert-danger  { background: #FFEBEE; color: #C62828; }
.alert-info    { background: var(--blue-light); color: var(--blue-dark); }

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

/* ══ ADMIN LOGIN ══════════════════════════════════════════════════════════ */
.login-wrap {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    width: 100%;
    max-width: 380px;
}
.login-logo {
    display: block;
    margin: 0 auto 10px;
    height: 72px;
}

/* ══ ADMIN TABS ═══════════════════════════════════════════════════════════ */
.nav-tabs-zeco {
    border-bottom: 2px solid var(--border);
    gap: 4px;
    margin-bottom: 20px;
}
.nav-tabs-zeco .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 10px 18px;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: color .15s, border-color .15s;
    margin-bottom: -2px;
}
.nav-tabs-zeco .nav-link:hover { color: var(--blue); }
.nav-tabs-zeco .nav-link.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ══ LIST ITEM (admin) ════════════════════════════════════════════════════ */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 8px;
    transition: box-shadow .15s;
}
.list-item:hover { box-shadow: var(--shadow); }
.list-item.disabled { opacity: .45; }
.list-item-name { font-weight: 600; font-size: 0.95rem; }
.list-item-badge {
    font-size: 0.68rem; font-weight: 700;
    background: var(--border); color: var(--text-muted);
    padding: 2px 8px; border-radius: 20px;
    text-transform: uppercase; letter-spacing: .05em;
}

/* ══ FORM SECTION DIVIDER ═════════════════════════════════════════════════ */
.section-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 16px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.section-divider::before, .section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ══ ULTIMI INTERVENTI ════════════════════════════════════════════════════ */
.ultimi-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ══ TECNICO DI TURNO ════════════════════════════════════════════════════ */
.turno-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #f0f4ff;
    border: 1.5px solid #c5d5f5;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    transition: background .2s, border-color .2s;
}
.turno-card-attivo {
    background: #e3f0e3;
    border-color: #7cb87c;
}
.turno-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.turno-icon {
    font-size: 1.6rem;
    color: var(--blue);
    flex-shrink: 0;
}
.turno-card-attivo .turno-icon { color: #388e3c; }
.turno-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
}
.turno-nome {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.turno-card-attivo .turno-nome { color: #2e7d32; }
.turno-right { flex-shrink: 0; }
.turno-select {
    font-size: .82rem;
    min-width: 130px;
    max-width: 170px;
}
.turno-azzera {
    background: none;
    border: none;
    padding: 4px 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: .9rem;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
}
.turno-azzera:hover { color: var(--danger); background: #fff0f0; }

/* ══ ALLEGATI ═════════════════════════════════════════════════════════════ */
.allegati-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    background: #fafbff;
}
.allegati-dropzone:hover,
.allegati-dropzone.drag-over {
    border-color: var(--blue);
    background: #eef3fb;
}
.allegati-link {
    color: var(--blue);
    cursor: pointer;
    text-decoration: underline;
    font-weight: 600;
}
.allegati-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.allegato-thumb {
    position: relative;
    width: 90px;
    text-align: center;
}
.allegato-img {
    width: 90px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: block;
}
.allegato-icon {
    width: 90px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--blue);
    background: #eef3fb;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.allegato-name {
    font-size: .68rem;
    color: var(--text-muted);
    margin-top: 3px;
    word-break: break-all;
    line-height: 1.2;
    max-height: 2.4em;
    overflow: hidden;
}
.allegato-rm {
    position: absolute;
    top: -6px;
    right: -6px;
    background: none;
    border: none;
    padding: 0;
    color: #c62828;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
}
.allegato-rm:hover { color: #b71c1c; }

.btn-camera-zeco {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e8f0fe;
    color: var(--blue);
    border: 1.5px solid var(--blue);
    border-radius: var(--radius-sm);
    padding: 8px 18px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.btn-camera-zeco:hover { background: #d0e1fc; }

/* Allegati in stampa/lista */
.allegati-lista {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.allegato-link-thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: inherit;
}
.allegato-link-thumb img {
    width: 80px;
    height: 64px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #d0d8e8;
}
.allegato-link-thumb .al-icon {
    width: 80px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #1a5fb4;
    background: #eef3fb;
    border-radius: 5px;
    border: 1px solid #d0d8e8;
}
.allegato-link-thumb .al-name {
    font-size: .65rem;
    color: #666;
    max-width: 80px;
    text-align: center;
    word-break: break-all;
    line-height: 1.2;
}

/* ══ RESPONSIVE ═══════════════════════════════════════════════════════════ */
@media (max-width: 576px) {
    .page-wrap, .page-wrap-wide { padding: 14px 10px; }
    .card-body { padding: 14px; }
    .stat-num { font-size: 1.6rem; }
    .btn-primary-zeco { padding: 12px; font-size: 0.97rem; }
    .dur-btns { gap: 6px; }
    .btn-dur { padding: 7px 12px; font-size: 0.82rem; min-width: 50px; }
    .page-hero { padding: 14px 16px; gap: 10px; }
    .page-hero-title { font-size: 1rem; }
    .form-label { font-size: 0.8rem; }
    .header-logo { height: 34px; width: 34px; }
    .header-title { font-size: 0.9rem; }
    .header-sub { font-size: 0.65rem; }
}
