/* XC Flightcheck Violation Map - Main CSS File */
/* This file imports all modular CSS components */

/* Core styles and layout */
@import url('base.css');

/* Chart specific styles */
@import url('chart.css');

/* Popup and dialog styles */
@import url('popup.css');

/* Table styles */
@import url('tables.css');

/* Info panels and status displays */
@import url('info.css');

/* Enhanced track statistics */
@import url('stats.css');

/* Dark mode overrides */
@import url('dark.css');

/* Responsive design and media queries */
@import url('responsive.css');

/* Utility classes */
@import url('utilities.css');

/* Custom application-specific overrides can be added below */

.trackinfo-pilot-identity {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.trackinfo-pilot-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 2px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.92em;
    font-weight: 700;
    line-height: 1.2;
}

.trackinfo-pilot-flag {
    width: 16px !important;
    height: 11px !important;
    max-width: 16px !important;
    max-height: 11px !important;
    min-width: 16px !important;
    inline-size: 16px !important;
    block-size: 11px !important;
    max-inline-size: 16px !important;
    max-block-size: 11px !important;
    flex: 0 0 16px !important;
    display: inline-block !important;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
    object-fit: cover;
}

.igc-shared-flight-actions {
    display: grid;
    gap: 8px;
    margin: 0 16px 12px;
}

.igc-replay-launch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: calc(100% - 32px);
    min-height: 44px;
    margin: 0 16px;
    padding: 12px 8px;
    border: 0;
    border-radius: 0;
    background: #aedb34;
    color: #3c3434;
    font-weight: 600;
    text-decoration: none;
    box-shadow: none;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.igc-shared-flight-actions .igc-replay-launch,
.igc-shared-flight-actions .igc-flightbook-launch {
    width: 100%;
    margin: 0;
}

.igc-replay-launch:hover,
.igc-replay-launch:focus-visible {
    background: #9ac52d;
    color: #3c3434;
    box-shadow: none;
    text-decoration: none;
    outline: none;
}

.igc-flightbook-launch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 12px 8px;
    border: 0;
    border-radius: 0;
    background: #aedb34;
    color: #3c3434;
    font-weight: 600;
    text-decoration: none;
    box-shadow: none;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.igc-flightbook-launch:hover,
.igc-flightbook-launch:focus-visible {
    background: #9ac52d;
    color: #3c3434;
    text-decoration: none;
    outline: none;
}

.igc-flightbook-launch:hover,
.igc-flightbook-launch:focus-visible {
    background: #f8fafc;
    color: #0f172a;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
    text-decoration: none;
    outline: none;
}

body.dark-mode .igc-replay-launch {
    background: linear-gradient(135deg, #334155, #0f766e);
    color: #ffffff;
    box-shadow: 0 12px 28px rgba(2, 6, 23, 0.32);
}

body.dark-mode .igc-flightbook-launch {
    background: rgba(15, 23, 42, 0.86);
    border-color: rgba(148, 163, 184, 0.42);
    color: #e2e8f0;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.26);
}

/* Smooth scrolling for chart container */
#altitude-chart-container {
    scroll-behavior: smooth;
}

/* Highlight animation for chart */
@keyframes chartHighlightPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Map wrapper flex container */
.map-wrapper {
    display: flex;
    position: relative;
    width: 100%;
    flex: 0 0 clamp(500px, 58dvh, 760px);
    height: clamp(500px, 58dvh, 760px);
    min-height: clamp(500px, 58dvh, 760px);
    background: #f5f5f5;
    min-width: 0;
}

/* Map takes remaining space */
.ol-map {
    flex: 1;
    position: relative;
    min-width: 0; /* Important for flex to work properly */
}

/* Enhanced track info sidebar */
#enhanced-track-info {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background: transparent;
    border-left: none;
    flex-shrink: 1;
    padding-left: 10px;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    #enhanced-track-info {
        width: 100%;
    }
    
}

@media (max-width: 768px) {
    .map-wrapper {
        flex-direction: column;
        flex: 1 1 auto;
        height: auto;
        min-height: 500px;
    }
    
    .ol-map {
        height: 500px;
        width: 100%;
    }
    
    #enhanced-track-info {
        width: 100%;
        height: auto;
        max-height: 400px;
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    #display-settings-overlay {
        right: 0px !important;
        top: 0px !important;
    }
}

/* Scrollbar styling for enhanced track info */
#enhanced-track-info::-webkit-scrollbar {
    width: 8px;
}

#enhanced-track-info::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

#enhanced-track-info::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

#enhanced-track-info::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* IGC Validation Result Styles */
.igc-file-result.warning {
    border-color: #f39c12;
}

.igc-status-text.warning {
    background: #f39c12;
}

.igc-validation-warning {
    color: #e74c3c;
    font-size: 0.85em;
    margin-top: 4px;
}

.igc-validation-warning i {
    margin-right: 4px;
}



#enhanced-track-info {
    width: 100%; 
    height: 100%; 
    max-height: inherit; /* Erbt die Höhe vom map-wrapper */
    overflow-y: auto; 
    overflow-x: hidden;
    background: transparent;
}

/* Scrollbar Styling für bessere Optik */
#enhanced-track-info::-webkit-scrollbar {
    width: 8px;
}

#enhanced-track-info::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

#enhanced-track-info::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

#enhanced-track-info::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Firefox Scrollbar */
#enhanced-track-info {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.1);
}

/* Accordion Content Padding für bessere Scroll-Erfahrung */
.accordion-content {
    padding-bottom: 12px; /* Extra Platz am Ende für besseres Scrollen */
}

/* Letztes Accordion Item Extra Padding */
.accordion-card:last-child .accordion-content {
    padding-bottom: 20px;
}

/* Download section styles */
.download-section {
    background: transparent;
    width: 100%;
    padding: 0;
    margin-top: 16px;
}

.download-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.download-btn {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 110px;
    justify-content: center;
}

.download-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.download-btn:active {
    transform: translateY(0);
}

.download-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.igc-btn {
    background: linear-gradient(135deg, #007bff, #0056b3);
}

.igc-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #0056b3, #004085);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.kmz-btn {
    background: linear-gradient(135deg, #007bff, #0056b3);
}

.kmz-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #0056b3, #004085);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.share-button-group {
    position: relative;
    margin-left: auto;
    display: flex;
    align-items: center;
}

.share-btn {
    background: linear-gradient(135deg, #6366f1, #4338ca);
    min-width: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1px;
}

.share-btn i {
    margin: 0;
    font-size: 1rem;
}

.share-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #4338ca, #3730a3);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.share-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    min-width: 240px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.2);
    border-radius: 1px;
    box-shadow: 0 22px 44px rgba(15, 23, 42, 0.25);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10060;
}

.share-menu.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.share-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: none;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    font-size: 0.86em;
    padding: 10px 14px;
    border-radius: 1px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
    justify-content: center;
}

.share-menu__item i {
    width: 18px;
    text-align: center;
}

.share-menu__item:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
}

.share-menu__item.is-success {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.share-menu__item.is-error {
    background: linear-gradient(135deg, #f87171, #ef4444);
}

.share-menu__item.is-success:hover,
.share-menu__item.is-error:hover {
    background: inherit;
    filter: brightness(1.05);
}

.share-menu__item[disabled] {
    opacity: 0.75;
    cursor: not-allowed;
}

.share-menu__item--link {
    padding-right: 12px;
    color: #ffffff;
}

.share-menu__item--link i {
    color: inherit;
}

.share-menu__item--link:hover {
    color: #ffffff;
}

.share-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(1.8px);
    z-index: 10050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.share-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ISA Debug Toggle Button */
#isa-debug-toggle {
    transition: all 0.3s ease;
    font-weight: 500;
}

#isa-debug-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#isa-debug-toggle:active {
    transform: translateY(0);
}

/* Responsive behavior for mobile */
@media (max-width: 768px) {
    .violation-table-title {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    #isa-debug-toggle {
        float: none !important;
        margin-left: 0 !important;
        width: 100%;
    }
}

/* Show on Map Button Styles */
.show-on-map-btn {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2);
}

.show-on-map-btn:hover {
    background: linear-gradient(135deg, #5a6268, #495057);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.4);
}

.show-on-map-btn:active {
    transform: translateY(0);
}

.show-on-map-container {
    display: flex;
    justify-content: center;
}

.info-map-btn {
    background: linear-gradient(135deg, #0d6efd, #0b5ed7);
    color: #fff;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75em;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.18);
}

.info-map-btn:hover {
    background: linear-gradient(135deg, #0b5ed7, #0a58ca);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.28);
}

.info-map-btn:active {
    transform: translateY(0);
}

.weather-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.weather-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.weather-metric {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.weather-metric .info-meta {
    color: #6c757d;
    font-size: 0.85em;
}

/* Enhanced violation status container */
.violation-status-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
}

/* Responsive behavior for show on map button */
@media (max-width: 768px) {
    .show-on-map-btn {
        font-size: 0.75em;
        padding: 5px 10px;
    }

    .info-map-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Enhanced tooltip animation for violations */
.violation-jump-tooltip {
    animation: violationPulse 0.3s ease-in-out;
}

@keyframes violationPulse {
    0% { transform: scale(0.95); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Episode Filter Styles */
.episode-filter-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.1);
}

.episode-category {
    margin-bottom: 12px;
}

.episode-category:last-child {
    margin-bottom: 0;
}

.episode-category-header {
    font-weight: bold;
    font-size: 0.9em;
    color: #ffc107;
    margin-bottom: 6px;
    padding-bottom: 2px;
    border-bottom: 1px solid rgba(255, 193, 7, 0.3);
}

.episode-category-content {
    padding-left: 8px;
}

.episode-filter-item {
    margin-bottom: 4px;
}

.episode-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85em;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.episode-checkbox-label:hover {
    background: rgba(255, 255, 255, 0.1);
}

.episode-filter-checkbox {
    margin: 0;
    accent-color: #4a90e2;
}

.episode-color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.episode-name {
    flex: 1;
}

/* Enhanced Track Popup Styles */
.track-popup {
    background: rgba(0, 0, 0, 0.9);
    border-radius: 8px;
    padding: 0;
    min-width: 280px;
    max-width: 350px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 2px solid #4a90e2;
    color: white;
    font-size: 0.9em;
    position: relative;
}

.track-popup-content {
    padding: 12px;
}

.popup-header h4 {
    margin: 0 0 8px 0;
    color: #4a90e2;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.popup-section {
    margin-bottom: 12px;
}

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

.popup-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: #ffc107;
    font-size: 0.95em;
}

.popup-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 0.9em;
}

.popup-row:last-child {
    margin-bottom: 0;
}

.popup-row i {
    width: 16px;
    text-align: center;
    color: #4a90e2;
}
.popup-glider-section {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    border: 1px dashed #cbd5f5;
    background: #f8fbff;
}
.popup-glider-hint {
    margin: 0 0 0.65rem 0;
    font-size: 0.9rem;
    color: #475569;
}
.popup-glider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.65rem;
    margin-top: 0.65rem;
}
.popup-glider-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: #0f172a;
}
.popup-glider-grid input {
    border-radius: 8px;
    border: 1px solid #cbd5f5;
    padding: 0.45rem 0.65rem;
    font-size: 0.95rem;
}

.episode-row {
    padding: 2px 0;
    border-left: 3px solid transparent;
    padding-left: 8px;
    margin-left: 4px;
}

.episode-indicator {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
    margin-right: 4px;
}

.episode-id {
    color: #999;
    font-size: 0.8em;
    margin-left: 4px;
}

.popup-actions {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    gap: 8px;
}

.popup-btn {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
}

.popup-btn:hover {
    background: #357abd;
}

.popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #999;
    font-size: 0.8em;
    transition: color 0.2s;
}

.popup-close:hover {
    color: white;
}

/* Dark mode episode filter styles */
body.dark-mode .episode-filter-container {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .episode-category-header {
    color: #ffc107;
    border-bottom-color: rgba(255, 193, 7, 0.2);
}

body.dark-mode .episode-checkbox-label:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .episode-color-indicator {
    border-color: rgba(255, 255, 255, 0.2);
}

/* Dark mode track popup styles */
body.dark-mode .track-popup {
    background: rgba(0, 0, 0, 0.95);
    border-color: #4a90e2;
}

body.dark-mode .popup-header h4 {
    color: #74b9ff;
}

body.dark-mode .popup-section-header {
    color: #ffeaa7;
}

body.dark-mode .popup-row i {
    color: #74b9ff;
}
body.dark-mode .popup-glider-section {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(96, 165, 250, 0.4);
}
body.dark-mode .popup-glider-grid input {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(96, 165, 250, 0.4);
    color: #e2e8f0;
}
body.dark-mode .popup-glider-hint {
    color: #cbd5f5;
}

body.dark-mode .popup-actions {
    border-top-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .popup-btn {
    background: #74b9ff;
}

body.dark-mode .popup-btn:hover {
    background: #0984e3;
}

.altitude-filter {
    margin: 6px 0 12px;
}

#display-settings-overlay .altitude-filter {
    color: #fff;
}

body.dark-mode #display-settings-overlay .altitude-filter {
}

.altitude-filter-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #fff;
    margin-bottom: 8px;
}

.altitude-slider {
    position: relative;
    height: 34px;
}

.altitude-slider-track,
.altitude-slider-range {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    border-radius: 3px;
}

.altitude-slider-track {
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.15);
}

.altitude-slider-range {
    left: 0%;
    right: 77.5%;
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
}

.altitude-slider input[type="range"] {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    pointer-events: none;
    background: none;
    -webkit-appearance: none;
    appearance: none;
    height: 25px;
}

.altitude-slider input[type="range"]::-webkit-slider-thumb {
    pointer-events: all;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2563eb;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
    -webkit-appearance: none;
}

.altitude-slider input[type="range"]::-moz-range-thumb {
    pointer-events: all;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2563eb;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
}

.altitude-slider input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: transparent;
}

.altitude-slider input[type="range"]::-moz-range-track {
    height: 6px;
    background: transparent;
}

body.dark-mode .altitude-filter {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(148, 163, 184, 0.3);
}

body.dark-mode .altitude-filter-values {
    color: rgba(226, 232, 240, 0.85);
}

body.dark-mode .altitude-slider-track {
    background: rgba(148, 163, 184, 0.3);
}

body.dark-mode .altitude-slider-range {
    background: linear-gradient(90deg, #60a5fa, #22d3ee);
}

body.dark-mode .altitude-slider input[type="range"]::-webkit-slider-thumb,
body.dark-mode .altitude-slider input[type="range"]::-moz-range-thumb {
    background: #60a5fa;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.45);
}

/* Radio button options for episode coloring */
.track-coloring-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.track-coloring-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.track-coloring-options label:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark-mode .track-coloring-options label:hover {
    background: rgba(255, 255, 255, 0.05);
}

.display-settings-hint {
    font-size: 0.85rem;
    color: #e2e8f0;
    margin-top: 0.35rem;
}

.thermal-day-layer-status:empty {
    display: none;
}

.thermal-day-popup {
    min-width: 320px;
    max-width: min(380px, calc(100vw - 32px));
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 6px;
    background: linear-gradient(145deg, rgba(48, 58, 51, 0.96) 0%, rgba(34, 47, 50, 0.96) 100%);
    color: #f7faf7;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(8px);
    font-size: 0.78rem;
    pointer-events: auto;
}

.thermal-day-popup-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    cursor: pointer;
    line-height: 1;
}

.thermal-day-popup-close:hover,
.thermal-day-popup-close:focus-visible {
    background: rgba(255, 255, 255, 0.22);
    outline: none;
}

.thermal-day-popup-title {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-right: 26px;
    font-size: 0.88rem;
    font-weight: 700;
}

.thermal-day-popup-swatch {
    width: 10px;
    height: 10px;
    border: 1px solid rgba(0, 0, 0, 0.9);
    border-radius: 50%;
    flex: 0 0 10px;
}

.thermal-day-popup-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 12px;
    margin: 8px 0 0;
}

.thermal-day-popup-stats div {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.thermal-day-popup-stats dt,
.thermal-day-popup-stats dd {
    margin: 0;
}

.thermal-day-popup-stats dt {
    color: rgba(255, 255, 255, 0.72);
}

.thermal-day-popup-stats dd {
    color: #ffffff;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.glide-contest-card {
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    padding: 0.75rem 0.9rem;
    background: rgba(15, 23, 42, 0.45);
}

.glide-contest-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 0.6rem;
}

.glide-contest-title {
    font-weight: 600;
    font-size: 1rem;
    color: #e2e8f0;
}

.glide-contest-window {
    font-size: 0.85rem;
    color: #94a3b8;
}

.glide-validity {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.2rem 0.9rem;
    border: 1px solid transparent;
}

.glide-validity.is-valid {
    background: rgba(34, 197, 94, 0.18);
    border-color: rgba(34, 197, 94, 0.45);
    color: #4ade80;
}

.glide-validity.is-invalid {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.45);
    color: #f87171;
}

.glide-contest-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.glide-contest-metric span {
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #94a3b8;
}

.glide-contest-metric strong {
    display: block;
    font-size: 1.1rem;
    color: #e2e8f0;
}

.glide-contest-points {
    margin-bottom: 0.4rem;
}

.glide-point-row {
    font-size: 0.9rem;
    color: #e2e8f0;
    margin-bottom: 0.25rem;
}

.glide-point-row strong {
    margin-right: 0.35rem;
}

.glide-point-coord,
.glide-point-alt,
.glide-point-time {
    margin-right: 0.35rem;
    color: #94a3b8;
}

.glide-contest-flags {
    margin-top: 0.4rem;
}

.glide-contest-flags ul {
    margin: 0.3rem 0 0 1.2rem;
    padding: 0;
    list-style: disc;
    color: #fbbf24;
}

.glide-contest-flags li {
    margin-bottom: 0.2rem;
}

/* --- Air Buddy Card --- */
.buddy-card {
    background: #f8fafc;
    color: #0f172a;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.buddy-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #cbd5e1;
    background: #eaf2f8;
    color: #0f172a;
}

.buddy-card__header--interactive {
    cursor: pointer;
}

.buddy-card__heading {
    min-width: 0;
}

.buddy-card__header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.buddy-card__bulk-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.buddy-card__bulk-toggle.tra-admin-switch {
    --switch-on: #0ea5e9;
}

.buddy-card__collapse {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.08);
    color: inherit;
    cursor: pointer;
}

.buddy-card__collapse:hover {
    background: rgba(15, 23, 42, 0.14);
}

.buddy-card__title {
    font-size: 1rem;
    font-weight: 600;
    display: block;
}

.buddy-card__subtitle {
    font-size: 0.85rem;
    color: #475569;
}

.buddy-card__body {
    padding: 0;
}

.buddy-card__section {
    padding: 0;
    border-bottom: 1px solid #d8e1ea;
}

.buddy-card__section:last-child {
    border-bottom: none;
}

.buddy-card__section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    background: #edf2f7;
    border-bottom: 1px solid #d8e1ea;
    margin: 0;
    padding: 8px 14px;
}

.buddy-card__empty,
.buddy-card__message {
    padding: 18px;
    text-align: center;
    color: #475569;
    font-size: 0.9rem;
}

.buddy-card__message strong {
    display: block;
    font-size: 0.95rem;
    color: #0f172a;
    margin-bottom: 4px;
}

.buddy-card__message--inline {
    padding: 8px 0;
    text-align: left;
}

.buddy-entry {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) minmax(78px, auto);
    align-items: center;
    padding: 8px 14px 8px 22px;
    gap: 12px;
    background: #ffffff;
    border-bottom: 1px solid #d8e1ea;
    position: relative;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.buddy-entry:nth-child(even) {
    background: #f8fafc;
}

.buddy-entry:last-child {
    border-bottom: none;
}

.buddy-entry::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 12px;
    background: var(--buddy-color, #0ea5e9);
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.buddy-entry.is-active {
    background: #edf9ff;
    box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.28);
}

.buddy-entry.is-active::before {
    opacity: 1;
}

.buddy-entry__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.buddy-entry__toggle.tra-admin-switch {
    --switch-on: var(--buddy-color, #0ea5e9);
}

.buddy-entry__toggle input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.buddy-entry__color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--buddy-color, #0ea5e9);
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.08);
    flex-shrink: 0;
}

.buddy-entry__toggle .buddy-entry__color {
    display: none;
}

.buddy-entry__content {
    display: grid;
    grid-template-columns:
        minmax(190px, 1.1fr)
        minmax(150px, 0.85fr)
        minmax(160px, 0.95fr)
        minmax(170px, 0.9fr)
        minmax(118px, 0.65fr);
    align-items: center;
    gap: 3px 14px;
    min-width: 0;
}

.buddy-entry__pilot {
    font-weight: 600;
    color: #0f172a;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.buddy-entry__pilot small {
    font-weight: 500;
    color: #475569;
    font-size: 0.85em;
}

.buddy-entry__profile-link {
    color: inherit;
    text-decoration: none;
}

.buddy-entry__profile-link:hover,
.buddy-entry__profile-link:focus-visible,
.buddy-entry__username:hover,
.buddy-entry__username:focus-visible {
    color: #0369a1;
    text-decoration: underline;
}

.buddy-entry__route-distance {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 650;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.buddy-entry__route-icon {
    width: 16px;
    height: 16px;
    max-width: 16px;
    max-height: 16px;
    inline-size: 16px;
    block-size: 16px;
    object-fit: contain;
    flex: 0 0 auto;
}

.buddy-entry__route-summary,
.buddy-entry__stats {
    grid-column: 2;
    grid-row: 1;
    font-size: 0.85rem;
    color: #475569;
    margin-top: 0;
    display: flex;
    column-gap: 12px;
    row-gap: 2px;
    flex-wrap: wrap;
}

.buddy-entry__route-summary span,
.buddy-entry__stats span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.buddy-entry__timeline {
    grid-column: 5;
    grid-row: 1;
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0;
    white-space: nowrap;
}

.buddy-entry__route-controls {
    grid-column: 3 / span 3;
    grid-row: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin-top: 0;
}

.buddy-entry__route-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: #475569;
    cursor: pointer;
}

.buddy-entry__route-option input {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.buddy-entry__route-option.is-disabled {
    opacity: 0.45;
    cursor: default;
}

.buddy-entry__route-option.is-disabled input {
    cursor: default;
}

.buddy-entry__glider {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    font-size: 0.82rem;
    color: #475569;
    margin-top: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.buddy-entry__flag {
    width: 16px;
    height: 11px;
    max-width: 16px;
    max-height: 11px;
    min-width: 16px;
    inline-size: 16px;
    block-size: 11px;
    border-radius: 2px;
    object-fit: cover;
    flex: 0 0 16px;
    display: inline-block;
    line-height: 1;
}

.buddy-entry__username {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
    text-decoration: none;
}

.buddy-entry__manufacturer,
.buddy-entry__manufacturer-logo {
    flex: 0 0 auto;
}

.buddy-entry__manufacturer {
    color: #0f172a;
    font-weight: 600;
}

.buddy-entry__manufacturer-logo {
    width: 52px;
    height: 18px;
    object-fit: contain;
}

.buddy-entry__coverage {
    grid-column: 4;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: none;
    margin-top: 0;
    color: #475569;
    font-size: 0.78rem;
}

.buddy-entry__coverage-track {
    height: 5px;
    min-width: 46px;
    flex: 1 1 auto;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.3);
}

.buddy-entry__coverage-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--buddy-color, #0ea5e9);
}

.buddy-entry__coverage-label {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}

.buddy-entry__launch {
    grid-column: 1 / span 2;
    grid-row: 2;
    font-size: 0.82rem;
    color: #475569;
    margin-top: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.glide-mode-active #buddy-card {
    display: none !important;
}

.buddy-entry__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 8px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: rgba(14, 165, 233, 0.12);
    color: #0369a1;
}

.buddy-entry__badge--route {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.2);
}

.buddy-entry__links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
    text-align: right;
    align-self: center;
}

.buddy-entry__links a {
    color: #0f62fe;
    text-decoration: none;
    font-weight: 600;
}

.buddy-entry__links a:hover {
    text-decoration: underline;
}

.buddy-entry__state {
    grid-column: 1 / -1;
    font-size: 0.78rem;
    color: #c2410c;
    margin-top: 2px;
}

.buddy-entry__state--error {
    color: #b91c1c;
}

.buddy-entry.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

@media (max-width: 1024px) {
    .buddy-entry {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }

    .buddy-entry__content {
        display: block;
        width: 100%;
    }

    .buddy-entry__stats {
        margin-top: 2px;
    }

    .buddy-entry__glider,
    .buddy-entry__launch {
        margin-top: 2px;
        white-space: normal;
    }

    .buddy-entry__coverage,
    .buddy-entry__timeline {
        margin-top: 4px;
    }

    .buddy-entry__coverage {
        max-width: 260px;
    }

    .buddy-entry__route-controls {
        margin-top: 6px;
    }

    .buddy-card__header {
        flex-wrap: wrap;
    }

    .buddy-card__header-controls {
        order: 3;
        width: 100%;
        margin-left: 0;
        flex-wrap: wrap;
    }

    .buddy-entry__links {
        flex-direction: row;
        gap: 10px;
        text-align: left;
    }
}
