/* AQup Aviation Map Styles - ForeFlight Style */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #1a1a2e;
    color: #e0e0e0;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Main content area */
#main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ================================
   Left Sidebar - Layer Panel (ForeFlight Style)
   ================================ */
#layer-panel {
    width: 260px;
    background-color: #ffffff;
    border-right: 1px solid #e5e7eb;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
    transition: width 0.3s ease, transform 0.3s ease;
}

#layer-panel.collapsed {
    width: 0;
    transform: translateX(-100%);
    box-shadow: none;
}

.btn-open-sidebar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 12px;
    z-index: 150;
    width: 36px;
    height: 36px;
    background-color: #ffffff;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-open-sidebar:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.btn-open-sidebar.hidden {
    display: none;
}

.layer-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.panel-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    letter-spacing: 0.5px;
}

.panel-logo {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 28px;
    width: auto;
}

.btn-toggle {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.btn-toggle:hover {
    color: #374151;
}

.layer-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* Layer Groups */
.layer-group {
    border-bottom: 1px solid #f3f4f6;
}

.layer-group:last-child {
    border-bottom: none;
}

.layer-group-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.layer-group-header:hover {
    background-color: #f3f4f6;
}

.layer-group-header .chevron {
    margin-right: 10px;
    transition: transform 0.2s ease;
    color: #9ca3af;
}

.layer-group-header.expanded .chevron {
    transform: rotate(90deg);
}

.group-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.group-toggle-label {
    display: flex;
    align-items: center;
    margin-left: auto;
    padding: 2px;
    cursor: pointer;
}

.group-toggle-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.group-toggle-label .checkbox-custom {
    width: 14px;
    height: 14px;
    border: 1px solid #9ca3af;
    border-radius: 3px;
    background: transparent;
    position: relative;
    transition: all 0.2s;
    cursor: pointer;
}

.group-toggle-label input[type="checkbox"]:checked + .checkbox-custom {
    background: #3b82f6;
    border-color: #3b82f6;
}

.group-toggle-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 0px;
    width: 4px;
    height: 8px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.group-toggle-label input[type="checkbox"]:indeterminate + .checkbox-custom::after {
    content: "";
    position: absolute;
    left: 2px;
    top: 6px;
    width: 8px;
    height: 0;
    border-top: 2px solid #3b82f6;
    transform: none;
}

/* Layer Items */
.layer-group-items {
    display: none;
    padding: 4px 0;
    background-color: #f9fafb;
}

.layer-group-items.expanded {
    display: block;
}

.layer-item {
    display: flex;
    align-items: center;
    padding: 10px 16px 10px 38px;
    cursor: pointer;
    transition: background-color 0.15s;
    position: relative;
}

.layer-item:hover {
    background-color: #eff6ff;
}

.layer-item input[type="checkbox"],
.layer-item input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

/* Custom Checkbox */
.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #9ca3af;
    border-radius: 3px;
    margin-right: 12px;
    position: relative;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.layer-item .checkbox-custom {
    width: 14px;
    height: 14px;
    border-width: 1px;
}

.layer-item input[type="checkbox"]:checked + .checkbox-custom {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.layer-item input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 4px;
    height: 8px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Layer Divider */
.layer-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 6px 16px 6px 38px;
}

/* Custom Radio */
.radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #6b7280;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.layer-item input[type="radio"]:checked + .radio-custom {
    border-color: #3b82f6;
}

.layer-item input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 8px;
    height: 8px;
    background-color: #3b82f6;
    border-radius: 50%;
}

.layer-name {
    font-size: 13px;
    color: #374151;
}

.layer-item:hover .layer-name {
    color: #1f2937;
}

/* ================================
   Map
   ================================ */
#map {
    flex: 1;
    height: 100%;
}

.maplibregl-ctrl-bottom-left {
    display: none !important;
}

.maplibregl-ctrl-attrib {
    font-size: 10px;
    background-color: rgba(0, 0, 0, 0.6) !important;
    color: #aaa !important;
}

.maplibregl-ctrl-attrib a {
    color: #7cb3f0 !important;
}

/* ================================
   Info Panel (ForeFlight Style - Right Sidebar)
   ================================ */
#info-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    background-color: #f2f2f7;
    border-left: 1px solid #c7c7cc;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(0);
    transition: transform 0.3s ease;
}

#info-panel.hidden {
    transform: translateX(100%);
}

#panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: #e5e5ea;
    border-bottom: 1px solid #c7c7cc;
}

#panel-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: #1c1c1e;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

#btn-close-panel {
    background: none;
    border: none;
    color: #007aff;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    font-weight: 400;
    transition: opacity 0.2s;
}

#btn-close-panel:hover {
    opacity: 0.7;
}

#btn-close-panel.hidden {
    display: none;
}

#btn-back-panel {
    background: none;
    border: none;
    color: #007aff;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    font-weight: 400;
    transition: opacity 0.2s;
    position: absolute;
    left: 16px;
}

#btn-back-panel:hover {
    opacity: 0.7;
}

#btn-back-panel.hidden {
    display: none;
}

#panel-header {
    position: relative;
}

/* Popup tabs */
.popup-tabs {
    display: flex;
    background-color: #e5e5ea;
    padding: 0 12px 12px;
    gap: 0;
}

.popup-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background-color: transparent;
    color: #3a3a3c;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 0;
}

.popup-tab:first-child {
    border-radius: 6px 0 0 6px;
}

.popup-tab:last-child {
    border-radius: 0 6px 6px 0;
}

.popup-tab.active {
    background-color: #007aff;
    color: #ffffff;
}

.popup-tab:not(.active):hover {
    background-color: rgba(0, 122, 255, 0.1);
}

#panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    color: #1c1c1e;
    background-color: #f2f2f7;
}

.panel-section {
    margin-bottom: 0;
}

.panel-section h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #8e8e93;
    margin: 0;
    padding: 12px 16px 8px;
    letter-spacing: 0.5px;
    background-color: #f2f2f7;
}

.placeholder {
    color: #8e8e93;
    font-size: 14px;
    text-align: center;
    padding: 40px 20px;
}

/* Location header in popup */
.location-header {
    background-color: #ffffff;
    padding: 12px 16px;
    border-bottom: 1px solid #c7c7cc;
}

.location-coords {
    font-size: 15px;
    font-weight: 500;
    color: #1c1c1e;
    margin-bottom: 4px;
}

.location-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.location-coords-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.location-coord-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.coord-label {
    font-size: 11px;
    font-weight: 600;
    color: #8e8e93;
    width: 36px;
    flex-shrink: 0;
}

.coord-value {
    font-size: 13px;
    font-weight: 500;
    color: #1c1c1e;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
}

.location-header .location-add-route {
    position: static;
    margin-top: 0;
    width: auto;
    padding: 10px 14px;
    font-size: 12px;
    line-height: 1.3;
    flex-shrink: 0;
    top: auto;
    right: auto;
}

.location-distance {
    font-size: 13px;
    color: #8e8e93;
    margin-bottom: 4px;
}

/* Popup list items (ForeFlight style) */
.popup-list {
    background-color: #ffffff;
}

.popup-section-header {
    padding: 8px 16px;
    background-color: #f2f2f7;
    color: #8e8e93;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e5ea;
}

.popup-list-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e5ea;
    cursor: pointer;
    transition: background-color 0.15s;
}

.popup-list-item:last-child {
    border-bottom: none;
}

.popup-list-item:hover {
    background-color: #f2f2f7;
}

.popup-list-item:active {
    background-color: #e5e5ea;
}

.item-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.item-icon svg {
    width: 24px;
    height: 24px;
}

.item-icon.airport {
    color: #d946ef;
}

.item-icon.navaid {
    color: #f59e0b;
}

.item-icon.waypoint {
    color: #10b981;
}

.item-icon.airspace {
    color: #3b82f6;
}

.item-content {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-size: 15px;
    font-weight: 500;
    color: #1c1c1e;
    margin-bottom: 2px;
}

.item-subtitle {
    font-size: 13px;
    color: #8e8e93;
}

.item-action {
    color: #007aff;
    font-size: 14px;
    font-weight: 400;
    padding: 4px 8px;
    flex-shrink: 0;
    margin-left: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.15s;
}

.item-action:hover {
    background-color: rgba(0, 122, 255, 0.1);
}

/* Airspace details */
#airspace-details {
    font-size: 13px;
}

.airspace-name {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.airspace-type {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.airspace-type.CTR { background-color: rgba(0, 100, 255, 0.3); color: #7cb3f0; }
.airspace-type.TMA,
.airspace-type.CTA { background-color: rgba(100, 149, 237, 0.3); color: #a0c4ff; }
.airspace-type.R { background-color: rgba(255, 0, 0, 0.3); color: #ff6b6b; }
.airspace-type.P { background-color: rgba(139, 0, 0, 0.4); color: #ff4444; }
.airspace-type.MOA,
.airspace-type.M { background-color: rgba(255, 165, 0, 0.3); color: #ffb347; }
.airspace-type.D { background-color: rgba(255, 0, 255, 0.3); color: #ff77ff; }

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: #6b7280;
}

.detail-value {
    color: #111827;
    font-weight: 500;
}

/* ================================
   Aircraft Detail Panel (AirNav Style)
   ================================ */
.ac-panel-header {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    color: #fff;
    padding: 16px;
}
.ac-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.ac-callsign-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ac-callsign {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.ac-operator {
    font-size: 12px;
    color: #9ca3af;
}
.ac-reg-line {
    margin-top: 4px;
    font-size: 12px;
    color: #d1d5db;
}
.ac-status-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.ac-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
}
.ac-badge-mil {
    background: #dc2626;
}
.ac-type-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #111827;
    color: #fff;
    font-size: 13px;
}
.ac-type-reg {
    font-weight: 600;
}
.ac-type-name {
    color: #9ca3af;
    text-align: right;
}
.ac-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}
.ac-data-cell {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e5ea;
    border-right: 1px solid #e5e5ea;
}
.ac-data-cell:nth-child(2n) {
    border-right: none;
}
.ac-data-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    color: #8e8e93;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}
.ac-data-value {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}
.ac-data-sub {
    font-size: 12px;
    color: #6b7280;
    margin-top: 1px;
}
.section-content.collapsed {
    display: none;
}

.info-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    background-color: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    margin-bottom: 12px;
}

.info-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #6b7280;
    margin: 12px 0 6px;
    letter-spacing: 0.4px;
}

.info-list {
    display: grid;
    gap: 6px;
}

.info-list-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 6px;
}

.info-list-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-muted {
    color: #6b7280;
}

/* ================================
   Airport Detail Panel (ForeFlight Style)
   ================================ */
.airport-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e5ea;
    position: relative;
}

.btn-add-to-route {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 8px 14px;
    background-color: #3b82f6;
    border: none;
    border-radius: 6px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-add-to-route:hover {
    background-color: #2563eb;
}
#btn-header-add-route {
    position: static;
    margin-left: auto;
    padding: 6px 12px;
    font-size: 12px;
    z-index: 1;
}

#btn-header-add-route.hidden {
    display: none;
}

.airport-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8e8e93;
    flex-shrink: 0;
}

.airport-icon svg {
    width: 40px;
    height: 40px;
}

.airport-title {
    flex: 1;
    min-width: 0;
}

.airport-name-main {
    font-size: 17px;
    font-weight: 600;
    color: #1c1c1e;
    margin-bottom: 2px;
}

.airport-location {
    font-size: 13px;
    color: #8e8e93;
    margin-bottom: 2px;
}

.airport-elevation {
    font-size: 13px;
    color: #8e8e93;
}
.airport-sun-times {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.airport-section {
    background-color: #ffffff;
    margin-bottom: 8px;
}

.airport-section:last-child {
    margin-bottom: 0;
}

.section-header {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #8e8e93;
    letter-spacing: 0.5px;
    padding: 12px 16px 8px;
    background-color: #f2f2f7;
}

.panel-end-marker {
    height: 6px;
}

.section-content {
    padding: 0;
}

.airport-freq-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e5ea;
}

.airport-freq-row:last-child {
    border-bottom: none;
}

.freq-name {
    font-size: 12px;
    color: #1c1c1e;
}

.freq-value {
    font-size: 12px;
    color: #1c1c1e;
    text-align: right;
}

.freq-value.morse-code {
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    font-size: 14px;
}

.navaid-icon {
    color: #ff8800;
}

.navaid-icon svg {
    width: 40px;
    height: 40px;
}

.waypoint-icon {
    color: #00ff88;
}

.waypoint-icon svg {
    width: 40px;
    height: 40px;
}

.heliport-icon {
    color: #2b6fff;
}

.heliport-icon svg {
    width: 40px;
    height: 40px;
}

.airstrip-icon {
    color: #88cc44;
}

.airstrip-icon svg {
    width: 40px;
    height: 40px;
}

.airspace-icon {
    color: #6495ed;
}

.airspace-icon svg {
    width: 40px;
    height: 40px;
}

.no-data {
    padding: 12px 16px;
    color: #8e8e93;
    font-size: 14px;
}

/* Runway Cards */
.runway-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.runway-card {
    background-color: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e5ea;
}

.runway-card-header {
    background-color: #3b82f6;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.runway-id {
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
}

.runway-card-body {
    padding: 8px 0;
}

.runway-card-body .airport-freq-row {
    padding: 6px 16px;
}

.rwy-ends-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-top: 1px solid #333;
    margin-top: 6px;
}

.rwy-end-detail {
    padding: 6px 0;
}

.rwy-end-detail:nth-child(odd) {
    border-right: 1px solid #333;
}

.rwy-end-name {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    padding: 4px 16px;
}

.rwy-end-detail .airport-freq-row {
    padding: 3px 16px;
}

/* Procedure Links */
.procedure-link {
    display: block;
    padding: 12px 16px;
    color: #3b82f6;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s;
}

.procedure-link:hover {
    background-color: rgba(59, 130, 246, 0.1);
    text-decoration: underline;
}

/* Route panel (floating) */
#route-panel {
    position: absolute;
    bottom: 100px;
    right: 20px;
    width: 280px;
    background-color: #ffffff;
    border-radius: 10px;
    padding: 16px;
    z-index: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border: 1px solid #e5e7eb;
}

#route-panel.hidden {
    display: none;
}

/* Route info */
.route-summary {
    background-color: #f9fafb;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.summary-item .label {
    color: #6b7280;
    font-size: 12px;
}

.summary-item .value {
    color: #3b82f6;
    font-weight: 600;
    font-size: 14px;
}

#route-legs {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.route-leg {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background-color: #f9fafb;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 12px;
}

.leg-number {
    color: #3b82f6;
    font-weight: 600;
    min-width: 30px;
}

.leg-info {
    flex: 1;
    display: flex;
    gap: 16px;
}

.leg-distance,
.leg-bearing {
    color: #374151;
}

.leg-distance span,
.leg-bearing span {
    color: #9ca3af;
    margin-right: 4px;
}

.btn-secondary {
    width: 100%;
    padding: 10px;
    background-color: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: #ef4444;
    color: #fff;
}

/* Route Waypoint Info Panel */
.rwp-summary {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
}

.rwp-list {
    padding: 4px 0;
}

.rwp-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.15s;
}

.rwp-item:hover {
    background-color: #f9fafb;
}

.rwp-item.active {
    background-color: #eff6ff;
}

.rwp-label {
    font-size: 12px;
    font-weight: 700;
    color: #3b82f6;
    min-width: 32px;
}

.rwp-item:first-child .rwp-label {
    color: #22c55e;
}

.rwp-coords {
    font-size: 11px;
    color: #374151;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    flex: 1;
    min-width: 0;
}

.rwp-leg {
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
}

.rwp-delete {
    width: 22px;
    height: 22px;
    border: none;
    background: none;
    color: #9ca3af;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.rwp-delete:hover {
    background-color: #fee2e2;
    color: #ef4444;
}

/* ================================
   Map Controls Overlay
   ================================ */
#map-controls {
    position: absolute;
    bottom: 10px;
    left: 280px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

/* Zoom buttons */
#zoom-controls {
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.zoom-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background-color: #ffffff;
    color: #374151;
    font-size: 20px;
    font-weight: 300;
    cursor: pointer;
    transition: background-color 0.15s;
}

.zoom-btn:first-child {
    border-bottom: 1px solid #e5e7eb;
}

.zoom-btn:hover {
    background-color: #f3f4f6;
}

.zoom-btn:active {
    background-color: #e5e7eb;
}

#mode-indicator {
    display: flex;
    gap: 4px;
    background-color: rgba(30, 37, 48, 0.95);
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.mode-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background-color: transparent;
    color: #6b7280;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    background-color: #252d38;
    color: #d1d5db;
}

.mode-btn.active {
    background-color: #3b82f6;
    color: #fff;
}

#scale-display {
    font-size: 11px;
    color: #374151;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 2px 8px;
    border: 1px solid #9ca3af;
    border-radius: 3px;
    min-width: 60px;
    text-align: center;
}

#coordinates-display {
    background-color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Monaco', 'Consolas', monospace;
    color: #1f2937;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

/* ================================
   Cursor styles
   ================================ */
#map.route-mode {
    cursor: crosshair;
}

/* Route waypoint markers */
.waypoint-marker {
    width: 12px;
    height: 12px;
    background-color: #ef4444;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
}

.waypoint-marker.start {
    background-color: #22c55e;
}

/* ================================
   Popup styling
   ================================ */
.maplibregl-popup-content {
    background-color: #1e2530 !important;
    color: #e0e0e0;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.maplibregl-popup-tip {
    border-top-color: #1e2530 !important;
}

.maplibregl-popup-close-button {
    color: #6b7280;
    font-size: 18px;
}

.maplibregl-popup-close-button:hover {
    color: #ef4444;
    background: none;
}

/* ================================
   Scrollbar styling
   ================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #1a2028;
}

::-webkit-scrollbar-thumb {
    background: #3d4654;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4d5664;
}

/* ================================
   OSM Geocoding Search (Top-Left)
   ================================ */
#geo-results.hidden {
    display: none;
}

.geo-clear.hidden {
    display: none;
}

#geo-search {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

#geo-search-bar {
    display: flex;
    align-items: center;
    height: 36px;
    background-color: #f3f4f6;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    box-shadow: none;
    padding: 0 10px;
    gap: 6px;
}

.geo-search-icon {
    color: #9ca3af;
    flex-shrink: 0;
}

#geo-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #1f2937;
    font-size: 13px;
    min-width: 0;
}

#geo-search-input::placeholder {
    color: #9ca3af;
}

.geo-clear {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.geo-clear:hover {
    color: #374151;
}

#geo-results {
    margin-top: 4px;
    background-color: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    max-height: 250px;
    overflow-y: auto;
}

.geo-result-item {
    display: flex;
    align-items: flex-start;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    gap: 8px;
    transition: background-color 0.15s;
}

.geo-result-item:hover {
    background-color: #eff6ff;
}

.geo-result-item:last-child {
    border-bottom: none;
}

.geo-result-icon {
    color: #3b82f6;
    flex-shrink: 0;
    margin-top: 2px;
}

.geo-result-name {
    font-size: 13px;
    color: #1f2937;
    font-weight: 500;
}

.geo-result-detail {
    font-size: 11px;
    color: #6b7280;
    margin-top: 1px;
}

.geo-type-tag {
    font-size: 10px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
}

.geo-panel-card {
    padding: 16px 20px;
}

.geo-panel-name {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
}

.geo-panel-badge {
    font-size: 11px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 7px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 400;
}

.geo-panel-coord {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    font-family: 'Menlo', 'Consolas', monospace;
}

.geo-panel-sub {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 6px;
}

.geo-panel-actions {
    margin-top: 14px;
}

/* ================================
   Search Bar & FPL Panel (ForeFlight Style)
   ================================ */
#fpl-container {
    position: absolute;
    top: 16px;
    right: 0;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 380px;
    max-width: calc(100vw - 300px);
}

#search-bar {
    display: flex;
    align-items: center;
    width: 100%;
    height: 44px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

#btn-fpl-toggle {
    height: 100%;
    padding: 0 16px;
    background-color: #3b82f6;
    border: none;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#btn-fpl-toggle:hover {
    background-color: #2563eb;
}

#btn-fpl-toggle.active {
    background-color: #1d4ed8;
}

#search-input {
    flex: 1;
    height: 100%;
    padding: 0 16px;
    background: transparent;
    border: none;
    color: #1f2937;
    font-size: 15px;
    outline: none;
}

#search-input::placeholder {
    color: #9ca3af;
}

#btn-search-clear {
    width: 44px;
    height: 100%;
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

#btn-search-clear:hover {
    color: #ef4444;
}

#btn-search-clear.hidden {
    display: none;
}

/* Search Results Dropdown */
#search-results {
    width: 100%;
    margin-top: 4px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    max-height: 320px;
    overflow-y: auto;
}

#search-results.hidden {
    display: none;
}

#search-results-list {
    padding: 8px 0;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.search-result-item:hover {
    background-color: #eff6ff;
}

.search-result-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.search-result-icon.airport { color: #d946ef; }
.search-result-icon.heliport { color: #2b6fff; }
.search-result-icon.navaid { color: #f59e0b; }
.search-result-icon.waypoint { color: #10b981; }
.search-result-icon.geo { color: #ef4444; }

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
}

.search-result-subtitle {
    font-size: 12px;
    color: #6b7280;
}

.search-result-distance {
    font-size: 12px;
    color: #3b82f6;
    margin-left: 12px;
}

.search-result-add {
    padding: 6px 12px;
    background-color: #3b82f6;
    border: none;
    border-radius: 4px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    flex-shrink: 0;
    margin-left: 8px;
}

.search-result-add:hover {
    background-color: #2563eb;
}

/* FPL Panel */
#fpl-panel {
    width: 100%;
    margin-top: 8px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

#fpl-panel.hidden {
    display: none;
}

.fpl-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.fpl-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.fpl-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.fpl-actions button {
    padding: 6px 12px;
    background-color: transparent;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    color: #374151;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.fpl-actions button:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

#btn-fpl-clear:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.fpl-close-btn {
    padding: 2px 8px !important;
    font-size: 18px !important;
    line-height: 1;
    border: none !important;
    color: #9ca3af !important;
}

.fpl-close-btn:hover {
    color: #374151 !important;
    background-color: #f3f4f6 !important;
}

.fpl-route-input {
    display: flex;
    padding: 12px 16px;
    gap: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.fpl-route-input input {
    flex: 1;
    padding: 10px 12px;
    background-color: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #1f2937;
    font-size: 13px;
    font-family: 'Monaco', 'Consolas', monospace;
    outline: none;
    transition: border-color 0.2s;
}

.fpl-route-input input:focus {
    border-color: #3b82f6;
}

.fpl-route-input input::placeholder {
    color: #9ca3af;
}

#btn-fpl-parse {
    padding: 10px 16px;
    background-color: #3b82f6;
    border: none;
    border-radius: 6px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

#btn-fpl-parse:hover {
    background-color: #2563eb;
}

/* FPL Waypoints List */
#fpl-waypoints {
    max-height: 240px;
    overflow-y: auto;
}

.fpl-waypoint {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    border-bottom: 1px solid #f3f4f6;
    gap: 8px;
}

.fpl-waypoint:last-child {
    border-bottom: none;
}

.fpl-waypoint-handle {
    color: #6b7280;
    cursor: grab;
}

.fpl-waypoint-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fpl-waypoint-icon.airport { color: #d946ef; }
.fpl-waypoint-icon.heliport { color: #2b6fff; }
.fpl-waypoint-icon.navaid { color: #f59e0b; }
.fpl-waypoint-icon.waypoint { color: #10b981; }

.fpl-waypoint-name {
    font-size: 13px;
    font-weight: 500;
    color: #1f2937;
    flex: 1;
    min-width: 0;
}

.fpl-waypoint-leg {
    font-size: 12px;
    color: #3b82f6;
    font-weight: 500;
    white-space: nowrap;
    margin-left: auto;
}

.fpl-waypoint-remove {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.fpl-waypoint-remove:hover {
    background-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* FPL Summary */
.fpl-summary {
    padding: 12px 16px;
    background-color: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.fpl-summary .summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fpl-summary .label {
    font-size: 13px;
    color: #6b7280;
}

.fpl-summary .value {
    font-size: 16px;
    font-weight: 600;
    color: #3b82f6;
}

/* Empty state for FPL */
.fpl-empty {
    padding: 32px 16px;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
}

/* ================================
   Responsive adjustments
   ================================ */
@media (max-width: 1024px) {
    #layer-panel {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 200;
    }

    #map-controls {
        left: 20px;
    }

    #layer-panel.collapsed + #map + #info-panel ~ #map-controls {
        left: 20px;
    }

    #fpl-container {
        max-width: calc(100vw - 40px);
        right: 0;
    }
}

@media (max-width: 768px) {
    #info-panel {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        max-width: 320px;
    }

    #layer-panel {
        width: 100%;
        max-width: 280px;
    }
}

/* ===== Weather Detail Panel (Airport Info) ===== */
/* Procedure sub-tabs */
.proc-sub-tabs {
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    background: #1e2d3d;
}

.proc-sub-tab {
    flex: 1;
    padding: 7px 0;
    border: none;
    background: transparent;
    color: #8899aa;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    border-radius: 4px;
    text-align: center;
}

.proc-sub-tab.active {
    color: #ffffff;
    background: #2a5a8a;
}

.proc-sub-tab:hover:not(.active) {
    color: #ccddee;
    background: rgba(255,255,255,0.06);
}

.proc-sub-pane {
    display: none;
}

.proc-sub-pane.active {
    display: block;
}

.wx-detail-tabs {
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    background: #1e2d3d;
}

.wx-detail-tab {
    flex: 1;
    padding: 7px 0;
    border: none;
    background: transparent;
    color: #8899aa;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    border-radius: 4px;
}

.wx-detail-tab.active {
    color: #ffffff;
    background: #2a5a8a;
}

.wx-detail-tab:hover:not(.active) {
    color: #ccddee;
    background: rgba(255,255,255,0.06);
}

.wx-detail-pane {
    padding: 12px;
}

/* Flight category header */
.wx-cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.wx-cat-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.wx-cat-badge.vfr { background: #22aa22; }
.wx-cat-badge.mvfr { background: #2277cc; }
.wx-cat-badge.ifr { background: #cc3333; }
.wx-cat-badge.lifr { background: #aa22aa; }
.wx-cat-badge.unknown { background: #666; }

.wx-station-age {
    font-size: 11px;
    color: #8899aa;
}

/* Raw METAR/TAF text */
.wx-raw-text {
    font-size: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #ffffff;
    line-height: 1.5;
    word-break: break-all;
    padding: 8px 10px;
    background: rgba(0,0,0,0.4);
    border-radius: 4px;
    margin-bottom: 12px;
    font-weight: 600;
}

.wx-raw-text.taf-raw {
    color: #ffffff;
}

/* Decoded fields table */
.wx-decoded {
    border-top: 1px solid rgba(255,255,255,0.08);
}

.wx-decoded-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.wx-decoded-label {
    font-size: 12px;
    color: #8899aa;
    font-weight: 500;
}

.wx-decoded-value {
    font-size: 12px;
    color: #4a9eff;
    font-weight: 600;
}

/* Nearby label */
.wx-nearby-label {
    font-size: 10px;
    color: #aa8866;
    font-style: italic;
    margin-bottom: 6px;
}

/* TAF forecast periods */
.taf-period {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 8px;
    margin-top: 4px;
}

.taf-period-header {
    font-size: 11px;
    font-weight: 700;
    color: #8899aa;
    padding-bottom: 4px;
    letter-spacing: 0.3px;
}

.wx-weather-nsw {
    color: #44bb44 !important;
}

/* Nearby weather section */
.wx-decoded-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #8899aa;
    padding: 12px 0 6px;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 4px;
    letter-spacing: 0.5px;
}

.wx-nearby-station {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.wx-nearby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
    font-size: 12px;
    color: #8899aa;
}

.wx-nearby-detail {
    font-size: 11px;
    color: #778899;
    line-height: 1.4;
}

/* Flight category dot (reused in nearby) */
.wx-flight-cat {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

.wx-flight-cat.vfr { background: #22cc22; }
.wx-flight-cat.mvfr { background: #2288ee; }
.wx-flight-cat.ifr { background: #ee4444; }
.wx-flight-cat.lifr { background: #cc22cc; }

/* Radar Timeline Player */
.radar-player { margin-top: 6px; padding: 6px 8px; background: rgba(30,30,30,0.85); border-radius: 6px; }
.radar-player.hidden { display: none; }
.radar-player-controls { display: flex; align-items: center; gap: 6px; }
.radar-btn {
    width: 28px; height: 28px; border: none; border-radius: 4px;
    background: #444; color: #fff; cursor: pointer; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
}
.radar-btn:hover { background: #555; }
.radar-btn.playing { color: #00BCD4; }
.radar-timeline-wrap { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.radar-timeline-wrap input[type="range"] {
    width: 100%; height: 4px; -webkit-appearance: none; appearance: none;
    background: #555; border-radius: 2px; outline: none;
}
.radar-timeline-wrap input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 12px; height: 12px;
    background: #00BCD4; border-radius: 50%; cursor: pointer;
}
.radar-timeline-labels { display: flex; justify-content: space-between; font-size: 10px; color: #aaa; }
.radar-label-center { color: #00BCD4; font-weight: 600; }
.radar-speed-select {
    background: #444; color: #fff; border: 1px solid #555; border-radius: 4px;
    padding: 2px 4px; font-size: 11px; cursor: pointer;
}

/* Elevation Profile */
#elevation-profile {
    position: absolute;
    bottom: 0;
    left: 260px;
    right: 380px;
    height: 180px;
    background: rgba(20, 24, 32, 0.92);
    border-top: 1px solid #333;
    z-index: 500;
    display: flex;
    flex-direction: column;
}

#elevation-profile.hidden {
    display: none;
}

.elev-header {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    gap: 12px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.elev-title {
    font-size: 12px;
    font-weight: 600;
    color: #ccc;
}

.elev-stats {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: #888;
    flex: 1;
}

.elev-stats span {
    white-space: nowrap;
}

.elev-msa-badge {
    color: #00e5ff;
    font-weight: 600;
}

#btn-elev-close {
    background: none;
    border: none;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
}

#btn-elev-close:hover {
    color: #fff;
}

#elev-canvas {
    flex: 1;
    width: 100%;
    min-height: 0;
    display: block;
    cursor: crosshair;
}

#elev-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 510;
}

#elev-tooltip.hidden {
    display: none;
}
