/* TrailQ Details CSS placeholder */
/* ==========================================================================
   TrailQ 2.0
   Details View

   Owner:
       DetailsView.js

   Layout

       DetailsPane
       ├── Header
       ├── Tabs
       └── Content
           ├── Description
           ├── Profile
           └── Photos

   ========================================================================== */


/* ==========================================================================
   DETAILS PANE
   ========================================================================== */

#detailsPane {

    display: flex;
    flex-direction: column;

    /* about two thirds of the right side, the divider changes it (UI-DET-02) */
    flex: 0 0 var(--details-height, 62%);
    min-height: 0;

    overflow: hidden;

    background: white;

    border-top: 1px solid #dbe2ea;
}


/* --------------------------------------------------------------------------
   Collapsed
   -------------------------------------------------------------------------- */

/* collapsed: as high as its header, which can take two lines when the
   figures wrap (kcal, UI-KCAL-02/03) */
#detailsPane.collapsed {

    flex: 0 0 auto;
}

#detailsPane.collapsed #detailsContent {

    display: none;
}


/* ==========================================================================
   HEADER
   ========================================================================== */

#detailsHeader {

    flex: 0 0 42px;

    display: flex;
    align-items: center;
    gap: 10px;

    padding: 0 12px;

    background:
        linear-gradient(
            180deg,
            #ffffff,
            #f4f7f4
        );

    border-bottom:
        1px solid #dbe2ea;
}


/* ==========================================================================
   TITLE
   ========================================================================== */

#detailTitle {

    flex: 1;

    min-width: 0;

    font-size: 16px;
    font-weight: 700;

    color: #111827;
}


/* ==========================================================================
   STATS
   ========================================================================== */

#stats {

    display: flex;
    align-items: center;
    gap: 10px;

    white-space: nowrap;

    font-size: 13px;

    color: #4b5563;
}

/* ==========================================================================
   TOGGLE BUTTON
   ========================================================================== */

#toggleDetails {

    flex: 0 0 auto;

    /* at the top of a header of one or two lines */
    align-self: flex-start;
    margin-top: 8px;

    width: 26px;
    height: 26px;

    padding: 0;

    border: none;
    background: transparent;

    cursor: pointer;

    color: #475569;

    font-size: 15px;

    transition:
        transform .18s ease,
        color .18s ease;
}

#toggleDetails::before {

    content: "▼";
}

#toggleDetails.collapsed {

    transform: rotate(-180deg);
}

#toggleDetails:hover {

    color: #111827;
}


/* ==========================================================================
   TAB BAR
   ========================================================================== */

#tabButtons {

    flex: 0 0 38px;

    display: flex;
    align-items: stretch;

    /* tabs keep one line; when they do not fit the bar scrolls */
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;

    /* a darker grey than the content, the chosen tab white (UI-NAV-01) */
    background: var(--color-tabbar);

    border-bottom: 1px solid #dbe2ea;
}


/* ==========================================================================
   TAB BUTTON
   ========================================================================== */

.tabButton {

    flex: 1 0 auto;
    white-space: nowrap;
    padding: 0 10px;

    border: none;

    background: transparent;

    cursor: pointer;

    color: #475569;

    font-size: 13px;
    font-weight: 500;

    transition:
        background .15s ease,
        color .15s ease;
}

.tabButton:hover {

    background: rgba(255, 255, 255, 0.55);
}

.tabButton.active {

    background: white;

    color: #111827;

    font-weight: 600;

    border-bottom: 2px solid #3b82f6;
}
/* ==========================================================================
   COLLAPSED
   ========================================================================== */

#detailsPane.collapsed #tabButtons {

    display: none;
}

/* two lines: name with Go, then the figures */
.detailsTitleRow {

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 10px;
    min-width: 0;
}

.detailsWalkName {

    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detailsTitleRow .detailsGoButton {

    flex: 0 0 auto;
}

.detailsTitleRow .detailsStats {

    flex: 1 0 100%;
}

.detailsStats {

    display: flex;
    align-items: center;

    /* whole figures go to a next line when they do not fit; none falls
       off (UI-DET-01) */
    flex-wrap: wrap;
    min-width: 0;

    gap: 2px 10px;
}

/* a figure never breaks over two lines ("16.47 / km") (UI-DET-01) */
.detailsStats .stat {

    flex: 0 0 auto;
    white-space: nowrap;
}

.stat {

    display: flex;
    align-items: center;

    gap: 4px;
}

.durationStat {

    font-variant-numeric: tabular-nums;
}

.cacheStat {

    color: #0f766e;
}

.difficultyStat {

    display:flex;
    align-items:center;
}

.loopStat {

    color:#15803d;
}

.elevationStat {

    font-weight:500;
}

/* ==========================================================================
   CONTENT
   ========================================================================== */

#detailsContent {

    flex: 1;

    min-height: 0;

    display: flex;

    overflow: hidden;

    background: white;
}


/* ==========================================================================
   TABS
   ========================================================================== */

.detailsTab {

    display: none;

    flex: 1;

    min-width: 0;
    min-height: 0;

    padding: 14px 16px;

    box-sizing: border-box;
}


/* one scrolling column per tab (UI-DET-01) */
.detailsTab.active {

    display: flex;

    flex-direction: column;

    gap: 12px;

    overflow-y: auto;
}


/* ==========================================================================
   DESCRIPTION
   ========================================================================== */

#descriptionTab {

    padding: 0;

    line-height: 1.55;

    color: #374151;

    font-size: 14px;

    min-height: 0;
}

#descriptionTab::-webkit-scrollbar {

    width: 8px;
}

#descriptionTab::-webkit-scrollbar-track {

    background: transparent;
}

#descriptionTab::-webkit-scrollbar-thumb {

    background: #cbd5e1;

    border-radius: 4px;
}

#descriptionTab::-webkit-scrollbar-thumb:hover {

    background: #94a3b8;
}

/* ==========================================================================
   PHOTO VIEWER
   ========================================================================== */

/* the photo viewer over the screen, opened from the strip (UI-DET-01) */
#photosTab {

    position: fixed;

    inset: 0;

    z-index: 9500;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 24px;

    background: rgba(15, 23, 42, 0.82);
}

#photosTab[hidden] {

    display: none;
}

#photosTab .photoViewer {

    position: relative;

    width: min(1100px, 100%);

    height: min(800px, 100%);
}

.photoClose {

    position: absolute;

    top: -14px;

    right: -14px;

    z-index: 1;

    width: 32px;

    height: 32px;

    border: none;

    border-radius: 50%;

    background: white;

    font-size: 16px;

    cursor: pointer;
}


.photoViewer {

    display: flex;

    flex-direction: column;

    height: 100%;
}


.photoViewerImage {

    flex: 1;

    min-height: 0;

    width: 100%;

    object-fit: contain;

    background: #f8fafc;

    border: 1px solid #dbe2ea;

    border-radius: 8px;
}


/* ==========================================================================
   PHOTO CONTROLS
   ========================================================================== */

.photoControls {

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 18px;

    margin-top: 12px;
}


.photoControls button {

    min-width: 34px;

    height: 34px;

    border: 1px solid #dbe2ea;

    border-radius: 6px;

    background: white;

    cursor: pointer;

    transition: background .15s;
}


.photoControls button:hover {

    background: #eef2f7;
}


.photoCounter {

    min-width: 70px;

    text-align: center;

    color: #475569;

    font-size: 13px;
}

/* phone: a lower elevation chart, so it does not fill the screen
   (UI-NAV-02) */
@media (max-width: 700px) and (orientation: portrait) {

    /* #detailsContent is a flex row: keep the full width, limit the
       height only */
    #profileTab {
        height: 220px;
    }
}

/* ===== Trajects (UI-TRAJ-02) ===== */

#trajectsTab,
#walkEventsPart,
#walkLabelsPart,
#sessionsTab {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.trajectHead p,
.trajectEmpty,
.trajectMessage {
    margin: 0;
    color: var(--color-text-muted, #666);
    font-size: 0.85rem;
}

#trajectsTab button,
#walkEventsPart button,
#walkLabelsPart button {
    font: inherit;
    font-size: 0.85rem;
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    background: var(--color-surface);
    white-space: nowrap;
}

#trajectsTab .trajectPrimary,
#walkEventsPart .trajectPrimary,
#walkLabelsPart .trajectPrimary {
    background: var(--color-primary);
    color: var(--color-surface);
}

.trajectList {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.trajectList li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

/* a click shows the traject on the map and the profile (UI-TRAJ-02) */
#trajectsTab .trajectList li[data-show] {
    cursor: pointer;
}

#trajectsTab .trajectList li.shown {
    background: #ffedd5;
    border-color: #f97316;
    box-shadow: inset 3px 0 0 #f97316;
}

.trajectInfo {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.trajectInfo small {
    color: var(--color-text-muted, #666);
    font-variant-numeric: tabular-nums;
}

.trajectActions {
    display: flex;
    gap: 6px;
}

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

.trajectProfile {
    width: 100%;
    height: 150px;
    touch-action: none;
    cursor: ew-resize;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
}

.trajectArea {
    fill: var(--color-border);
}

.trajectLine {
    fill: none;
    stroke: var(--color-text-muted, #666);
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

.trajectBand {
    fill: var(--color-primary);
    fill-opacity: 0.22;
}

.trajectHandle line {
    stroke: var(--color-primary);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.trajectHandle circle {
    fill: var(--color-primary);
}

.trajectFields {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.trajectFields input {
    width: 5.5em;
    font: inherit;
}

.trajectFigures,
.trajectTimes {
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.trajectName {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.85rem;
}

.trajectName input {
    font: inherit;
    font-size: 1rem;
}

.trajectButtons {
    display: flex;
    gap: 8px;
}

@media (max-width: 700px) and (orientation: portrait) {

    .trajectHead,
    .trajectList li {
        flex-wrap: wrap;
    }
}

/* ===== Own events in the details (UI-EVENT-05) ===== */

#walkEventsPart,
#walkLabelsPart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#walkEventsPart h4,
#walkLabelsPart h4 {
    margin: 0;
    font-size: 0.95rem;
}

.walkEventListIcon {
    flex: 0 0 auto;
    width: 24px;
    text-align: center;
    font-size: 17px;
}

.walkEventShape {
    display: flex;
    gap: 14px;
    font-size: 0.9rem;
}

.walkEventBand {
    fill: #c2410c;
    fill-opacity: 0.22;
}

.walkEventKindName {
    align-self: center;
    font-size: 0.85rem;
    color: var(--color-text-muted, #666);
}

/* ===== Labels (UI-LABEL-03/04) ===== */

.labelChips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.labelChip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 4px 2px 10px;
    border-radius: 12px;
    background: var(--color-border);
    font-size: 0.85rem;
}

#walkLabelsPart .labelChip button {
    border: none;
    background: none;
    color: inherit;
    padding: 0 4px;
    font-size: 1rem;
    line-height: 1;
}

.labelAdd {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.labelAdd input {
    flex: 1 1 140px;
    min-width: 0;
    font: inherit;
}

.labelFilter {
    position: relative;
}

.labelFilterButton {
    font: inherit;
    font-size: 0.85rem;
    border-radius: 6px;
    padding: 2px 10px;
    cursor: pointer;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    white-space: nowrap;
}

.labelFilterButton.active {
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 600;
}

.labelFilterPanel {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 1200;
    width: min(320px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}

.labelFilterPanel[hidden] {
    display: none;
}

.labelFilterPanel h4 {
    margin: 0;
    font-size: 0.85rem;
}

.labelFilterOptions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    max-height: 160px;
    overflow-y: auto;
}

.labelFilterOptions label {
    white-space: nowrap;
    font-size: 0.85rem;
}

.labelHint {
    margin: 0;
    font-size: 0.8rem;
    color: var(--color-text-muted, #666);
}

.labelFilterPanel .labelAdd button {
    font: inherit;
    font-size: 0.85rem;
}

/* phone: the panel spans the filter row instead of hanging off the button */
@media (max-width: 700px) {

    #exploreFilterRow {
        position: relative;
    }

    .labelFilter {
        position: static;
    }

    .labelFilterPanel {
        left: 8px;
        right: 8px;
        width: auto;
    }
}

/* ===== Sessions of the walk (UI-EXP-04) ===== */

.walkSessionRow {
    cursor: pointer;
}

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

/* ===== Preferences (UI-EXP-05) ===== */

/* the panel opens inside the filter row, over its full width, so the
   list below stays visible while the score changes */
#preferenceFilter {
    position: static;
    display: contents;
}

#preferenceFilter .preferencePanel {
    position: static;
    order: 99;
    flex: 1 0 100%;
    box-sizing: border-box;
    width: auto;
    min-width: 0;
    margin-top: 4px;
    box-shadow: none;
}

#preferenceFilter .preferenceRow {
    max-width: 520px;
}

.preferenceRow {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) 64px;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.preferenceUse {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.preferenceRow input[type="range"] {
    width: 100%;
    min-width: 0;
}

.preferenceRow input[type="range"]:disabled {
    opacity: .4;
}

.preferenceValue {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* data quality above the description (UI-QUAL-01) */
.qualityLabels {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin-bottom: 8px;
}

.qualityLabel {
    padding: 1px 8px;
    border-radius: 10px;
    background: var(--color-background, #f4f5f7);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* the camera time of the photo folder, under the strip (UI-PHOTO-01) */
.cameraTime {
    font-size: 0.78rem;
    color: var(--color-text-secondary, #666);
}

.cameraTime:empty {
    display: none;
}

.cameraTime select {
    font: inherit;
}

/* in place of an Obsidian Dataview query (ROUTE-SAME-03) */
.dataviewNote {
    color: var(--color-text-secondary, #666);
    font-style: italic;
}

.dataviewLink {
    padding: 0;
    border: none;
    background: none;
    color: var(--color-primary, #2b6f3e);
    font: inherit;
    font-style: normal;
    cursor: pointer;
}

/* the same route walked more than once (ROUTE-SAME-03) */
.sameRoute {
    display: grid;
    gap: 4px;
    margin-bottom: 8px;
    font-size: 0.82rem;
}

.sameRouteRow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
}

.sameRouteItem {
    padding: 1px 8px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
    font: inherit;
    white-space: nowrap;
}

button.sameRouteItem {
    cursor: pointer;
}

button.sameRouteItem:hover {
    border-color: #2b6f3e;
}

.sameRouteItem.current {
    border-color: #2b6f3e;
    background: #e3f1e6;
    font-weight: 600;
}

/* the walk's stars, in the colour of "lijkt op" (EXP-08) */
.walkRatingLabel {
    color: #e0a400;
}

.walkRatingLabel:empty {
    display: none;
}

.qualityLabel.good {
    color: var(--color-primary);
}

.qualityLabel.warn {
    color: #b45309;
}

/* a warning with a place on the route: a click shows it in orange (UI-QUAL-02) */
button.qualityLabel {
    border: 1px solid transparent;
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

button.qualityLabel:hover {
    border-color: #f97316;
}

button.qualityLabel.shown {
    border-color: #f97316;
    background: #ffedd5;
}

/* repairing in the GPX (UI-QUAL-03) */
.repairPanel {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
    padding: 8px 10px;
    border-left: 3px solid #f97316;
    border-radius: 4px;
    background: #fff7ed;
    font-size: 0.85rem;
}

.repairPanel p {
    margin: 0;
}

.repairInfo,
.repairNote {
    color: var(--color-text-secondary);
}

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

.repairSummary {
    font-weight: 600;
}

.repairMessage {
    color: #b45309;
}

.repairButtons {
    display: flex;
    gap: 8px;
}

.remeasure {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
    margin: 0 0 10px;
}

.remeasure.warn {
    padding: 8px 10px;
    border-left: 3px solid #d99a1e;
    border-radius: 4px;
    background: #fff8eb;
}

.remeasure.warn p {
    margin: 0;
    flex-basis: 100%;
}

/* translating the description (UI-LANG-02) */
.translateBar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.translateBar:empty {
    display: none;
}

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

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

.qualityStat {
    white-space: nowrap;
}


/* ===== Details in three tabs (UI-DET-01, UI-DET-02) ===== */

/* the profile chart in Route gets a fixed height inside the scrolling tab */
#profileTab {
    flex: 0 0 auto;
    height: 260px;
    position: relative;
}

/* the first photos as a strip; a tap opens the viewer */
.photoStrip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.photoStrip:empty {
    display: none;
}

.photoThumb {
    position: relative;
    aspect-ratio: 4 / 3;
    border: none;
    border-radius: 6px;
    background: #eef2f7 center / cover no-repeat;
    cursor: pointer;
    padding: 0;
}

.photoMore {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.5);
    color: white;
    font-weight: 600;
}

/* a small profile in Overzicht */
.overviewProfile svg {
    display: block;
    width: 100%;
    height: 44px;
}

.overviewProfile small {
    color: #64748b;
    font-size: 11px;
}

.overviewProfileArea {
    fill: #d9eadf;
}

.overviewProfileLine {
    fill: none;
    stroke: #2b6f3e;
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

/* the divider between the list and Details on the laptop */
#detailsDivider {
    flex: 0 0 7px;
    cursor: row-resize;
    background: #eef2f7;
    border-top: 1px solid #dbe2ea;
    touch-action: none;
}

#detailsDivider:hover,
body.resizingDetails #detailsDivider {
    background: #cbd5e1;
}

#detailsDivider:has(+ #detailsPane.collapsed) {
    display: none;
}

body.resizingDetails {
    user-select: none;
}

@media (max-width: 700px) and (orientation: portrait) {

    #detailsDivider {
        display: none;
    }
}

#photosTab .photoCounter {
    color: white;
}
