/* ============================================================
   Map Styles - Mapbox Overrides, Markers, Popups
   ============================================================ */

/* ---- Map Container ---- */
.map-wrapper {
    position: relative;
    width: 100%;
    height: 500px;
    min-height: 400px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--color-border-primary);
}
.map-wrapper--fullheight {
    height: calc(100vh - var(--header-height) - 200px);
}

#map-container {
    width: 100%;
    height: 100%;
}

/* ---- Map Controls Overlay ---- */
.map-controls {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    z-index: 10;
}
.map-control-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-primary);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: var(--text-sm);
    box-shadow: var(--shadow-md);
}
.map-control-btn:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}
.map-control-btn.active {
    background: var(--color-accent-blue);
    color: white;
    border-color: var(--color-accent-blue);
}

.map-legend {
    position: absolute;
    bottom: var(--space-3);
    left: var(--space-3);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2) var(--space-3);
    z-index: 10;
}
.map-legend__title {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-1);
}
.map-legend__item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    padding: 2px 0;
}
.map-legend__dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

/* ---- Flight Markers ---- */
.flight-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition-fast);
}
.flight-marker:hover {
    transform: scale(1.2);
    z-index: 100;
}

.flight-marker--ground {
    width: 28px;
    height: 28px;
    background: var(--color-accent-green);
    border: 2px solid rgba(16, 185, 129, 0.5);
    border-radius: var(--radius-full);
    box-shadow: 0 0 12px var(--color-accent-green-glow);
    color: white;
    font-size: 11px;
}

.flight-marker--approach {
    width: 32px;
    height: 32px;
    background: var(--color-accent-amber);
    border: 2px solid rgba(245, 158, 11, 0.5);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 0 12px var(--color-accent-amber-glow);
    color: white;
    font-size: 11px;
}
.flight-marker--approach i {
    transform: rotate(45deg);
}

.flight-marker--holding {
    width: 32px;
    height: 32px;
    background: var(--color-accent-red);
    border: 3px solid rgba(239, 68, 68, 0.4);
    border-radius: var(--radius-full);
    box-shadow: 0 0 16px var(--color-accent-red-glow);
    color: white;
    font-size: 11px;
    animation: pulse-glow 2s ease-in-out infinite;
}

.flight-marker__label {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: var(--weight-bold);
    font-family: var(--font-mono);
    color: var(--color-text-primary);
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    pointer-events: none;
}

/* ---- Airport Markers ---- */
.airport-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}
.airport-marker__icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-size: 10px;
    color: white;
    box-shadow: var(--shadow-md);
}
.airport-marker__icon--open {
    background: var(--color-accent-green);
    border: 2px solid rgba(16, 185, 129, 0.4);
}
.airport-marker__icon--closed {
    background: var(--color-accent-red);
    border: 2px solid rgba(239, 68, 68, 0.4);
    animation: pulse-glow 2s ease-in-out infinite;
}
.airport-marker__label {
    font-size: 10px;
    font-weight: var(--weight-bold);
    font-family: var(--font-mono);
    padding: 1px 4px;
    border-radius: var(--radius-xs);
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.airport-marker__label--open {
    color: var(--color-accent-green);
    background: rgba(16, 185, 129, 0.1);
}
.airport-marker__label--closed {
    color: var(--color-accent-red);
    background: rgba(239, 68, 68, 0.1);
}

/* ---- Map Popup ---- */
.map-popup {
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    line-height: var(--leading-normal);
}
.map-popup__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border-secondary);
    margin-bottom: var(--space-2);
}
.map-popup__callsign {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    color: var(--color-text-primary);
}
.map-popup__status {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: var(--radius-full);
}
.map-popup__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-1) var(--space-4);
}
.map-popup__item {
    display: flex;
    flex-direction: column;
}
.map-popup__item-label {
    font-size: 9px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.map-popup__item-value {
    font-weight: var(--weight-semibold);
    color: var(--color-text-secondary);
}
.map-popup__footer {
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-border-secondary);
    font-size: 9px;
    color: var(--color-text-muted);
    text-align: center;
}

/* ---- Mapbox Overrides ---- */
.mapboxgl-popup {
    z-index: 50;
}
.mapboxgl-popup-content {
    background: var(--color-bg-secondary) !important;
    border: 1px solid var(--color-border-primary) !important;
    border-radius: var(--radius-lg) !important;
    padding: var(--space-3) !important;
    box-shadow: var(--shadow-lg) !important;
    color: var(--color-text-primary) !important;
    min-width: 220px;
}
.mapboxgl-popup-tip {
    border-top-color: var(--color-bg-secondary) !important;
    border-bottom-color: var(--color-bg-secondary) !important;
    border-left-color: var(--color-bg-secondary) !important;
    border-right-color: var(--color-bg-secondary) !important;
}
.mapboxgl-popup-close-button {
    color: var(--color-text-muted) !important;
    font-size: 16px;
    padding: 4px 8px;
}
.mapboxgl-popup-close-button:hover {
    color: var(--color-text-primary) !important;
    background: transparent !important;
}
.mapboxgl-ctrl-group {
    background: var(--color-bg-secondary) !important;
    border: 1px solid var(--color-border-primary) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-md) !important;
}
.mapboxgl-ctrl-group button {
    border-color: var(--color-border-secondary) !important;
}
.mapboxgl-ctrl-group button span {
    filter: invert(0.7);
}

/* ---- Weather Overlay Indicator ---- */
.weather-overlay-badge {
    position: absolute;
    top: var(--space-3);
    left: var(--space-3);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-accent-red);
    backdrop-filter: blur(8px);
}
.weather-overlay-badge i {
    animation: pulse-glow 2s ease-in-out infinite;
}
