/* ==========================================================================
   TrailQ
   Menus (UI-NAV-01): workspace button, Explore second level with the
   Profiles and Data panels, Map / Bubble / Heatmap switch, filter row.
   Replaces ribbon.css.
========================================================================== */

/* ----------------------------------------------------------
   Workspace button and dropdown
---------------------------------------------------------- */

#workspaceMenuWrap {
    position: relative;
}

#workspaceMenuButton {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 220px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text);
    padding: 4px 12px;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

#workspaceMenuLabel {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspaceDirty {
    color: #d99a1e;
}

#workspaceMenu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 2000;
    min-width: 220px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
    padding: 4px;
    display: grid;
}

.menuItem {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 0;
    background: none;
    font: inherit;
    font-size: 0.85rem;
    text-align: left;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--color-text);
}

.menuItem:hover:not(:disabled) {
    background: var(--color-background);
}

.menuItem:disabled {
    color: var(--color-text-secondary);
    cursor: default;
}

.menuSeparator {
    height: 1px;
    background: var(--color-border);
    margin: 4px 6px;
}

.menuIcon {
    width: 1.3em;
    text-align: center;
}

.menuLater {
    margin-left: auto;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px dashed currentColor;
    border-radius: 4px;
    padding: 0 4px;
    color: #8a7a52;
}

/* ----------------------------------------------------------
   Explore: Walks | Profiles | Data
---------------------------------------------------------- */

#exploreNav {
    display: flex;
    gap: 2px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--color-border);
    /* a darker grey than the content, the chosen tab white (UI-NAV-01) */
    background: var(--color-tabbar);
}

#exploreNav button {
    font: inherit;
    font-size: 0.82rem;
    border: 0;
    background: none;
    color: var(--color-text-secondary);
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
}

#exploreNav button[aria-selected="true"] {
    background: var(--color-surface);
    color: var(--color-primary);
    font-weight: 600;
    box-shadow: 0 0 0 1px var(--color-border);
}

.explorePanel {
    display: none;
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: var(--spacing-md);
    background: var(--color-background);
}

.explorePanel h2 {
    margin: 0 0 var(--spacing-sm);
    font-size: 1.1rem;
}

/* visibility per phase and section */
body:not(.phase-explore) #exploreNav,
body:not(.phase-explore) .explorePanel {
    display: none !important;
}

body.phase-explore.explore-profiles #routeContext,
body.phase-explore.explore-data #routeContext {
    display: none !important;
}

body.phase-explore.explore-profiles #exploreProfilesPanel,
body.phase-explore.explore-data #exploreDataPanel {
    display: block;
}

/* tab "Trajecten": the search in place of the list, Details stays (UI-SEARCH-01) */
#trajectSearchPanel {
    display: none;
}

body.phase-explore.explore-trajects #trajectSearchPanel {
    display: block;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--spacing-sm) var(--spacing-md, 12px);
}

/* tab "Vakantie": the holiday panel in place of the list (HOL-01) */
#holidayPanel {
    display: none;
}

body.phase-explore.explore-holiday #holidayPanel {
    display: grid;
    align-content: start;
    gap: 10px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--spacing-sm) var(--spacing-md, 12px);
}

body.phase-explore.explore-holiday #routeList,
body.phase-explore.explore-holiday #exploreFilterRow {
    display: none;
}

.holidayCard {
    display: grid;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}

.holidayCard h3 {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.holidayRow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    font-size: 0.85rem;
}

.holidayRow label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-text-secondary);
}

.holidayRow input[type="number"] {
    width: 4em;
}

.holidayName {
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
}

.holidayHint {
    margin: 0;
    font-size: 0.76rem;
    color: var(--color-text-secondary);
}

.holidayDayNo {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    margin-right: 4px;
    padding: 0 2px;
    border: 2.5px solid;
    border-radius: 4px;
    background: #fff;
    color: #111;
    font-size: 0.7rem;
    font-weight: 700;
    vertical-align: middle;
}

.holidayInsight {
    padding: 6px 10px;
    border-left: 3px solid #d99a1e;
    border-radius: 4px;
    background: #fff8eb;
    font-size: 0.8rem;
}

.holidayInsight ul {
    margin: 2px 0 6px;
    padding-left: 18px;
}

.holidayInsight .holidayWalk {
    font-weight: 600;
}

.holidayAdvice button {
    font: inherit;
    font-weight: 600;
}

.holidayOwn td {
    background: #d9ecfb;
}

.holidayHint.warn {
    color: #b45309;
}

.holidayProblem {
    margin: 0;
    padding: 4px 8px;
    border-radius: 6px;
    background: #fff7e6;
    color: #8a5300;
    font-size: 0.8rem;
}

.holidayPlace {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    background: #e3f1e6;
    font-size: 0.85rem;
}

.holidayPlaceName {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.holidayPlaceName input {
    width: 100%;
    min-width: 0;
    font: inherit;
    font-size: 0.82rem;
}

.holidayPlaceName input[data-place-label] {
    font-weight: 600;
}

.holidayPlaceName small {
    display: block;
    color: var(--color-text-secondary);
}

.holidayPlace input[type="number"] {
    width: 3.5em;
}

.holidayPin {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #7c3aed;
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
}

.holidayPin.small {
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
}

.holidaySuggestions {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
    font-size: 0.82rem;
}

.holidaySuggestions li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 3px 8px;
    border: 1px dashed var(--color-border);
    border-radius: 6px;
}

.holidaySuggestions small {
    display: block;
    color: var(--color-text-secondary);
}

.holidayDays {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.holidayDay {
    padding: 1px 8px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}

.holidayDay.walk {
    background: #e3f1e6;
    border-color: #2b6f3e;
}

.holidayDay.light {
    background: #fff7e6;
    border-color: #e0a400;
}

.holidayDay.rest {
    background: #f3f4f6;
    color: var(--color-text-secondary);
}

.holidayPrimary {
    background: var(--color-primary);
    color: var(--color-surface);
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    padding: 3px 12px;
    font: inherit;
    cursor: pointer;
}

.holidayPrimary:disabled {
    opacity: 0.5;
    cursor: default;
}

[data-place].active {
    border-color: #7c3aed;
    color: #7c3aed;
}

.holidayPlan {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.holidayPlan th {
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
    padding: 3px 4px;
}

.holidayPlan td {
    border-bottom: 1px solid #eef0f3;
    padding: 4px;
    vertical-align: top;
}

.holidayWhen,
.holidayNum {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.holidayWalk {
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.holidayWalk:hover {
    color: var(--color-primary);
}

.holidayDot {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 5px;
    border-radius: 50%;
}

.holidayWhy {
    display: block;
    color: var(--color-text-secondary);
    font-size: 0.74rem;
}

/* a black walk on a day with a bad forecast (HOL-10) */
.holidayWeatherWarn {
    display: block;
    margin-top: 2px;
    padding: 2px 6px;
    border-left: 3px solid #dc2626;
    background: #fef2f2;
    color: #991b1b;
    font-size: 0.74rem;
    font-weight: 600;
}

.holidayRest td {
    color: var(--color-text-secondary);
    background: #fafafa;
}

/* the report over the app, in a frame of its own (HOL-06) */
#holidayReportOverlay {
    position: fixed;
    inset: 0;
    z-index: 9600;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.6);
}

#holidayReportOverlay[hidden] {
    display: none;
}

#holidayReportOverlay iframe {
    flex: 1;
    width: 100%;
    border: none;
    background: #e9ecef;
}

.holidayReportClose {
    align-self: flex-end;
    margin: 6px 10px;
    padding: 3px 12px;
    border: none;
    border-radius: 6px;
    background: #fff;
    font: inherit;
    cursor: pointer;
}

/* the weather of the day (HOL-07) */
.holidayWeather {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

/* ⇄ 📌 ↑ ↓ per day (HOL-05) */
.holidayActs {
    white-space: nowrap;
    text-align: right;
}

.holidayActs button {
    padding: 0 4px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}

.holidayActs button:disabled {
    opacity: 0.35;
    cursor: default;
}

.holidayActs button.active {
    border-color: var(--color-primary);
    background: #e3f1e6;
}

.holidayAlts td {
    background: #f6f8f6;
}

.holidayAltList {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
}

.holidayAltList li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.holidayAltList small {
    display: block;
    color: var(--color-text-secondary);
}

/* the map: places and walks by day */
.holidayPlaceIcon span,
.holidayDayIcon span {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.holidayPlaceIcon span {
    background: #7c3aed;
    font-size: 13px;
}

/* the day: a white square, the border in the difficulty's colour */
.holidayDayIcon span {
    border-radius: 6px;
    border-width: 3px;
    border-style: solid;
    background: #fff;
    color: #111;
}

.holidayPlacing,
.holidayPlacing .leaflet-interactive {
    cursor: crosshair !important;
}

/* the filters belong to the list; what is set there still applies */
body.phase-explore.explore-trajects #routeList,
body.phase-explore.explore-trajects #exploreFilterRow {
    display: none;
}

#trajectSearchPanel h2 {
    margin: 0 0 var(--spacing-sm);
    font-size: 1.1rem;
}

#trajectSearchPanel tr[data-row] {
    cursor: pointer;
}

#trajectSearchPanel tr[data-row]:hover {
    background: #f1f5f9;
}

#trajectSearchPanel tr.chosen {
    background: #ffedd5;
    box-shadow: inset 3px 0 0 #f97316;
}

/* Explore · Data in groups, separated by a line (UI-NAV-01) */
.commandGroup + .commandGroup {
    border-top: 1px solid var(--color-border);
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
}

.commandGroup h3 {
    margin: 0 0 6px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-text-secondary, #666);
}

.commandCard {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: var(--spacing-sm);
    display: grid;
    gap: 6px;
    font-size: 0.85rem;
}

.commandCard header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.commandCard p {
    margin: 0;
    color: var(--color-text-secondary);
}

.commandCard .commandStatus {
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

.commandCard.later {
    border-style: dashed;
}

.commandCard button,
.profileList button {
    justify-self: start;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    background: var(--color-surface);
    border-radius: 6px;
    padding: 3px 12px;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.commandCard button:disabled {
    border-color: var(--color-border);
    color: var(--color-text-secondary);
    cursor: default;
}

.profileActions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.profileMessage {
    margin: 0;
    color: var(--color-primary);
    font-size: 0.85rem;
}

.profileList {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
}

.profileList li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
}

.profileList li.current {
    background: var(--color-background);
}

.profileList li span {
    display: grid;
}

.profileList small {
    color: var(--color-text-secondary);
}

.profileCurrent {
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.8rem;
}

/* ----------------------------------------------------------
   Map / Bubble / Heatmap
---------------------------------------------------------- */

#viewTabs {
    padding: 6px 10px;
}

body.phase-go #viewTabs {
    display: none;
}

.viewSwitch {
    display: inline-flex;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
}

.viewSwitch button {
    font: inherit;
    font-size: 0.8rem;
    border: 0;
    background: var(--color-surface);
    color: var(--color-text-secondary);
    padding: 3px 12px;
    cursor: pointer;
}

.viewSwitch button + button {
    border-left: 1px solid var(--color-border);
}

.viewSwitch button[aria-pressed="true"] {
    background: var(--color-primary);
    color: var(--color-surface);
}

.viewSwitch button:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ----------------------------------------------------------
   Filter row above the list
---------------------------------------------------------- */

#exploreFilterRow {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

/* experience words in Voorkeuren: + zoek, − vermijd (EXP-12) */
.preferenceWords {
    display: grid;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
}

.preferenceWordChips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.preferenceWord {
    padding: 1px 8px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

.preferenceWord.seek {
    border-color: #2b6f3e;
    background: #e3f1e6;
    color: #1f5130;
    font-weight: 600;
}

.preferenceWord.avoid {
    border-color: #b91c1c;
    background: #fde8e8;
    color: #8b1414;
    font-weight: 600;
}

/* folded in behind one bar with a summary (UI-NAV-01) */
#filterRowToggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 2px 4px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--color-text-secondary);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

#filterRowToggle:hover {
    background: var(--color-background);
}

.filterRowArrow {
    display: inline-block;
    transition: transform 0.15s;
}

#filterRowToggle[aria-expanded="true"] .filterRowArrow {
    transform: rotate(90deg);
}

.filterRowTitle {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

#filterRowSummary {
    display: flex;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.filterRowCompute,
.filterRowFilters {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* an active filter stays noticeable while folded in */
.filterRowFilters {
    flex: 0 1 auto;
    padding: 0 6px;
    border-radius: 4px;
    background: #eef4ff;
    box-shadow: inset 2px 0 0 #3b82f6;
    color: #1e3a8a;
}

#exploreFilterRow.collapsed .filterGroup {
    display: none;
}

/* the summary only when folded in */
#filterRowToggle[aria-expanded="true"] #filterRowSummary {
    display: none;
}

/* two rows: what changes the figures, what filters the walks (UI-NAV-01) */
.filterGroup {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    padding: 3px 6px 3px 86px;
    border-radius: 6px;
}

.filterGroupFilter {
    background: #eef4ff;
    box-shadow: inset 3px 0 0 #3b82f6;
}

.filterGroupLabel {
    /* its own column, wrapped controls stay to the right of it */
    position: absolute;
    left: 8px;
    top: 7px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.filterGroupFilter .filterGroupLabel::before {
    content: "⏷ ";
}

#exploreFilterRow label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#exploreFilterRow label[hidden] {
    display: none;
}

/* the bubble range as a filter, never hidden (VIEW-BUBBLE-04) */
.bubbleRangeChip:not([hidden]) {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 4px 1px 10px;
    border: 1px solid var(--color-primary);
    border-radius: 12px;
    color: var(--color-primary);
    font-weight: 600;
    white-space: nowrap;
}

.bubbleRangeChip button {
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 0 4px;
}
