/* ============================================================================
   RESET E STILI BASE
   ============================================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    width: 95%;
    margin: 20px auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    /* permette menu su mobile */
    overflow: visible; 
}

/* ============================================================================
   HEADER & NAVIGATION
   ============================================================================ */
.header {
    background: #2c3e50;
    color: white;
    padding: 20px 30px;
    border-bottom: 3px solid #34495e;
    position: relative;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.header-left h1 {
    font-size: 2em;
    margin-bottom: 5px;
}

.header-left p {
    font-size: 1em;
    opacity: 0.9;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Bottone hamburger (visibile solo mobile) */
.hamburger-btn {
    display: none;
    background: none;
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s;
}

.hamburger-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: white;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-right: 10px;
}

.user-info span {
    font-size: 14px;
}

.user-role {
    background: rgba(255,255,255,0.2);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin-top: 3px;
    text-transform: uppercase;
    font-weight: 600;
}

.user-role.admin { background: #e74c3c; }
.user-role.manager { background: #e74c3c; }
.user-role.technician { background: #3498db; }

.header-buttons {
    display: flex;
    gap: 10px;
}

/* ============================================================================
   NUOVO LAYOUT CONTROLLI AZIONI + FILTRI
   ============================================================================ */
.controls {
    padding: 20px 30px;
    background: #fff;
    border-bottom: 2px solid #e9ecef;
    max-width: 1200px; 
    margin: 0 auto;    
    border-radius: 8px;
}

/* Barra Superiore Ricerca + Toggle Buttons */
.top-bar {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
}

.search-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    max-width: 600px;
}

#searchInput {
    width: 100%;
    padding: 12px 40px 12px 15px; 
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

#searchInput:focus {
    border-color: #2c3e50;
    outline: none;
}

.btn-icon-clear {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.btn-icon-clear:hover { color: #dc3545; }

/* Bottoni Toggle Visibili solo su Mobile */
.toggle-buttons {
    display: none;
    gap: 8px;
}

.btn-icon-menu {
    padding: 12px 15px;
    white-space: nowrap;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Pannelli a Scomparsa Dropdown */
.panel-dropdown {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    animation: slideDown 0.2s ease-out;
}

/* Griglia pulsanti azioni */
.actions-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Griglia Filtri */
.filters-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #ddd;
}

.filter-label {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-right: 5px;
}

.filter-group {
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.filter-group select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 100%;
    background: white;
}

/* Barra Ordinamento */
.sort-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.sort-label {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-right: 5px;
}

.sort-btn, .sort-reset {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.sort-btn:hover { border-color: #2c3e50; color: #2c3e50; }

.sort-btn.active {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}
.sort-btn.active.asc::after { content: " ↑"; }
.sort-btn.active.desc::after { content: " ↓"; }

/* ============================================================================
   SELEZIONE & AZIONI DI MASSA
   ============================================================================ */
.selection-bar-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.select-all-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
    font-weight: 600;
    margin-bottom: 10px;
}

.select-all-wrapper input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Barra verde delle azioni */
.bulk-actions-bar {
    background: #e8f5e9;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #c8e6c9;
    animation: slideDown 0.3s ease;
}

.bulk-actions-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bulk-group {
    display: flex;
    align-items: center;
    gap: 5px;
    background: white;
    padding: 4px;
    border-radius: 6px;
    border: 1px solid #c8e6c9;
}

.bulk-group select {
    border: none;
    background: transparent;
    padding: 5px;
    font-size: 14px;
    outline: none;
    min-width: 120px;
}

/* ============================================================================
   BUTTON STYLES
   ============================================================================ */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn-primary { background: #2c3e50; color: white; }
.btn-primary:hover:not(:disabled) { background: #34495e; transform: translateY(-2px); }

.btn-success { background: #28a745; color: white; }
.btn-success:hover:not(:disabled) { background: #218838; transform: translateY(-2px); }

.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover:not(:disabled) { background: #5a6268; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; display: inline-block; }

.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover:not(:disabled) { background: #c82333; }

.btn-warning { background: #ffc107; color: #333; }
.btn-warning:hover:not(:disabled) { background: #e0a800; }

.btn-dark { background: #1a252f; color: white; } 

/* File upload container (vecchia compatibilità) */
.file-upload input[type="file"] { display: none; }

/* ============================================================================
   INCIDENT GRID & CARDS
   ============================================================================ */
.content { padding: 30px; }

.incidents-grid {
    display: grid;
    /* Responsive grid: min 300px width cards */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
    animation: fadeIn 0.3s ease;
}

.incident-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s;
    cursor: pointer;
    position: relative; 
}

.incident-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: #2c3e50;
}

/* Checkbox su card */
.card-checkbox {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 22px;
    height: 22px;
    cursor: pointer;
    z-index: 10;
    accent-color: #4CAF50;
    display: block !important;
}

/* Card Selezionata */
.incident-card.selected {
    border: 3px solid #4CAF50 !important;
    background: #e8f5e9 !important;
    opacity: 1 !important;
}

/* Stati speciali */
.incident-card.state-in-progress {
}
.incident-card.state-on-hold {
}
.incident-card.state-resolved {
    opacity: 0.75;
    background: linear-gradient(135deg, #fff 0%, #f1f8e9 100%);
    border-color: #c8e6c9;
}
.incident-card.state-not-resolved {
    opacity: 0.85;
    background: linear-gradient(135deg, #fff 0%, #fff3e0 100%);
    border-color: #ffcc80;
}
.incident-card.state-closed {
    opacity: 0.6;
    background: #f8f9fa;
    border-color: #e9ecef;
}

.incident-number {
    font-size: 1.2em;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
    padding-right: 30px;
}

.incident-badges { margin-bottom: 10px; }

.incident-priority, .incident-state {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    margin-right: 8px;
}

/* Colori Priorità */
.priority-1, .priority-2 { background: #dc3545; color: white; }
.priority-3 { background: #ffc107; color: #333; }
.priority-4, .priority-5 { background: #28a745; color: white; }
.incident-state { background: #6c757d; color: white; }
.state-in-progress .incident-state { background: #2196f3; color: white; }
.state-on-hold .incident-state { background: #ff9800; color: white; }
.state-resolved .incident-state { background: #28a745; }
.state-not-resolved .incident-state { background: #fd7e14; color: white; }

.incident-company {
    color: #495057;
    font-size: 0.95em;
    margin: 8px 0;
    font-weight: 600;
}

.incident-location {
    color: #6c757d;
    font-size: 0.9em;
    margin: 5px 0;
}

.incident-description {
    color: #6c757d;
    margin: 10px 0;
    font-size: 0.95em;
    line-height: 1.5;
}

.incident-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    font-size: 0.85em;
    color: #6c757d;
}

/* ============================================================================
   MODALS & FORMS TUTTI REINSERITI
   ============================================================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-header {
    background: #2c3e50;
    color: white;
    padding: 20px 30px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2em;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.modal-body { padding: 30px; }

/* Form Elements */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #333; }
.required::after { content: " *"; color: #dc3545; }

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #2c3e50;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* Stile speciale per datetime-local */
input[type="datetime-local"] {
    padding: 10px 12px;
}

.form-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.form-section h3 {
    display: flex;
    justify-content: left;
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.form-section h3 * { margin-right: 4px; }

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

/* Detail Views Modal Dettaglio */
.detail-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { font-weight: 600; color: #2c3e50; }
.detail-value { color: #333; word-wrap: break-word; }

.detail-section { margin-bottom: 25px; }
.detail-section h3 {
    display: flex;
    justify-content: left;
    color: #2c3e50;
    margin-bottom: 15px;
    margin-left: 2px;
    border-bottom: 2px solid #2c3e50;
    padding-bottom: 10px;
    font-size: 1.1em;
}
.detail-section h3 * { margin-right: 4px; }

/* ============================================================================
    ASSETS MANAGEMENT BENI MULTIPLI
   ============================================================================ */
.asset-row, .used-asset-row {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    position: relative;
    transition: all 0.3s;
    animation: fadeIn 0.3s ease;
}

.asset-row:hover, .used-asset-row:hover {
    border-color: #2c3e50;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.asset-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
}

.asset-row-number { font-weight: 600; color: #2c3e50; }

.btn-add-asset, .btn-add-used-asset {
    display: flex;
    align-items: center;
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-remove-asset {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.empty-assets-message {
    text-align: center;
    padding: 20px;
    font-style: italic;
    color: #666;
    background: #f8f9fa;
    border-radius: 8px;
}

/* ============================================================================
   USER MANAGEMENT TABLE & UTILITIES
   ============================================================================ */
.users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.users-table th, .users-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}
.users-table th { background: #f8f9fa; font-weight: 600; color: #2c3e50; }
.users-table tr:hover { background: #f9f9f9; }

/* Classe per tabelle responsive */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 15px;
}

/* Badge Utente */
.user-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.user-badge.admin { background: #e74c3c; color: white; }
.user-badge.manager { background: #e74c3c; color: white; }
.user-badge.technician { background: #3498db; color: white; }
.user-badge.active { background: #28a745; color: white; }
.user-badge.inactive { background: #6c757d; color: white; }

/* ============================================================================
   SIGNATURES FIRMA DIGITALE
   ============================================================================ */
.sig-preview {
    border: 2px dashed #ccc;
    background: #f9f9f9;
    height: 120px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: all 0.3s;
}
.sig-preview:hover { border-color: #2196f3; background: #e3f2fd; }
.sig-preview img { max-width: 90%; max-height: 90%; }

.signature-modal { 
    display: none; 
    position: fixed; 
    z-index: 9999; 
    top:0; left:0; 
    width:100%; height:100%; 
    background:rgba(0,0,0,0.8); 
}
.signature-modal.active { display: flex; align-items: center; justify-content: center; }

.signature-content { 
    background: white; 
    width: 95%; 
    height: 90%; 
    border-radius: 10px;
    display: flex; 
    flex-direction: column; 
}

.signature-body { 
    flex: 1; 
    background: #fff; 
    position: relative; 
    overflow: hidden; 
    cursor: crosshair; 
    border-top: 1px solid #eee; 
    border-bottom: 1px solid #eee;
}

#signatureCanvas { 
    width: 100%; 
    height: 100%; 
    display: block; 
    touch-action: none; 
}

.signature-footer { 
    padding: 15px; 
    display: flex; 
    justify-content: space-between; 
    background: #f8f9fa; 
    border-radius: 0 0 10px 10px;
}

/* ============================================================================
   TOAST, LOADING & EXTRAS
   ============================================================================ */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 2000;
    animation: slideIn 0.3s ease-out;
    max-width: 400px;
}
.toast.success { background: #28a745; }
.toast.error { background: #dc3545; }
.toast.info { background: #17a2b8; }
.toast.warning { background: #ffc107; color: #333; }

/* Loading Overlay */
.loading-indicator {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}
.spinner {
    width: 50px; height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading { text-align: center; padding: 20px; color: #666; }

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}
.pagination {
    display: flex;
    gap: 5px;
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.pagination-btn {
    min-width: 35px; height: 35px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.pagination-btn.active { background: #2c3e50; color: white; border-color: #2c3e50; }
.pagination-btn:hover:not(.active):not(:disabled) { background: #f1f1f1; }

/* Stats */
.stats-container {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
    border: 1px solid #e9ecef;
}

/* Keyframes */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDownMenu { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { transform: translateX(400px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============================================================================
   MEDIA QUERIES MOBILE RESPONSIVE
   ============================================================================ */
@media (max-width: 768px) {
    /* Layout Container */
    body { padding: 10px; }
    .container {
        border-radius: 0;
        overflow: visible; 
    }

    /* Header */
    .header { padding: 10px 15px; position: relative; }
    .header-content { flex-wrap: nowrap; gap: 0; }
    .hamburger-btn { display: block; }

    /* Menu Utente a tendina Hamburger */
    .header-right {
        display: none;
        position: absolute;
        top: 100%; left: 0; width: 100%;
        background-color: #34495e;
        flex-direction: column;
        padding: 20px;
        z-index: 1000;
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    }
    .header-right.active { display: flex; animation: slideDownMenu 0.3s ease-out; }
    
    .header-right .user-info {
        align-items: center;
        margin-right: 0;
        width: 100%;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    .header-buttons { flex-direction: column; width: 100%; }
    .header-buttons .btn { width: 100%; justify-content: center; }

    /* CONTROLLI MOBILE */
    .toggle-buttons { display: flex; } /* Mostra i tasti Azioni/Filtri */
    
    .hidden-mobile { display: none; } /* Nascondi i pannelli di default */
    .panel-dropdown.active { display: block; } /* Mostra quando attivi */
    
    /* Griglia Azioni Mobile: 2 colonne */
    .actions-grid { grid-template-columns: 1fr 1fr; }
    
    /* Griglia Filtri Mobile: Stack verticale */
    .filters-grid { flex-direction: column; gap: 10px; }
    
    /* Griglia Ordinamento Mobile */
    .sort-bar {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        width: 100%;
    }
    .filter-label { display: none; } 
    .sort-label { display: none; }

    /* Griglia Incident Mobile */
    .incidents-grid { grid-template-columns: 1fr; }

    /* Forms Mobile */
    .form-row, .detail-row { grid-template-columns: 1fr; }
    .modal { padding: 0; align-items: flex-end; }
    .modal-content { height: 100%; max-height: 100vh; border-radius: 0; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; }
    
    /* Asset rows responsive */
    .asset-row .form-row, .used-asset-row .form-row { flex-direction: column; }
    
    /* Azioni di massa su mobile */
    .bulk-actions-content { flex-direction: column; align-items: stretch; }
    .bulk-group { width: 100%; display: flex; justify-content: space-between; }
    .bulk-group select { flex: 1; }
}

/* DESKTOP (> 769px) */
@media (min-width: 769px) {
    /* Nascondi Hamburger e Toggle Menu */
    .hamburger-btn { display: none; }
    .toggle-buttons { display: none; }
    
    /* Pannelli sempre visibili e puliti */
    .hidden-mobile { 
        display: block !important; 
        background: transparent;
        border: none;
        padding: 0;
        margin-top: 20px;
        box-shadow: none;
    }
    
    /* Layout Orizzontale Desktop */
    .panel-dropdown { 
        background: transparent; 
        border: none; 
        box-shadow: none; 
        padding: 0; 
        margin: 0;
    }
    
    .filters-grid { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
    
    /* Organizzazione spaziale */
    #actionsPanel { margin-bottom: 20px; border-bottom: 1px solid #eee; padding-bottom: 20px; }
    #filtersPanel { display: flex; align-items: flex-end; justify-content: space-between; }
    .filters-grid { margin-bottom: 0; }
    .sort-bar { border-top: none; padding-top: 0; margin-top:4px }
    
    .actions-grid {
        display: flex;
        justify-content: flex-start;
    }
    .actions-grid .btn { width: auto; }
}

/* ============================================================================
   SCROLL TO TOP BUTTON
   ============================================================================ */
.scroll-to-top-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    z-index: 999; /* Sotto i Modal */
}

.scroll-to-top-btn:hover {
    background: #34495e;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.scroll-to-top-btn:active {
    transform: translateY(-1px);
}

.scroll-to-top-btn svg {
    width: 24px;
    height: 24px;
}

/* Mostra pulsante su mobile e con scroll */
@media (max-width: 768px) {
    .scroll-to-top-btn.visible {
        display: flex;
    }
}
