/* MAIN-13: the Travel page. Colours come from theme.css, so the light and the dark theme both work. The pin colours are
   fixed: they sit on the map tiles, which stay light in both themes */

.travelHead {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 16px;
}

.travelCount {
    margin-left: auto;
    font-size: 14px;
    color: var(--ink-body);
}

.travelStorageNote {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--cell-warn-ink);
    background: var(--cell-warn-bg);
    border-radius: 6px;
    padding: 6px 10px;
}

.travelStorageNote[hidden] {
    display: none;
}

.travelMapBox {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* The card is positioned against this box, over the map */
.travelMapWrap {
    position: relative;
}

/* The map fills the window's height under the header; the legend and the buttons stay in view below it.
   isolation keeps Leaflet's own z-indexes inside the map, so the card only has to sit above the map itself */
.travelMap {
    height: calc(100vh - 190px);
    min-height: 480px;
    border-radius: 6px;
    background: var(--surface-panel);
    isolation: isolate;
}

.travelBelow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
}

.travelLegend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: 13px;
    color: var(--ink-body);
}

.travelLegend > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.travelTools {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.travelHint {
    font-size: 13px;
    color: var(--accent-ink);
}

.travelButton {
    min-height: 36px;
    padding: 4px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
}

.travelButton[hidden] {
    display: none;
}

.travelButton--primary {
    background: var(--btn-primary-bg);
    border-color: var(--btn-primary-line);
    color: var(--btn-primary-ink);
}

.travelButton--small {
    min-height: 32px;
    padding: 2px 10px;
    font-size: 13px;
}

.travelButton:disabled,
.travelStatusButton:disabled {
    opacity: 0.55;
}

.travelMessage {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--ok-ink);
    background: var(--ok-bg);
    border-radius: 6px;
    padding: 6px 10px;
}

.travelMessage--error {
    color: var(--danger);
    background: var(--warn-bg);
}

.travelMessage[hidden],
.travelMove[hidden] {
    display: none;
}

/* The offer to move a visitor's browser stamps into the list */
.travelMove {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 0 0 8px;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--ink);
    background: var(--accent-soft-bg);
    border: 1px solid var(--accent-line);
    border-radius: 6px;
}

.travelMuted {
    margin: 0;
    font-size: 13px;
    color: var(--ink-muted);
}

/* ---------- form fields: the visits, the note and the place form ---------- */

.travelField {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
}

.travelFieldRow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 8px;
}

.travelInput {
    width: 100%;
    min-height: 36px;
    padding: 4px 8px;
    border: 1px solid var(--line-control);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
}

.travelInput:focus {
    outline: none;
    border-color: var(--input-focus-line);
    box-shadow: 0 0 0 3px var(--input-focus-ring);
}

textarea.travelInput {
    resize: vertical;
}

.travelFormButtons,
.travelCardTools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.travelCardMessage {
    margin: 0;
    font-size: 14px;
    color: var(--ok-ink);
}

.travelCardMessage--error {
    color: var(--danger);
}

/* ---------- pins ---------- */

.travelPin {
    border-radius: 50%;
    box-sizing: border-box;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    cursor: pointer;
}

.travelPin--been {
    background: #0f766e;
    border: 3px solid #fff;
}

.travelPin--seen {
    background: #8fd3cb;
    border: 3px solid #0f766e;
}

.travelPin--want {
    background: #fff;
    border: 4px solid #d9480f;
}

.travelPin--none {
    background: #868e96;
    border: 1px solid #fff;
}

/* Where a place being added or edited goes */
.travelPin--draft {
    background: rgba(255, 255, 255, 0.85);
    border: 3px dashed #212529;
}

.travelPin--selected {
    outline: 3px solid #212529;
    outline-offset: 2px;
}

/* Leaflet places a marker with a transform on the element itself, so the diamond turns an inner span */
.travelHome span {
    display: block;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background: #212529;
    border: 2px solid #fff;
    transform: rotate(45deg);
}

.travelCluster {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-sizing: border-box;
    background: #343a40;
    color: #fff;
    border: 3px solid rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

/* The legend's samples */
.travelKey {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-sizing: border-box;
}

.travelKey.travelPin--been {
    border-width: 2px;
    box-shadow: 0 0 0 1px #0f766e;
}

.travelKey.travelPin--seen {
    border-width: 2px;
}

.travelKey.travelPin--want {
    border-width: 3px;
}

.travelKey--group {
    width: 20px;
    height: 20px;
    background: #343a40;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ---------- the place card: floats over the map's top right corner while a place is picked ---------- */

.travelCard {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    width: 300px;
    max-height: calc(100% - 40px); /*clear of the map's credits line*/
    overflow-y: auto;
    display: none;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.travelSheetOpen .travelCard {
    display: block;
}

.travelBand {
    height: 6px;
    background: var(--line);
}

.travelCard[data-status="want"] .travelBand {
    background: #d9480f;
}

.travelCard[data-status="been"] .travelBand,
.travelCard[data-status="seen"] .travelBand {
    background: #0f766e;
}

.travelCardEmpty {
    margin: 0;
    padding: 18px;
    color: var(--ink-muted);
}

.travelCardInner {
    position: relative;
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.travelClose {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 32px;
    height: 32px;
    border: 0;
    background: none;
    color: var(--ink-body);
    font-size: 22px;
    line-height: 1;
}

.travelTags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-right: 32px; /*clear of the close button*/
}

.travelTag {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--surface-tag);
    color: var(--ink-body);
}

.travelTag--kind {
    background: var(--chip-on-bg);
    color: var(--chip-on-ink);
}

.travelTitle {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.travelTitle h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.travelWhere {
    font-size: 13px;
    color: var(--ink-body);
}

.travelDescription {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.travelLinks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.travelLink {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--line-control);
    border-radius: 6px;
    font-size: 13px;
    color: var(--ink);
    text-decoration: none;
}

.travelLink:hover {
    color: var(--ink);
    background: var(--surface-panel);
}

.travelLink svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.travelStamp {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--line-soft);
    padding-top: 10px;
}

.travelLabel {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-body);
}

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

.travelStatusButton {
    flex: 1 1 0;
    min-height: 36px;
    padding: 6px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
}

.travelStatusButton[aria-pressed="true"] {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--on-accent);
}

/* A member's visits and note, under the status buttons */
.travelDetails {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-top: 6px;
}

.travelDetails > .travelField {
    align-self: stretch;
}

.travelVisits {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* The month and the remove button stay on one line; the names wrap between them */
.travelVisit {
    display: flex;
    align-items: center;
    gap: 10px;
}

.travelInput.travelMonth {
    flex: 0 0 150px;
    width: 150px;
}

.travelWhoList {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
}

.travelWho {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    font-size: 14px;
}

.travelRemove {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border: 0;
    background: none;
    color: var(--ink-body);
    font-size: 22px;
    line-height: 1;
}

.travelCardTools {
    border-top: 1px solid var(--line-soft);
    padding-top: 12px;
}

/* The place form */
.travelForm h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.travelPosition {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    font-size: 14px;
    color: var(--ink-body);
}

/* ---------- the import box ---------- */

.travelImport {
    border-top: 1px solid var(--line-soft);
    padding-top: 8px;
    font-size: 14px;
}

.travelImport summary {
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
}

.travelImportBody {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.travelImportFormat {
    margin: 0;
    padding: 8px 10px;
    font-size: 12px;
    color: var(--ink-body);
    background: var(--surface-panel);
    border-radius: 6px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.travelImportText {
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
}

.travelImportHead {
    margin: 6px 0 2px;
    font-size: 14px;
    font-weight: 700;
}

.travelImportList,
.travelImportErrors {
    margin: 0;
    padding-left: 18px;
}

.travelImportErrors {
    color: var(--danger);
}

.travelImportMatch label {
    margin-left: 10px;
    white-space: nowrap;
}

/* ---------- phones: the card is a bottom sheet over the map ---------- */

@media (max-width: 767.98px) {
    .travelMapBox {
        padding: 6px;
    }

    .travelMap {
        height: calc(100vh - 190px);
        height: calc(100dvh - 190px);
        min-height: 360px;
    }

    .travelCard {
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1100; /*over the page's own bars too*/
        width: auto;
        max-height: 75vh;
        overflow-y: auto;
        display: block; /*hidden by the transform, so it can slide in*/
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.18);
        transform: translateY(100%);
        visibility: hidden;
        transition: transform 0.2s ease, visibility 0.2s;
    }

    .travelSheetOpen .travelCard {
        transform: none;
        visibility: visible;
    }

    .travelBand {
        display: none;
    }

    .travelCardInner {
        padding: 14px 16px 16px;
        gap: 10px;
    }

    .travelClose {
        top: 6px;
        right: 8px;
        width: 40px;
        height: 40px;
        font-size: 26px;
    }

    .travelTags {
        padding-right: 44px;
    }

    .travelTitle h2 {
        font-size: 21px;
    }

    .travelStatusButton {
        min-height: 44px;
    }

    .travelLinks {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .travelLink {
        min-height: 44px;
        font-size: 13px;
    }
}
