/* Stili ottimizzati per la dashboard - Layout compatto e professionale */

/* Reset e layout principale - COMPATTO */
.istat-dashboard-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 100%;
    margin: 0;
    padding: 8px;
    background: transparent;
    line-height: 1.2;
}

/* Stili specifici per la sezione header - ASSICURA VISIBILITÀ */
.header {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    border-radius: 20px !important;
    padding: 30px !important;
    margin-bottom: 30px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
    text-align: center !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1 !important;
}

.header h1 {
    color: #2c3e50 !important;
    font-size: 2.5em !important;
    margin-bottom: 10px !important;
    font-weight: 700 !important;
    display: block !important;
    visibility: visible !important;
}

.header p {
    color: #7f8c8d !important;
    font-size: 1.1em !important;
    display: block !important;
    visibility: visible !important;
}

/* Layout controlli ottimizzato - COMPATTO */
.controls {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.1);
}

/* Layout a due righe migliorato - COMPATTO */
.indicator-select-row {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.other-controls-row {
    display: grid !important;
    grid-template-columns: 180px 180px 1fr auto !important;
    gap: 10px !important;
    align-items: end !important;
    margin-bottom: 8px;
    width: 100%;
}

/* Controlli indicatore */
.indicator-controls {
    display: flex;
    gap: 12px;
    align-items: end;
}

.indicator-controls select {
    flex: 1;
    min-width: 0;
}

/* Animazioni per i card */
.card {
    animation: fadeInUp 0.4s ease-out;
    margin-bottom: 20px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Effetti hover più sottili */
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* Stili per i tooltip personalizzati */
.custom-tooltip {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
}

/* Stili per i filtri avanzati */
.advanced-filters {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 20px;
    margin-top: 15px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.filter-group label {
    font-weight: 500;
    min-width: 120px;
}

/* Layout principale ottimizzato - COMPATTO */
.dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

/* Stili per le sezioni card ottimizzati - COMPATTI */
.card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.card h3 {
    color: #2c3e50;
    margin-bottom: 12px;
    font-size: 1.1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
    line-height: 1.2;
}

.card h3 i {
    color: #667eea;
    font-size: 1.1em;
}

/* Stili per le statistiche compatte */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

/* Controlli form ottimizzati - COMPATTI */
.control-group {
    margin-bottom: 4px;
}

.control-group label {
    display: block;
    margin-bottom: 3px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.8em;
    line-height: 1.0;
}

.control-group select, 
.control-group input {
    width: 100%;
    padding: 6px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 5px;
    font-size: 12px;
    background: white;
    transition: all 0.3s ease;
    font-family: inherit;
    line-height: 1.1;
}

.control-group select:focus, 
.control-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Filtri territori ottimizzati - COMPATTI */
.territory-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    align-items: center;
}

.territory-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 8px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8em;
    font-weight: 500;
    min-height: 28px;
    line-height: 1.0;
}

.territory-checkbox:hover {
    background: #e9ecef;
    border-color: rgba(102, 126, 234, 0.2);
}

.territory-checkbox input {
    margin: 0;
    accent-color: #667eea;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    border-left: 4px solid #667eea;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Tabelle ottimizzate */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    font-size: 0.9em;
}

.data-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    color: #2c3e50;
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Grafico container ottimizzato */
.chart-container {
    position: relative;
    height: 350px;
    margin-top: 15px;
    padding: 10px;
    background: #fafafa;
    border-radius: 8px;
}

.stat-value {
    font-size: 1.8em;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.85em;
    color: #7f8c8d;
    margin-top: 5px;
    line-height: 1.3;
}

/* Stili per le statistiche avanzate */
.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.stat-card .stat-number {
    font-size: 3em;
    font-weight: 700;
    margin-bottom: 10px;
}

.stat-card .stat-description {
    font-size: 1.1em;
    opacity: 0.9;
    font-weight: 500;
}

/* Stili per i pulsanti di azione */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

.btn-outline {
    background: transparent;
    border: 2px solid #667eea;
    color: #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

/* Pulsante esporta ottimizzato */
.other-controls-row .control-group:last-child {
    display: flex;
    align-items: end;
}

.other-controls-row .control-group:last-child .btn {
    white-space: nowrap;
    min-width: 140px;
}

/* Responsive design ottimizzato */
@media (max-width: 1024px) {
    .other-controls-row {
        grid-template-columns: 1fr 1fr auto;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
    
    .chart-container {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .istat-dashboard-container {
        padding: 10px;
    }
    
    .controls, .card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .other-controls-row {
        grid-template-columns: 100px 100px 1fr auto !important;
        gap: 8px;
    }
    
    .other-controls-row .control-group:last-child {
        grid-column: 1 / -1;
        justify-content: center;
    }
    
    .indicator-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .territory-filter {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .chart-container {
        height: 250px;
        padding: 5px;
    }
    
    .data-table {
        font-size: 0.8em;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .istat-dashboard-container {
        padding: 8px;
    }
    
    .controls, .card {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .card h3 {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
    
    .territory-filter {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .btn-info {
        width: 100%;
        justify-content: center;
        margin-top: 8px;
    }
    
    .chart-container {
        height: 200px;
        margin-top: 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stat-item {
        padding: 10px;
    }
    
    .stat-value {
        font-size: 1.4em;
    }
    
    .stat-label {
        font-size: 0.8em;
    }
}

/* Stili per il tema scuro (opzionale) */
.dark-theme {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: #ecf0f1;
}

.dark-theme .card {
    background: rgba(44, 62, 80, 0.95);
    color: #ecf0f1;
}

.dark-theme .header {
    background: rgba(44, 62, 80, 0.95);
}

.dark-theme .controls {
    background: rgba(44, 62, 80, 0.95);
}

/* Stili per le notifiche */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #27ae60;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
}

.notification.error {
    background: #e74c3c;
}

.notification.warning {
    background: #f39c12;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Stili per il loader personalizzato */
.custom-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

/* Stili per i grafici migliorati */
.chart-container {
    position: relative;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Stili per la tabella migliorata */
.data-table {
    font-size: 0.9em;
}

.data-table th {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 0.9em;
}

/* Stili per i valori nulli */
.null-value {
    color: #bdc3c7;
    font-style: italic;
}

/* Stili per i valori positivi/negativi */
.positive-value {
    color: #27ae60;
    font-weight: 600;
}

.negative-value {
    color: #e74c3c;
    font-weight: 600;
}

/* Stili per il footer */
.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9em;
    margin-top: 40px;
}

.footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
} 

/* Stili per la sezione di analisi comparativa */
.advanced-stats-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e9ecef;
}

.advanced-stats-section h4 {
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 25px;
    color: #2c3e50;
}

/* Stili per pulsante Info e controlli indicatore */
.indicator-controls {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.indicator-controls select {
    flex: 1;
}

.btn-info {
    padding: 8px 12px;
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.1;
    min-height: 32px;
}

.btn-info:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.3);
}

.btn-info:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Stili per il modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 25px;
    max-height: 400px;
    overflow-y: auto;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
}

/* Stili per il contenuto del modal */
.info-section {
    margin-bottom: 20px;
}

.info-section h4 {
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-section p {
    margin: 0;
    line-height: 1.6;
    color: #5a6c7d;
}

.info-badge {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Animazioni modal */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: scale(0.9) translateY(-20px);
        opacity: 0;
    }
    to { 
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Responsività per le statistiche */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .stat-item {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 1.8em;
    }
    
    .stat-label {
        font-size: 0.9em;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-card .stat-number {
        font-size: 2.5em;
    }
    
    .indicator-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
} 

/* Media queries per assicurare visibilità header su tutti i dispositivi */
@media (max-width: 1024px) {
    .header {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        padding: 20px !important;
    }
    
    .header h1 {
        font-size: 2em !important;
        display: block !important;
        visibility: visible !important;
    }
    
    .header p {
        font-size: 1em !important;
        display: block !important;
        visibility: visible !important;
    }
}

@media (max-width: 768px) {
    .header {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        padding: 15px !important;
        margin-bottom: 20px !important;
    }
    
    .header h1 {
        font-size: 1.8em !important;
        display: block !important;
        visibility: visible !important;
    }
    
    .header p {
        font-size: 0.9em !important;
        display: block !important;
        visibility: visible !important;
    }
}

@media (max-width: 480px) {
    .header {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        padding: 10px !important;
        margin-bottom: 15px !important;
    }
    
    .header h1 {
        font-size: 1.5em !important;
        display: block !important;
        visibility: visible !important;
    }
    
    .header p {
        font-size: 0.8em !important;
        display: block !important;
        visibility: visible !important;
    }
} 