html,
body {
    height: 100%;
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
}

body {
    display: flex;
    background: #f4f4f4;
}

#sidebar {
    width: 340px;
    background: #0c2a8d;
    color: white;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 100;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
}

#logo {
    text-align: center;
    margin-bottom: 25px;
    background: white;
    border-radius: 10px;
    padding: 14px 10px;
}

#logo img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

#searchWrap {
    position: relative;
    margin-bottom: 25px;
}

#search {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 15px;
    background: #1a3da8;
    color: white;
    transition: all 0.3s;
}

#search::placeholder {
    color: rgba(255,255,255,0.6);
}

#search:focus {
    outline: none;
    background: #234cb8;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.2);
}

#searchResults {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #1a3da8;
    border-radius: 8px;
    overflow: hidden;
    max-height: 260px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

.searchItem {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #2a4db8;
    font-size: 14px;
    transition: background 0.2s;
}

.searchItem:last-child {
    border-bottom: none;
}

.searchItem:hover {
    background: #234cb8;
}

.searchItemName {
    font-weight: 600;
}

.searchItemShort {
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    margin-left: 10px;
}

.searchEmpty {
    padding: 10px 12px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
}

.filterBox {
    background: #1a3da8;
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.filterBoxHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.filterBoxHeader.static {
    cursor: default;
}

.filterBoxHeader h3 {
    margin: 0;
    font-size: 15px;
    color: white;
}

.filterBoxContent {
    margin-top: 10px;
}

.filterBox label {
    display: block;
    margin-bottom: 6px;
    cursor: pointer;
    color: #e0e0e0;
    font-size: 13px;
    transition: color 0.2s;
}

.filterBox label:hover {
    color: white;
}

.filterBox input[type="checkbox"] {
    margin-right: 6px;
    cursor: pointer;
    accent-color: #0c2a8d;
}

.checkboxGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 8px;
}

hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.15);
    margin: 20px 0;
}

/* ==============================
   FILTER ALLE/KEINE BUTTONS
   ============================== */

.filterButtons {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.filterBtn {
    flex: 1;
    background: #0c2a8d;
    color: white;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.filterBtn:hover {
    background: #234cb8;
}

/* ==============================
   HÖHENFILTER (FLIGHT LEVEL)
   ============================== */

.altRow {
    margin-bottom: 14px;
}

.altRow:last-child {
    margin-bottom: 0;
}

.altRow label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #e0e0e0;
    margin-bottom: 6px;
}

.altRow label span {
    color: white;
    font-weight: 600;
}

.altRow input[type="range"] {
    width: 100%;
    accent-color: #ffffff;
    cursor: pointer;
}

/* ==============================
   COLLAPSE BUTTON (für alle Filter-Boxen)
   ============================== */

.collapseBtn {
    background: #0c2a8d;
    color: white;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 4px;
    width: 20px;
    height: 20px;
    line-height: 1;
    cursor: pointer;
    font-size: 13px;
    flex-shrink: 0;
}

.collapseBtn:hover {
    background: #234cb8;
}

/* ==============================
   LEGEND
   ============================== */

.legendSection {
    margin-bottom: 12px;
    font-size: 13px;
    color: #e0e0e0;
}

.legendSection:last-child {
    margin-bottom: 0;
}

.legendSection strong {
    display: block;
    margin-bottom: 6px;
    color: white;
    font-size: 13px;
}

.legendItem {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    color: #d8d8d8;
}

.legendSwatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legendLine {
    width: 22px;
    height: 0;
    border-top-width: 2px;
    border-top-style: solid;
    border-top-color: #ffffff;
    flex-shrink: 0;
}

.legendLine.dashed {
    border-top-style: dashed;
}

.legendLine.dotted {
    border-top-style: dotted;
    border-top-width: 3px;
}

.legendLine.dashdot {
    border-top-style: dashed;
    border-top-width: 2px;
    /* CSS kennt kein "dash-dot", daher optisch angenähert über gepunktete Linie + Farbe */
    background-image: radial-gradient(circle, #ffffff 1px, transparent 1px);
    background-size: 6px 2px;
    background-repeat: repeat-x;
    background-position: bottom;
}

.legendShape {
    width: 16px;
    height: 16px;
    background: #ffffff;
    flex-shrink: 0;
}

.legendShape.pill {
    border-radius: 8px;
}

.legendShape.square {
    border-radius: 3px;
}

.legendShape.hexagon {
    width: 20px;
    clip-path: polygon(6% 0, 94% 0, 100% 50%, 94% 100%, 6% 100%, 0 50%);
}

#sectorInfo {
    background: #1a3da8;
    padding: 18px;
    border-radius: 10px;
}

#sectorInfo h2 {
    margin-top: 0;
    font-size: 18px;
    color: white;
    word-wrap: break-word;
}

#sectorInfo p {
    margin: 6px 0;
    font-size: 13px;
    line-height: 1.4;
    color: #d8d8d8;
}

#sectorInfo p strong {
    color: white;
}

#map {
    flex: 1;
    height: 100vh;
    background: #e8ecf1;
}

/* ==============================
   SECTOR MARKER STYLES
   ============================== */

.sector-marker {
    z-index: 1000 !important;
    transform: translate(-50%, -50%);
}

.sector-marker div {
    transition: all 0.2s ease;
    font-family: 'Segoe UI', Arial, sans-serif;
    letter-spacing: 0.5px;
    font-size: 11px;
    font-weight: 700;
    color: white;
    border-radius: 12px;
    padding: 4px 10px;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    cursor: pointer;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.sector-marker.selected div {
    transform: scale(1.15);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
    border-width: 3px;
}

.sector-marker:hover div {
    transform: scale(1.08);
    box-shadow: 0 3px 12px rgba(0,0,0,0.4) !important;
}

/* Typ-abhängige Marker-Form, damit CTR / Approach / Oceanic auch bei
   gleicher FIR-Farbe auf einen Blick unterscheidbar sind */

.sector-marker.type-ctr div {
    border-radius: 12px;
}

.sector-marker.type-app div {
    border-radius: 4px;
    border-style: dashed;
}

.sector-marker.type-oceanic div {
    clip-path: polygon(6% 0, 94% 0, 100% 50%, 94% 100%, 6% 100%, 0 50%);
    border-radius: 0;
    padding: 6px 16px;
}

/* ==============================
   SECTOR TOOLTIP STYLES
   ============================== */

.sector-tooltip {
    background: rgba(0,0,0,0.85) !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 5px 12px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    pointer-events: none !important;
    font-family: 'Segoe UI', Arial, sans-serif !important;
}

.sector-tooltip::before {
    display: none !important;
}

/* ==============================
   POPUP STYLES (für Überlappungen)
   ============================== */

.custom-popup .leaflet-popup-content-wrapper {
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.sector-popup {
    min-width: 220px;
    padding: 0;
}

.sector-popup h4 {
    margin: 0;
    padding: 10px 16px;
    font-size: 14px;
    color: white;
    background: #0c2a8d;
    border-bottom: 2px solid #1a3da8;
}

.sector-popup ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sector-popup li {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
    font-size: 13px;
}

.sector-popup li:hover {
    background: #f0f4ff;
}

.sector-popup li:last-child {
    border-bottom: none;
}

.sector-popup-item.upper span:first-child {
    color: #FF6B6B;
    font-weight: 600;
}

.sector-popup-item.upper span:first-child::after {
    content: ' ⬆';
    font-size: 12px;
}

.sector-popup-item.lower span:first-child {
    color: #0c2a8d;
    font-weight: 600;
}

.sector-popup-item.lower span:first-child::after {
    content: ' ⬇';
    font-size: 12px;
}

.sector-popup-detail {
    font-size: 12px;
    color: #888;
    margin-left: 12px;
}

/* ==============================
   LEAFLET OVERRIDES
   ============================== */

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important;
}

.leaflet-control-zoom a {
    background: white !important;
    color: #0c2a8d !important;
    font-weight: bold !important;
}

.leaflet-control-zoom a:hover {
    background: #f0f4ff !important;
}

/* ==============================
   SCROLLBAR STYLES
   ============================== */

#sidebar::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-track {
    background: #0c2a8d;
}

#sidebar::-webkit-scrollbar-thumb {
    background: #1a3da8;
    border-radius: 3px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: #234cb8;
}

#searchResults::-webkit-scrollbar {
    width: 6px;
}

#searchResults::-webkit-scrollbar-track {
    background: #1a3da8;
}

#searchResults::-webkit-scrollbar-thumb {
    background: #2a4db8;
    border-radius: 3px;
}

#searchResults::-webkit-scrollbar-thumb:hover {
    background: #3a5dc8;
}

/* ==============================
   RESPONSIVE DESIGN
   ============================== */

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    
    #sidebar {
        width: 100%;
        max-height: 45vh;
        box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    }
    
    #map {
        height: 55vh;
    }
    
    .sector-marker div {
        font-size: 9px;
        padding: 2px 7px;
    }
}

@media (max-width: 480px) {
    #sidebar {
        padding: 12px;
        max-height: 40vh;
    }
    
    #logo h1 {
        font-size: 22px;
    }
    
    #logo h2 {
        font-size: 14px;
    }
    
    #search {
        font-size: 13px;
        padding: 10px;
    }
    
    #sectorInfo h2 {
        font-size: 15px;
    }
    
    #sectorInfo p {
        font-size: 12px;
    }
    
    .sector-popup {
        min-width: 160px;
    }
}