/* css/settings.css
 *
 * Styling for the generalised HT settings window (includes/settings/settingsMenu.js)
 * and its companion floating panels (3D-radar archive browser, camera-path manager).
 * The window is a movable + resizable floating panel whose contents are built
 * data-driven from feature "sections" registered via window.HTSettings.register().
 *
 * Everything is namespaced under .hts- / .r3da- / .htcp- so it can't collide
 * with map/app styles.
 *
 * ============================================================================
 *  THEME TOKENS  —  EDIT HERE to restyle every settings panel at once.
 * ----------------------------------------------------------------------------
 *  Every colour/font/shape below is pulled from the main HT app so the panels
 *  match it. Each rule further down uses var(--…), so changing a value here
 *  updates the window, the archive browser and the camera-path panel together.
 *  Tweak these to dial in the exact look — nothing else needs editing.
 * ============================================================================ */
:root {
    /* Typography — Segoe UI first (HT's primary face), then the app's stack */
    --hts-font: 'Segoe UI', 'Open Sans', 'Roboto', Arial, sans-serif;

    /* Glass surfaces (HT navy). Lower the alpha for more see-through; the blur
       keeps text readable. Set --hts-blur to 0 to switch the glass off. */
    --hts-panel-bg: rgba(44, 66, 94, 0.82);
    /* window / panel body          */
    --hts-bar-bg: rgba(29, 52, 76, 0.95);
    /* title bars + table headers    */
    --hts-blur: 6.6px;
    /* frosted-glass blur amount     */
    --hts-radius: 14px;
    /* panel corner rounding         */
    --hts-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);

    /* Fields (inputs / selects / dropdowns) */
    --hts-field-bg: rgba(29, 52, 76, 0.55);
    --hts-field-hover: rgba(41, 87, 123, 0.60);
    /* row hover, field hover        */

    /* Lines */
    --hts-border: rgba(255, 255, 255, 0.14);
    /* outer panel outline           */
    --hts-divider: rgba(255, 255, 255, 0.10);
    /* internal separators           */

    /* Text */
    --hts-text: #ffffff;
    /* primary labels                */
    --hts-text-dim: #ffffff;
    /* secondary text                */
    --hts-text-muted: #ffffff;
    /* help / status / muted         */

    /* HT orange accent — hover, active toggles, slider fill, focus */
    --hts-accent: rgb(229, 132, 17);
    --hts-accent-hover: rgb(242, 146, 30);
    --hts-accent-text: #ffffff;

    /* Numeric readouts / highlighted cells (radar id, times, slider value) */
    --hts-value: rgb(255, 255, 255);

    /* Buttons — default navy, solid orange on hover (the HT button behaviour).
       To make buttons ORANGE BY DEFAULT instead, set:
           --hts-btn-bg: var(--hts-accent);
           --hts-btn-text: var(--hts-accent-text);
       (their hover already deepens to --hts-accent-hover). */
    --hts-btn-bg: var(--hts-field-bg);
    --hts-btn-text: var(--hts-text);
    --hts-btn-hover-bg: var(--hts-accent);
    --hts-btn-hover-text: var(--hts-accent-text);
}


/* ===========================================================================
   SETTINGS WINDOW (the gear button opens this)
   =========================================================================== */
.hts-window {
    position: fixed;
    top: 80px;
    right: 60px;
    width: 330px;
    height: 460px;
    min-width: 260px;
    min-height: 180px;
    max-width: 96vw;
    max-height: 88vh;
    z-index: 1300;
    /* above the 3D-radar archive panel */
    display: flex;
    flex-direction: column;
    background: var(--hts-panel-bg);
    backdrop-filter: blur(var(--hts-blur));
    -webkit-backdrop-filter: blur(var(--hts-blur));
    color: var(--hts-text);
    border: 1px solid var(--hts-border);
    border-radius: var(--hts-radius);
    box-shadow: var(--hts-shadow);
    font: 13px/1.4 var(--hts-font);
    overflow: hidden;
    /* required for the CSS resize grip below */
    resize: both;
    /* user-resizable from the bottom-right */
}

.hts-window[hidden] {
    display: none;
}

/* --- Title bar (drag handle) --- */
.hts-titlebar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    background: var(--hts-bar-bg);
    border-bottom: 1px solid var(--hts-divider);
    cursor: move;
    user-select: none;
}

.hts-title {
    font-weight: 600;
    letter-spacing: .02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hts-title i {
    color: var(--hts-text);
    opacity: .95;
}

.hts-close {
    cursor: pointer;
    font-size: 19px;
    line-height: 1;
    opacity: .7;
    padding: 0 4px;
}

.hts-close:hover {
    color: var(--hts-accent);
    opacity: 1;
}

/* --- Scrollable content --- */
.hts-content {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0px 12px 14px;
}

.hts-empty {
    color: var(--hts-text-muted);
    font-size: 12px;
    padding: 14px 4px;
    text-align: center;
}

/* --- Feature section (collapsible) --- */
.hts-section {
    margin: 10px 0 4px;
}

.hts-section-hd {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--hts-text-muted);
    cursor: pointer;
    border-bottom: 1px solid var(--hts-divider);
    user-select: none;
}

.hts-section-hd:hover {
    color: var(--hts-accent);
}

.hts-chevron {
    margin-left: auto;
    transition: transform .15s ease;
    opacity: .7;
    font-size: 10px;
}

.hts-section.collapsed .hts-chevron {
    transform: rotate(-90deg);
}

.hts-section.collapsed .hts-section-body {
    display: none;
}

.hts-section-body {
    padding: 6px 2px 2px;
}

/* --- Generic control row --- */
.hts-control {
    margin: 12px 0;
}

.hts-control-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
}

.hts-control-name {
    color: var(--hts-text-dim);
}

.hts-val {
    color: var(--hts-value);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    min-width: 42px;
    text-align: right;
}

/* range */
.hts-control input[type="range"] {
    width: 100%;
    margin: 0;
    accent-color: var(--hts-accent);
    cursor: pointer;
}

/* select (for future feature settings) */
.hts-control select {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    background: var(--hts-field-bg);
    border: 1px solid var(--hts-divider);
    border-radius: 6px;
    color: var(--hts-text);
    outline: none;
}

.hts-control select:focus {
    border-color: var(--hts-accent);
}

/* toggle (for future feature settings) */
.hts-control--toggle .hts-control-label {
    margin-bottom: 0;
}

.hts-toggle {
    position: relative;
    width: 38px;
    height: 20px;
    flex: 0 0 auto;
    border-radius: 20px;
    background: var(--hts-field-bg);
    cursor: pointer;
    transition: background .15s ease;
}

.hts-toggle::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform .15s ease;
}

.hts-toggle.on {
    background: var(--hts-accent);
}

.hts-toggle.on::after {
    transform: translateX(18px);
}

/* colour picker (e.g. sky/horizon/fog tints) */
.hts-control--color .hts-control-label {
    margin-bottom: 0;
}

.hts-color {
    -webkit-appearance: none;
    appearance: none;
    width: 44px;
    height: 24px;
    padding: 0;
    flex: 0 0 auto;
    border: 1px solid var(--hts-divider);
    border-radius: 5px;
    background: none;
    cursor: pointer;
}

.hts-color::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.hts-color::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

.hts-color::-moz-color-swatch {
    border: none;
    border-radius: 3px;
}

/* action button (e.g. reset) */
.hts-btn {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    background: var(--hts-btn-bg);
    border: 1px solid var(--hts-divider);
    border-radius: 6px;
    color: var(--hts-btn-text);
    cursor: pointer;
    font: 12px var(--hts-font);
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.hts-btn:hover {
    background: var(--hts-btn-hover-bg);
    border-color: var(--hts-btn-hover-bg);
    color: var(--hts-btn-hover-text);
}

.hts-help {
    margin-top: 4px;
    font-size: 11px;
    color: var(--hts-text-muted);
}


/* ===========================================================================
   3D RADAR ARCHIVE BROWSER (includes/settings/radar3dArchivePanel.js)
   A movable panel listing archived 3D-radar events, opened from the button at
   the bottom of the 3D Radar settings section. Shares the window's look; sits
   just above it (z-index) so it's visible when opened.
   =========================================================================== */
.r3da-panel {
    position: fixed;
    top: 110px;
    right: 410px;
    width: 780px;
    max-width: 94vw;
    height: 420px;
    max-height: 80vh;
    z-index: 1310;
    display: flex;
    flex-direction: column;
    background: var(--hts-panel-bg);
    backdrop-filter: blur(var(--hts-blur));
    -webkit-backdrop-filter: blur(var(--hts-blur));
    color: var(--hts-text);
    border: 1px solid var(--hts-border);
    border-radius: var(--hts-radius);
    box-shadow: var(--hts-shadow);
    font: 13px/1.4 var(--hts-font);
    overflow: hidden;
    resize: both;
}

.r3da-panel[hidden] {
    display: none;
}

.r3da-titlebar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    background: var(--hts-bar-bg);
    border-bottom: 1px solid var(--hts-divider);
    cursor: move;
    user-select: none;
}

.r3da-title {
    font-weight: 600;
    letter-spacing: .02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.r3da-title i {
    color: var(--hts-accent);
    opacity: .95;
}

.r3da-close {
    cursor: pointer;
    font-size: 19px;
    line-height: 1;
    opacity: .7;
    padding: 0 4px;
}

.r3da-close:hover {
    color: var(--hts-accent);
    opacity: 1;
}

.r3da-search {
    flex: 0 0 auto;
    padding: 8px 10px 6px;
}

.r3da-search input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 9px;
    background: var(--hts-field-bg);
    border: 1px solid var(--hts-divider);
    border-radius: 6px;
    color: var(--hts-text);
    outline: none;
    font: 12.5px var(--hts-font);
}

.r3da-search input:focus {
    border-color: var(--hts-accent);
}

.r3da-scroll {
    flex: 1 1 auto;
    overflow: auto;
    padding: 0 10px;
}

.r3da-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.r3da-table th {
    position: sticky;
    top: 0;
    background: var(--hts-bar-bg);
    color: var(--hts-text-muted);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    text-align: left;
    padding: 7px 8px 5px;
    border-bottom: 1px solid var(--hts-divider);
    white-space: nowrap;
}

.r3da-table td {
    padding: 5px 8px;
    border-bottom: 1px solid var(--hts-divider);
    white-space: nowrap;
}

.r3da-table tbody tr:hover {
    background: var(--hts-field-hover);
}

.r3da-radar {
    color: var(--hts-value);
    font-variant-numeric: tabular-nums;
}

.r3da-time {
    font-variant-numeric: tabular-nums;
    color: var(--hts-text-dim);
}

.r3da-status {
    flex: 0 0 auto;
    padding: 6px 12px 8px;
    font-size: 11px;
    color: var(--hts-text-muted);
    border-top: 1px solid var(--hts-divider);
}


/* ===========================================================================
   CAMERA PATH MANAGER (includes/settings/cameraPath.js)
   Floating waypoint editor opened from the Camera Path settings section.
   =========================================================================== */
.htcp-panel {
    position: fixed;
    top: 140px;
    right: 410px;
    width: 460px;
    max-width: 94vw;
    height: 360px;
    max-height: 80vh;
    z-index: 1310;
    display: flex;
    flex-direction: column;
    background: var(--hts-panel-bg);
    backdrop-filter: blur(var(--hts-blur));
    -webkit-backdrop-filter: blur(var(--hts-blur));
    color: var(--hts-text);
    border: 1px solid var(--hts-border);
    border-radius: var(--hts-radius);
    box-shadow: var(--hts-shadow);
    font: 13px/1.4 var(--hts-font);
    overflow: hidden;
    resize: both;
}

.htcp-panel[hidden] {
    display: none;
}

.htcp-titlebar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    background: var(--hts-bar-bg);
    border-bottom: 1px solid var(--hts-divider);
    cursor: move;
    user-select: none;
}

.htcp-title {
    font-weight: 600;
    letter-spacing: .02em;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.htcp-title i {
    color: var(--hts-text);
    opacity: .95;
}

.htcp-close {
    cursor: pointer;
    font-size: 19px;
    line-height: 1;
    opacity: .7;
    padding: 0 4px;
}

.htcp-close:hover {
    color: var(--hts-accent);
    opacity: 1;
}

.htcp-scroll {
    flex: 1 1 auto;
    overflow: auto;
    padding: 0 0px;
}

.htcp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.htcp-table th {
    position: sticky;
    top: 0;
    background: var(--hts-bar-bg);
    color: var(--hts-text-muted);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    text-align: left;
    padding: 7px 8px 5px;
    border-bottom: 1px solid var(--hts-divider);
    white-space: nowrap;
}

.htcp-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--hts-divider);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.htcp-table tbody tr:hover {
    background: var(--hts-field-hover);
}

.htcp-time {
    color: var(--hts-value);
}

.htcp-clamped {
    color: var(--hts-accent);
}

.htcp-rowbtn {
    padding: 2px 7px;
    margin-left: 4px;
    background: var(--hts-btn-bg);
    border: 1px solid var(--hts-divider);
    border-radius: 4px;
    color: var(--hts-btn-text);
    cursor: pointer;
    font: 11px var(--hts-font);
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.htcp-rowbtn:hover {
    background: var(--hts-btn-hover-bg);
    border-color: var(--hts-btn-hover-bg);
    color: var(--hts-btn-hover-text);
}

.htcp-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-top: 1px solid var(--hts-divider);
}

.htcp-footer .hts-btn {
    width: auto;
    flex: 0 0 auto;
}

.htcp-status {
    margin-left: auto;
    font-size: 11px;
    color: var(--hts-text-muted);
    text-align: right;
}

.htcp-empty {
    color: var(--hts-text-muted);
    font-size: 12px;
    padding: 16px 4px;
    text-align: center;
}