/**
 * Weather Layers CSS
 * Styling per layer meteorologici (radar, stazioni, isobare)
 */

/* ============================================
   MODAL ISTRUZIONI E LEGGENDE
   ============================================ */

.legends-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    animation: fadeIn 0.2s ease-out;
}

.legends-modal-content {
    background: white;
    border-radius: 0.75rem;
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

.legends-modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-radius: 0.75rem 0.75rem 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.legends-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.legends-modal-body {
    padding: 2rem;
    background: white;
}

.legend-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.legend-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.legend-section h3 {
    color: #1e293b;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.legend-section p {
    color: #475569;
    margin-bottom: 0.75rem;
}

.legend-section ul,
.legend-section ol {
    color: #475569;
    margin-left: 0 !important;
    padding-left: 1.5rem !important;
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
}

.legend-section ul ul,
.legend-section ol ul,
.legend-section ul ol,
.legend-section ol ol {
    margin-top: 0.5rem !important;
    margin-bottom: 0 !important;
}

.legend-section li {
    margin-bottom: 0.25rem;
}

.legends-modal-footer {
    padding: 1.5rem;
    border-top: 2px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 0.75rem 0.75rem;
    text-align: right;
}

/* ============================================
   CONTROLLI LAYER SIDEBAR
   ============================================ */

.weather-section {
    margin-top: 1rem;
}

.layer-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.layer-control:last-child {
    border-bottom: none;
}

.layer-control label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #334155;
    user-select: none;
}

.layer-control input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* Checkbox indeterminate state (partial selection) */
.layer-control input[type="checkbox"]:indeterminate {
    background: #3b82f6;
    border-color: #3b82f6;
    opacity: 0.7;
}

.layer-status {
    font-size: 0.75rem;
    color: #64748b;
    font-style: italic;
}

.layer-status.loading {
    color: #3b82f6;
}

.layer-status.active {
    color: #10b981;
    font-weight: 600;
}

.layer-status.error {
    color: #ef4444;
}

.layer-status.inactive {
    color: #94a3b8;
}

/* Slider opacità */
.opacity-control {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: #f8fafc;
    border-radius: 0.25rem;
}

.opacity-control label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.opacity-slider {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #cbd5e1;
    outline: none;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.opacity-slider:hover {
    opacity: 1;
}

.opacity-slider::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
}

.opacity-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: none;
}

/* Info box */
.meteo-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: #f1f5f9;
    border-radius: 0.375rem;
    border-left: 3px solid #3b82f6;
}

.meteo-info small {
    font-size: 0.75rem;
    color: #475569;
    display: block;
    line-height: 1.4;
}

/* ============================================
   LEGENDA RADAR
   ============================================ */

.radar-legend {
    position: absolute;
    bottom: 2rem;
    right: 1rem;
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
                0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    min-width: 200px;
    font-size: 0.875rem;
}

.legend-title {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    color: #1e293b;
    font-size: 0.9rem;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.radar-color {
    width: 24px;
    height: 16px;
    border: 1px solid #cbd5e1;
    border-radius: 2px;
    flex-shrink: 0;
}

.legend-item span {
    font-size: 0.8rem;
    color: #475569;
}

.legend-footer {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e2e8f0;
}

.legend-footer small {
    color: #64748b;
    font-size: 0.7rem;
}

/* Responsive - nascondi legenda su schermi piccoli */
@media (max-width: 768px) {
    .radar-legend {
        bottom: 1rem;
        right: 0.5rem;
        padding: 0.75rem;
        min-width: 160px;
        font-size: 0.8rem;
    }

    .legend-title {
        font-size: 0.85rem;
    }

    .legend-item span {
        font-size: 0.75rem;
    }

    .radar-color {
        width: 20px;
        height: 14px;
    }
}

/* ============================================
   ANIMAZIONI
   ============================================ */

.layer-control {
    transition: background-color 0.2s;
}

.layer-control:hover {
    background-color: #f8fafc;
}

.radar-legend {
    animation: slideInRight 0.3s ease-out;
}

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

/* ============================================
   INDICATORI STATO
   ============================================ */

.layer-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
}

.layer-status.loading::before {
    background-color: #3b82f6;
    animation: pulse 1.5s infinite;
}

.layer-status.active::before {
    background-color: #10b981;
}

.layer-status.error::before {
    background-color: #ef4444;
}

.layer-status.inactive::before {
    background-color: #cbd5e1;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ============================================
   TOOLTIP LAYER
   ============================================ */

.layer-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    pointer-events: none;
    z-index: 10000;
    white-space: nowrap;
}

/* ============================================
   STAZIONI METEO
   ============================================ */

/* Marker stazioni */
.station-marker {
    transition: transform 0.2s ease;
}

.station-marker:hover {
    transform: scale(1.1);
    z-index: 1000 !important;
}

/* Cluster stazioni */
.station-cluster {
    transition: transform 0.2s ease;
}

.station-cluster:hover {
    transform: scale(1.1);
}

/* Popup stazioni */
.station-popup .leaflet-popup-content-wrapper {
    border-radius: 0.5rem;
    padding: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
                0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.station-popup .leaflet-popup-content {
    margin: 0;
    min-width: 250px;
}

.station-popup .leaflet-popup-tip {
    background: white;
}

/* Animazione apparizione marker */
@keyframes stationFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.station-marker {
    animation: stationFadeIn 0.3s ease-out;
}

/* Responsive - marker più piccoli su mobile */
@media (max-width: 768px) {
    .station-marker {
        transform: scale(0.85);
    }

    .station-popup .leaflet-popup-content {
        min-width: 220px;
    }
}

/* ============================================
   ISOBARE (LINEE DI PRESSIONE)
   ============================================ */

/* Label isobare */
.isobar-label {
    background: transparent !important;
    border: none !important;
}

.isobar-label div {
    background: rgba(255, 255, 255, 0.95) !important;
    padding: 2px 6px !important;
    border: 1.5px solid #000 !important;
    border-radius: 3px !important;
    font-size: 11px !important;
    font-weight: bold !important;
    font-family: Arial, sans-serif !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3) !important;
    white-space: nowrap !important;
    color: #000 !important;
}

/* Linee isobare - stile gestito direttamente in Leaflet */
.leaflet-interactive.isobar-line {
    stroke: #000000;
    stroke-width: 1.5;
    fill: none;
    opacity: 0.7;
}

.leaflet-interactive.isobar-line.major {
    stroke-width: 2;
    opacity: 0.8;
}

/* Animazione apparizione isobare */
@keyframes isobarFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 0.7;
    }
}

.leaflet-interactive.isobar-line {
    animation: isobarFadeIn 0.5s ease-out;
}

/* ============================================
   WEATHER LAYERS ADVANCED MENU
   ============================================ */

.weather-layers-advanced {
    margin-top: 1rem;
    border-top: 2px solid #e2e8f0;
    padding-top: 1rem;
}

.layers-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Category */
.layer-category {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    overflow: hidden;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    background: #f1f5f9;
    transition: background 0.2s;
    user-select: none;
}

.category-header:hover {
    background: #e2e8f0;
}

.category-icon {
    font-size: 1.25rem;
}

.category-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.875rem;
    color: #1e293b;
}

.category-count {
    background: #cbd5e1;
    color: #475569;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.category-toggle {
    color: #64748b;
    font-size: 0.75rem;
    transition: transform 0.2s;
}

/* Category layers container */
.category-layers {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    max-height: 500px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.category-layers.collapsed {
    max-height: 0;
    padding: 0;
    overflow: hidden;
}

/* Layer item */
.layer-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.layer-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.layer-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin-bottom: 0.25rem;
}

.layer-toggle {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.layer-name {
    font-size: 0.875rem;
    color: #334155;
    font-weight: 500;
}

.layer-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    position: relative;
}

.layer-info {
    cursor: pointer;
    font-size: 0.875rem;
    user-select: none;
    transition: transform 0.2s;
    position: relative;
}

.layer-info:hover {
    transform: scale(1.2);
}

.layer-info:active {
    transform: scale(0.95);
}

.layer-opacity {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: #cbd5e1;
    outline: none;
    -webkit-appearance: none;
}

.layer-opacity::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
}

.layer-opacity::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: none;
}

.layer-description {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
    line-height: 1.4;
}

/* Tooltip opacità */
.opacity-tooltip {
    position: absolute;
    right: -10px;
    top: 100%;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
                0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    pointer-events: none;
}

.opacity-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.opacity-tooltip-content {
    font-size: 0.8rem;
    color: #334155;
    line-height: 1.5;
}

.opacity-tooltip-content strong {
    color: #1e293b;
    display: block;
    margin-bottom: 0.25rem;
}

/* Freccia tooltip */
.opacity-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: white;
    border-left: 1px solid #e2e8f0;
    border-top: 1px solid #e2e8f0;
    transform: rotate(45deg);
}

/* Responsive */
@media (max-width: 768px) {
    .weather-layers-advanced {
        font-size: 0.85rem;
    }

    .category-icon {
        font-size: 1rem;
    }

    .layer-item {
        padding: 0.375rem;
    }

    .category-layers {
        max-height: 300px;
    }

    .opacity-tooltip {
        right: 0;
        left: 0;
        width: auto;
        margin: 0.5rem 0.5rem 0;
    }

    .opacity-tooltip::before {
        right: 15px;
    }
}

/* ============================================
   FLIGHT REPORT MODAL
   ============================================ */

.flight-report-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.2s ease-out;
}

.flight-report-modal {
    background: white;
    border-radius: 0.75rem;
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
    margin: 1rem;
}

.flight-report-header {
    padding: 1.5rem;
    border-radius: 0.75rem 0.75rem 0 0;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flight-report-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.flight-report-body {
    padding: 2rem;
}

.report-section {
    margin-bottom: 1.5rem;
}

.report-section:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.report-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
}

.report-coordinates {
    background: #f8fafc;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: #475569;
}

.report-recommendation {
    padding: 1.25rem;
    border-radius: 0.5rem;
    margin-bottom: 0;
}

.report-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.report-list li {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.report-list.critical li {
    background: #fee2e2;
    color: #991b1b;
    border-left: 3px solid #dc2626;
}

.report-list.warning li {
    background: #fef3c7;
    color: #92400e;
    border-left: 3px solid #f59e0b;
}

.zones-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.zone-item {
    background: #fef2f2;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border-left: 3px solid #dc2626;
}

.zone-item strong {
    color: #991b1b;
    font-size: 0.9rem;
}

.zone-item small {
    color: #7f1d1d;
    line-height: 1.6;
}

.weather-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.weather-item {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.375rem;
    text-align: center;
}

.weather-label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.weather-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #1e293b;
}

.kp-report {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

.spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Click marker */
.click-marker {
    animation: markerPulse 1.5s ease-in-out infinite;
}

@keyframes markerPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .flight-report-modal {
        max-width: 95%;
        margin: 0.5rem;
    }

    .flight-report-header {
        padding: 1rem;
    }

    .flight-report-header h2 {
        font-size: 1.25rem;
    }

    .flight-report-body {
        padding: 1rem;
    }

    .weather-grid {
        grid-template-columns: 1fr;
    }

    .report-section {
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }

    .report-section h3 {
        font-size: 1rem;
    }
}

/* Scrollbar personalizzato */
.category-layers::-webkit-scrollbar {
    width: 6px;
}

.category-layers::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.category-layers::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.category-layers::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================
   KP INDEX WIDGET (SPACE WEATHER)
   ============================================ */

.btn-mini {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.2s, color 0.2s;
}

.btn-mini:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.kp-widget {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 0.75rem;
}

.kp-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.kp-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #cbd5e1;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
    animation: pulse 2s infinite;
}

.kp-main {
    flex: 1;
}

.kp-value-container {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.kp-label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.kp-value {
    font-size: 2rem;
    font-weight: bold;
    color: #10b981;
    line-height: 1;
}

.kp-estimated {
    font-size: 0.875rem;
    color: #94a3b8;
    font-weight: normal;
}

.kp-status {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #10b981;
}

.kp-description {
    font-size: 0.875rem;
    color: #475569;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.kp-impact {
    padding: 0.75rem;
    border-radius: 0.375rem;
    border-left: 3px solid #10b981;
    background-color: #d1fae5;
    font-size: 0.875rem;
    color: #065f46;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.kp-impact strong {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.kp-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.5rem;
    border-top: 1px solid #e2e8f0;
    margin-bottom: 0.5rem;
}

.kp-widget-status {
    font-size: 0.7rem;
    color: #94a3b8;
}

.kp-widget-status.loading {
    color: #3b82f6;
}

.kp-widget-status.active {
    color: #10b981;
}

.kp-widget-status.error {
    color: #ef4444;
}

.kp-info {
    padding-top: 0.5rem;
    border-top: 1px solid #e2e8f0;
}

.kp-info a:hover {
    color: #1e293b;
}

/* Animazione pulsazione indicatore */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .kp-value {
        font-size: 1.75rem;
    }

    .kp-header {
        gap: 0.75rem;
    }

    .kp-impact {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
}

/* ============================================
   LEGENDS MODAL
   ============================================ */

.legends-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legends-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.legends-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

.legends-modal {
    background: white;
    border-radius: 0.75rem;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease-out;
}

.legends-modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-radius: 0.75rem 0.75rem 0 0;
}

.legends-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

/* ============================================
   MODAL CLOSE BUTTONS (X)
   ============================================ */

/* Stile base per tutti i pulsanti di chiusura modal */
.modal-close {
    position: relative;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.75rem;
    font-weight: 300;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.modal-close:active {
    transform: rotate(90deg) scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Effetto focus per accessibilità */
.modal-close:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4);
}

/* Variante per modal con header colorato (istruzioni/leggende) */
.legends-modal-close {
    position: relative;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.75rem;
    font-weight: 300;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.legends-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.legends-modal-close:active {
    transform: rotate(90deg) scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.legends-modal-close:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4);
}

/* Variante per modal con header chiaro (aeroporti) */
.modal-header .modal-close {
    background: rgba(100, 116, 139, 0.1);
    border: 2px solid rgba(100, 116, 139, 0.2);
    color: #475569;
}

.modal-header .modal-close:hover {
    background: rgba(100, 116, 139, 0.15);
    border-color: rgba(100, 116, 139, 0.3);
    color: #1e293b;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-header .modal-close:active {
    transform: rotate(90deg) scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal-header .modal-close:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.legends-modal-body {
    padding: 1.5rem;
}

.legend-section {
    margin-bottom: 2rem;
}

.legend-section:last-child {
    margin-bottom: 0;
}

.legend-section h3 {
    margin: 0 0 1rem 0;
    color: #1e293b;
    font-size: 1.125rem;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legend-color {
    width: 32px;
    height: 20px;
    border-radius: 0.25rem;
    border: 1px solid #cbd5e1;
    flex-shrink: 0;
}

.legend-color.ok {
    background-color: #10b981;
}

.legend-color.caution {
    background-color: #f59e0b;
}

.legend-color.no-fly {
    background-color: #ef4444;
}

.legend-color.no-data {
    background-color: #94a3b8;
}

.legend-label {
    font-size: 0.875rem;
    color: #334155;
    line-height: 1.4;
}

.legend-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.legend-table th,
.legend-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.875rem;
}

.legend-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #475569;
}

.legend-table td {
    color: #334155;
}

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

.kp-legend-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.zone-legend-box {
    width: 24px;
    height: 24px;
    border: 2px solid;
    border-radius: 0.25rem;
    display: inline-block;
    margin-right: 0.5rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Scrollbar modal */
.legends-modal::-webkit-scrollbar {
    width: 8px;
}

.legends-modal::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.legends-modal::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.legends-modal::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive */
@media (max-width: 768px) {
    .legends-modal {
        max-width: 95%;
        max-height: 85vh;
        margin: 1rem;
    }

    .legends-modal-header {
        padding: 1rem;
    }

    .legends-modal-header h2 {
        font-size: 1.25rem;
    }

    .legends-modal-body {
        padding: 1rem;
    }

    .legend-section h3 {
        font-size: 1rem;
    }

    .legend-table {
        font-size: 0.8rem;
    }

    .legend-table th,
    .legend-table td {
        padding: 0.375rem;
    }
}

/* ============================================
   DARK MODE ADJUSTMENTS
   ============================================ */

[data-theme="dark"] .legends-modal,
[data-theme="dark"] .flight-report-modal {
    background: #1e293b;
    color: #ffffff;
}

[data-theme="dark"] .legends-modal-body,
[data-theme="dark"] .flight-report-body {
    background: #1e293b;
    color: #ffffff;
}

/* Flight Report Modal - Dark Mode Specific - ULTRA AGGRESSIVE OVERRIDE */
[data-theme="dark"] .flight-report-modal .flight-report-body *[style],
[data-theme="dark"] .flight-report-modal .flight-report-body * {
    color: #ffffff !important;
}

[data-theme="dark"] .flight-report-modal .flight-report-body h2,
[data-theme="dark"] .flight-report-modal .flight-report-body h3,
[data-theme="dark"] .flight-report-modal .flight-report-body h4 {
    color: #ffffff !important;
    border-bottom-color: #334155 !important;
}

[data-theme="dark"] .flight-report-modal .flight-report-body strong,
[data-theme="dark"] .flight-report-modal .flight-report-body b {
    color: #ffffff !important;
}

[data-theme="dark"] .flight-report-modal .flight-report-body p,
[data-theme="dark"] .flight-report-modal .flight-report-body span,
[data-theme="dark"] .flight-report-modal .flight-report-body div,
[data-theme="dark"] .flight-report-modal .flight-report-body small,
[data-theme="dark"] .flight-report-modal .flight-report-body br {
    color: #ffffff !important;
}

/* Override ALL inline colors in flight report */
[data-theme="dark"] .flight-report-modal .flight-report-body *[style*="color"] {
    color: #ffffff !important;
}

/* Override ALL inline backgrounds in flight report */
[data-theme="dark"] .flight-report-modal .flight-report-body *[style*="background-color"] {
    background-color: #1e293b !important;
}

[data-theme="dark"] .flight-report-modal .flight-report-body *[style*="background:"] {
    background-color: #1e293b !important;
}

/* Don't use generic background override - use specific color matches below */

/* Recommendation box with dynamic color + alpha - force transparent on dark */
[data-theme="dark"] .flight-report-body .report-recommendation {
    background-color: transparent !important;
    border-left-color: #60a5fa !important;
}

/* Inline color overrides for flight report - Dark grays to light */
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color: #1e293b"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color:#1e293b"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color: #334155"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color:#334155"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color: #475569"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color:#475569"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color: #64748b"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color:#64748b"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color: #94a3b8"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color:#94a3b8"] {
    color: #e2e8f0 !important;
}

/* Red colors */
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color: #991b1b"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color:#991b1b"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color: #7f1d1d"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color:#7f1d1d"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color: #dc2626"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color:#dc2626"] {
    color: #fecaca !important;
}

/* Green colors */
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color: #065f46"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color:#065f46"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color: #047857"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color:#047857"] {
    color: #a7f3d0 !important;
}

/* Orange/Yellow colors */
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color: #92400e"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color:#92400e"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color: #f59e0b"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="color:#f59e0b"] {
    color: #fde047 !important;
}

/* Zone restriction boxes */
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background: #fee2e2"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background:#fee2e2"] {
    background: #7f1d1d !important;
    border-left-color: #ef4444 !important;
}

[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background: #fef3c7"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background:#fef3c7"] {
    background: #713f12 !important;
    border-left-color: #f59e0b !important;
}

[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background-color: #fee2e2"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background-color:#fee2e2"] {
    background-color: #7f1d1d !important;
}

[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background-color: #fef3c7"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background-color:#fef3c7"] {
    background-color: #713f12 !important;
}

[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background-color: #f0fdf4"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background-color:#f0fdf4"] {
    background-color: #064e3b !important;
}

/* Background slate colors */
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background: #f8fafc"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background:#f8fafc"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background-color: #f8fafc"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background-color:#f8fafc"] {
    background: #0f172a !important;
    background-color: #0f172a !important;
}

[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background: #f1f5f9"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background:#f1f5f9"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background-color: #f1f5f9"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background-color:#f1f5f9"] {
    background: #1e293b !important;
    background-color: #1e293b !important;
}

/* Warning yellow background */
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background: #fef3c7"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="background:#fef3c7"] {
    background: #713f12 !important;
}

/* Background e2e8f0 (border/separator color) */
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="border-bottom: 2px solid #e2e8f0"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="border-bottom:2px solid #e2e8f0"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="border-bottom: 2px solid #e2e8f0;"],
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="border-bottom:2px solid #e2e8f0;"] {
    border-bottom-color: #334155 !important;
}

/* Border colors for zones */
[data-theme="dark"] .flight-report-modal .flight-report-body [style*="border-left: 4px solid"] {
    border-left-color: #60a5fa !important;
}

/* Weather labels and values */
[data-theme="dark"] .flight-report-modal .weather-label,
[data-theme="dark"] .flight-report-modal .weather-value {
    color: #ffffff !important;
}

/* Report sections */
[data-theme="dark"] .flight-report-modal .report-section,
[data-theme="dark"] .flight-report-modal .report-coordinates,
[data-theme="dark"] .flight-report-modal .report-recommendation {
    color: #ffffff !important;
}

[data-theme="dark"] .legends-modal-body p,
[data-theme="dark"] .legends-modal-body span,
[data-theme="dark"] .legends-modal-body div,
[data-theme="dark"] .legend-label {
    color: #ffffff !important;
}

[data-theme="dark"] .legend-section h3,
[data-theme="dark"] .flight-report-modal .report-section h3 {
    color: #ffffff !important;
    border-bottom-color: #334155;
}

[data-theme="dark"] .legend-section p {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .legend-table th {
    background-color: #0f172a;
    color: #cbd5e1 !important;
}

[data-theme="dark"] .legend-table td {
    color: #ffffff !important;
    border-bottom-color: #334155;
}

[data-theme="dark"] strong {
    color: #ffffff !important;
}

[data-theme="dark"] small {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .kp-widget {
    background: #0f172a;
    border-color: #334155;
}

[data-theme="dark"] .kp-label,
[data-theme="dark"] .kp-description,
[data-theme="dark"] .kp-impact,
[data-theme="dark"] .kp-info,
[data-theme="dark"] .kp-status {
    color: #ffffff !important;
}

/* Kp Impact box - force dark backgrounds for all states */
[data-theme="dark"] .kp-impact {
    background-color: #1e293b !important;  /* slate-800 dark background */
    border-left: 3px solid #10b981 !important; /* green border by default */
    border-color: #10b981 !important;
    color: #ffffff !important;
}

/* Kp Impact strong tags - white text */
[data-theme="dark"] .kp-impact strong {
    color: #ffffff !important;
}

/* Kp Impact br tags */
[data-theme="dark"] .kp-impact br {
    color: #ffffff !important;
}

/* Kp Status - force light colors */
[data-theme="dark"] .kp-status {
    color: #cbd5e1 !important;  /* light gray, readable on dark */
}

[data-theme="dark"] .kp-description,
[data-theme="dark"] .kp-footer {
    border-color: #334155;
}

[data-theme="dark"] .kp-info small,
[data-theme="dark"] .kp-footer small {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .kp-value {
    color: #10b981 !important;
}

[data-theme="dark"] .kp-estimated {
    color: #cbd5e1 !important;
}

[data-theme="dark"] #kp-timestamp {
    color: #94a3b8 !important;
}

[data-theme="dark"] .kp-info a {
    color: #60a5fa !important;
}

[data-theme="dark"] .layer-control {
    border-bottom-color: #334155;
}

[data-theme="dark"] .layer-control:hover {
    background-color: #1e293b !important;
}

[data-theme="dark"] .layer-control label,
[data-theme="dark"] .layer-control span {
    color: #ffffff !important;
}

[data-theme="dark"] .layer-item {
    background: #0f172a;
    border-color: #334155;
}

[data-theme="dark"] .layer-name,
[data-theme="dark"] .layer-description {
    color: #ffffff !important;
}

[data-theme="dark"] .category-header {
    background: #0f172a;
    color: #ffffff !important;
}

[data-theme="dark"] .category-header:hover {
    background: #1e293b;
}

[data-theme="dark"] .category-name {
    color: #ffffff !important;
}

[data-theme="dark"] .radar-legend {
    background: #1e293b;
    border: 1px solid #334155;
}

[data-theme="dark"] .legend-title {
    border-bottom-color: #334155;
    color: #ffffff !important;
}

[data-theme="dark"] .legend-item span {
    color: #ffffff !important;
}

[data-theme="dark"] .opacity-tooltip {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .opacity-tooltip-content {
    color: #ffffff !important;
}

[data-theme="dark"] .opacity-tooltip::before {
    background: #1e293b;
    border-left-color: #334155;
    border-top-color: #334155;
}

/* Warning/Important boxes in modals */
[data-theme="dark"] .warning-box {
    background-color: #7f1d1d !important;
    border-left-color: #ef4444 !important;
}

[data-theme="dark"] .warning-box strong {
    color: #fecaca !important;
}

[data-theme="dark"] .warning-box span {
    color: #ffffff !important;
}

[data-theme="dark"] .warning-box span strong {
    color: #fecaca !important;
}

/* Info section paragraph with inline styles */
[data-theme="dark"] .legend-section p[style*="color: #334155"],
[data-theme="dark"] .legend-section p[style*="color:#334155"] {
    color: #ffffff !important;
}

[data-theme="dark"] .legend-section ul {
    color: #ffffff !important;
}

[data-theme="dark"] .legend-section ul li {
    color: #ffffff !important;
}

[data-theme="dark"] .legend-section p[style*="color: #64748b"],
[data-theme="dark"] .legend-section p[style*="color:#64748b"] {
    color: #cbd5e1 !important;
}

/* H4 headers with inline color */
[data-theme="dark"] .legend-section h4[style*="color: #1e293b"],
[data-theme="dark"] .legend-section h4[style*="color:#1e293b"] {
    color: #ffffff !important;
}

/* Scale labels with inline color */
[data-theme="dark"] .legend-section div[style*="color: #64748b"] {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .legend-section div[style*="color: #64748b"] span {
    color: #cbd5e1 !important;
}

/* Links with inline color */
[data-theme="dark"] .legend-section a[style*="color: #2563eb"],
[data-theme="dark"] .legend-section a[style*="color:#2563eb"] {
    color: #60a5fa !important;
}

[data-theme="dark"] .legend-section a[style*="color: #2563eb"]:hover,
[data-theme="dark"] .legend-section a[style*="color:#2563eb"]:hover {
    color: #93c5fd !important;
}

/* ============================================
   INSTRUCTIONS MODAL - DARK MODE
   ============================================ */

/* Info cards blu (background: #eff6ff) */
[data-theme="dark"] .legend-section div[style*="background: #eff6ff"],
[data-theme="dark"] .legend-section div[style*="background:#eff6ff"] {
    background: #1e3a8a !important;
    border-left-color: #60a5fa !important;
}

[data-theme="dark"] .legend-section div[style*="background: #eff6ff"] strong,
[data-theme="dark"] .legend-section div[style*="background:#eff6ff"] strong {
    color: #bfdbfe !important;
}

[data-theme="dark"] .legend-section div[style*="background: #eff6ff"] ol,
[data-theme="dark"] .legend-section div[style*="background: #eff6ff"] ul,
[data-theme="dark"] .legend-section div[style*="background: #eff6ff"] li {
    color: #ffffff !important;
}

/* Info cards grigie (background: #f8fafc) */
[data-theme="dark"] .legend-section div[style*="background: #f8fafc"],
[data-theme="dark"] .legend-section div[style*="background:#f8fafc"] {
    background: #0f172a !important;
    border-left-color: #475569 !important;
}

[data-theme="dark"] .legend-section div[style*="background: #f8fafc"] strong {
    color: #ffffff !important;
}

[data-theme="dark"] .legend-section div[style*="background: #f8fafc"] p {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .legend-section div[style*="background: #f8fafc"] small {
    color: #cbd5e1 !important;
}

/* Info cards blu chiaro (background: #f1f5f9) */
[data-theme="dark"] .legend-section div[style*="background-color: #f1f5f9"],
[data-theme="dark"] .legend-section div[style*="background:#f1f5f9"] {
    background: #1e3a8a !important;
    border-left-color: #60a5fa !important;
}

[data-theme="dark"] .legend-section div[style*="background-color: #f1f5f9"] strong,
[data-theme="dark"] .legend-section div[style*="background:#f1f5f9"] strong {
    color: #bfdbfe !important;
}

[data-theme="dark"] .legend-section div[style*="background-color: #f1f5f9"] ul,
[data-theme="dark"] .legend-section div[style*="background-color: #f1f5f9"] li {
    color: #ffffff !important;
}

/* Warning sections rosso (background: #fef2f2) - Disclaimer */
[data-theme="dark"] .legend-section[style*="background: #fef2f2"],
[data-theme="dark"] .legend-section div[style*="background: #fef2f2"] {
    background: #7f1d1d !important;
    border-left-color: #ef4444 !important;
}

[data-theme="dark"] .legend-section[style*="background: #fef2f2"] h3,
[data-theme="dark"] .legend-section div[style*="background: #fef2f2"] h3 {
    color: #fecaca !important;
}

[data-theme="dark"] .legend-section[style*="background: #fef2f2"] strong,
[data-theme="dark"] .legend-section div[style*="background: #fef2f2"] strong {
    color: #fecaca !important;
}

[data-theme="dark"] .legend-section[style*="background: #fef2f2"] ul,
[data-theme="dark"] .legend-section[style*="background: #fef2f2"] li,
[data-theme="dark"] .legend-section[style*="background: #fef2f2"] p,
[data-theme="dark"] .legend-section div[style*="background: #fef2f2"] ul,
[data-theme="dark"] .legend-section div[style*="background: #fef2f2"] li,
[data-theme="dark"] .legend-section div[style*="background: #fef2f2"] p {
    color: #ffffff !important;
}

/* Strong with inline color in instructions */
[data-theme="dark"] .legend-section strong[style*="color: #1e40af"],
[data-theme="dark"] .legend-section strong[style*="color:#1e40af"] {
    color: #bfdbfe !important;
}

[data-theme="dark"] .legend-section strong[style*="color: #991b1b"],
[data-theme="dark"] .legend-section strong[style*="color:#991b1b"] {
    color: #fecaca !important;
}

/* Paragraphs with inline color #475569 */
[data-theme="dark"] .legend-section p[style*="color: #475569"],
[data-theme="dark"] .legend-section p[style*="color:#475569"],
[data-theme="dark"] .legend-section small[style*="color: #475569"],
[data-theme="dark"] .legend-section small[style*="color:#475569"],
[data-theme="dark"] .legend-section ul[style*="color: #475569"],
[data-theme="dark"] .legend-section ul[style*="color:#475569"] {
    color: #e2e8f0 !important;
}

/* Paragraphs with inline color #7f1d1d (warning red) */
[data-theme="dark"] .legend-section p[style*="color: #7f1d1d"],
[data-theme="dark"] .legend-section p[style*="color:#7f1d1d"],
[data-theme="dark"] .legend-section ul[style*="color: #7f1d1d"],
[data-theme="dark"] .legend-section ul[style*="color:#7f1d1d"] {
    color: #ffffff !important;
}

/* Links in instructions modal */
[data-theme="dark"] .legend-section a[style*="color: #3b82f6"],
[data-theme="dark"] .legend-section a[style*="color:#3b82f6"] {
    color: #60a5fa !important;
}

[data-theme="dark"] .legend-section a[style*="color: #3b82f6"]:hover,
[data-theme="dark"] .legend-section a[style*="color:#3b82f6"]:hover {
    color: #93c5fd !important;
}

/* Modal footer */
[data-theme="dark"] .legends-modal-footer {
    background: #0f172a !important;
    border-top-color: #334155 !important;
}

/* Legends modal content wrapper */
[data-theme="dark"] .legends-modal-content {
    background: #1e293b !important;
}

/* ============================================
   ZONE CLICK CHOICE DIALOG
   ============================================ */

.zone-click-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

.zone-click-dialog {
    background: white;
    border-radius: 0.75rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease-out;
}

.zone-dialog-header {
    padding: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.zone-dialog-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
}

.zone-dialog-close {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.zone-dialog-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.zone-dialog-body {
    padding: 1.5rem;
}

.zone-dialog-body p {
    margin: 0 0 1.5rem 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #64748b;
}

.zone-dialog-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.zone-dialog-btn {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.zone-dialog-btn-primary {
    background: #3b82f6;
    color: white;
}

.zone-dialog-btn-primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.zone-dialog-btn-secondary {
    background: #f1f5f9;
    color: #1e293b;
}

.zone-dialog-btn-secondary:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

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

/* Dark Mode for Zone Click Dialog */
[data-theme="dark"] .zone-click-dialog {
    background: #1e293b;
}

[data-theme="dark"] .zone-dialog-header {
    border-bottom-color: #334155;
}

[data-theme="dark"] .zone-dialog-header h3 {
    color: #ffffff;
}

[data-theme="dark"] .zone-dialog-close {
    color: #cbd5e1;
}

[data-theme="dark"] .zone-dialog-close:hover {
    background: #334155;
    color: #ffffff;
}

[data-theme="dark"] .zone-dialog-body p {
    color: #e2e8f0;
}

[data-theme="dark"] .zone-dialog-btn-secondary {
    background: #334155;
    color: #ffffff;
}

[data-theme="dark"] .zone-dialog-btn-secondary:hover {
    background: #475569;
}


/* ============================================
   AIRPORT DETAILS MODAL - DARK MODE
   ============================================ */

[data-theme="dark"] .modal-content {
    background: #1e293b !important;
    color: #ffffff !important;
}

[data-theme="dark"] .modal-body {
    background: #1e293b !important;
    color: #ffffff !important;
}

[data-theme="dark"] .modal-header {
    background: #0f172a !important;
    border-bottom-color: #334155 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .modal-header h2 {
    color: #ffffff !important;
}

[data-theme="dark"] .detail-section {
    color: #ffffff !important;
}

[data-theme="dark"] .detail-section h3 {
    color: #60a5fa !important;
}

[data-theme="dark"] .metar-raw,
[data-theme="dark"] .taf-raw {
    background: #0f172a !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .metar-decoded,
[data-theme="dark"] .taf-decoded {
    color: #ffffff !important;
}

[data-theme="dark"] .airport-warning {
    background: #7f1d1d !important;
    border-left-color: #ef4444 !important;
}

[data-theme="dark"] .airport-warning h3 {
    color: #fecaca !important;
}

[data-theme="dark"] .airport-warning p {
    color: #fecaca !important;
}

[data-theme="dark"] .airport-warning strong {
    color: #ffffff !important;
}

[data-theme="dark"] .airport-warning a {
    color: #fca5a5 !important;
}

[data-theme="dark"] .airport-warning a:hover {
    color: #ffffff !important;
}


/* ============================================
   LEAFLET ZOOM CONTROLS - DARK MODE
   ============================================ */

[data-theme="dark"] .leaflet-control-zoom a {
    background-color: #1e293b !important;
    color: #ffffff !important;
    border: 1px solid #475569 !important;
}

[data-theme="dark"] .leaflet-control-zoom a:hover {
    background-color: #334155 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .leaflet-bar {
    border: 2px solid #475569 !important;
}

/* ============================================
   FLIGHT REPORT CARDS - DARK MODE ULTRA FIX
   ============================================ */

/* Report sections and cards - force white text */
[data-theme="dark"] .flight-report-body .report-section,
[data-theme="dark"] .flight-report-body .report-section * {
    color: #ffffff !important;
}

/* Coordinates box */
[data-theme="dark"] .flight-report-body .report-coordinates,
[data-theme="dark"] .flight-report-body .report-coordinates * {
    color: #ffffff !important;
    background-color: #0f172a !important;
}

/* Recommendation box */
[data-theme="dark"] .flight-report-body .report-recommendation,
[data-theme="dark"] .flight-report-body .report-recommendation * {
    color: #ffffff !important;
    background-color: #0f172a !important;
}

/* Zone cards - override dynamic backgrounds */
[data-theme="dark"] .flight-report-body .zones-list,
[data-theme="dark"] .flight-report-body .zone-item,
[data-theme="dark"] .flight-report-body .zones-list *,
[data-theme="dark"] .flight-report-body .zone-item * {
    background-color: #1e293b !important;
    color: #ffffff !important;
}

/* Weather cards */
[data-theme="dark"] .flight-report-body .weather-label,
[data-theme="dark"] .flight-report-body .weather-value,
[data-theme="dark"] .flight-report-body .weather-label *,
[data-theme="dark"] .flight-report-body .weather-value * {
    color: #ffffff !important;
}

/* All divs with inline background styles - FORCE DARK */
[data-theme="dark"] .flight-report-body div[style*="background"] {
    background: #1e293b !important;
    background-color: #1e293b !important;
}

/* All paragraphs, spans, strongs in flight report */
[data-theme="dark"] .flight-report-body p,
[data-theme="dark"] .flight-report-body span,
[data-theme="dark"] .flight-report-body strong,
[data-theme="dark"] .flight-report-body small,
[data-theme="dark"] .flight-report-body div {
    color: #ffffff !important;
}

/* H2, H3 headers in flight report */
[data-theme="dark"] .flight-report-body h2,
[data-theme="dark"] .flight-report-body h3,
[data-theme="dark"] .flight-report-body h4 {
    color: #ffffff !important;
}

/* Detail map border */
[data-theme="dark"] #detail-map {
    border-color: #475569 !important;
}

/* Override ANY light background color */
[data-theme="dark"] .flight-report-body [style*="background-color: #f"],
[data-theme="dark"] .flight-report-body [style*="background: #f"] {
    background: #1e293b !important;
    background-color: #1e293b !important;
}

/* Override ANY dark text color */
[data-theme="dark"] .flight-report-body [style*="color: #1"],
[data-theme="dark"] .flight-report-body [style*="color: #2"],
[data-theme="dark"] .flight-report-body [style*="color: #3"],
[data-theme="dark"] .flight-report-body [style*="color: #4"],
[data-theme="dark"] .flight-report-body [style*="color: #5"],
[data-theme="dark"] .flight-report-body [style*="color: #6"],
[data-theme="dark"] .flight-report-body [style*="color: #7"],
[data-theme="dark"] .flight-report-body [style*="color: #8"],
[data-theme="dark"] .flight-report-body [style*="color: #9"] {
    color: #ffffff !important;
}


/* Weather items background - CRITICAL FIX */
[data-theme="dark"] .weather-item {
    background: #0f172a !important;
    background-color: #0f172a !important;
}

[data-theme="dark"] .weather-grid .weather-item {
    background: #0f172a !important;
}

[data-theme="dark"] .flight-report-body .weather-item,
[data-theme="dark"] .flight-report-body .weather-grid .weather-item {
    background: #0f172a !important;
    background-color: #0f172a !important;
    color: #ffffff !important;
}

[data-theme="dark"] .flight-report-body .weather-item *,
[data-theme="dark"] .flight-report-body .weather-grid .weather-item * {
    color: #ffffff !important;
}

/* Space Weather / Kp section in flight report */
[data-theme="dark"] .flight-report-body .kp-report {
    background: #0f172a !important;
    background-color: #0f172a !important;
}

[data-theme="dark"] .flight-report-body .kp-report * {
    color: #ffffff !important;
}

/* H2 headers in flight report - ensure white */
[data-theme="dark"] .flight-report-body h2[style] {
    color: #ffffff !important;
    border-bottom-color: #334155 !important;
}

/* Small tags in flight report */
[data-theme="dark"] .flight-report-body small,
[data-theme="dark"] .flight-report-body small[style] {
    color: #e2e8f0 !important;
}

/* Paragraphs in flight report */
[data-theme="dark"] .flight-report-body p,
[data-theme="dark"] .flight-report-body p[style] {
    color: #ffffff !important;
}


/* Avvertenze / Warnings section */
[data-theme="dark"] .flight-report-body .report-list.warning,
[data-theme="dark"] .flight-report-body .report-list.warning li,
[data-theme="dark"] .flight-report-body .report-list li {
    color: #ffffff !important;
    background: transparent !important;
}

[data-theme="dark"] .flight-report-body h3,
[data-theme="dark"] .flight-report-body h3[style] {
    color: #ffffff !important;
}

/* Disclaimer box in flight report */
[data-theme="dark"] .flight-report-body div[style*="border-left: 4px solid #ef4444"] {
    background: #7f1d1d !important;
    border-left-color: #ef4444 !important;
}

[data-theme="dark"] .flight-report-body div[style*="border-left: 4px solid #ef4444"] * {
    color: #ffffff !important;
}

/* Force white on ALL strong tags */
[data-theme="dark"] .flight-report-body strong,
[data-theme="dark"] .flight-report-body strong[style] {
    color: #ffffff !important;
}

/* Force light gray on ALL small tags */
[data-theme="dark"] .flight-report-body small,
[data-theme="dark"] .flight-report-body small[style] {
    color: #e2e8f0 !important;
}

/* Lists in flight report */
[data-theme="dark"] .flight-report-body ul,
[data-theme="dark"] .flight-report-body ol,
[data-theme="dark"] .flight-report-body li {
    color: #ffffff !important;
}

/* Kp Index box specifically */
[data-theme="dark"] .flight-report-body div[style*="border: 1px solid #e2e8f0"] {
    background: #0f172a !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .flight-report-body div[style*="border: 1px solid #e2e8f0"] * {
    color: #ffffff !important;
}

