/* RoadTrip site-specific styles. Loaded only by RoadTripLayout pages on
   the roadtrip.* host so the consumer site can have a different look
   from the admin UI without theme.css fighting it. Builds on the same
   CSS-variable system as theme.css (--bg, --card, --text, etc) but
   layers a softer, more inviting palette on top. */

.roadtrip-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: linear-gradient(180deg, #0f1014 0%, #14171c 100%);
    color: #f3f4f6;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Offline banner — sits above the topbar when the browser reports it's
   offline (the App.razor JS bridge sets data-online="false" on <html>).
   Hidden by default; the [data-online="false"] selector below reveals
   it. Amber on dark, warmer amber on light — signals "degraded" without
   being alarming red. */
.roadtrip-offline-banner {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #78350f;
    color: #fef3c7;
    font-size: 12px;
    text-align: center;
    justify-content: center;
}
[data-online="false"] .roadtrip-offline-banner {
    display: flex;
}
[data-theme="light"] .roadtrip-offline-banner {
    background: #fef3c7;
    color: #78350f;
    border-bottom: 1px solid #fde68a;
}

/* ---- Topbar ---- */
.roadtrip-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 28px;
    border-bottom: 1px solid #23252b;
    background: rgba(15, 16, 20, 0.85);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.roadtrip-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: #f3f4f6;
    text-decoration: none;
    letter-spacing: 0.2px;
}
.roadtrip-brand-icon { font-size: 22px; }
.roadtrip-brand-text { color: #60a5fa; }
.roadtrip-topbar-spacer { flex: 1; }
.roadtrip-topbar-actions {
    display: flex;
    gap: 14px;
    align-items: center;
}
.roadtrip-topbar-actions a {
    color: #d1d5db;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.roadtrip-topbar-actions a:hover { color: #f3f4f6; background: #1f2024; }
.roadtrip-topbar-actions a.roadtrip-cta {
    background: #2563eb;
    color: #fff;
    font-weight: 600;
}
.roadtrip-topbar-actions a.roadtrip-cta:hover { background: #1d4ed8; }

/* ---- Main + footer ---- */
.roadtrip-main {
    flex: 1;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px 48px;
}
.roadtrip-footer {
    padding: 18px 24px;
    text-align: center;
    color: #6b7280;
    font-size: 12px;
    border-top: 1px solid #23252b;
}

/* ---- Hero ---- */
.roadtrip-hero {
    text-align: center;
    padding: 48px 16px 24px;
}
.roadtrip-hero-title {
    font-size: 40px;
    font-weight: 800;
    margin: 0 0 14px;
    line-height: 1.15;
    background: linear-gradient(90deg, #60a5fa, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.roadtrip-hero-subtitle {
    font-size: 17px;
    color: #c2c5cc;
    max-width: 620px;
    margin: 0 auto 28px;
    line-height: 1.55;
}
.roadtrip-hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.roadtrip-hero-note {
    font-size: 13px;
    color: #9ca3af;
}

/* ---- Buttons ---- */
.roadtrip-btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
}
.roadtrip-btn:active { transform: translateY(1px); }
.roadtrip-btn-primary {
    background: #2563eb;
    color: #fff;
}
.roadtrip-btn-primary:hover { background: #1d4ed8; }
.roadtrip-btn-primary:disabled { background: #374151; color: #9ca3af; cursor: not-allowed; }
.roadtrip-btn-secondary {
    background: #1f2024;
    color: #f3f4f6;
    border: 1px solid #2c2f36;
}
.roadtrip-btn-secondary:hover { background: #262830; }
.roadtrip-btn-block { width: 100%; }

/* ---- Features grid ---- */
.roadtrip-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 48px;
}
.roadtrip-feature {
    background: #14171c;
    border: 1px solid #23252b;
    border-radius: 10px;
    padding: 22px;
}
.roadtrip-feature-icon { font-size: 28px; margin-bottom: 10px; }
.roadtrip-feature-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #f3f4f6;
}
.roadtrip-feature-text {
    font-size: 13px;
    line-height: 1.55;
    color: #9ca3af;
}

/* ---- Auth cards (sign-in / sign-up) ---- */
.roadtrip-auth-card {
    max-width: 420px;
    margin: 32px auto;
    background: #14171c;
    border: 1px solid #23252b;
    border-radius: 12px;
    padding: 28px;
}
.roadtrip-auth-card h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px;
}
.roadtrip-auth-subtitle {
    font-size: 13px;
    color: #9ca3af;
    margin-bottom: 18px;
    line-height: 1.5;
}
.roadtrip-auth-card label {
    display: block;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 12px;
    margin-bottom: 4px;
}
.roadtrip-auth-card input {
    width: 100%;
    padding: 10px 12px;
    background: #0f1014;
    border: 1px solid #2c2f36;
    border-radius: 6px;
    color: #f3f4f6;
    font-size: 14px;
    box-sizing: border-box;
}
.roadtrip-auth-card input:focus {
    outline: none;
    border-color: #60a5fa;
}
.roadtrip-auth-card .roadtrip-btn { margin-top: 18px; }
.roadtrip-auth-footer {
    margin-top: 18px;
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
}
.roadtrip-auth-footer a {
    color: #60a5fa;
    text-decoration: none;
}
.roadtrip-auth-footer a:hover { text-decoration: underline; }

.roadtrip-error {
    padding: 10px 12px;
    background: #2a1414;
    border: 1px solid #7f1d1d;
    border-radius: 6px;
    color: #fca5a5;
    font-size: 13px;
    margin-bottom: 12px;
}

@media (max-width: 600px) {
    .roadtrip-hero-title { font-size: 28px; }
    .roadtrip-hero-subtitle { font-size: 15px; }
    .roadtrip-main { padding: 16px 12px 32px; }
}

/* ─── Light-mode overrides ───
   Activated by [data-theme="light"] on the <html> root (set by the
   theme toggle JS in App.razor). The dark palette above is the
   default; these rules are the diff for light. Selectors are
   prefixed [data-theme="light"] .roadtrip-foo so they only apply
   to the consumer surface — admin pages use theme.css's variables
   and adapt automatically. */
[data-theme="light"] .roadtrip-shell {
    background: linear-gradient(180deg, #f6f8fa 0%, #ffffff 100%);
    color: #1f2937;
}
[data-theme="light"] .roadtrip-topbar {
    background: rgba(255, 255, 255, 0.9);
    border-bottom-color: #d0d7de;
}
[data-theme="light"] .roadtrip-brand {
    color: #1f2937;
}
[data-theme="light"] .roadtrip-topbar-actions a:not(.roadtrip-cta) {
    color: #57606a;
}
[data-theme="light"] .roadtrip-topbar-actions a:not(.roadtrip-cta):hover {
    color: #1f2937;
    background: #f0f2f5;
}
/* The Register CTA stays white-on-blue in both themes — the previous
   broad rule above was repainting it dark grey on its blue background,
   which made the label nearly unreadable. */
[data-theme="light"] .roadtrip-topbar-actions a.roadtrip-cta {
    color: #fff;
}
[data-theme="light"] .roadtrip-topbar-actions a.roadtrip-cta:hover {
    color: #fff;
    background: #1d4ed8;
}
[data-theme="light"] .roadtrip-footer {
    color: #6b7280;
    border-top-color: #d0d7de;
}
[data-theme="light"] .roadtrip-hero-subtitle {
    color: #4b5563;
}
[data-theme="light"] .roadtrip-hero-note {
    color: #6b7280;
}
[data-theme="light"] .roadtrip-feature {
    background: #ffffff;
    border-color: #d0d7de;
}
[data-theme="light"] .roadtrip-feature-title {
    color: #1f2937;
}
[data-theme="light"] .roadtrip-feature-text {
    color: #57606a;
}
[data-theme="light"] .roadtrip-btn-secondary {
    background: #f0f2f5;
    color: #1f2937;
    border-color: #d0d7de;
}
[data-theme="light"] .roadtrip-btn-secondary:hover {
    background: #e5e7eb;
}
/* Primary buttons (CTAs, Save, Sign in, +Add a route, …) stay white-on-blue
   in light mode. Without these explicit rules the document-level color
   (#1f2937) cascades onto the button label and you get unreadable dark
   text on a blue background. */
[data-theme="light"] .roadtrip-btn-primary {
    color: #fff;
}
[data-theme="light"] .roadtrip-btn-primary:hover {
    color: #fff;
}
/* The bare <button class="primary"> styling on admin pages comes from
   theme.css's variable system and adapts automatically — these rules
   only apply to consumer .roadtrip-* buttons. */
[data-theme="light"] .roadtrip-auth-card {
    background: #ffffff;
    border-color: #d0d7de;
}
[data-theme="light"] .roadtrip-auth-card label {
    color: #57606a;
}
[data-theme="light"] .roadtrip-auth-card input {
    background: #f6f8fa;
    border-color: #d0d7de;
    color: #1f2937;
}
[data-theme="light"] .roadtrip-auth-subtitle {
    color: #57606a;
}
[data-theme="light"] .roadtrip-auth-footer {
    color: #57606a;
}
[data-theme="light"] .roadtrip-error {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}
/* Generic .muted class used in trip pages */
[data-theme="light"] .muted {
    color: #57606a !important;
}
[data-theme="light"] code {
    background: #f0f2f5 !important;
    color: #1f2937 !important;
}
/* Inline form controls inside Trips.razor / TripManage.razor */
[data-theme="light"] .roadtrip-shell input,
[data-theme="light"] .roadtrip-shell textarea {
    background: #f6f8fa;
    border: 1px solid #d0d7de;
    color: #1f2937;
}

/* Theme toggle button — same shape on both themes, content swaps via :before */
.roadtrip-theme-toggle {
    background: transparent;
    border: 1px solid currentColor;
    color: inherit;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}
.roadtrip-theme-toggle:hover {
    opacity: 0.8;
}

/* ─── Card-inset: a nested card used inside .roadtrip-feature ───
   Route rows in TripManage, the "Add a member" panel, day-total
   summary boxes — anything that's a sub-card. Defaults to dark with
   a light-mode override below so the same class works in both
   themes. The previous code hardcoded #0f1014 inline; switching to
   this class is what lets light-mode actually read. */
.roadtrip-card-inset {
    background: #0f1014;
    border: 1px solid #23252b;
    border-radius: 6px;
    padding: 10px;
    color: inherit;
}
[data-theme="light"] .roadtrip-card-inset {
    background: #f6f8fa;
    border-color: #d0d7de;
    color: #1f2937;
}

/* Inline <code> chips inside cards — invite codes etc. */
.roadtrip-code-chip {
    font-size: 14px;
    background: #0f1014;
    color: inherit;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: bold;
    letter-spacing: 1px;
    border: 1px solid #23252b;
}
[data-theme="light"] .roadtrip-code-chip {
    background: #f0f2f5;
    border-color: #d0d7de;
    color: #1f2937;
}

/* Day-group section headers + totals strip */
.roadtrip-day-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #23252b;
}
[data-theme="light"] .roadtrip-day-header {
    border-bottom-color: #d0d7de;
}

/* Sub-card panel border at top (used between members and routes) */
[data-theme="light"] .roadtrip-shell hr,
[data-theme="light"] .roadtrip-shell [style*="border-top:1px solid #23252b"],
[data-theme="light"] .roadtrip-shell [style*="border-color:#23252b"] {
    /* Inline styles can't be overridden via CSS class without !important
       — these legacy spots in TripManage.razor still pick the dark
       border colour. Push our light value through. */
    border-top-color: #d0d7de !important;
    border-color: #d0d7de !important;
}

/* Trip-total summary card at the bottom of the routes section */
.roadtrip-totals-bar {
    margin-top: 6px;
    padding: 10px;
    background: #1a1b1f;
    border: 1px solid #23252b;
    border-radius: 6px;
}
[data-theme="light"] .roadtrip-totals-bar {
    background: #ffffff;
    border-color: #d0d7de;
}

/* Per-leg pill — "Leg 1: 12.3 km · 18 min" inside the show-map panel */
.roadtrip-leg-pill {
    background: #1a1b1f;
    border: 1px solid #23252b;
    padding: 2px 8px;
    border-radius: 10px;
    color: inherit;
}
[data-theme="light"] .roadtrip-leg-pill {
    background: #ffffff;
    border-color: #d0d7de;
}

/* Map containers in the route preview / route edit pages */
.roadtrip-map-frame {
    width: 100%;
    background: #1f2024;
    border: 1px solid #23252b;
    border-radius: 6px;
}
[data-theme="light"] .roadtrip-map-frame {
    background: #f0f2f5;
    border-color: #d0d7de;
}

/* ─── Tab strip on TripManage ─── */
.roadtrip-tabs {
    display: flex;
    gap: 2px;
    align-items: stretch;
    flex-wrap: wrap;
    border-bottom: 1px solid #23252b;
    margin-bottom: 14px;
}
[data-theme="light"] .roadtrip-tabs {
    border-bottom-color: #d0d7de;
}
.roadtrip-tab {
    background: transparent;
    border: none;
    color: #9ca3af;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.roadtrip-tab:hover {
    color: #f3f4f6;
    background: rgba(255,255,255,0.03);
}
.roadtrip-tab-active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}
[data-theme="light"] .roadtrip-tab {
    color: #57606a;
}
[data-theme="light"] .roadtrip-tab:hover {
    color: #1f2937;
    background: rgba(0,0,0,0.03);
}
[data-theme="light"] .roadtrip-tab-active {
    color: #1d4ed8;
    border-bottom-color: #1d4ed8;
}

/* ─── Today highlight on a day group in the Routes tab ─── */
.roadtrip-day-today {
    background: rgba(34, 197, 94, 0.06);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 8px;
    padding: 6px;
}
[data-theme="light"] .roadtrip-day-today {
    background: rgba(34, 197, 94, 0.10);
    border-color: rgba(22, 163, 74, 0.4);
}
.roadtrip-today-pill {
    display: inline-block;
    background: rgba(34, 197, 94, 0.18);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.4);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
[data-theme="light"] .roadtrip-today-pill {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
    border-color: rgba(22, 163, 74, 0.45);
}

/* ─── Live Map legend swatch ─── */
.roadtrip-legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.4);
    vertical-align: middle;
    margin-right: 6px;
}
[data-theme="light"] .roadtrip-legend-swatch {
    border-color: rgba(0,0,0,0.2);
}

/* ─── Info banner — yellow-bordered notice strip ───
   Used at the top of RouteEdit when in edit mode ("Editing an existing
   route…"). Hardcoded #1f2024 background read fine in dark mode but
   was an unreadable black bar on a near-white page in light. CSS class
   gives both palettes their own treatment. */
.roadtrip-info-banner {
    padding: 6px 10px;
    background: #1f2024;
    color: #f3f4f6;
    border-left: 3px solid #fbbf24;
    border-radius: 0 4px 4px 0;
    font-size: 12px;
}
[data-theme="light"] .roadtrip-info-banner {
    background: #fffbeb;
    color: #1f2937;
    border-left-color: #d97706;
}

/* Floating overlay over a map (e.g. "Re-routing…" pill at the top-right
   of the route-overview map, or the "📏 12 km · ⏱ 30 min" summary at
   the bottom-left). Two variants — info (amber) and success (green) —
   both light-mode-aware so they don't disappear into a white page. */
.roadtrip-map-overlay {
    position: absolute;
    padding: 4px 10px;
    background: rgba(15, 16, 20, 0.85);
    border: 1px solid #333;
    border-radius: 4px;
    font-size: 12px;
    color: #f3f4f6;
    pointer-events: none;
}
.roadtrip-map-overlay-info { color: #fbbf24; }
.roadtrip-map-overlay-success { color: #22c55e; }
[data-theme="light"] .roadtrip-map-overlay {
    background: rgba(255, 255, 255, 0.94);
    border-color: #d0d7de;
    color: #1f2328;
}
[data-theme="light"] .roadtrip-map-overlay-info { color: #b45309; }
[data-theme="light"] .roadtrip-map-overlay-success { color: #14532d; }

/* Inline editor hint — used for the "💡 Search above…" tip and the
   amber error / status messages inside the stop editor card. Picks up
   a soft amber surround in both themes so the text never falls back
   onto raw amber-on-white (unreadable). */
.roadtrip-editor-tip {
    padding: 6px 10px;
    background: rgba(251, 191, 36, 0.08);
    border-left: 3px solid #fbbf24;
    border-radius: 0 4px 4px 0;
    color: #fbbf24;
    font-size: 11px;
    margin-bottom: 6px;
}
[data-theme="light"] .roadtrip-editor-tip {
    background: #fffbeb;
    border-left-color: #d97706;
    color: #92400e;
}

/* ─── Chat bubbles (Messaging tab on TripManage) ───
   Three classes work together:
     .roadtrip-chat-bubble        → standard left-aligned bubble (someone else's message)
     .roadtrip-chat-bubble-mine   → right-aligned, primary-coloured (my message)
     .roadtrip-chat-bubble-meta   → small line above the body for sender name + email
   Each has a light-mode override below so the chat reads on both themes. */
.roadtrip-chat-bubble {
    display: inline-block;
    max-width: 78%;
    padding: 8px 12px;
    background: #1a1b1f;
    border: 1px solid #23252b;
    border-radius: 12px 12px 12px 2px;
    color: inherit;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
.roadtrip-chat-bubble-mine {
    display: inline-block;
    max-width: 78%;
    padding: 8px 12px;
    background: #1d4ed8;
    border: 1px solid #1e40af;
    border-radius: 12px 12px 2px 12px;
    color: #fff;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
.roadtrip-chat-bubble-meta {
    font-size: 11px;
    margin-bottom: 3px;
    line-height: 1.2;
}
.roadtrip-chat-bubble-meta strong {
    font-weight: 600;
    color: #f3f4f6;
}
.roadtrip-chat-bubble-meta .roadtrip-chat-meta-email {
    color: #9ca3af;
    margin-left: 6px;
}
.roadtrip-chat-bubble-meta .roadtrip-chat-meta-time {
    color: #9ca3af;
    margin-left: 6px;
}
.roadtrip-chat-bubble-meta .roadtrip-chat-meta-ticks {
    color: #60a5fa;
    margin-left: 6px;
    font-weight: bold;
}
[data-theme="light"] .roadtrip-chat-bubble {
    background: #f6f8fa;
    border-color: #d0d7de;
    color: #1f2937;
}
[data-theme="light"] .roadtrip-chat-bubble-mine {
    background: #1d4ed8;
    border-color: #1e40af;
    color: #fff;
}
[data-theme="light"] .roadtrip-chat-bubble-meta strong {
    color: #1f2937;
}
[data-theme="light"] .roadtrip-chat-bubble-meta .roadtrip-chat-meta-email,
[data-theme="light"] .roadtrip-chat-bubble-meta .roadtrip-chat-meta-time {
    color: #57606a;
}
[data-theme="light"] .roadtrip-chat-bubble-meta .roadtrip-chat-meta-ticks {
    color: #1d4ed8;
}

/* Meta-line inside MY bubble (blue background in both themes) needs
   light text — the default greys for email/time/ticks were essentially
   invisible against the #1d4ed8 fill. Override with white + slightly
   transparent variants so the line still reads as secondary metadata
   without disappearing. */
.roadtrip-chat-bubble-mine .roadtrip-chat-bubble-meta strong,
[data-theme="light"] .roadtrip-chat-bubble-mine .roadtrip-chat-bubble-meta strong {
    color: #ffffff;
}
.roadtrip-chat-bubble-mine .roadtrip-chat-bubble-meta .roadtrip-chat-meta-email,
.roadtrip-chat-bubble-mine .roadtrip-chat-bubble-meta .roadtrip-chat-meta-time,
[data-theme="light"] .roadtrip-chat-bubble-mine .roadtrip-chat-bubble-meta .roadtrip-chat-meta-email,
[data-theme="light"] .roadtrip-chat-bubble-mine .roadtrip-chat-bubble-meta .roadtrip-chat-meta-time {
    color: rgba(255, 255, 255, 0.78);
}
.roadtrip-chat-bubble-mine .roadtrip-chat-bubble-meta .roadtrip-chat-meta-ticks,
[data-theme="light"] .roadtrip-chat-bubble-mine .roadtrip-chat-bubble-meta .roadtrip-chat-meta-ticks {
    color: rgba(255, 255, 255, 0.92);
}

/* Container row — parent for one bubble. Right-align when the row
   carries .roadtrip-chat-row-mine so my bubble sits on the right edge. */
.roadtrip-chat-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 8px;
}
.roadtrip-chat-row-mine {
    align-items: flex-end;
}

/* The scrollable message list inside the messaging tab. Fixed height
   so the page itself doesn't scroll on long histories — the bubble
   list scrolls inside the card. */
.roadtrip-chat-scroll {
    height: 480px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid #23252b;
    border-radius: 6px;
    background: #0f1014;
}
[data-theme="light"] .roadtrip-chat-scroll {
    background: #f6f8fa;
    border-color: #d0d7de;
}

/* Image attachment inside a chat bubble. Capped to a sensible
   thumbnail size — the user clicks to open the full-resolution
   version in a new tab. Sits above any text body in the bubble
   (matches WhatsApp / iMessage layout). */
.roadtrip-chat-image-link {
    display: block;
    margin: 0 0 4px;
}
.roadtrip-chat-image {
    display: block;
    max-width: 280px;
    max-height: 280px;
    width: auto;
    height: auto;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #0f1014;
}
[data-theme="light"] .roadtrip-chat-image {
    border-color: #d0d7de;
    background: #ffffff;
}

/* Pending bubble — same shape as roadtrip-chat-bubble-mine but slightly
   faded so the user clearly sees "this hasn't gone yet." Green tick (✓)
   reserved for confirmed; pending uses the ⏱ glyph in the meta row. */
.roadtrip-chat-bubble-pending {
    opacity: 0.75;
    border: 1px dashed rgba(255, 255, 255, 0.3);
}
[data-theme="light"] .roadtrip-chat-bubble-pending {
    border-color: rgba(0, 0, 0, 0.18);
}

/* Inline delete button on a chat bubble's meta row — shown on the
   sender's own messages within the 24h delete window. Discreet by
   default, brighter on hover. */
.roadtrip-chat-delete-btn {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.55;
    cursor: pointer;
    font-size: 12px;
    padding: 0 4px;
    margin-left: 4px;
    line-height: 1;
}
.roadtrip-chat-delete-btn:hover {
    opacity: 1;
    color: #ef4444;
}

/* "🚫 message deleted" stub — replaces the body of a soft-deleted
   message. Italicised + muted so it's obvious the message used to be
   here but isn't anymore. */
.roadtrip-chat-deleted-stub {
    font-style: italic;
    opacity: 0.6;
    font-size: 12px;
}

/* Modal backdrop + card — used by the Navigate dialog (and any future
   trip-page overlay). Backdrop dims the page; clicking it closes.
   Card is a centred panel that stops the click from propagating so
   the user can interact with it without dismissing.
   Belt-and-braces fixed positioning: explicit top/left/width/height
   in viewport units (vh/vw) instead of `inset:0`, so any ancestor
   that's accidentally set up `transform`/`filter`/`will-change`
   (which would normally re-anchor `position:fixed` to that ancestor
   instead of the viewport) still gets the modal centred over the
   actual viewport. The high z-index puts it above sticky topbar
   (z:10), Leaflet maps (z:400), and SignalR overlays. */
.roadtrip-modal-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.6);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important;
    padding: 20px;
}
.roadtrip-modal-card {
    background: #14171c;
    color: #f3f4f6;
    border: 1px solid #2c2f36;
    border-radius: 10px;
    padding: 16px 18px;
    max-width: 420px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
[data-theme="light"] .roadtrip-modal-card {
    background: #ffffff;
    color: #1f2328;
    border-color: #d0d7de;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
}

/* "⋯ Actions" dropdown menu rendered under each route's Actions button.
   Absolute-positioned just below the trigger so it doesn't push the
   row layout around. Right-aligned so a route card on a narrow phone
   doesn't overflow off the right edge. The wrapping container has
   position:relative so this absolutely positions against the button. */
.roadtrip-actions-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 200px;
    background: #14171c;
    border: 1px solid #2c2f36;
    border-radius: 8px;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
    padding: 4px 0;
    /* Bumped above the backdrop (z:99) so the menu still receives
       pointer events while the backdrop captures clicks anywhere
       else on the page. Stays below the tabs dropdown (z:1100) and
       any modals (z:1500+) — those should win when nested. */
    z-index: 100;
    display: flex;
    flex-direction: column;
}
/* Click-outside catcher for the actions menu. Full-viewport, fixed,
   transparent — sits one z-level below the menu so a tap on it
   resolves to CloseActionsMenu without blocking the menu's items. */
.roadtrip-actions-backdrop {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 99;
    cursor: default;
}
[data-theme="light"] .roadtrip-actions-menu {
    background: #ffffff;
    border-color: #d0d7de;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
}
.roadtrip-actions-item {
    display: block;
    padding: 8px 14px;
    background: transparent;
    border: none;
    color: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    font-size: 13px;
    width: 100%;
}
.roadtrip-actions-item:hover {
    background: rgba(37, 99, 235, 0.15);
}
[data-theme="light"] .roadtrip-actions-item:hover {
    background: #e9eef6;
}
.roadtrip-actions-item-danger {
    color: #fca5a5;
}
.roadtrip-actions-item-danger:hover {
    background: rgba(185, 28, 28, 0.18);
    color: #fff;
}
[data-theme="light"] .roadtrip-actions-item-danger {
    color: #b91c1c;
}
[data-theme="light"] .roadtrip-actions-item-danger:hover {
    background: #fee2e2;
    color: #7f1d1d;
}

/* Small (40×40) round-cornered thumbnail of a member's vehicle cover
   photo, shown in the trip's Members section next to the member name.
   Falls back to a 🚗 emoji on the same backdrop when the member hasn't
   uploaded a photo yet. */
.roadtrip-member-vehicle-thumb {
    display: inline-flex;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: #0f1014;
    border: 1px solid #2c2f36;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.roadtrip-member-vehicle-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
[data-theme="light"] .roadtrip-member-vehicle-thumb {
    background: #f6f8fa;
    border-color: #d0d7de;
}

/* "Loading older messages…" hint at the top of the scroll region. */
.roadtrip-chat-loadmore {
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    padding: 6px 0;
}
[data-theme="light"] .roadtrip-chat-loadmore {
    color: #57606a;
}

/* The "Type a message…" textarea below the scroll region. Dark by
   default to match the rest of the chat surface; light-mode override
   gives a white card so the placeholder + typed text stay legible
   instead of the dark-on-light contrast bug we had before. */
.roadtrip-text-input {
    background: #0f1014;
    border: 1px solid #2c2f36;
    border-radius: 6px;
    color: #f3f4f6;
}
.roadtrip-text-input::placeholder {
    color: #6b7280;
}
[data-theme="light"] .roadtrip-text-input {
    background: #ffffff;
    border-color: #d0d7de;
    color: #1f2328;
}
[data-theme="light"] .roadtrip-text-input::placeholder {
    color: #8b95a1;
}
[data-theme="light"] .roadtrip-text-input:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* ─── Danger button — destructive actions (Delete route, Leave trip, Kick member) ─── */
.roadtrip-btn-danger {
    background: #b91c1c;
    color: #fff;
    border: 1px solid #7f1d1d;
}
.roadtrip-btn-danger:hover {
    background: #991b1b;
    color: #fff;
}
.roadtrip-btn-danger:disabled {
    background: #7f1d1d;
    color: #fca5a5;
    cursor: not-allowed;
}
/* Keep white text in light mode too — without this rule the
   document-level color (#1f2937) would override the .color: #fff
   declared above and render the label dark on red. */
[data-theme="light"] .roadtrip-btn-danger,
[data-theme="light"] .roadtrip-btn-danger:hover {
    color: #fff;
}

/* ─────────────────────────────────────────────────────────────────
   Mobile responsiveness — kills the horizontal scroll on phones.
   ─────────────────────────────────────────────────────────────────

   The pages were built max-width:840-920px with assumption of a
   wide viewport. On narrow phones (< 400 px) several inline rules
   force overflow:
     • flex children with min-width:200px don't shrink below
       their min, total row > viewport
     • topbar's padding:14px 28px wastes a lot of horizontal space
     • images / pre-blocks without max-width:100% can blow out wider
       than their container
     • .muted runs with monospace coords (43.60127, 3.80657) can
       extend past the viewport on small screens
   These rules backstop all of those. */

/* Hard cap the page width to viewport. Belt-and-braces overflow:hidden
   on body so anything that does overshoot gets clipped instead of
   producing a scrollbar. */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
    width: 100%;
}
.roadtrip-shell {
    max-width: 100vw;
    overflow-x: hidden;
    width: 100%;
}
/* Belt-and-braces against any rogue child that ignores its parent —
   most often a Leaflet map container, an iframe, or a card that's
   set min-width with a hardcoded pixel value that exceeds the viewport. */
.roadtrip-main {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Universal box-sizing inside the shell so widths include padding —
   fixes a cascade of "child + padding > parent" overflows. */
.roadtrip-shell *,
.roadtrip-shell *::before,
.roadtrip-shell *::after {
    box-sizing: border-box;
}

/* Images / iframes / video — never allowed to push their parent
   wider than the parent itself. Fixes route-preview maps, chat
   image attachments, vehicle photos. */
.roadtrip-shell img,
.roadtrip-shell video,
.roadtrip-shell iframe,
.roadtrip-shell svg {
    max-width: 100%;
    height: auto;
}

/* Form fields — text inputs, textareas, selects — never wider than
   their container. Inline width:200px / min-width:200px declarations
   on individual fields still apply, but they combine with this so
   the FIELD width caps at parent width. */
.roadtrip-shell input,
.roadtrip-shell textarea,
.roadtrip-shell select {
    max-width: 100%;
}

/* Long unbroken strings (URLs, GPS coords, monospace tokens) wrap
   instead of pushing the row wide. */
.roadtrip-shell .muted,
.roadtrip-shell pre,
.roadtrip-shell code {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Tabs dropdown — narrow-viewport replacement for the inline tab
   strip. Hidden on wide screens; the @@media query below flips them.
   Designed to look like a sleeker version of a native <select> —
   icon + label + chevron, tap to reveal a panel of options. */
.roadtrip-tabs-dropdown {
    display: none;
    position: relative;
    width: 100%;
}
.roadtrip-tabs-dropdown-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: #14171c;
    color: #f3f4f6;
    border: 1px solid #2c2f36;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.roadtrip-tabs-dropdown-trigger:hover {
    border-color: #2563eb;
}
[data-theme="light"] .roadtrip-tabs-dropdown-trigger {
    background: #ffffff;
    color: #1f2328;
    border-color: #d0d7de;
}
.roadtrip-tabs-dropdown-trigger .caret {
    color: #6b7280;
    font-size: 12px;
    transition: transform 180ms ease;
}
.roadtrip-tabs-dropdown.is-open .roadtrip-tabs-dropdown-trigger .caret {
    transform: rotate(180deg);
}
.roadtrip-tabs-dropdown-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #14171c;
    border: 1px solid #2c2f36;
    border-radius: 10px;
    overflow: hidden;
    /* Leaflet's control containers (zoom +/-, attribution, scale) sit
       at z-index 1000 by default, so 1000 was a tie that Leaflet won
       on most browsers' stacking-context heuristics — the +/- buttons
       bled through the dropdown. Bumped to 1100 to sit cleanly above
       all Leaflet UI while still leaving headroom (modals at 9999
       stay above us, which is what we want for nested confirmations).
     */
    z-index: 1100;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
    display: none;
}
.roadtrip-tabs-dropdown.is-open .roadtrip-tabs-dropdown-panel {
    display: block;
}
[data-theme="light"] .roadtrip-tabs-dropdown-panel {
    background: #ffffff;
    border-color: #d0d7de;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
}
.roadtrip-tabs-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: none;
    color: inherit;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.roadtrip-tabs-dropdown-item:last-child { border-bottom: none; }
.roadtrip-tabs-dropdown-item:hover {
    background: rgba(37, 99, 235, 0.15);
}
[data-theme="light"] .roadtrip-tabs-dropdown-item {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .roadtrip-tabs-dropdown-item:hover {
    background: #e9eef6;
}
.roadtrip-tabs-dropdown-item.is-active {
    background: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
    font-weight: 600;
}
[data-theme="light"] .roadtrip-tabs-dropdown-item.is-active {
    background: #dbeafe;
    color: #1d4ed8;
}
/* Divider between the tab list and the page-action items
   (View memento / Leave trip). Slim line, matches the panel
   border colour for a subtle separation. */
.roadtrip-tabs-dropdown-divider {
    height: 1px;
    background: #2c2f36;
    margin: 4px 0;
}
[data-theme="light"] .roadtrip-tabs-dropdown-divider {
    background: #d0d7de;
}
.roadtrip-tabs-dropdown-item-danger {
    color: #fca5a5;
}
.roadtrip-tabs-dropdown-item-danger:hover {
    background: rgba(185, 28, 28, 0.18);
    color: #fff;
}
[data-theme="light"] .roadtrip-tabs-dropdown-item-danger {
    color: #b91c1c;
}
[data-theme="light"] .roadtrip-tabs-dropdown-item-danger:hover {
    background: #fee2e2;
    color: #7f1d1d;
}

/* Burger button — invisible on wide screens, slides into the topbar
   below 600 px. Just a 36×36 square with a glyph that toggles between
   ☰ and ✕ depending on menu state. */
.roadtrip-burger {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid #2c2f36;
    background: transparent;
    color: inherit;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
[data-theme="light"] .roadtrip-burger {
    border-color: #d0d7de;
}

/* Click-outside backdrop for the open burger menu. Sits between
   the topbar (which contains the menu nav, z-index ~10) and the
   page content. A click on the backdrop bubbles up to the layout's
   @onclick handler which clears the open state. Hidden on wide
   screens via the @media query that controls the burger itself. */
.roadtrip-burger-backdrop {
    display: none;
}
@media (max-width: 600px) {
    .roadtrip-burger-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: transparent;
        z-index: 5;
        cursor: default;
    }
}
/* The "you are signed in as Tom" username chip — hidden on narrow
   screens (room is at a premium, name shows inside the burger menu). */
.roadtrip-topbar-username {
    color: var(--text-muted, #9ca3af);
    font-size: 13px;
}

/* Phone-shaped viewports (≤ 700 px wide). Tighter padding on the
   structural elements + drop the inline min-width:200px floors so
   form fields can shrink to fit. */
@media (max-width: 700px) {
    .roadtrip-topbar {
        padding: 10px 14px;
        gap: 10px;
    }
    .roadtrip-main {
        padding: 12px;
    }
    .roadtrip-feature {
        padding: 12px 14px;
    }
    .roadtrip-card-inset {
        padding: 10px 12px;
    }
    /* Override hard-coded min-widths on flex inputs that were
       making rows overflow. The flex:1 still does the right thing,
       fields just shrink down to 0 instead of ploughing past the
       viewport. */
    .roadtrip-shell input[style*="min-width"],
    .roadtrip-shell select[style*="min-width"] {
        min-width: 0 !important;
    }
    .roadtrip-shell div[style*="min-width:200"],
    .roadtrip-shell div[style*="min-width:160"] {
        min-width: 0 !important;
    }

    /* Burger menu pattern — replace the inline nav with a button +
       slide-down panel. Topbar nav becomes a vertical stack
       absolutely-positioned under the topbar; toggling the
       <nav>'s class drops it in via a tiny transform. */
    .roadtrip-burger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .roadtrip-topbar-actions {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 14px 14px;
        background: rgba(15, 16, 20, 0.98);
        backdrop-filter: blur(8px);
        border-bottom: 1px solid #23252b;
        transform: translateY(-200%);
        transition: transform 220ms ease;
        pointer-events: none;
        z-index: 9;
    }
    [data-theme="light"] .roadtrip-topbar-actions {
        background: rgba(255, 255, 255, 0.98);
        border-bottom-color: #d0d7de;
    }
    .roadtrip-topbar-actions.roadtrip-topbar-actions-open {
        transform: translateY(0);
        pointer-events: auto;
    }
    .roadtrip-topbar-actions a,
    .roadtrip-topbar-actions .roadtrip-topbar-username {
        padding: 12px 6px;
        border-bottom: 1px solid #23252b;
        font-size: 15px;
        text-align: left;
    }
    [data-theme="light"] .roadtrip-topbar-actions a,
    [data-theme="light"] .roadtrip-topbar-actions .roadtrip-topbar-username {
        border-bottom-color: #d0d7de;
    }
    .roadtrip-topbar-actions a:last-child {
        border-bottom: none;
    }
    .roadtrip-theme-toggle {
        align-self: flex-start;
    }

    /* Tab strip → dropdown on narrow viewports. The inline strip
       (.roadtrip-tabs) is hidden; the .roadtrip-tabs-dropdown
       picker takes its place — a single button showing the active
       tab + caret, reveals a drop panel of options on tap. Clean,
       single-row, never overflows. */
    .roadtrip-tabs {
        display: none !important;
    }
    .roadtrip-tabs-dropdown {
        display: block !important;
    }
    /* Hide the wide-screen inline View memento / Leave trip buttons
       on narrow — the dropdown's copy of the same items is already
       there, no need to duplicate. */
    .roadtrip-tab-actions-wide {
        display: none !important;
    }

    /* Route card action row — on wide screens the title + buttons
       sit side-by-side. On narrow the buttons MUST stack below the
       title or the title gets squeezed into a 30 px column and
       wraps every couple of letters. The card's outer flex
       (justify-content:space-between) is the trigger; we override
       it to wrap-and-stack here. */
    .roadtrip-card-inset > div[style*="justify-content:space-between"],
    .roadtrip-feature > div[style*="justify-content:space-between"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    /* Action button rows themselves still wrap left-to-right within
       their stacked-below position — gives the user a clean row of
       Show map / Navigate / Actions at full width. */
    .roadtrip-card-inset > div[style*="justify-content:space-between"] > div[style*="flex-wrap:wrap"],
    .roadtrip-feature > div[style*="justify-content:space-between"] > div[style*="flex-wrap:wrap"] {
        justify-content: flex-start !important;
    }

    /* Memento page padding — drop from 60 px desktop hero spacing
       to something sensible on phones. */
    .memento .wrap,
    .memento {
        padding: 16px 12px !important;
    }
}

