@import "https://unpkg.com/open-props/easings.min.css";

:root {
    /* --- MODERN LIGHT MODE (DEFAULT) --- */
    --primary: #234567;
    /* Prussian Blue */
    --secondary: #325d88;
    --accent: #ffffff;
    --bg: #f0f4f7;
    /* Light Grey-Blue */
    --white: #ffffff;
    --sidebar-bg: #234567;
    --sidebar-text: #d1d8e0;
    --card-bg: #ffffff;
    --text-main: #234567;
    --text-muted: #8ba2b9;
    --input-border: #d1d9e0;
    --input-bg: #ffffff;
    --shadow: 0 4px 12px rgba(35, 69, 103, 0.1);

    /* Buttons */
    --btn-gradient: linear-gradient(135deg, #234567 0%, #3b6a99 100%);
    --btn-hover-gradient: linear-gradient(135deg, #2c5680 0%, #4a84bd 100%);
    --btn-shadow: 0 4px 12px rgba(35, 69, 103, 0.2);

    /* Theme Toggle Icons */
    --icon-fill: #234567;
    --icon-fill-hover: #3b6a99;
}

[data-theme="dark"] {
    /* --- MODERN DARK MODE (SOFT CHARCOAL & NAVY) --- */
    --bg: #1a1c1e;
    /* Deep Charcoal - Professional background */
    --card-bg: #212529;
    /* Elevated Soft Grey for cards */
    --white: #2d3135;
    /* Soft Grey-Blue for inner elements */
    --primary: #4a84bd;
    /* Lighter Blue for visibility on dark */
    --secondary: #3b6a99;
    --text-main: #e2e8f0;
    --label-color: #ffffff;
    /* Off-White text for readability */
    --text-muted: #94a3b8;
    --input-bg: #2d3135;
    --input-border: #444c56;
    --sidebar-text: #cbd5e1;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);

    --icon-fill: #cbd5e1;
    --icon-fill-hover: #ffffff;
}

/* --- GLOBAL STYLES --- */
* {
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    display: flex;
    background: var(--bg);
    color: var(--text-main);
}

/* --- SIDEBAR --- */
nav {
    width: 260px;
    background: var(--sidebar-bg);
    color: white;
    height: 100vh;
    position: fixed;
    display: flex;
    flex-direction: column;
    z-index: 100;

    /* Enable scrolling functionality */
    overflow-y: auto;

    /* Hide scrollbar for Firefox */
    scrollbar-width: none;

    /* Hide scrollbar for IE and Edge */
    -ms-overflow-style: none;
}

/* Hide scrollbar for Chrome, Safari, and Opera */
nav::-webkit-scrollbar {
    display: none;
}

nav::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}

.nav-header {
    padding: 2rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
}

.nav-header h1 {
    font-size: 1.2rem;
    margin: 0;
    letter-spacing: 3px;
    font-weight: 800;
    color: white;
}

.nav-header p {
    font-size: 0.7rem;
    margin: 5px 0 0;
    opacity: 0.6;
    color: white;
}

.version-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 0.70rem;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

.version-badge:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.nav-group-label {
    padding: 1.2rem 1.5rem 0.3rem;
    font-size: 0.7rem;
    color: #8ba2b9;
    font-weight: bold;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
    background: var(--secondary);
    color: white;
}

.nav-item.active {
    border-left: 4px solid var(--accent);
}

.nav-item i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
    text-align: center;
    font-size: 0.85rem;
    color: #8ba2b9;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.developer-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
    cursor: pointer;
}

.developer-badge:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: white;
}

/* --- MAIN CONTENT --- */
main {
    flex: 1;
    margin-left: 260px;
    padding: 2.5rem;
    min-height: 100vh;
}

.tool-view {
    display: none;
    max-width: 1400px;
    margin: auto;
    animation: fadeIn 0.4s ease;
}

.tool-view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border: 1px solid var(--input-border);
}

h2 {
    margin-top: 0;
    color: var(--primary);
    font-size: 1.4rem;
    border-bottom: 2px solid var(--bg);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

/* --- FORMS & INPUTS --- */
.vertical-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.input-row label {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    /* Change this from var(--primary) to var(--text-main) or white */
}

input,
select {
    flex: 2;
    padding: 0.75rem;
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-main);
    border: 1.5px solid var(--input-border) !important;
}

input:focus,
select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(74, 132, 189, 0.2);
    outline: none;
}

/* --- BUTTONS --- */
/* --- MINIMALIST GHOST BUTTONS --- */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #234567;
    /* Light and airy */
    color: #ffffff;
    /* Contrast text */
    border: 1.5px solid var(--primary);
    /* Thin, clean border */
    padding: 0.6rem 1.8rem;
    border-radius: 6px;
    /* Subtle rounding, not a full pill */
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    width: fit-content;
    /* Centered */
    transition: all 0.2s ease-in-out;
    box-shadow: none;
    /* Remove heavy shadows */
}

/* On Hover: The button "fills" in */
.btn-primary:hover {
    background: var(--primary);
    color: #ffffff;
    /* Invert colors */
    transform: translateY(-1px);
    /* Very slight lift */
}

/* Secondary Actions (Set 3 deg, etc) */
.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--input-border);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin: 5px auto;
    display: block;
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Small Table Buttons */
.btn-small {
    margin: 0 auto;
    padding: 0.3rem 0.8rem;
    font-size: 0.7rem;
    letter-spacing: 0;
}

/* --- CHARTING-CODING TOOLS --- */
.coding-table {
    width: 100%;
    table-layout: fixed;
    /* Enforce column widths */
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.7rem;
    color: var(--text-main);
}

.coding-table th {
    background: var(--bg);
    padding: 6px 4px;
    /* Reduced from 12px 8px */
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.65rem;
    /* Small but readable */
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 10;
    text-align: center;
}

.coding-table td {
    padding: 3px 4px;
    border-bottom: 0.8px solid var(--input-border);
    vertical-align: middle;
}

.coding-table tr:hover {
    background: rgba(var(--primary-rgb), 0.05);
}

.coding-table select,
.coding-table input {
    width: 100%;
    padding: 4px 6px;
    /* Reduced from 6px 8px */
    border: 1px solid var(--input-border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text-main);
    font-size: 0.75rem;
    transition: all 0.2s;
}

.coding-table input:focus,
.coding-table select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}

.coding-table .locked-field {
    background: var(--input-border) !important;
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

[data-theme="dark"] .coding-table .locked-field {
    background: #1e293b !important;
    /* Very dark in dark mode */
    border-color: #334155;
}

.coding-table .serial-cell {
    font-family: monospace;
    font-weight: bold;
    color: var(--primary);
    text-align: center;
    width: 40px;
}

.btn-small-danger {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 3px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
}

.btn-small-danger:hover {
    background: #c0392b;
}

.card.full-width {
    max-width: 100%;
    overflow-x: hidden;
    /* Try to keep content within card if possible */
}

/* Tooltip style for required fields */
.coding-table .req-field {
    border-left: 2px solid var(--primary) !important;
}

.navspec-custom {
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    color: var(--primary) !important;
    border: 1.5px solid var(--primary) !important;
}

/* --- RESULT BOXES --- */
.result-box {
    background: var(--input-bg);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--input-border);
    border-left: 6px solid var(--primary);
    font-weight: 500;
    margin-top: 20px;
    color: var(--text-main);
    line-height: 1.7;
}

/* --- THEME TOGGLE (FIXED TOP RIGHT) --- */
.theme-toggle {
    position: fixed;
    top: 25px;
    right: 25px;
    z-index: 1000;
    background: var(--card-bg);
    border: 1.5px solid var(--input-border);
    padding: 8px;
    border-radius: 12px;
    cursor: pointer;
    inline-size: 2.8rem;
    block-size: 2.8rem;
    box-shadow: var(--shadow);
}

.sun-and-moon> :is(.moon, .sun, .sun-beams) {
    transform-origin: center;
}

.sun-and-moon> :is(.moon, .sun) {
    fill: var(--icon-fill);
}

.theme-toggle:hover .sun-and-moon> :is(.moon, .sun) {
    fill: var(--icon-fill-hover);
}

.sun-and-moon>.sun-beams {
    stroke: var(--icon-fill);
    stroke-width: 2px;
}

[data-theme="dark"] .sun-and-moon>.sun {
    transform: scale(1.75);
}

[data-theme="dark"] .sun-and-moon>.sun-beams {
    opacity: 0;
}

[data-theme="dark"] .sun-and-moon>.moon>circle {
    transform: translateX(-7px);
}

@media (prefers-reduced-motion: no-preference) {
    .sun-and-moon>.sun {
        transition: transform .5s var(--ease-elastic-3);
    }

    .sun-and-moon>.sun-beams {
        transition: transform .5s var(--ease-elastic-4), opacity .5s var(--ease-3);
    }

    .sun-and-moon .moon>circle {
        transition: transform .25s var(--ease-out-5);
    }
}

/* --- UTILITIES --- */
.live-timer {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-main);
    font-family: monospace;
}

.center {
    text-align: center;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--input-bg);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--input-border);
}

.status-indicator {
    font-weight: bold;
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 4px;
    background: #888;
    color: white;
}

.status-online {
    background: #234567;
}

.status-offline {
    background: #c62828;
}

/* --- IFPD STATUS BADGES --- */
.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.good {
    background: #2e7d32; /* Green */
}

.status-badge.warning {
    background: #f57f17; /* Yellow/Orange */
}

.status-badge.critical {
    background: #c62828; /* Red */
}

.suggestions-list {
    position: absolute;
    top: 100%;
    right: 0;
    width: 66%;
    background: var(--card-bg);
    border: 1px solid var(--input-border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: var(--shadow);
    display: none;
}

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--input-border);
}

.suggestion-item:hover {
    background: var(--input-bg);
}

/* --- TABLES --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th,
td {
    padding: 12px;
    border: 1px solid var(--input-border);
    text-align: center;
    color: var(--text-main);
}

th {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary);
}

.current-cycle {
    background-color: rgba(74, 132, 189, 0.15);
    font-weight: bold;
    border-left: 4px solid var(--primary);
}

/* --- MOBILE RESPONSIVE FIX --- */
@media (max-width: 850px) {
    nav {
        width: 260px !important;
        height: 100vh !important;
        top: 0 !important;
        left: 0 !important;
        position: fixed !important;
        /* Start off-screen to the left */
        transform: translateX(-100%) !important;
        transition: transform 0.4s cubic-bezier(0.05, 0.7, 0.1, 1) !important;
        display: flex !important;
        flex-direction: column !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
        z-index: 1100 !important;
    }

    /* Force visibility of headers/footers in the drawer */
    .nav-header,
    .nav-group,
    .sidebar-footer {
        display: block !important;
    }

    /* Move Toggle Button to a safe spot at the top */
    .nav-toggle-btn {
        left: 0 !important;
        top: 15px !important;
        transform: none !important;
        width: 45px !important;
        height: 45px !important;
        border-radius: 0 10px 10px 0 !important;
        background: var(--primary) !important;
        z-index: 1200 !important;
    }

    main {
        margin-left: 0 !important;
        padding: 1rem !important;
        padding-top: 80px !important;
    }

    /* THE FIX: When this class is active, slide the nav IN */
    body.sidebar-mobile-open nav {
        transform: translateX(0) !important;
    }

    body.sidebar-mobile-open .nav-toggle-btn {
        left: 260px !important;
    }

    /* Button Icon Logic */
    .nav-toggle-btn i {
        transform: rotate(180deg);
        /* Points Right when closed */
        transition: transform 0.3s;
    }

    body.sidebar-mobile-open .nav-toggle-btn i {
        transform: rotate(0deg);
        /* Points Left when open */
    }

    /* Stack form rows for better mobile viewing */
    .input-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    input,
    select {
        width: 100%;
    }
}

/* Enhanced Geodetic Calculator Layout */
.geo-point-container {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--input-border);
}

.geo-label {
    display: block;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.geo-select {
    width: 100%;
    margin-bottom: 15px;
    border-color: var(--primary) !important;
    font-weight: 600;
}

.dms-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1.5fr 0.8fr;
    /* Responsive column widths */
    gap: 8px;
    margin-bottom: 10px;
}

.dms-row input {
    text-align: center;
    padding: 0.6rem 0.2rem;
}

/* Label indicating Latitude vs Longitude inside the container */
.coord-type-label {
    font-size: 0.7rem;
    color: var(--primary);
    font-weight: bold;
    margin-bottom: 4px;
    display: block;
}

/* Ensure the ICAO result box adapts to themes */
#icaoResult {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-main);
    /* Dynamically changes based on [data-theme] */
}

/* Style for the meaning text specifically */
.icao-meaning {
    color: var(--text-main);
    line-height: 1.6;
}

/* Fix for the divider line in dark mode */
.icao-divider {
    border-bottom: 2px solid var(--input-border);
    margin-bottom: 10px;
    padding-bottom: 10px;
}

[data-theme="dark"] .input-row label {
    color: #ffffff !important;
}

/* Sidebar and Main Transition Settings */
nav,
main {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* --- MODERN SLIM TOGGLE --- */
.nav-handle {
    position: absolute;
    right: -12px;
    /* Sits perfectly on the border line */
    top: 0;
    bottom: 0;
    width: 24px;
    /* Wider hit area for ease of use */
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    transition: all 0.3s ease;
}

/* The actual visible "line" inside the handle */
.nav-handle::after {
    content: '';
    width: 4px;
    height: 40px;
    background: var(--accent);
    /* Uses your Green accent color */
    border-radius: 10px;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.nav-handle:hover::after {
    opacity: 1;
    height: 60px;
    box-shadow: 0 0 10px var(--accent);
}

/* --- REFINED SIDEBAR & MAIN --- */
nav {
    transition: transform 0.4s cubic-bezier(0.05, 0.7, 0.1, 1);
    z-index: 1001;
}

main {
    transition: margin-left 0.4s cubic-bezier(0.05, 0.7, 0.1, 1);
}

/* --- THE EDGE TOGGLE BUTTON --- */
.nav-toggle-btn {
    position: fixed;
    /* This stays attached to the end line of the nav */
    left: 260px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 50px;
    background: var(--sidebar-bg);
    border: none;
    border-radius: 0 8px 8px 0;
    /* Rounded only on the right side */
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.05, 0.7, 0.1, 1);
    z-index: 1002;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.nav-toggle-btn:hover {
    width: 30px;
    background: var(--secondary);
}

/* --- HIDDEN STATE --- */
.sidebar-hidden nav {
    transform: translateX(-260px);
}

.sidebar-hidden main {
    margin-left: 0;
}

/* When hidden, move the button to the screen edge */
.sidebar-hidden .nav-toggle-btn {
    left: 0;
}

/* Rotate the icon when sidebar is hidden */
.sidebar-hidden .nav-toggle-btn i {
    transform: rotate(180deg);
}

/* --- DARK MODE LABEL VISUALIZATION --- */
[data-theme="dark"] .input-row label {
    color: #ffffff !important;
}

.nav-logo {
    width: 60px;
    /* Adjust size as needed */
    height: auto;
    margin-bottom: 15px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.nav-header {
    padding: 1.5rem 1.5rem;
    /* Slightly reduced padding to accommodate logo */
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
}

/* Container to group input + select */
/* Container to group input + select */
.input-group {
    display: flex;
    width: 100%;
    /* Ensure it spans the full width of the card */
    margin-bottom: 10px;
}

/* Fix for standard vertical forms */
.input-group select,
.input-group input {
    min-width: 0;
    /* Forces the elements to respect flex-grow and not overflow */
}

/* Numeric input - takes all available width */
.input-group input {
    flex: 1;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-right: none !important;
}

/* Unit selector - stays small and compact */
.input-group .unit-select {
    width: 60px !important;
    /* Fixed small width */
    flex: none !important;
    padding: 0 5px !important;
    text-align: center;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    background-color: var(--input-bg);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--primary);
}

/* Fix for standard vertical forms */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 600;
}

/* Internal elements - remove individual borders and use flex */
#climbGradSelect,
#climbGradCustom {
    border: none !important;
    /* Remove individual borders */
    background: transparent !important;
    margin: 0;
    height: 100%;
    border-radius: 0 !important;
    /* Remove individual radii */
}

#climbGradSelect {
    flex: 2;
    border-right: 1px solid var(--input-border) !important;
    /* Divider line only */
}

#climbGradCustom {
    flex: 1;
}

/* FIX: Unified Climb Gradient Row Styling */
.input-group-climb {
    display: flex;
    width: 100%;
    border: 1.5px solid var(--input-border);
    /* Unified border */
    border-radius: 8px;
    /* Matches your other inputs */
    overflow: hidden;
    /* Clips the internal elements to the rounded corners */
    background: var(--input-bg);
}

/* Indicates text can be copied */

/* Styling for data cells that can be copied */
.copyable {
    cursor: copy !important;
    transition: all 0.2s ease;
}

.copyable:hover {
    background-color: rgba(35, 69, 103, 0.05);
}

/* Specific styling for the plot button in the table */
.plot-btn {
    width: auto !important;
    min-width: 60px;
}

.plot-btn:hover {
    transform: scale(1.05);
}

/* Ensure table cells are aligned well */
#wptTable td {
    vertical-align: middle;
}

/* Container for the map to prevent overflow */
.map-wrapper {
    position: relative;
    width: 100%;
    height: 500px;
    /* Default height */
    min-height: 300px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    overflow: hidden;
    /* Keeps map inside the card borders */
    resize: vertical;
    /* Allows dragging the bottom corner to resize */
}

#atsMap {
    width: 100%;
    height: 100%;
    /* Fills the wrapper completely */
}

/* Ensure the map container is visible when in fullscreen mode */
#atsMap:-webkit-full-screen {
    width: 100% !important;
    height: 100% !important;
}

/* Optional: Style the fullscreen button to match your theme */
.leaflet-control-fullscreen a {
    background-color: var(--card-bg) !important;
    color: var(--primary) !important;
    border: 1px solid var(--input-border) !important;
}

[data-theme="dark"] .leaflet-control-fullscreen a {
    filter: invert(1) hue-rotate(180deg);
}

/* Styling for the Waypoint Names toggle */
.wpt-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.wpt-label span {
    color: var(--primary);
    /* Prussian Blue */
    font-weight: 800;
    font-size: 11px;
    text-transform: uppercase;
    text-shadow:
        1px 1px 0 #fff,
        -1px -1px 0 #fff,
        1px -1px 0 #fff,
        -1px 1px 0 #fff;
    /* White halo for legibility */
    white-space: nowrap;
}

/* Route Label Styling */
.route-label-container {
    background: transparent !important;
    border: none !important;
}

.rotated-label {
    font-size: 11px;
    font-weight: 900;
    text-align: center;
    white-space: nowrap;
    text-shadow:
        1.5px 1.5px 0 #fff,
        -1.5px -1.5px 0 #fff,
        1.5px -1.5px 0 #fff,
        -1.5px 1.5px 0 #fff;
    /* Strong halo to read over green terrain */
    pointer-events: none;
    transition: transform 0.2s ease;
}

/* Ensure icons in layer control are properly sized */
.leaflet-control-layers-overlays i {
    width: 18px;
    text-align: center;
    margin-right: 5px;
}

/* Triangle Diagram Styling */
.ttt-diagram {
    margin-top: 15px;
    width: 100%;
}

#tttCanvas {
    width: 100%;
    height: 200px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
}

/* Table styling for Distance to Point results */
#distToPointResult table {
    width: 100%;
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
}

#distToPointResult th {
    background: var(--primary);
    color: white;
    font-size: 0.8rem;
    padding: 10px;
}

#distToPointResult td {
    padding: 8px;
    border-bottom: 1px solid var(--input-border);
}

/* Enhanced Set 3º Button */
.btn-secondary {
    background: var(--bg);
    color: var(--primary);
    border: 1.5px solid var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s ease;
    margin-top: 5px;
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

.btn-secondary:active {
    transform: translateY(0);
}

.status-meta {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ping-text {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-checking {
    background: var(--secondary);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* NOTAM Decoder Enhanced Styling */
.notam-header {
    border-bottom: 2px solid var(--primary);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.notam-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 1px;
}

.notam-subtitle {
    font-size: 0.75rem;
    font-weight: bold;
    color: #234567;
}

.notam-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    align-items: start;
    /* Ensures Row 2 starts together even if Row 1 is short */
}

.notam-field label {
    display: block;
    text-transform: uppercase;
    font-weight: 800;
    margin-bottom: 4px;
    color: #234567;
}

.notam-field .val {
    min-height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.notam-dates {
    background: rgba(0, 0, 0, 0.03);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--secondary);
}

.notam-content-box {
    background: var(--card-bg);
    border: 1.5px solid var(--input-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.content-label {
    background: var(--primary);
    color: white;
    padding: 6px 15px;
    font-size: 0.75rem;
    font-weight: 800;
}

.content-text {
    padding: 20px;
    font-family: 'Courier New', Courier, monospace;
    /* Aviation standard look */
    font-size: 1rem;
    line-height: 1.6;
    white-space: pre-wrap;
    /* Keeps line breaks from the raw NOTAM */
    word-break: break-word;
    /* Prevents long words from breaking the layout */
    color: var(--text-main);
    background: var(--card-bg);
}

/* Hover Term Decoration */
.notam-term {
    color: var(--primary);
    background: rgba(35, 69, 103, 0.1);
    padding: 0 2px;
    border-radius: 3px;
    border-bottom: 2px solid var(--primary);
    cursor: help;
}

[data-theme="dark"] .notam-content-box {
    background: #151719;
}

[data-theme="dark"] .notam-dates {
    background: #2d3135;
}

/* Ensure grid items handle multi-line content gracefully */
.notam-field .val {
    font-weight: 600;
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.02);
    padding: 5px;
    border-radius: 4px;
    margin-top: 4px;
}

[data-theme="dark"] .notam-field .val {
    background: rgba(255, 255, 255, 0.05);
}

.notam-dates b {
    color: var(--primary);
    display: inline-block;
    width: 60px;
}

/* --- VERSION MODAL STYLES --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-card {
    background: var(--card-bg);
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--input-border);
    animation: modalSlide 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes modalSlide {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--input-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.release-item {
    margin-bottom: 20px;
}

.release-ver {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8rem;
}

.release-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 10px;
}

.release-item ul {
    margin: 10px 0 0 20px;
    padding: 0;
    font-size: 0.9rem;
    color: var(--text-main);
}

.release-item li {
    margin-bottom: 5px;
}

.notam-schedule {
    background: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #ffc107;
    padding: 10px 15px;
    font-family: monospace;
    font-size: 0.9rem;
    margin-bottom: 15px;
    border-radius: 0 8px 8px 0;
}

[data-theme="dark"] .notam-schedule {
    background: rgba(255, 193, 7, 0.05);
    color: #ffd54f;
}