/* IceReports safety layer: report age on markers, the "how are you going out?" answer in the
   popup, the travel picker and the emergency card. Rules: static/js/icesafety.js. */

/* --- Age on markers --- */
.marker-age {
    position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 2px;
    padding: 0 5px; border-radius: 8px; background: var(--card-bg); border: 1px solid var(--border);
    color: var(--text-main); font: 700 11px/15px 'JetBrains Mono', monospace; white-space: nowrap;
    text-shadow: none; letter-spacing: 0;
}
.ice-marker.age-fading { filter: saturate(0.55); }
.ice-marker.age-fading .marker-age { border-style: dashed; }
/* Older than the limit: grey and dashed whatever the thickness, so it cannot read as current */
.ice-marker.age-stale,
html[data-contrast="high"] .ice-marker.age-stale {
    background: var(--card-bg); border: 2px dashed var(--text-muted); color: var(--text-muted);
    box-shadow: none; text-shadow: none;
}
.ice-marker.age-stale .marker-age { border-style: dashed; color: var(--text-muted); }

/* --- Popup --- */
.popup-age { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.popup-title.age-stale { color: var(--text-muted); }
.verdict { border-radius: 10px; padding: 0.5rem 0.65rem; margin-bottom: 0.5rem; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-main); }
.verdict.danger { border-color: var(--danger); background: var(--danger-bg); }
.verdict.caution { border-color: var(--caution); background: var(--caution-bg); }
.verdict.safe { border-color: var(--safe); background: var(--safe-bg); }
.verdict.age-stale { border-color: var(--text-muted); border-style: dashed; background: var(--card-bg); }
.verdict-head { font-weight: 700; font-size: 0.95rem; line-height: 1.3; }
.verdict-notes { margin-top: 0.2rem; font-size: 0.8rem; line-height: 1.35; opacity: 0.85; }
.popup-note { margin: 0.5rem 0; background: #fffbe6; border: 1.5px solid #ffe066; border-radius: 8px; padding: 0.5rem 0.75rem; line-height: 1.5; color: #3a2c00; font-size: 0.97em; }
.popup-meta-row { margin-top: 0.5rem; font-size: 0.8rem; border-top: 1px solid var(--border); padding-top: 0.5rem; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.popup-reminder { margin-top: 0.35rem; font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }

/* --- Travel chip and SOS button on the map --- */
.map-chips { position: fixed; z-index: 900; top: calc(10px + env(safe-area-inset-top, 0px)); left: calc(10px + env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.map-chips-row { display: flex; align-items: center; gap: 8px; }
.travel-chip, .sos-btn { min-height: 44px; padding: 0 14px; border-radius: 12px; font-family: inherit; font-weight: 600; font-size: 0.92rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 10px var(--shadow); display: inline-flex; align-items: center; gap: 0.4rem; }
.travel-chip { background: var(--card-bg); color: var(--text-main); border: 1px solid var(--border); }
.sos-btn { background: #c81e1e; color: #fff; border: none; font-weight: 700; letter-spacing: 0.04em; }

/* --- Travel picker --- */
.travel-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 1rem 0; }
.travel-option { min-height: 72px; border-radius: 12px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-main); font-family: inherit; font-weight: 600; font-size: 1rem; line-height: 1.2; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem; padding: 0.5rem; }
.travel-option .travel-icon { font-size: 1.7rem; line-height: 1; }
.travel-option .travel-min { font-size: 0.75rem; font-weight: 500; color: var(--text-muted); }
.travel-option.active { border-color: var(--accent); background: var(--accent-bg); box-shadow: inset 0 0 0 1px var(--accent); }
.travel-row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); margin-bottom: 0.75rem; }
.travel-row small { display: block; color: var(--text-muted); font-size: 0.75rem; }
.travel-row button { min-height: 44px; padding: 0 1rem; border-radius: 12px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-main); font-family: inherit; font-weight: 600; font-size: 0.9rem; line-height: 1; cursor: pointer; white-space: nowrap; }

/* --- "When did you measure?" on the report form --- */
.measured-when { display: flex; gap: 0.5rem; }
.measured-when label { flex: 1; margin: 0; }
.measured-when input { position: absolute; opacity: 0; pointer-events: none; }
.measured-when span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 0.4rem; border-radius: 10px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-main); font-weight: 500; font-size: 0.9rem; text-align: center; text-transform: none; letter-spacing: 0; cursor: pointer; }
.measured-when input:checked + span { border-color: var(--text-main); background: var(--text-main); color: var(--bg); }
.measured-when input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* --- Emergency card --- */
.sos-coords { font: 800 1.5rem/1.3 'JetBrains Mono', monospace; text-align: center; padding: 0.75rem; border-radius: 12px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-main); word-break: break-word; user-select: all; }
.sos-coords small { display: block; margin-top: 0.3rem; font-family: 'Inter', system-ui, sans-serif; font-weight: 500; font-size: 0.85rem; line-height: 1.4; color: var(--text-muted); }
.sos-callout { margin: 0.9rem 0 0; padding: 0.75rem; border-radius: 12px; border: 2px solid #b91c1c; color: var(--text-main); font-weight: 700; font-size: 1.05rem; line-height: 1.35; text-align: center; }
.sos-actions { display: flex; flex-direction: column; gap: 0.6rem; margin: 0.9rem 0; }
.sos-share { display: flex; align-items: center; justify-content: center; min-height: 56px; border-radius: 14px; font-family: inherit; font-weight: 800; font-size: 1.15rem; line-height: 1; text-decoration: none; cursor: pointer; }
.sos-share { background: var(--card-bg); color: var(--text-main); border: 1px solid var(--border); }
.sos-steps { margin: 0; padding-left: 1.3rem; line-height: 1.5; font-size: 0.95rem; }
.sos-steps li { margin-bottom: 0.3rem; }

/* --- First screen: privacy folds away under the safety terms --- */
details.disclaimer-privacy { margin: 1rem 0; border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.9rem; }
details.disclaimer-privacy summary { cursor: pointer; font-weight: 700; min-height: 32px; display: flex; align-items: center; }
details.disclaimer-privacy p { margin: 0.6rem 0 0.2rem; }

/* --- One-minute report: big thickness control, chips, review --- */
.thick-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.thick-head label { margin: 0; }
/* A segmented control: a quiet track, the choice raised on it */
.unit-toggle { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--fill); flex: 0 0 auto; }
.unit-toggle button { min-height: 38px !important; padding: 0 0.8rem; border: none; border-radius: 8px; background: transparent; color: var(--text-muted); font-family: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.unit-toggle button.active { background: var(--bg); color: var(--text-main); box-shadow: 0 1px 3px var(--shadow); }
.thick-entry { display: flex; align-items: center; gap: 0.6rem; }
.thick-entry input { flex: 0 1 9rem; min-width: 0; min-height: 52px; padding: 0 0.9rem; border-radius: 10px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-main); font-family: inherit; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1.5rem; text-align: center; }
.thick-entry input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.thick-unit { color: var(--text-muted); font-weight: 500; }
/* Voice: one row above the thickness control */
.voice-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.9rem; }
.voice-btn { flex: 1 1 auto; min-height: 44px; padding: 0 1rem; border-radius: 10px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-main); font-family: inherit; font-weight: 600; font-size: 0.92rem; cursor: pointer; }
.voice-btn.listening { background: var(--accent); border-color: var(--accent); color: var(--btn-text); animation: voice-pulse 1.2s ease-in-out infinite; }
.voice-heard, .review-heard { flex: 1 0 100%; font-size: 0.8rem; color: var(--text-muted); line-height: 1.3; }
.voice-heard.has-value { color: var(--text-main); }
.review-heard { margin-top: 0.4rem; }
@keyframes voice-pulse { 50% { opacity: 0.7; } }
@media (prefers-reduced-motion: reduce) { .voice-btn.listening { animation: none; } }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.form-group label.chip, .chip { margin: 0; text-transform: none; letter-spacing: 0; font-size: inherit; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.85rem; border-radius: 10px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-main); font-weight: 500; font-size: 0.92rem; cursor: pointer; transition: background 0.12s, border-color 0.12s; }
.chip input:checked + span { border-color: var(--text-main); background: var(--text-main); color: var(--bg); }
.chip input[type="checkbox"]:checked + span { border-color: var(--caution); background: var(--caution); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.start-choice { width: 100%; min-height: 56px; margin-bottom: 0.5rem; border-radius: 12px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-main); font-family: inherit; font-weight: 600; font-size: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.start-choice.primary { background: var(--accent); color: var(--btn-text); border-color: var(--accent); }
.start-choice:disabled { opacity: 0.7; }
.start-choice[hidden], .was-here[hidden], #measuredWhenGroup[hidden] { display: none; }
.was-here { margin: 0 0 0.9rem; font-size: 0.88rem; color: var(--text-muted); }
.review-card { border: 1px solid var(--border); border-radius: 12px; padding: 0.9rem; background: var(--card-bg); color: var(--text-main); }
.review-card .review-main { font-weight: 700; font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.01em; }
.review-card ul { margin: 0.5rem 0 0; padding-left: 1.1rem; line-height: 1.5; }
.review-card .review-warn { margin-top: 0.6rem; padding: 0.5rem 0.7rem; border-radius: 10px; border: 1px solid var(--caution); background: var(--caution-bg); font-weight: 600; font-size: 0.9rem; }
.ice-marker small { font-size: 9px; font-weight: 700; margin-left: 1px; }

/* --- Layout under the bottom bar (css/bottombar.css): everything that sat at the bottom edge moves above it --- */
.fab-container { bottom: calc(var(--bar-space) + 1rem); right: 1rem; }
.toast { pointer-events: none; }   /* hidden, it must not take taps */
@media (min-width: 769px) { .toast { bottom: calc(var(--bar-space) + 1rem); } }   /* phones show it at the top (mobile.css) */
.toast.show { pointer-events: auto; }
.location-instruction, .location-instruction.active { bottom: calc(var(--bar-space) + 1.5rem); }
.leaflet-bottom { bottom: calc(var(--bar-space) + 12px); }   /* clear of the raised Report button */
.legend { bottom: calc(var(--bar-space) + 1rem); max-height: calc(100% - var(--bar-space) - 6rem); overflow-y: auto; }
/* History: a chip beside the locate button says what the map shows and opens the panel (also under More) */
.history-panel { display: none; bottom: calc(var(--bar-space) + 1rem); }
body.history-open .history-panel { display: block; }
.history-header { gap: 0.5rem; }
.history-close { width: 40px; height: 40px; margin: -0.4rem -0.6rem -0.4rem 0; border: none; background: none; color: var(--text-muted); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.history-total { margin-top: 0.75rem; border-top: 1px solid var(--border); padding-top: 0.5rem; font-size: 0.8rem; color: var(--text-muted); }
.history-total span { color: var(--text-main); font-weight: 600; }
.history-chip { display: flex; height: 40px; border: 1px solid var(--border); border-radius: 12px; background: var(--card-bg); color: var(--text-main); box-shadow: 0 4px 20px var(--shadow); backdrop-filter: blur(12px); overflow: hidden; }
body.history-open .history-chip { display: none; }
.history-chip button { border: none; background: none; color: inherit; font-family: inherit; cursor: pointer; }
.history-chip-open { display: flex; align-items: center; gap: 0.4rem; padding: 0 0.75rem; font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.history-chip-live { width: 40px; border-left: 1px solid var(--border) !important; font-size: 1.4rem; line-height: 1; }
.history-chip.past { background: var(--accent); border-color: var(--accent); color: var(--btn-text); }
.history-chip.past .history-chip-live { border-left-color: rgba(255, 255, 255, 0.35) !important; }
/* Closing the panel on a past view asks one short question in its place */
.history-leave { padding: 1rem; }
.history-leave-q { font-weight: 600; font-size: 1rem; color: var(--text-main); margin-bottom: 0.75rem; }
.history-leave-actions { display: flex; gap: 0.5rem; }
.history-leave-actions button { flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-main); font-family: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.history-leave-actions button.primary { background: var(--accent); border-color: var(--accent); color: var(--btn-text); }
.history-panel.asking .history-body { display: none; }
@media (max-width: 768px) {
    .history-panel { bottom: var(--bar-space); padding-bottom: 0; }
    .legend { bottom: calc(var(--bar-space) + 92px); z-index: 1300; max-width: min(300px, calc(100% - 2rem)); }   /* above the History chip and locate button */
    .fab-container { margin-bottom: 0; }
    .history-chip { height: 44px; }
    .history-chip-live { width: 44px; }
}

/* --- Near me --- */
.near-for { margin: 0 0 0.4rem; color: var(--text-muted); font-size: 0.8rem; }
.near-for .disclaimer-link { min-height: 0; padding: 0; }
.near-dot { flex: 0 0 36px; width: 36px; height: 36px; font-size: 0.85rem; box-shadow: none; }

/* --- Trust signals in the report popup --- */
.tag.trust { background: var(--card-bg); color: var(--text-main); font-weight: 600; }
.popup-confirm { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.5rem; }
.popup-confirm button { min-height: 44px; padding: 0.2rem 0.5rem; border-radius: 10px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-main); font-family: inherit; font-weight: 600; font-size: 0.88rem; line-height: 1.2; cursor: pointer; }
.popup-confirm button.confirm-same { border-color: var(--accent); }
.popup-confirm button:disabled { opacity: 0.7; cursor: default; }

/* --- Compact report card: the header and body lose their padding, lists their gaps --- */
.popup-header { padding: 0.55rem 0.8rem; }
.popup-title { font-size: 1.1rem; }
.popup-age { font-size: 0.8rem; }
.popup-body { padding: 0.6rem 0.8rem 0.7rem; }
.popup-tags { gap: 0.35rem; margin-bottom: 0.5rem; }
.popup-note { margin: 0.4rem 0; padding: 0.4rem 0.6rem; font-size: 0.9rem; line-height: 1.4; }
.alert-box { padding: 0.5rem 0.65rem; margin-top: 0.5rem; }

/* --- Colour key: tighter, and on a phone without the links the More list already has --- */
/* The legend chip (an icon) beside the travel chip: phones only, filled while the legend is open */
.key-chip { display: none; min-height: 44px; padding: 0 14px; border-radius: 12px; font-family: inherit; font-weight: 600; font-size: 0.92rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 10px var(--shadow); background: var(--card-bg); color: var(--text-main); border: 1px solid var(--border); }
.key-chip.on { background: var(--text-main); color: var(--bg); border-color: var(--text-main); }
@media (max-width: 768px) { .key-chip { display: inline-flex; align-items: center; } }
.legend-hint { font-size: 0.65rem; color: var(--text-muted); margin: 0.15rem 0 0.25rem; font-style: italic; }
@media (max-width: 768px) {
    .legend { padding: 0.6rem 0.75rem; }
    .legend > div:first-child { margin-bottom: 0.25rem !important; }
    .legend .legend-item { font-size: 0.82rem; margin-bottom: 0.15rem; }
    .legend .legend-item.filterable { min-height: 36px; padding: 0.15rem 0.5rem; }
    .legend .disclaimer-link { min-height: 0; padding: 0; }
    .legend-links { display: none !important; }
}

/* --- The look, IceReports' own parts (what both sites share is in css/look.css) --- */
.btn-report { border-radius: 12px; box-shadow: none; font-weight: 600; min-height: 50px; }
.btn-report:hover { transform: none; }
.section-toggle { background: none; border: none; border-top: 1px solid var(--border); border-radius: 0; padding: 0.9rem 0; margin: 1rem 0 0; color: var(--text-main); }
.photo-capture-btn { background: var(--fill); border: 1px dashed var(--border); border-radius: 10px; color: var(--text-main); font-weight: 500; }
.verdict { border-radius: 10px; }
.popup-confirm button.confirm-same { border-color: var(--border); background: var(--fill); }
.sos-coords { font: 700 1.25rem/1.3 'Inter', system-ui, sans-serif; letter-spacing: -0.01em; border-radius: 12px; background: var(--fill); border: none; }
.offline-info { background: var(--fill); border: none; border-radius: 12px; padding: 0.85rem 1rem; }
.offline-info h4 { color: var(--text-main); font-weight: 700; }
.offline-map-container { border: 1px solid var(--border); border-radius: 12px; }
.offline-bounds-overlay { border: 2px dashed var(--accent); border-radius: 12px; }
.travel-option .travel-icon { font-size: 1.4rem; }
.travel-option { min-height: 68px; }
/* The report card */
.popup-header { background: none; border-bottom: none; padding-bottom: 0.2rem; }
.popup-age { font-family: inherit; }
.tag { background: var(--fill); border: none; color: var(--text-muted); border-radius: 6px; }
.tag.trust { background: var(--fill); color: var(--text-muted); font-weight: 500; }
.popup-confirm button { font-weight: 500; }

/* First screen and small confirmations */
.delete-confirm-content h3 { color: var(--text-main); font-size: 1.15rem; font-weight: 700; }
.delete-confirm-buttons button { border-radius: 12px; font-weight: 600; }
.btn-cancel-delete { border: 1px solid var(--border); background: var(--bg); color: var(--text-main); }
