/*
 * istruttorie-table.css
 * ======================
 * Stili condivisi per il ViewComponent IstruttorieTable.
 * Incluso in _Layout.cshtml (disponibile globalmente).
 *
 * Sostituisce e centralizza:
 *   - blocco <style> in ElencoIstruttorie.cshtml
 *   - blocco <style> di istr-* in GestisciIstruttoria.cshtml
 *   - blocco <style> di istr-* in GeneraDocumentoIstruttoria.cshtml
 *
 * Convenzione classi:
 *   .ite-*           — prefisso "Istruttorie Table" (evita collisioni)
 *   .ite-expand-mode — applicato al contenitore quando MostraExpand=true
 *   .ite-compact-mode— applicato al contenitore quando MostraExpand=false
 */

/* ── Base tabella ─────────────────────────────────────────────────── */
.ite-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.ite-table th, .ite-table td {
    padding: 5px 8px;
    border: 1px solid #dee2e6;
    vertical-align: top;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.ite-table thead th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: .82rem;
    white-space: nowrap;
    box-shadow: 0 1px 0 #dee2e6; /* visibile durante sticky scroll */
}
.ite-table tbody tr:hover { background: #f0f7ff; }
.ite-table td { font-size: .82rem; }

/* ── Wrapper scrollabile con sticky header ────────────────────────── */
.ite-scroll-wrap {
    overflow-x: auto;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: .375rem;
}
/*
 * STICKY HEADER — regola critica:
 * border-collapse:collapse impedisce position:sticky in tutti i browser.
 * Si usa separate+spacing:0 (aspetto identico) e box-shadow al posto del border.
 */
.ite-scroll-wrap .ite-table {
    border-collapse: separate !important;
    border-spacing: 0;
}
.ite-scroll-wrap .ite-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #f8f9fa;
    box-shadow: inset 0 -1px 0 #dee2e6;
}

/* ── Riga corrente (modalità compatta: pannello fascicolo) ────────── */
.ite-corrente { background-color: #e3f2fd !important; }

/* ── Pulsante espansione (modalità expand) ────────────────────────── */
.ite-btn-expand {
    background: none;
    border: none;
    padding: 0 2px;
    cursor: pointer;
    color: #6c757d;
    line-height: 1;
    display: flex;
    align-items: center;
}
.ite-btn-expand:hover { color: #0d6efd; }
.ite-btn-expand .material-icons { font-size: 18px; transition: transform .15s ease; }
.ite-btn-expand.is-open .material-icons { transform: rotate(90deg); }

/* Pulsante link apri istruttoria (modalità compatta) */
.ite-btn-view {
    display: inline-flex;
    align-items: center;
    color: #6c757d;
    text-decoration: none;
    padding: 0 2px;
    line-height: 1;
}
.ite-btn-view:hover { color: #0d6efd; }

/* ── Pannello azioni espanso sotto la riga ────────────────────────── */
.ite-expand-row td {
    background: #eef4ff;
    border-top: 2px solid #0d6efd !important;
    border-bottom: 1px solid #c5d8f8 !important;
}
tr.ite-main-open > td { background: #daeaff !important; }

/* ── Badge colori personalizzati ─────────────────────────────────── */
.ite-badge-alta    { background-color: #ffc107; color: #212529; font-size: .70rem; }
.ite-badge-urgente { background-color: #dc3545; color: #fff;    font-size: .70rem; }
.bg-orange { background-color: #fd7e14; } /* riutilizzato per stati "in attesa" */

/* ── Note trasmissione: grigio corsivo sotto il nominativo ─────────── */
.ite-trasda-note { color: #6c757d; font-style: italic; font-size: .75rem; margin-top: 2px; }

/* ── Scadenza: testo centrato e compatto ────────────────────────────── */
.ite-table td.ite-col-scad { text-align: center; font-size: .80rem; font-weight: 600; padding: 4px 6px !important; }

/* ═══════════════════════════════════════════════════════════════════
   LARGHEZZE COLONNE — MODALITÀ EXPAND (MostraExpand=true)
   11 colonne: expand, data, scad, N.Ist., Istanza, Oggetto,
                Tipo istr., Assegnata a, Trasmessa da, Stato, Note
   ═══════════════════════════════════════════════════════════════════ */
.ite-expand-mode .ite-col-ops     { width: 3%;    min-width: 10px;  text-align: center; padding: 3px !important; }
.ite-expand-mode .ite-col-data    { width: 4.3%;  min-width: 28px; }
.ite-expand-mode .ite-col-scad    { width: 4.3%;  min-width: 28px; text-align: center; }
.ite-expand-mode .ite-col-nist    { width: 4%;    min-width: 20px; }
.ite-expand-mode .ite-col-ist     { width: 15%;   min-width: 60px; } /* Ditta + Tipo istanza */
.ite-expand-mode .ite-col-ogg     { width: 22%;   min-width: 80px; } /* Oggetto + Ubicazione */
.ite-expand-mode .ite-col-tipoistr{ width: 9%;    min-width: 35px; }
.ite-expand-mode .ite-col-ass     { width: 6%;    min-width: 30px; }
.ite-expand-mode .ite-col-trasda  { width: 6%;    min-width: 30px; }
.ite-expand-mode .ite-col-stato   { width: 8%;    min-width: 20px; }
.ite-expand-mode .ite-col-note    { min-width: 60px; }              /* residuo ~4.5% */

/* ═══════════════════════════════════════════════════════════════════
   LARGHEZZE COLONNE — MODALITÀ COMPATTA (MostraExpand=false)
   9 colonne: ops(link), data, scad, N.Ist., Tipo istr.,
              Assegnata a, Trasmessa da, Stato, Note
   ═══════════════════════════════════════════════════════════════════ */
.ite-compact-mode .ite-col-ops    { width: 30px;  min-width: 30px;  text-align: center; padding: 3px !important; }
.ite-compact-mode .ite-col-data   { width: 72px;  min-width: 65px; }
.ite-compact-mode .ite-col-scad   { width: 72px;  min-width: 65px; text-align: center; }
.ite-compact-mode .ite-col-nist   { width: 72px;  min-width: 60px; }
.ite-compact-mode .ite-col-tipoistr{ width: 130px; min-width: 80px; }
.ite-compact-mode .ite-col-ass    { width: 100px; min-width: 80px; }
.ite-compact-mode .ite-col-trasda { width: 115px; min-width: 80px; }
.ite-compact-mode .ite-col-stato  { width: 120px; min-width: 80px; }
.ite-compact-mode .ite-col-note   { min-width: 80px; }
