/* =============================================================================
   Nomad Riders Go — Bootstrap 5 dual-theme overrides + brand-specific styles
   ============================================================================= */

/* --- Brand tokens (shared between themes) ------------------------------- */
:root {
    --nr-accent: #e53935;
    --nr-accent-hover: #c62828;
    --nr-accent-active: #b71c1c;
    --nr-sidebar-width: 240px;
}

/* --- Dark theme (default) ----------------------------------------------- */
[data-bs-theme="dark"] {
    --bs-primary: #e53935;
    --bs-primary-rgb: 229, 57, 53;
    --bs-body-bg: #0f1117;
    --bs-body-color: #e1e3e8;
    --bs-secondary-bg: #181b24;
    --bs-tertiary-bg: #14161e;
    --bs-border-color: #262a36;
    --bs-border-color-translucent: rgba(255, 255, 255, 0.08);
    --bs-link-color: #ff5a52;
    --bs-link-hover-color: #ff7770;
    --bs-emphasis-color: #ffffff;
    --nr-sidebar-bg: #0a0d14;
    --nr-card-img-bg: #0a0d14;
    --nr-hero-gradient: linear-gradient(135deg, #1a1d29 0%, #2a1924 60%, #3d1d20 100%);
    --nr-banner-gradient: linear-gradient(90deg, #181b24 0%, #2a1620 100%);
    --nr-skeleton-bg: rgba(255, 255, 255, 0.05);
    --nr-skeleton-shimmer: rgba(255, 255, 255, 0.1);
    --nr-route-card-title: #ffffff;
}

/* --- Light theme -------------------------------------------------------- */
[data-bs-theme="light"] {
    --bs-primary: #c62828;
    --bs-primary-rgb: 198, 40, 40;
    --bs-link-color: #c62828;
    --bs-link-hover-color: #b71c1c;
    --nr-sidebar-bg: #f6f7f9;
    --nr-card-img-bg: #eef0f4;
    --nr-hero-gradient: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 60%, #ffd5d5 100%);
    --nr-banner-gradient: linear-gradient(90deg, #fff8f8 0%, #ffe8e8 100%);
    --nr-skeleton-bg: rgba(0, 0, 0, 0.06);
    --nr-skeleton-shimmer: rgba(0, 0, 0, 0.12);
    --nr-route-card-title: var(--bs-body-color);
}

html, body {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Bootstrap primary -> brand red (works in both themes) -------------- */
.btn-primary {
    --bs-btn-bg: var(--nr-accent);
    --bs-btn-border-color: var(--nr-accent);
    --bs-btn-hover-bg: var(--nr-accent-hover);
    --bs-btn-hover-border-color: var(--nr-accent-hover);
    --bs-btn-active-bg: var(--nr-accent-active);
    --bs-btn-active-border-color: var(--nr-accent-active);
    --bs-btn-disabled-bg: var(--nr-accent);
    --bs-btn-disabled-border-color: var(--nr-accent);
}

.btn-outline-primary {
    --bs-btn-color: var(--bs-link-color);
    --bs-btn-border-color: var(--nr-accent);
    --bs-btn-hover-bg: var(--nr-accent);
    --bs-btn-hover-border-color: var(--nr-accent);
    --bs-btn-active-bg: var(--nr-accent-active);
    --bs-btn-active-border-color: var(--nr-accent-active);
}

.text-primary { color: var(--nr-accent) !important; }

/* --- Form controls polish ------------------------------------------------ */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: var(--bs-tertiary-bg);
    border-color: var(--nr-accent);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
    color: var(--bs-body-color);
}

[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus {
    border-color: var(--nr-accent);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.18);
}

/* --- Cards -------------------------------------------------------------- */
[data-bs-theme="dark"] .card {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
}

/* --- Layout: sidebar + content shell ------------------------------------ */
.nr-app {
    display: flex;
    min-height: 100vh;
}

.nr-sidebar {
    width: var(--nr-sidebar-width);
    background: var(--nr-sidebar-bg);
    border-right: 1px solid var(--bs-border-color);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.nr-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 1.25rem 1.25rem;
    color: var(--bs-emphasis-color);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.nr-brand-logo { font-size: 1.6rem; }

.nr-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 1.25rem;
    color: var(--bs-secondary-color);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.nr-nav-link:hover {
    background: rgba(var(--bs-emphasis-color-rgb, 0, 0, 0), 0.04);
    color: var(--bs-emphasis-color);
    text-decoration: none;
}

[data-bs-theme="dark"] .nr-nav-link:hover {
    background: rgba(255, 255, 255, 0.04);
}

.nr-nav-link.active {
    background: rgba(229, 57, 53, 0.12);
    color: var(--bs-emphasis-color);
    border-left-color: var(--nr-accent);
}

/* Logout button styled as a nav link (in a form for circuit-less fallback). */
.nr-nav-link-button {
    width: 100%;
    background: transparent;
    border: 0;
    border-left: 3px solid transparent;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.nr-nav-link-button:focus { outline: none; }

.nr-nav-icon { width: 1.25rem; text-align: center; flex-shrink: 0; }
.nr-nav-spacer { flex: 1; }

.nr-content { flex: 1; min-width: 0; padding: 1.5rem 2rem 3rem; }

.nr-mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--nr-sidebar-bg);
    border-bottom: 1px solid var(--bs-border-color);
    position: sticky;
    top: 0;
    z-index: 1020;
}

@media (max-width: 991.98px) {
    .nr-sidebar { display: none; }
    .nr-mobile-header { display: flex; }
    .nr-content { padding: 1rem; }
}

.nr-app-mobile-shell { display: flex; flex-direction: column; min-height: 100vh; }

@media (min-width: 992px) {
    .nr-app-mobile-shell { display: contents; }
}

/* --- Theme toggle button ------------------------------------------------ */
.nr-theme-toggle {
    background: transparent;
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.nr-theme-toggle:hover {
    color: var(--bs-emphasis-color);
    border-color: var(--nr-accent);
    background: rgba(var(--bs-primary-rgb), 0.08);
}

.nr-theme-toggle .bi-sun-fill { display: none; }
[data-bs-theme="dark"] .nr-theme-toggle .bi-sun-fill { display: inline-block; }
[data-bs-theme="dark"] .nr-theme-toggle .bi-moon-stars-fill { display: none; }

/* --- Page headers ------------------------------------------------------- */
.nr-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.nr-page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
}

/* Sticky variant — pulls flush with content edges so background covers full width while scrolling. */
.nr-sticky-header {
    position: sticky;
    top: 0;
    z-index: 1100;
    background: var(--bs-body-bg);
    margin: -1.5rem -2rem 1.25rem;
    padding: 0.85rem 2rem;
    border-bottom: 1px solid var(--bs-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.nr-sticky-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.nr-sticky-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 991.98px) {
    .nr-sticky-header {
        top: 60px; /* below the mobile header */
        margin: -1rem -1rem 1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* --- Hero --------------------------------------------------------------- */
.nr-hero {
    background: var(--nr-hero-gradient);
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.nr-hero h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 0.5rem;
    color: var(--bs-emphasis-color);
}

.nr-hero p { margin: 0; color: var(--bs-secondary-color); font-size: 1.05rem; }

/* --- Subscribe banner --------------------------------------------------- */
.nr-subscribe-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--nr-banner-gradient);
    border: 1px solid var(--bs-border-color);
    border-left: 4px solid var(--nr-accent);
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.nr-subscribe-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.nr-avatar-fallback {
    align-items: center;
    justify-content: center;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    font-size: 1.6rem;
    border: 1px solid var(--bs-border-color);
}
.nr-subscribe-meta { flex: 1; min-width: 0; }
.nr-subscribe-meta h2 { margin: 0; font-size: 1.05rem; color: var(--bs-emphasis-color); }
.nr-subscribe-meta p { margin: 0.25rem 0 0; color: var(--bs-secondary-color); font-size: 0.9rem; }

@media (max-width: 600px) {
    .nr-subscribe-banner { flex-wrap: wrap; }
    .nr-subscribe-banner .btn { width: 100%; }
}

/* --- Route cards -------------------------------------------------------- */
.nr-route-card {
    display: flex;
    flex-direction: column;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
    height: 100%;
}

.nr-route-card:hover {
    transform: translateY(-3px);
    border-color: var(--nr-accent);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    text-decoration: none;
}

[data-bs-theme="dark"] .nr-route-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.nr-route-card-img {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--nr-card-img-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nr-route-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Mobile art-direction: taller for visual punch on small screens */
@media (max-width: 575.98px) {
    .nr-route-card-img { aspect-ratio: 4 / 3; }
}

.nr-route-card-placeholder {
    font-size: 2.75rem;
    color: var(--bs-secondary-color);
    opacity: 0.4;
}

.nr-video-badge {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    background: rgba(229, 57, 53, 0.95);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.nr-route-card-body {
    padding: 0.85rem 1rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nr-route-card-body h3 {
    font-size: 1.02rem;
    font-weight: 600;
    margin: 0;
    color: var(--nr-route-card-title);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nr-route-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.85rem;
    font-size: 0.82rem;
    color: var(--bs-secondary-color);
}

.nr-draft-badge {
    background: #5a4a00;
    color: #ffd54f;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    margin-right: 0.4rem;
    vertical-align: middle;
}

[data-bs-theme="light"] .nr-draft-badge {
    background: #fff8e1;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.nr-card-admin-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
    display: flex;
    gap: 0.35rem;
    padding: 0.3rem;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 8px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

[data-bs-theme="light"] .nr-card-admin-actions {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--bs-border-color);
}

.nr-icon-btn {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.nr-icon-btn:hover { background: var(--bs-secondary-bg); color: var(--bs-emphasis-color); }

.nr-icon-btn-danger:hover {
    background: rgba(229, 57, 53, 0.15);
    color: var(--nr-accent);
    border-color: var(--nr-accent);
}

/* --- Video tiles (Latest Videos on home) -------------------------------- */
.nr-video-tile {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 150ms ease, border-color 150ms ease;
    height: 100%;
}

.nr-video-tile:hover {
    transform: translateY(-2px);
    border-color: var(--nr-accent);
    text-decoration: none;
}

.nr-video-tile-img {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--nr-card-img-bg);
    overflow: hidden;
}

.nr-video-tile-img img { width: 100%; height: 100%; object-fit: cover; }

.nr-video-tile-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2.5rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
    opacity: 0.85;
    pointer-events: none;
}

.nr-video-tile-body { padding: 0.7rem 0.85rem 0.85rem; }

.nr-video-tile-title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--nr-route-card-title);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nr-video-tile-date { margin: 0.3rem 0 0; font-size: 0.78rem; color: var(--bs-secondary-color); }

/* --- Embedded video grid (route detail / admin form) -------------------- */
.nr-video-card {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    overflow: hidden;
}

.nr-video-card iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }

.nr-video-card p {
    padding: 0.6rem 0.85rem 0.4rem;
    margin: 0;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--nr-route-card-title);
}

.nr-video-card .btn { margin: 0 0.85rem 0.85rem; }

/* --- Login -------------------------------------------------------------- */
.nr-login-container {
    max-width: 420px;
    margin: 4rem auto;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    padding: 2.25rem 2rem;
}

.nr-login-container h1 {
    text-align: center;
    margin: 0 0 1.5rem;
    font-size: 1.5rem;
}

/* --- Map page ----------------------------------------------------------- */
.nr-fullmap {
    width: 100%;
    height: calc(100vh - 180px);
    min-height: 480px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
}

.nr-map {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
}

@media (max-width: 575.98px) {
    .nr-map { aspect-ratio: 4 / 3; }
    .nr-fullmap { height: calc(100vh - 140px); }
}

.nr-marker {
    background: transparent !important;
    border: none !important;
    font-size: 1.4rem;
    text-align: center;
    line-height: 1;
}

.nr-marker-start { color: #4caf50; }
.nr-marker-end { color: #e53935; }

/* GPX rubber-band editor anchor — small draggable dot. */
.nr-gpx-anchor {
    background: transparent !important;
    border: none !important;
}

.nr-gpx-anchor span {
    display: block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #1976d2;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
    cursor: grab;
}

.nr-gpx-anchor span:active {
    cursor: grabbing;
    background: #ff9800;
}

/* Gesture-handling hint shown when the user tries to scroll/pan the map
   with one finger or wheel-without-Ctrl, mirroring Google Maps embed UX. */
.nr-map-gesture {
    position: relative;
}

.nr-map-gesture-hint {
    position: absolute;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    font-weight: 600;
    font-size: 1rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.nr-map-gesture-hint-show {
    opacity: 1;
}

/* --- Waypoint cards ----------------------------------------------------- */
/* --- Waypoint slider ---------------------------------------------------- */
.nr-wp-slider {
    width: 100%;
    max-width: 720px;
    margin-inline: auto;
}

.nr-wp-slider-stage {
    position: relative;
}

.nr-wp-slider-viewport {
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-secondary-bg);
}

.nr-wp-slider-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.nr-wp-slide {
    flex: 0 0 100%;
    min-width: 100%;
    display: flex;
    flex-direction: column;
}

.nr-wp-slide__media {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bs-tertiary-bg);
    overflow: hidden;
    position: relative;
}

.nr-wp-slide__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.nr-wp-slide__media--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-secondary-color);
    font-size: 3rem;
    opacity: 0.35;
}

.nr-wp-slide__body {
    padding: 1rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.nr-wp-slide__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nr-wp-slide__icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bs-tertiary-bg);
    color: var(--nr-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
    border: 1px solid var(--bs-border-color);
}

.nr-wp-slide__title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.25;
    overflow-wrap: break-word;
}

.nr-wp-slide__meta {
    font-size: 0.825rem;
    color: var(--bs-secondary-color);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    margin-top: 0.15rem;
}

.nr-wp-slide__description {
    font-size: 0.9rem;
    color: var(--bs-body-color);
    line-height: 1.55;
    margin: 0;
    overflow-wrap: break-word;
}

/* Floating navigation arrows — sit on top of the image area */
.nr-wp-nav-row {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    aspect-ratio: 16 / 9;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    z-index: 2;
}

.nr-wp-nav {
    pointer-events: auto;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.nr-wp-nav:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.78);
}

.nr-wp-nav:disabled {
    opacity: 0;
    pointer-events: none;
}

/* Progress indicator */
.nr-wp-progress {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-top: 0.85rem;
}

.nr-wp-progress__counter {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    min-width: 3.5rem;
}

.nr-wp-progress__bar {
    flex: 1;
    height: 3px;
    background: var(--bs-border-color);
    border-radius: 999px;
    overflow: hidden;
}

.nr-wp-progress__fill {
    height: 100%;
    background: var(--nr-accent);
    border-radius: 999px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 575.98px) {
    .nr-wp-slide__media { aspect-ratio: 4 / 3; }
    .nr-wp-nav-row { aspect-ratio: 4 / 3; padding: 0 0.5rem; }
    .nr-wp-slide__body { padding: 0.85rem 1rem 1rem; }
    .nr-wp-slide__title { font-size: 1rem; }
    .nr-wp-nav { width: 2.25rem; height: 2.25rem; font-size: 1rem; }
}

.nr-waypoint-card {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    overflow: hidden;
}

.nr-waypoint-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bs-tertiary-bg);
    color: var(--nr-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
    border: 1px solid var(--bs-border-color);
}

.nr-waypoint-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-top: 1px solid var(--bs-border-color);
    border-bottom: 1px solid var(--bs-border-color);
}

/* --- Photo grid --------------------------------------------------------- */
.nr-photo {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--bs-border-color);
}

@media (max-width: 575.98px) {
    .nr-photo { aspect-ratio: 1 / 1; }
}

/* --- Elevation chart canvas wrapper ------------------------------------- */
.nr-elevation-chart {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    overflow: hidden;
}

.nr-elevation-chart canvas { display: block; width: 100%; }

/* --- Tag/badge ---------------------------------------------------------- */
.nr-tag {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
}

/* --- Searchable video picker (admin route form) ------------------------ */
.nr-video-picker-list {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    background: var(--bs-tertiary-bg);
}

.nr-video-picker-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.75rem;
    width: 100%;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--bs-border-color);
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 100ms ease;
}

.nr-video-picker-item:last-child { border-bottom: 0; }

.nr-video-picker-item:hover { background: rgba(229, 57, 53, 0.07); }

.nr-video-picker-item.selected {
    background: rgba(229, 57, 53, 0.14);
}

.nr-video-picker-checkbox {
    width: 1.4rem;
    flex-shrink: 0;
    color: var(--bs-secondary-color);
    font-size: 1.1rem;
    line-height: 1;
    text-align: center;
}

.nr-video-picker-item.selected .nr-video-picker-checkbox {
    color: var(--nr-accent);
}

.nr-video-picker-item img {
    width: 80px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    background: var(--nr-card-img-bg);
}

.nr-video-picker-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.nr-video-picker-meta .title {
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.3;
    color: var(--bs-emphasis-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.nr-video-picker-meta .date {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}

/* --- Skeletons ---------------------------------------------------------- */
.nr-skeleton {
    background: var(--nr-skeleton-bg);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.nr-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        var(--nr-skeleton-shimmer),
        transparent
    );
    transform: translateX(-100%);
    animation: nr-skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes nr-skeleton-shimmer {
    100% { transform: translateX(100%); }
}

.nr-skeleton-img {
    aspect-ratio: 16 / 10;
    border-radius: 10px 10px 0 0;
}

@media (max-width: 575.98px) {
    .nr-skeleton-img { aspect-ratio: 4 / 3; }
}

.nr-skeleton-line {
    height: 0.8rem;
    margin-bottom: 0.55rem;
}

.nr-skeleton-line.short { width: 40%; }
.nr-skeleton-line.medium { width: 65%; }
.nr-skeleton-line.long { width: 85%; }

/* --- Save overlay ------------------------------------------------------- */
.nr-save-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.nr-save-overlay__box {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.nr-save-overlay__spinner {
    width: 2.5rem;
    height: 2.5rem;
    border-width: 3px;
    color: var(--bs-primary);
}

.nr-save-overlay__label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--bs-body-color);
    margin: 0;
}

/* --- Toast container ---------------------------------------------------- */
.nr-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1090;
    max-width: 360px;
    pointer-events: none;
}

.nr-toast {
    pointer-events: auto;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-left: 4px solid var(--nr-accent);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.6rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    color: var(--bs-body-color);
    animation: nr-toast-in 220ms ease-out;
}

.nr-toast.nr-toast-leaving { animation: nr-toast-out 200ms ease-in forwards; }

.nr-toast-success { border-left-color: #2e7d32; }
.nr-toast-success .nr-toast-icon { color: #4caf50; }
.nr-toast-info { border-left-color: #1565c0; }
.nr-toast-info .nr-toast-icon { color: #42a5f5; }
.nr-toast-warning { border-left-color: #ef6c00; }
.nr-toast-warning .nr-toast-icon { color: #ffa726; }
.nr-toast-error { border-left-color: #c62828; }
.nr-toast-error .nr-toast-icon { color: #ef5350; }

.nr-toast-icon { font-size: 1.15rem; flex-shrink: 0; line-height: 1.2; }
.nr-toast-body { flex: 1; min-width: 0; font-size: 0.92rem; }
.nr-toast-title { font-weight: 600; margin-bottom: 0.15rem; color: var(--bs-emphasis-color); }
.nr-toast-close {
    background: transparent;
    border: 0;
    color: var(--bs-secondary-color);
    padding: 0;
    cursor: pointer;
    line-height: 1;
}
.nr-toast-close:hover { color: var(--bs-emphasis-color); }

@keyframes nr-toast-in {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes nr-toast-out {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* --- Reconnect modal ---------------------------------------------------- */
#components-reconnect-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 23, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1080;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}

#components-reconnect-modal > div {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-emphasis-color);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    max-width: 360px;
    text-align: center;
}
