/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* Container */
.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 40px;
}

/* Header */
header {
    background: white;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    border-radius: 8px;
}

h1 {
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    flex-wrap: wrap;
}

.tab {
    padding: 10px 20px;
    background: #ecf0f1;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    color: #000000;
}

.tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
    color: white;
    font-weight: 700;
}

/* Colori hover per ogni tab */
.tab:nth-child(1):hover { background: linear-gradient(135deg, #667eea, #764ba2); }
.tab:nth-child(2):hover { background: linear-gradient(135deg, #10b981, #065f46); }
.tab:nth-child(3):hover { background: linear-gradient(135deg, #f59e0b, #d97706); }
.tab:nth-child(4):hover { background: linear-gradient(135deg, #ef4444, #dc2626); }
.tab:nth-child(5):hover { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.tab:nth-child(6):hover { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.tab:nth-child(7):hover { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.tab:nth-child(8):hover { background: linear-gradient(135deg, #ec4899, #db2777); }
.tab:nth-child(9):hover { background: linear-gradient(135deg, #84cc16, #65a30d); }
.tab:nth-child(10):hover { background: linear-gradient(135deg, #f97316, #ea580c); }
.tab:nth-child(11):hover { background: linear-gradient(135deg, #6366f1, #4f46e5); }

.tab.active {
    background: white;
    color: #4c1d95;
    font-weight: 800;
}

/* Content */
.content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-height: 400px;
}

.hidden {
    display: none;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.stat-card h3 {
    font-size: 14px;
    margin-bottom: 5px;
    opacity: 0.9;
}

.stat-card .value {
    font-size: 24px;
    font-weight: bold;
}

/* Alert Scadenze */
.scadenze-alert {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}.scadenze-count {
    font-size: 14px;
    margin: 5px 0;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background: #f8f9fa;
    font-weight: bold;
}

/* Modal */
.modal {
    display: none;
    position: fixed !important;
    z-index: 1000 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0,0,0,0.4) !important;
    animation: fadeIn 0.3s;
}

.modal.show {
    display: block !important;
}
.modal-content {
    background-color: white !important;
    margin: 20px auto !important;
    padding: 20px !important;
    border-radius: 8px !important;
    width: 95% !important;
    max-width: 1400px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    position: relative !important;
    z-index: 1001 !important;
    animation: slideIn 0.3s;
}
/* Animazioni */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translate(-50%, -60%); opacity: 0; }
    to { transform: translate(-50%, -50%); opacity: 1; }
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Buttons */
button {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #2980b9;
}

.btn-primary { background: #3498db; }
.btn-danger { background: #e74c3c; }
.btn-warning { background: #f39c12; }
.btn-success { background: #27ae60; }
.btn-info { background: #17a2b8; }

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-primary { background: #cce5ff; color: #004085; }
.badge-immediato { background: #dc3545; color: white; font-weight: bold; }

/* Storage Indicator */
.storage-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-width: 250px;
    z-index: 999;
}

.storage-bar {
    width: 100%;
    height: 20px;
    background: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.storage-fill {
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #3498db);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.storage-fill.warning {
    background: linear-gradient(90deg, #f39c12, #e67e22);
}

.storage-fill.danger {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.storage-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
}

/* Header Actions */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Stato Salvataggio */
#statoSalvataggio {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 10px 20px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    font-weight: bold;
    z-index: 1000;
    animation: fadeIn 0.3s;
    display: none;
}

#statoSalvataggio.show {
    display: block;
}

/* Export Menu */
.export-menu {
    position: relative;
    display: inline-block;
}

.export-dropdown {
    display: none;
    position: absolute;
    right: 0;
    background: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border-radius: 5px;
    margin-top: 5px;
    min-width: 200px;
    z-index: 100;
}

.export-dropdown.show {
    display: block;
}

.export-dropdown button {
    width: 100%;
    text-align: left;
    padding: 10px 15px;
    border-radius: 0;
    margin: 0;
}

.export-dropdown button:hover {
    background: #3498db;
}

/* Totals Row */
.totals-row {
    font-weight: bold;
    background: #ecf0f1;
}

/* Filter Group */
.filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group select {
    width: auto;
    min-width: 150px;
}

/* Alerts */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Info Scadenza */
.info-scadenza {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* Termini Rapidi */
.termini-rapidi {
    display: flex;
    gap: 10px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.termini-btn {
    padding: 5px 10px;
    background: #ecf0f1;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.termini-btn:hover {
    background: #3498db;
    color: white;
}

.termini-btn.selected {
    background: #2980b9;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab {
        width: 100%;
    }
}
/* Filtri periodo personalizzati */
#datePersonalizzate,
#datePersonalizzatePrimaNota,
#datePersonalizzateDDT,
#datePersonalizzateChiusure {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.filter-group input[type="date"] {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
/* Stili per scadenzario */
.scadenza-scaduta {
    color: #dc3545;
    font-weight: bold;
}

.scadenza-imminente {
    color: #fd7e14;
    font-weight: bold;
}

.scadenza-attenzione {
    color: #ffc107;
}

.scadenza-ok {
    color: #28a745;
}

.alert-scadenze {
    margin-bottom: 20px;
}

.text-danger {
    color: #dc3545;
    font-weight: bold;
}

.text-warning {
    color: #fd7e14;
    font-weight: bold;
}

.text-info {
    color: #17a2b8;
}

.badge-info {
    background-color: #17a2b8;
    color: white;
}

.filtri-container {
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
}
/* Autocomplete Articoli */
.autocomplete-item:hover {
    background: #f0f7ff !important;
}

.autocomplete-item.active {
    background: #e3f2fd !important;
}

.desc-autocomplete {
    width: 100%;
}
/* Tabella righe acquisto più spaziosa */
#righeAcquisto input,
#righeAcquisto select {
    min-width: 60px;
}

#righeAcquisto input[type="text"] {
    min-width: 150px;
}

#righeAcquisto .autocomplete-wrapper,
.autocomplete-wrapper {
    min-width: 200px;
    position: relative;
}

/* RIMUOVI SCROLL dalla sezione righe */
.modal-content div[style*="background: #f8f9fa"] {
    overflow: visible !important;
    max-height: none !important;
}

.modal-content div[style*="background: #f8f9fa"] > div {
    overflow: visible !important;
    max-height: none !important;
}

/* Dropdown autocomplete SOPRA tutto */
.autocomplete-dropdown,
div[id^="dropAcq_"] {
    z-index: 99999 !important;
    position: absolute !important;
    background: white !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4) !important;
    border: 2px solid #3498db !important;
    max-height: 250px !important;
    overflow-y: auto !important;
}
/* Storico Pagamenti - larghezze colonne uniformi */
.tabella-storico-pagamenti {
    width: 100% !important;
    table-layout: fixed !important;
}

.tabella-storico-pagamenti th,
.tabella-storico-pagamenti td {
    width: 16.66% !important;
}