/* Spinner Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.leaflet-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #0a4f9c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Flight Zone Map Styles */

#flight-zone-map {
    height: 600px;
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1;
    position: relative;
}

/* Ensure Leaflet controls are properly positioned and clickable */
#flight-zone-map .leaflet-control-container {
    z-index: 999;
    pointer-events: auto;
}

#flight-zone-map .leaflet-top,
#flight-zone-map .leaflet-bottom {
    z-index: 999;
    pointer-events: auto;
}

#flight-zone-map .leaflet-control {
    z-index: 999;
    pointer-events: auto;
}

/* Ensure layer control is clickable */
#flight-zone-map .leaflet-control-layers {
    z-index: 1000;
    pointer-events: auto;
}

#flight-zone-map .leaflet-control-layers input[type="checkbox"] {
    pointer-events: auto;
    cursor: pointer;
    width: 18px;
    height: 18px;
    margin-right: 5px;
}

#flight-zone-map .leaflet-control-layers label {
    pointer-events: auto;
    cursor: pointer;
    margin-bottom: 5px;
}

/* Make map fully interactive */
#flight-zone-map {
    touch-action: none;
}

#flight-zone-map .leaflet-pane {
    z-index: 400;
}

#flight-zone-map .leaflet-tile-pane {
    z-index: 200;
}

#flight-zone-map .leaflet-overlay-pane {
    z-index: 400;
}

#flight-zone-map .leaflet-shadow-pane {
    z-index: 300;
}

/* Make map container have proper positioning context */
.card-body {
    position: relative;
}

/* Make map full screen on mobile */
@media (max-width: 768px) {
    #flight-zone-map {
        height: 500px;
    }
}

/* Legend Styles */
.map-legend {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    max-width: 250px;
}

.map-legend h6 {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.legend-color {
    display: inline-block;
    width: 24px;
    height: 16px;
    margin-right: 10px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* Zone Popup Styles */
.zone-popup {
    min-width: 250px;
    max-width: 350px;
}

.zone-popup h6 {
    font-size: 16px;
    margin-bottom: 8px;
    color: #0a4f9c;
}

.zone-popup p {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 6px;
}

.zone-popup strong {
    font-weight: 600;
}

.zone-popup small {
    font-size: 12px;
}

/* Map Message (for loading/error messages) */
.map-message {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 6px;
}

/* Layer Control Styling */
.leaflet-control-layers {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.leaflet-control-layers-expanded {
    padding: 10px;
}

/* Map Container */
.map-container {
    margin-top: 20px;
    margin-bottom: 40px;
}

.map-info-card {
    background: #f8f9fa;
    border-left: 4px solid #0a4f9c;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 6px;
}

.map-info-card h5 {
    color: #0a4f9c;
    font-size: 18px;
    margin-bottom: 10px;
}

.map-info-card ul {
    margin-bottom: 0;
    padding-left: 20px;
}

.map-info-card li {
    margin-bottom: 6px;
}

/* Filter Controls */
.zone-filters {
    margin-bottom: 20px;
}

.zone-filters .btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.zone-filters .btn {
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
}

/* Loading Spinner */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

/* Mobile Responsive */
@media (max-width: 576px) {
    .map-legend {
        font-size: 12px;
        padding: 10px;
    }
    
    .legend-item {
        margin-bottom: 6px;
    }
    
    .zone-popup {
        min-width: 200px;
    }
    
    .zone-popup h6 {
        font-size: 14px;
    }
    
    .zone-popup p {
        font-size: 13px;
    }
}

/* ========================================================================
   DECLARED OPERATING AREAS - Modal & Styling
   ======================================================================== */

/* Modal overlay */
.declare-area-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* Modal content */
.declare-area-modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: declareAreaSlideIn 0.2s ease-out;
}

@keyframes declareAreaSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal header */
.declare-area-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.declare-area-modal-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.declare-area-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.declare-area-close-btn:hover {
    color: #475569;
}

/* Modal body */
.declare-area-modal-body {
    padding: 16px 20px 20px;
}

/* Info banner */
.declare-area-info-banner {
    background: #F0F9FF;
    border-left: 3px solid #0EA5E9;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    color: #0369A1;
}

/* Form fields */
.declare-area-field {
    margin-bottom: 12px;
    flex: 1;
}

.declare-area-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.declare-area-field input,
.declare-area-field select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    color: #1e293b;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.declare-area-field input:focus,
.declare-area-field select:focus {
    outline: none;
    border-color: #0EA5E9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

/* Field row (horizontal layout) */
.declare-area-field-row {
    display: flex;
    gap: 10px;
}

/* Coordinates display */
.declare-area-coords {
    text-align: center;
    color: #64748b;
    margin: 10px 0;
}

/* Action buttons */
.declare-area-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

.declare-area-btn-cancel {
    padding: 8px 20px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.declare-area-btn-cancel:hover {
    background: #e2e8f0;
}

.declare-area-btn-submit {
    padding: 8px 20px;
    background: #0EA5E9;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.declare-area-btn-submit:hover {
    background: #0284C7;
}

/* Declared area marker (no background for div icon) */
.declared-area-marker {
    background: transparent !important;
    border: none !important;
}

/* Responsive modal */
@media (max-width: 576px) {
    .declare-area-modal-content {
        max-width: 100%;
        margin: 8px;
    }
    
    .declare-area-field-row {
        flex-direction: column;
        gap: 0;
    }
}
