.incidenti-map-container {
    margin: 20px 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden
}

.incidenti-map-filters {
    background: #f9f9f9;
    padding: 15px;
    border-bottom: 1px solid #eee
}

.incidenti-map-filters .filter-row {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap
}

.incidenti-map-filters label {
    font-weight: 600;
    margin-right: 5px
}

.incidenti-map-filters input,
.incidenti-map-filters select {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 3px
}

.incidenti-map-filters button {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 3px;
    cursor: pointer
}

.incidenti-map-filters button:hover {
    background: #005a87
}

.incidenti-map {
    min-height: 400px;
    background: #f5f5f5
}

.incidente-marker {
    background: #fff;
    border: 2px solid #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .3);
    transition: transform .2s
}

.incidente-marker:hover {
    transform: scale(1.1)
}

.incidente-marker-morto,
.legend-marker-morto {
    border-color: #d63384;
    background: #fff5f5
}

.incidente-marker-ferito,
.legend-marker-ferito {
    border-color: #fd7e14;
    background: #fff8f0
}

.incidente-marker-solo-danni,
.legend-marker-solo-danni {
    border-color: #6c757d;
    background: #f8f9fa
}

.incidente-marker .marker-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%
}

.incidenti-map-legend {
    background: #f9f9f9;
    padding: 10px 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 20px;
    font-size: 14px
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px
}

.legend-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid;
    display: inline-block
}

.incidente-popup .feriti,
.incidente-popup .morti {
    font-weight: 600 !important;
    padding: 6px 10px;
    border-radius: 4px;
    margin: 10px 0 !important
}

.incidenti-map-stats {
    background: #f9f9f9;
    padding: 10px 15px;
    border-top: 1px solid #eee
}

.map-stats-summary {
    display: flex;
    gap: 20px;
    font-size: 14px
}

.map-stats-summary span.morti {
    color: #d63384;
    font-weight: 600
}

.map-stats-summary span.feriti {
    color: #fd7e14;
    font-weight: 600
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15)
}

.incidente-popup {
    min-width: 280px;
    max-width: 350px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif
}

.incidente-popup h4 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #333;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 8px
}

.incidente-popup h4 a {
    color: #0073aa !important;
    text-decoration: none !important;
    font-weight: 600;
    display: block
}

.incidente-popup h4 a:hover {
    color: #005a87 !important;
    text-decoration: underline !important
}

.incidente-popup p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.4;
    color: #555
}

.incidente-popup p strong {
    color: #333;
    font-weight: 600
}

.incidente-popup .morti {
    color: #d63384 !important;
    background: #fff5f5;
    border-left: 3px solid #d63384
}

.incidente-popup .feriti {
    color: #fd7e14 !important;
    background: #fff8f0;
    border-left: 3px solid #fd7e14
}

.incidente-popup hr {
    margin: 12px 0;
    border: none;
    border-top: 1px solid #eee
}

.incidente-popup p strong::before {
    margin-right: 6px
}

.incidente-popup .solo-danni {
    color: #6c757d;
    font-weight: 600
}

.incidenti-statistics.cards .stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0
}

.incidenti-statistics .stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
    text-align: center;
    border-left: 4px solid #0073aa
}

.incidenti-statistics .stat-card.morti {
    border-left-color: #d63384
}

.incidenti-statistics .stat-card.feriti {
    border-left-color: #fd7e14
}

.incidenti-statistics .stat-number {
    font-size: 2.5em;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px
}

.incidenti-statistics .stat-label {
    font-size: .9em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: .5px
}

.incidenti-lista {
    margin: 20px 0
}

.incidenti-items {
    display: flex;
    flex-direction: column;
    gap: 15px
}

.incidente-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .1)
}

.chart-container,
.incidenti-stats-table {
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
    background: #fff
}

.incidente-data {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px
}

.incidente-data strong {
    font-size: 1.1em;
    color: #333
}

.incidente-ora {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: .9em
}

.incidente-location {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
    color: #666
}

.location-icon {
    font-size: 14px
}

.incidente-gravita {
    display: flex;
    gap: 8px;
    margin-bottom: 10px
}

.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: .8em;
    font-weight: 600;
    color: #fff
}

.badge-morti {
    background: #d63384
}

.badge-feriti {
    background: #fd7e14
}

.badge-danni {
    background: #6c757d
}

.incidente-dettagli {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: .9em;
    color: #666
}

.incidente-dettagli p {
    margin: 5px 0
}

.incidenti-stats-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0
}

.incidenti-stats-table td,
.incidenti-stats-table th {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd
}

.incidenti-stats-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #333
}

.incidenti-stats-table tr:hover {
    background: #f9f9f9
}

.stats-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-top: 30px
}

.chart-container {
    padding: 20px;
    border-radius: 8px
}

.chart-container h4 {
    margin: 0 0 15px;
    color: #333;
    font-size: 16px;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 8px
}

.incidenti-lista .no-incidents {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
    background: #f9f9f9;
    border-radius: 4px
}

.incidenti-lista .incidente-item {
    transition: .3s;
    cursor: pointer;
    position: relative
}

.incidenti-lista .incidente-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, .15)
}

.incidenti-lista .incidente-item.expanded {
    border-color: #0073aa
}

.incidenti-lista .incidente-data {
    flex-wrap: wrap
}

.incidenti-lista .incidente-data strong {
    color: #0073aa
}

.incidenti-lista .incidente-ora {
    background: #e3f2fd;
    color: #1976d2;
    font-weight: 500;
    border-radius: 4px
}

.incidenti-lista .incidente-location {
    font-size: 14px;
    line-height: 1.4
}

.incidenti-lista .incidente-location small {
    color: #888;
    font-weight: 400
}

.incidenti-lista .incidente-gravita {
    flex-wrap: wrap;
    align-items: center
}

.incidenti-lista .badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-radius: 12px;
    margin: 2px 4px 2px 0;
    white-space: nowrap
}

.incidenti-lista .incidente-dettagli {
    background: #f8f9fa;
    border-radius: 4px;
    border-top: 1px solid #e9ecef;
    font-size: 13px;
    line-height: 1.5
}

.incidenti-lista .incidente-dettagli p {
    margin: 8px 0
}

.incidenti-lista .incidente-dettagli strong {
    color: #495057;
    font-weight: 600
}

.incidenti-pagination {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    border-top: 1px solid #eee
}

.incidenti-pagination p {
    margin: 0;
    color: #666;
    font-size: 14px
}

.incidenti-lista.loading {
    opacity: .6;
    pointer-events: none
}

.incidenti-lista.loading::before {
    content: "Caricamento...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
    z-index: 10
}

.incidenti-lista .incidente-item[data-severity=fatal] {
    border-left: 4px solid #d63384
}

.incidenti-lista .incidente-item[data-severity=injury] {
    border-left: 4px solid #fd7e14
}

.incidenti-lista .incidente-item[data-severity=damage] {
    border-left: 4px solid #6c757d
}

.incidenti-statistics.cards .stat-card {
    position: relative;
    overflow: hidden
}

.incidenti-statistics.cards .stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0073aa, #005a87)
}

.incidenti-statistics.cards .stat-card.morti::before {
    background: linear-gradient(90deg, #d63384, #b02a5b)
}

.incidenti-statistics.cards .stat-card.feriti::before {
    background: linear-gradient(90deg, #fd7e14, #e8590c)
}

.incidenti-statistics.cards .stat-number {
    font-family: Georgia, serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, .1)
}

@media (max-width:768px) {
    .incidenti-statistics.cards .stats-cards {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        grid-template-columns: 1fr
    }

    .incidenti-statistics .stat-card {
        padding: 15px
    }

    .incidenti-statistics .stat-number {
        font-size: 2em
    }

    .incidenti-statistics .stat-label {
        font-size: .8em
    }

    .incidente-popup {
        min-width: 240px;
        max-width: 280px
    }

    .incidente-popup p {
        font-size: 13px
    }

    .incidente-popup h4 {
        font-size: 15px
    }

    .incidenti-map-filters .filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px
    }

    .incidenti-map-filters .filter-row>* {
        width: 100%
    }

    .incidenti-map-legend,
    .map-stats-summary {
        flex-direction: column;
        gap: 10px
    }

    .incidente-data {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px
    }

    .incidente-gravita {
        flex-wrap: wrap
    }
}

@media (max-width:480px) {
    .incidenti-statistics.cards .stats-cards {
        grid-template-columns: 1fr
    }
}

.incidenti-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666
}

.incidenti-loading::before {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: 1s linear infinite spin;
    margin-right: 10px
}

@keyframes spin {
    0% {
        transform: rotate(0)
    }

    100% {
        transform: rotate(360deg)
    }
}

.incidenti-error {
    background: #fff5f5;
    border: 1px solid #ffebee;
    color: #d32f2f;
    padding: 15px;
    border-radius: 4px;
    margin: 10px 0
}

.marker-cluster-small {
    background-color: rgba(181, 226, 140, .6)
}

.marker-cluster-small div {
    background-color: rgba(110, 204, 57, .6)
}

.marker-cluster-medium {
    background-color: rgba(241, 211, 87, .6)
}

.marker-cluster-medium div {
    background-color: rgba(240, 194, 12, .6)
}

.marker-cluster-large {
    background-color: rgba(253, 156, 115, .6)
}

.marker-cluster-large div {
    background-color: rgba(241, 128, 23, .6)
}

.marker-cluster {
    background-clip: padding-box;
    border-radius: 20px
}

.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 15px;
    font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif
}

.marker-cluster span {
    line-height: 30px;
    color: #000;
    font-weight: 700
}

@media (prefers-color-scheme:dark) {
    .incidenti-map-container {
        background: #2c2c2c;
        border-color: #444
    }

    .incidenti-map-filters,
    .incidenti-map-legend,
    .incidenti-map-stats {
        background: #333;
        border-color: #444;
        color: #fff
    }

    .incidente-item,
    .incidenti-statistics .stat-card {
        background: #2c2c2c;
        border-color: #444;
        color: #fff
    }

    .incidente-popup {
        background: #2c2c2c;
        color: #fff
    }
}

.incidente-popup p[data-type=coordinates] {
    font-family: monospace;
    font-size: 12px;
    color: #666;
    background: #f8f9fa;
    padding: 4px 6px;
    border-radius: 3px
}


/* Messaggi form */
.form-message {
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 4px;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-icon {
    font-size: 18px;
    margin-right: 10px;
    font-weight: bold;
}

.message-text {
    flex: 1;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.info-message {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

.warning-message {
    background: #fff3cd;
    color: #856404;
    border-left-color: #ffc107;
}

/* Miglioramenti visual feedback */
.form-row input.error,
.form-row select.error {
    border-color: #dc3545 !important;
    background-color: #fff5f5;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

#form-loading {
    margin-left: 10px;
    color: #666;
    font-style: italic;
}

#submit-incidente:disabled {
    background: #6c757d !important;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Form Frontend Incidenti */
#incidenti-frontend-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#incidenti-frontend-form h3 {
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.form-section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #e1e1e1;
    border-radius: 5px;
}

.form-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #0073aa;
}

.form-row {
    margin-bottom: 15px;
}

.form-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.form-row input,
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-row input.error,
.form-row select.error {
    border-color: #dc3232;
    background-color: #ffeaea;
}

.form-row-group {
    display: flex;
    gap: 15px;
}

.form-row-group .form-row {
    flex: 1;
}

#frontend-map {
    height: 300px;
    border: 2px solid #ddd;
    border-radius: 5px;
    margin-bottom: 10px;
}

.map-help {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

#form-messages {
    margin-bottom: 20px;
}

.form-message {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.success-message {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.error-message {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.info-message {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

.warning-message {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.message-icon {
    font-weight: bold;
    margin-right: 8px;
}

.form-submit {
    text-align: center;
    margin-top: 30px;
}

#submit-incidente {
    background-color: #0073aa;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#submit-incidente:hover {
    background-color: #005a87;
}

#submit-incidente:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#form-loading {
    display: none;
    text-align: center;
    margin-top: 10px;
}

.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .form-row-group {
        flex-direction: column;
    }
    
    #incidenti-frontend-form {
        padding: 15px;
        margin: 10px;
    }
}

/* Miglioramenti layout filtri mappa */
.incidenti-map-filters .filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.incidenti-map-filters .filter-row label {
    font-weight: bold;
    margin-right: 5px;
    min-width: 120px;
}

.incidenti-map-filters .filter-row select,
.incidenti-map-filters .filter-row input[type="text"],
.incidenti-map-filters .filter-row input[type="date"] {
    min-width: 150px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.incidenti-map-filters .filter-row input[type="text"] {
    min-width: 200px;
}

@media (max-width: 768px) {
    .incidenti-map-filters .filter-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .incidenti-map-filters .filter-row label {
        min-width: auto;
        margin-bottom: 5px;
    }
    
    .incidenti-map-filters .filter-row select,
    .incidenti-map-filters .filter-row input {
        width: 100%;
        min-width: auto;
    }
}

/* Barra progresso caricamento mappa */
.loading-progress {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    min-width: 250px;
    text-align: center;
}

.loading-progress .progress-text {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: #333;
}

.loading-progress .progress-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.loading-progress .progress-fill {
    height: 100%;
    background: #0073aa;
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}