/* Fix filtri - Versione Dark Theme Coerente */

/* Rimuovi solo l'header "Filtri Avanzati" mantenendo il tema dark */
.filters-header {
    display: none !important;
}

/* Mantieni il pannello con tema dark */
#filtersPanel {
    /* Usa le variabili CSS del tema esistente */
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
    margin-bottom: 0;
}

/* Contenitore filtri orizzontale con wrap */
.filters-content {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    max-height: 150px; /* Aumentato per più campi */
    overflow-y: auto; /* Scroll se necessario */
    padding: 5px 0;
}

/* Scrollbar personalizzata per filtri */
.filters-content::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.filters-content::-webkit-scrollbar-track {
    background: var(--surface-hover);
    border-radius: 3px;
}

.filters-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
    opacity: 0.7;
}

.filters-content::-webkit-scrollbar-thumb:hover {
    opacity: 1;
}

/* Gruppo filtro inline compatto */
.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    min-width: 180px; /* Larghezza minima per leggibilità */
}

.filter-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    margin: 0;
}

.filter-group input,
.filter-input {
    padding: 5px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 12px;
    height: 28px;
    width: 120px; /* Ridotto per più filtri */
    background-color: var(--surface-hover);
    color: var(--text-primary);
    transition: var(--transition);
}

.filter-group input:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.2);
    background-color: var(--surface-color);
}

/* Footer filtri */
.filters-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.record-count {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.filter-actions button {
    padding: 6px 12px;
    font-size: 13px;
    height: 30px;
}

/* Placeholder */
.filter-group input::placeholder,
.filter-input::placeholder {
    color: var(--text-muted);
    font-size: 12px;
}

/* Messaggio filtri vuoti */
.filters-content:empty::before {
    content: "Nessun filtro disponibile per questa query";
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

/* === CUSTOM BUTTONS === */

.custom-buttons-container {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
    justify-content: center;
    padding: 0 15px;
}

.custom-action-btn {
    white-space: nowrap;
    font-size: 13px;
    padding: 6px 14px;
    transition: all 0.2s ease;
}

.custom-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.custom-action-btn i {
    margin-right: 5px;
}

/* Colori pulsanti */
.btn-warning {
    background: #f59e0b;
    color: #000;
    border: 1px solid #f59e0b;
}

.btn-warning:hover:not(:disabled) {
    background: #d97706;
    border-color: #d97706;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
    border: 1px solid #ef4444;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
}

.btn-success {
    background: #22c55e;
    color: #fff;
    border: 1px solid #22c55e;
}

.btn-success:hover:not(:disabled) {
    background: #16a34a;
    border-color: #16a34a;
}

/* === CHECKBOX SELEZIONE RIGHE === */

.checkbox-column {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    text-align: center;
    padding: 4px !important;
}

.checkbox-column input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Riga selezionata */
tr.row-selected {
    background: rgba(59, 130, 246, 0.15) !important;
}

tr.row-selected:hover {
    background: rgba(59, 130, 246, 0.25) !important;
}