/* Tabelle e responsive */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Per scroll fluido su iOS */
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

/* Regole per massimizzare larghezza tabelle */
.desktop-table-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.desktop-table-container .table-responsive {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.modern-table {
    width: 100%;
    min-width: 100%;
    table-layout: auto; /* Permette alle colonne di espandersi */
    box-sizing: border-box;
}

/* Assicura che le tabelle utilizzino tutto lo spazio disponibile del contenitore padre */
.page-content .desktop-table-container,
.main-content .desktop-table-container {
    width: 100%;
    max-width: none;
}

/* Forza le tabelle a espandersi completamente */
.desktop-table-container .modern-table {
    width: 100%;
    min-width: 100%;
}

/* Ottimizza la distribuzione delle colonne */
.modern-table th,
.modern-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0; /* Permette distribuzione automatica */
}

/* Colonne che possono espandersi */
.modern-table th:nth-child(4), /* Localizzazione */
.modern-table td:nth-child(4),
.modern-table th:nth-child(5), /* Descrizione */
.modern-table td:nth-child(5) {
    max-width: none;
    white-space: normal;
    word-wrap: break-word;
}

/* Colonne con larghezza fissa minima */
.modern-table th:nth-child(1), /* ID */
.modern-table td:nth-child(1) {
    width: 80px;
    min-width: 80px;
}

.modern-table th:nth-child(2), /* Data */
.modern-table td:nth-child(2) {
    width: 140px;
    min-width: 140px;
}

.modern-table th:nth-child(6), /* Urgenza */
.modern-table td:nth-child(6),
.modern-table th:nth-child(7), /* Stato */
.modern-table td:nth-child(7) {
    width: 120px;
    min-width: 120px;
}

.modern-table th:nth-child(8), /* Azioni */
.modern-table td:nth-child(8) {
    width: 140px;
    min-width: 140px;
}

table.table { /* Stile base per tutte le tabelle con classe .table */
    width: 100%;
    border-collapse: collapse; /* Bordi uniti */
    background-color: var(--bg-card);
    font-size: 0.9375rem; /* 15px */
}
table.table th,
table.table td {
    padding: 0.875rem 1rem; /* 14px 16px */
    text-align: left;
    vertical-align: middle; /* Allineamento verticale standard */
    border-bottom: 1px solid var(--bg-tertiary);
}
table.table thead th {
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    border-bottom-width: 2px; /* Bordo più spesso per header */
    border-bottom-color: var(--bg-tertiary);
}
table.table tbody tr:last-child td {
    border-bottom: none; /* Rimuove bordo all'ultima riga */
}
/* Variazioni tabella */
table.table-striped tbody tr:nth-of-type(odd) {
    background-color: color-mix(in srgb, var(--bg-secondary) 50%, transparent);
}
table.table-hover tbody tr:hover {
    background-color: color-mix(in srgb, var(--primary-color) 5%, transparent);
}
table.table-bordered,
table.table-bordered th,
table.table-bordered td {
    border: 1px solid var(--bg-tertiary);
}
table.table-sm th,
table.table-sm td {
    padding: 0.5rem 0.75rem; /* 8px 12px */
}
