/* WordPress Integration - Container Reset & Isolation */
#runroute-app {
    /* Position below theme header */
    display: block;
    position: fixed;
    top: 68px; /* Theme header height */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1; /* Below theme header */
    font-family: 'Jost', 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    box-sizing: border-box;
}

/* Reset box model for children */
#runroute-app *,
#runroute-app *::before,
#runroute-app *::after {
    box-sizing: border-box;
}

/* Preserve Font Awesome icons (NOT .fab which is for floating action buttons) */
#runroute-app .fa,
#runroute-app .fas,
#runroute-app .far,
#runroute-app .fal,
#runroute-app .fat,
#runroute-app .fad {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 5 Free", "Font Awesome 5 Pro" !important;
    font-weight: 900;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: inline-block;
    line-height: 1;
}

#runroute-app .far { font-weight: 400; }
#runroute-app .fal { font-weight: 300; }
#runroute-app .fat { font-weight: 100; }

/* WP Admin Bar Offset - accounts for theme header */
body.admin-bar #runroute-app { top: calc(32px + 68px); }
@media screen and (max-width: 782px) {
    body.admin-bar #runroute-app { top: calc(46px + 60px); }
}

/* Mobile header height adjustment */
@media (max-width: 860px) {
    #runroute-app { top: 60px; }
}

/* ========================================
   1. CSS CUSTOM PROPERTIES / THEMING
   ======================================== */
:root {
    /* Brand colors */
    --green: #00D46A;
    --green-dark: #00A855;
    --orange: #FF4D00;
    --orange-dark: #CC3A00;
    --blue: #1A8FFF;
    --red: #FF3B30;
    --yellow: #FFCC00;

    /* Light theme (default) */
    --bg-base: #F0F2F6;
    --bg-primary: #ffffff;
    --bg-secondary: #E8EBF2;
    --bg-tertiary: #dde1ea;
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --text-tertiary: #9CA3AF;
    --separator: rgba(17, 24, 39, 0.08);

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.80);
    --glass-bg-thick: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(0, 0, 0, 0.06);
    --glass-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);

    /* Component tokens */
    --topbar-h: 52px;
    --sidebar-w: 340px;
    --bottombar-h: 54px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 999px;
    --transition: 0.28s cubic-bezier(0.4, 0, 0.2, 1);

    /* Kort tile filter */
    --map-filter: none;
}

/* ========================================
   2. BASE
   ======================================== */
#runroute-app .app {
    font-family: 'Jost', 'Helvetica Neue', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
    height: 100%;
    width: 100%;
    position: relative;
}

#runroute-app button { font-family: inherit; cursor: pointer; border: none; background: none; }
#runroute-app input { font-family: inherit; border: none; outline: none; background: none; }

/* ========================================
   3. GLASS UTILITY
   ======================================== */
#runroute-app .glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
}
#runroute-app .glass-thick {
    background: var(--glass-bg-thick);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border: 1px solid var(--glass-border);
}

/* ========================================
   4. APP LAYOUT
   ======================================== */
#runroute-app .app {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
}

/* --- TOPBAR --- */
#runroute-app .topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 1000;
    box-shadow: var(--glass-shadow);
    position: relative;
}

#runroute-app .topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

#runroute-app .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    user-select: none;
}

#runroute-app .logo-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#runroute-app .logo-text {
    background: linear-gradient(135deg, var(--green), var(--orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#runroute-app .topbar-center { flex: 1; display: flex; justify-content: center; }
#runroute-app .topbar-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

/* --- SEARCH BAR --- */
#runroute-app .search-wrap {
    position: relative;
    width: 100%;
    max-width: 400px;
}

#runroute-app .search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    height: 36px;
    background: var(--bg-secondary);
    border-radius: var(--radius-pill);
    border: 1px solid var(--separator);
    transition: all var(--transition);
    width: 100%;
}

#runroute-app .search-bar:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

#runroute-app .search-bar i { color: var(--text-tertiary); font-size: 0.8rem; flex-shrink: 0; }

#runroute-app .search-bar input {
    flex: 1;
    font-size: 0.88rem;
    color: var(--text-primary);
    min-width: 0;
}

#runroute-app .search-bar input::placeholder { color: var(--text-tertiary); }

#runroute-app .search-clear {
    display: none;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    padding: 4px;
}
#runroute-app .search-clear.visible { display: flex; }

#runroute-app .search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--glass-bg-thick);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    display: none;
    z-index: 1001;
    max-height: 280px;
    overflow-y: auto;
}

#runroute-app .search-results.visible { display: block; }

#runroute-app .search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--separator);
}

#runroute-app .search-result-item:last-child { border-bottom: none; }
#runroute-app .search-result-item:hover { background: var(--bg-tertiary); }

#runroute-app .search-result-item i { color: var(--text-tertiary); width: 16px; text-align: center; }

#runroute-app .search-result-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#runroute-app .search-spinner {
    padding: 16px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

/* --- ICON BUTTON --- */
#runroute-app .icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition);
    position: relative;
}
#runroute-app .icon-btn:hover { background: var(--bg-tertiary); }
#runroute-app .icon-btn:active { transform: scale(0.92); }
#runroute-app .icon-btn:disabled { opacity: 0.35; pointer-events: none; }

/* --- TOPBAR (Hidden - Using Theme Header) --- */
#runroute-app .topbar {
    display: none;
}

/* --- FLOATING ACTION BUTTONS (Settings) --- */
#runroute-app .fab-theme {
    display: none !important;
}

#runroute-app .fab-settings {
    position: absolute;
    right: 16px;
    z-index: 900;
    bottom: 136px;
}

/* --- MAIN CONTENT --- */
#runroute-app .main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Hide topbar - using theme header instead */
#runroute-app .topbar { display: none !important; }

/* --- SETTINGS FAB --- */
#runroute-app .fab-settings {
    position: absolute;
    right: 16px;
    z-index: 800;
    bottom: 136px;
}

/* --- SIDEBAR --- */
#runroute-app .sidebar {
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 900;
    box-shadow: var(--glass-shadow);
    transition: transform var(--transition);
    border-right: 1px solid var(--glass-border);
}

/* Dark sidebar — matches lobeklubben theme header palette */
#runroute-app .sidebar {
    background: #0D1220;
    --text-primary: #f0f2f6;
    --text-secondary: rgba(240, 242, 246, 0.62);
    --text-tertiary: rgba(240, 242, 246, 0.38);
    --separator: rgba(255, 255, 255, 0.08);
    --bg-primary: #0D1220;
    --bg-secondary: #131B2C;
    --bg-tertiary: #192235;
    --glass-bg: rgba(13, 18, 32, 0.80);
    --glass-bg-thick: rgba(13, 18, 32, 0.96);
    --glass-border: rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

#runroute-app .sidebar::-webkit-scrollbar { width: 4px; }
#runroute-app .sidebar::-webkit-scrollbar-track { background: transparent; }
#runroute-app .sidebar::-webkit-scrollbar-thumb { background: var(--text-tertiary); border-radius: 2px; }

#runroute-app .sidebar-section {
    padding: 18px 18px 0 18px;
}
#runroute-app .sidebar-section:last-child { padding-bottom: 18px; }

#runroute-app .section-label {
    font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Collapsible sections */
#runroute-app .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding-bottom: 2px;
    user-select: none;
}

#runroute-app .section-header .chevron {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    transition: transform var(--transition);
}

#runroute-app .section-header.collapsed .chevron { transform: rotate(-90deg); }
#runroute-app .section-body { overflow: hidden; transition: max-height 0.3s ease; }
#runroute-app .section-body.collapsed { max-height: 0 !important; }

/* --- SEGMENTED CONTROL --- */
#runroute-app .segmented-control {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
    border: 1px solid var(--separator);
}

#runroute-app .segment {
    flex: 1;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

#runroute-app .segment.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    font-weight: 600;
}

#runroute-app .segment:not(.active):hover { color: var(--text-primary); }
#runroute-app .segment i { font-size: 0.78rem; }

/* --- iOS TOGGLE --- */
#runroute-app .option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--separator);
}

#runroute-app .option-row:last-child { border-bottom: none; }

#runroute-app .option-label {
    font-size: 0.88rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

#runroute-app .option-label i { color: var(--text-tertiary); width: 18px; text-align: center; }

#runroute-app .ios-toggle {
    width: 46px;
    height: 28px;
    border-radius: 14px;
    background: var(--bg-tertiary);
    position: relative;
    cursor: pointer;
    transition: background var(--transition);
    flex-shrink: 0;
}

#runroute-app .ios-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform var(--transition);
}

#runroute-app .ios-toggle.active { background: var(--green); }
#runroute-app .ios-toggle.active::after { transform: translateX(18px); }
/* --- WAYPOINTS LIST --- */
#runroute-app .waypoints-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

#runroute-app .waypoints-list::-webkit-scrollbar { width: 3px; }
#runroute-app .waypoints-list::-webkit-scrollbar-thumb { background: var(--text-tertiary); border-radius: 2px; }

#runroute-app .waypoint-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--separator);
    transition: all var(--transition);
    cursor: grab;
    position: relative;
}

#runroute-app .waypoint-item:hover { background: var(--bg-tertiary); }
#runroute-app .waypoint-item.dragging { opacity: 0.5; cursor: grabbing; }

#runroute-app .wp-marker {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.7rem;
    color: white;
    flex-shrink: 0;
}

#runroute-app .wp-marker.start { background: var(--green); }
#runroute-app .wp-marker.end { background: var(--orange); }
#runroute-app .wp-marker.via { background: var(--blue); }

#runroute-app .wp-info {
    flex: 1;
    min-width: 0;
}

#runroute-app .wp-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#runroute-app .wp-coords {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

#runroute-app .wp-delete {
    color: var(--text-tertiary);
    padding: 4px;
    font-size: 0.75rem;
    transition: color var(--transition);
    flex-shrink: 0;
}

#runroute-app .wp-delete:hover { color: var(--red); }

#runroute-app .empty-state {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-tertiary);
}

#runroute-app .empty-state i {
    font-size: 1.6rem;
    margin-bottom: 8px;
    display: block;
    opacity: 0.5;
}

#runroute-app .empty-state p { font-size: 0.85rem; line-height: 1.5; }

/* --- STATS GRID --- */
#runroute-app .stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

#runroute-app .stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--separator);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
    transition: transform var(--transition);
}

#runroute-app .stat-card:hover { transform: translateY(-1px); }

#runroute-app .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

#runroute-app .stat-unit {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 2px;
}

#runroute-app .stat-label {
    font-size: 0.68rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

#runroute-app .stat-card.dist .stat-value { color: var(--orange); }
#runroute-app .stat-card.gain .stat-value { color: var(--green); }
#runroute-app .stat-card.loss .stat-value { color: var(--red); }
#runroute-app .stat-card.wps .stat-value { color: var(--blue); }
#runroute-app .stat-card.cal .stat-value { color: #E8590C; }

/* Calorie stat card spans full width on its own row */
#runroute-app .stat-card.cal {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(232, 89, 12, 0.06), rgba(255, 107, 53, 0.04));
}

/* --- ACTION BUTTONS --- */
#runroute-app .action-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 6px;
}

#runroute-app .btn-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: var(--radius-pill);
    font-size: 0.88rem;
    font-weight: 600;
    transition: all var(--transition);
}

#runroute-app .btn-pill:active { transform: scale(0.97); }
#runroute-app .btn-pill:disabled { opacity: 0.4; pointer-events: none; }

#runroute-app .btn-primary-fill {
    background: var(--green);
    color: white;
}
#runroute-app .btn-primary-fill:hover { background: var(--green-dark); box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3); }

#runroute-app .btn-accent-fill {
    background: var(--orange);
    color: white;
}
#runroute-app .btn-accent-fill:hover { background: var(--orange-dark); box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3); }

#runroute-app .btn-accent-outline {
    background: transparent;
    color: var(--orange);
    border: 1.5px solid var(--orange);
}
#runroute-app .btn-accent-outline:hover { background: var(--orange); color: white; box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3); }

#runroute-app .btn-secondary-fill {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--separator);
}
#runroute-app .btn-secondary-fill:hover { background: var(--bg-tertiary); }

#runroute-app .btn-danger-text {
    color: var(--red);
    background: none;
}
#runroute-app .btn-danger-text:hover { background: rgba(255, 59, 48, 0.08); }

/* --- MAP CONTAINER --- */
#runroute-app .map-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#runroute-app #map {
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
}

/* --- FLOATING SEARCH OVERLAY --- */
#runroute-app .map-search-overlay {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 400px;
    max-width: calc(100% - 32px);
}

#runroute-app .map-search-overlay .search-wrap {
    position: relative;
    width: 100%;
}

#runroute-app .map-search-overlay .search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    height: 44px;
    background: var(--glass-bg-thick);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    width: 100%;
    transition: all var(--transition);
}

#runroute-app .map-search-overlay .search-bar:focus-within {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(255, 77, 0, 0.15), var(--glass-shadow);
}

#runroute-app .map-search-overlay .search-bar i {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    flex-shrink: 0;
}

#runroute-app .map-search-overlay .search-bar input {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
    min-width: 0;
    background: transparent;
}

#runroute-app .map-search-overlay .search-bar input::placeholder {
    color: var(--text-tertiary);
}

#runroute-app .map-search-overlay .search-clear {
    display: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all var(--transition);
}

#runroute-app .map-search-overlay .search-clear:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

#runroute-app .map-search-overlay .search-clear.visible {
    display: flex;
}

#runroute-app .map-search-overlay .search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--glass-bg-thick);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
}

#runroute-app .map-search-overlay .search-results.active,
#runroute-app .map-search-overlay .search-results.visible {
    display: block;
}

#runroute-app .map-search-overlay .search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--separator);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

#runroute-app .map-search-overlay .search-result-item:last-child {
    border-bottom: none;
}

#runroute-app .map-search-overlay .search-result-item:hover {
    background: var(--bg-tertiary);
}

#runroute-app .map-search-overlay .search-result-item i {
    color: var(--orange);
    margin-top: 3px;
}

#runroute-app .map-search-overlay .search-result-item .result-text {
    flex: 1;
    min-width: 0;
}

#runroute-app .map-search-overlay .search-result-item .result-name {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-primary);
}

#runroute-app .map-search-overlay .search-result-item .result-address {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Mobile: search bar offset to leave room for Leaflet zoom controls (top-left ~46px) */
@media (max-width: 600px) {
    #runroute-app .map-search-overlay {
        top: 12px;
        left: 54px;
        right: 12px;
        width: auto;
        max-width: none;
        transform: none;
    }
}

/* --- FLOATING SEARCH OVERLAY --- */
#runroute-app .map-search-overlay {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 400px;
    max-width: calc(100% - 32px);
}

#runroute-app .map-search-overlay .search-wrap {
    max-width: none;
    width: 100%;
}

#runroute-app .map-search-overlay .search-bar {
    background: var(--glass-bg-thick);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

#runroute-app .map-search-overlay .search-results {
    max-height: 300px;
    overflow-y: auto;
}

@media (max-width: 600px) {
    #runroute-app .map-search-overlay {
        left: 54px;
        right: 12px;
        width: auto;
        transform: none;
    }
}

/* Floating action buttons - repositioned */
#runroute-app .fab-settings {
    position: absolute;
    right: 16px;
    z-index: 900;
    bottom: 130px;
}

/* Mørk tilstand map tiles */
#runroute-app[data-theme="dark"] .leaflet-tile-pane { filter: var(--map-filter); }

/* Leaflet control overrides */
#runroute-app .leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--glass-shadow) !important;
    border-radius: var(--radius-sm) !important;
    overflow: hidden;
}

#runroute-app .leaflet-control-zoom a {
    background: var(--glass-bg-thick) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    color: var(--text-primary) !important;
    border: none !important;
    border-bottom: 1px solid var(--separator) !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 16px !important;
}

#runroute-app .leaflet-control-zoom a:last-child { border-bottom: none !important; }
#runroute-app .leaflet-control-zoom a:hover { background: var(--bg-tertiary) !important; }

#runroute-app .leaflet-control-attribution {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    color: var(--text-tertiary) !important;
    font-size: 10px !important;
    padding: 2px 6px !important;
    border-radius: 4px 0 0 0 !important;
}

#runroute-app .leaflet-control-attribution a { color: var(--text-secondary) !important; }

/* Custom markers - Minimal dots */
#runroute-app .custom-marker {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
}

#runroute-app .marker-num {
    color: white;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

#runroute-app .custom-marker:hover {
    transform: scale(1.4);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

#runroute-app .custom-marker:active {
    transform: scale(1.6);
    cursor: grabbing;
}

#runroute-app .custom-marker.start { background: var(--green); }
#runroute-app .custom-marker.end { background: var(--orange); }
#runroute-app .custom-marker.via { background: var(--blue); }

/* Dark mode enhancement for markers */
#runroute-app[data-theme="dark"] .custom-marker {
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Distance markers (km/mi indicators) */
#runroute-app .distance-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 24px;
    padding: 0 8px;
    background: var(--glass-bg-thick);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    pointer-events: none;
    white-space: nowrap;
    user-select: none;
}

#runroute-app .distance-marker.km::after {
    content: 'km';
    margin-left: 2px;
    font-size: 9px;
    opacity: 0.7;
}

#runroute-app .distance-marker.mi::after {
    content: 'mi';
    margin-left: 2px;
    font-size: 9px;
    opacity: 0.7;
}

/* Dark mode variant for distance markers */
#runroute-app[data-theme="dark"] .distance-marker {
    background: rgba(44, 44, 46, 0.95);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

/* --- FABs (Floating Action Buttons) --- */
#runroute-app .map-fabs {
    position: absolute;
    right: 14px;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 810;
}

#runroute-app .fab {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    transition: all var(--transition);
    color: var(--text-primary);
    background: var(--glass-bg-thick);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

#runroute-app .fab:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); }
#runroute-app .fab:active { transform: scale(0.95); }
#runroute-app .fab:disabled { opacity: 0.35; pointer-events: none; }
#runroute-app .fab.active { background: var(--blue); color: white; }

/* --- BOTTOM BAR --- */
#runroute-app .bottombar {
    height: var(--bottombar-h);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 0 20px;
    z-index: 900;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.06);
    position: relative;
    background: #0D1220;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

#runroute-app .bottombar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(90deg, var(--green), var(--orange));
    transition: width 0.4s ease;
}

#runroute-app .bottombar.loading::before {
    width: 100%;
    animation: pulse-bar 1.5s ease-in-out infinite;
}

@keyframes pulse-bar {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

#runroute-app .stat-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    color: rgba(240,242,246,0.85);
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: all 0.2s ease;
}
#runroute-app .stat-chip:active { transform: scale(0.95); }

#runroute-app .stat-chip i { font-size: 0.75rem; }
#runroute-app .stat-chip.dist { color: var(--orange); }
#runroute-app .stat-chip.dist i { color: var(--orange); }
#runroute-app .stat-chip.gain { color: var(--green); }
#runroute-app .stat-chip.gain i { color: var(--green); }
#runroute-app .stat-chip.loss { color: var(--red); }
#runroute-app .stat-chip.loss i { color: var(--red); }
#runroute-app .stat-chip.cal { color: var(--orange); }
#runroute-app .stat-chip.cal i { color: var(--orange); }

/* --- ELEVATION PANEL --- */
#runroute-app .elevation-panel {
    display: none !important;
}

#runroute-app .elev-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

#runroute-app .elev-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

#runroute-app .elev-close {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    padding: 4px;
}
#runroute-app .elev-close:hover { color: var(--text-primary); }



/* ========================================
   5. MODALS
   ======================================== */
#runroute-app .modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

#runroute-app .modal-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

#runroute-app .modal {
    background: var(--glass-bg-thick);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 28px;
    max-width: 420px;
    width: 92%;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition);
}

#runroute-app .modal-backdrop.visible .modal {
    transform: scale(1) translateY(0);
}

#runroute-app .modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

#runroute-app .modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

#runroute-app .modal-title i { color: var(--orange); }

#runroute-app .modal-x {
    color: var(--text-tertiary);
    font-size: 1.2rem;
    padding: 4px;
    transition: color var(--transition);
}
#runroute-app .modal-x:hover { color: var(--text-primary); }

#runroute-app .modal-body { margin-bottom: 22px; }

#runroute-app .modal-body p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
    margin-bottom: 14px;
}

#runroute-app .info-list {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 4px 14px;
    border: 1px solid var(--separator);
}

#runroute-app .info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--separator);
    font-size: 0.85rem;
}

#runroute-app .info-row:last-child { border-bottom: none; }
#runroute-app .info-row-label { color: var(--text-secondary); }
#runroute-app .info-row-value { font-weight: 600; color: var(--text-primary); }

#runroute-app .app-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

#runroute-app .app-badge {
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    background: var(--bg-secondary);
    border: 1px solid var(--separator);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
}

#runroute-app .modal-foot {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* --- Indstillinger Modal extras --- */
#runroute-app .setting-group {
    margin-bottom: 18px;
}

#runroute-app .setting-group-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

#runroute-app .setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--separator);
}

#runroute-app .setting-row:last-child { border-bottom: none; }

#runroute-app .setting-label {
    font-size: 0.88rem;
    color: var(--text-primary);
}

/* Weight input in settings */
#runroute-app .weight-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

#runroute-app .weight-input {
    width: 72px;
    padding: 6px 10px;
    border: 1px solid var(--separator);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-family: inherit;
    transition: border-color 0.2s ease;
    -moz-appearance: textfield;
}

#runroute-app .weight-input::-webkit-outer-spin-button,
#runroute-app .weight-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#runroute-app .weight-input:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.15);
}

#runroute-app .weight-unit {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* --- TOAST NOTIFICATIONS --- */
#runroute-app .toast-container {
    position: fixed;
    top: 64px;
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#runroute-app .toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    animation: toast-in 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    max-width: 340px;
}

#runroute-app .toast.success { background: var(--green); color: white; }
#runroute-app .toast.error { background: var(--red); color: white; }
#runroute-app .toast.warning { background: var(--yellow); color: #1d1d1f; }
#runroute-app .toast.info {
    background: var(--glass-bg-thick);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

#runroute-app .toast-exit { animation: toast-out 0.3s ease forwards; }

@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* --- LOADING OVERLAY --- */
#runroute-app .loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

#runroute-app .loading-overlay.visible { opacity: 1; visibility: visible; }

#runroute-app .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--separator);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

#runroute-app .loading-label {
    margin-top: 14px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- ONBOARDING OVERLAY --- */
#runroute-app .onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

#runroute-app .onboarding-overlay.visible { opacity: 1; visibility: visible; }

#runroute-app .onboarding-card {
    background: var(--glass-bg-thick);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 36px 32px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform var(--transition);
}

#runroute-app .onboarding-overlay.visible .onboarding-card { transform: scale(1); }

#runroute-app .onboarding-icon {
    font-size: 2.8rem;
    margin-bottom: 16px;
}

#runroute-app .onboarding-card h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 10px;
}

#runroute-app .onboarding-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 6px;
}

#runroute-app .onboarding-steps {
    list-style: none;
    text-align: left;
    margin: 16px 0 24px;
}

#runroute-app .onboarding-steps li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

#runroute-app .onboarding-steps li .step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--green);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

/* --- SAVED ROUTES LIST --- */
#runroute-app .saved-routes-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

#runroute-app .saved-routes-list::-webkit-scrollbar { width: 3px; }
#runroute-app .saved-routes-list::-webkit-scrollbar-thumb { background: var(--text-tertiary); border-radius: 2px; }

#runroute-app .saved-route-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--separator);
    transition: all var(--transition);
}

#runroute-app .saved-route-item:hover { background: var(--bg-tertiary); }

#runroute-app .saved-route-info {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

#runroute-app .saved-route-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#runroute-app .saved-route-meta {
    font-size: 0.72rem;
    color: var(--text-tertiary);
}

/* --- MOBILE SIDEBAR TOGGLE --- */
#runroute-app .mobile-sidebar-btn {
    display: none;
    position: absolute;
    top: 72px;
    left: 14px;
    z-index: 810;
}

/* ========================================
   6. RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    :root { --sidebar-w: 300px; }

    #runroute-app .leaflet-control-zoom { display: none !important; }

    #runroute-app .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 950;
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    #runroute-app .sidebar.open { transform: translateX(0); }

    #runroute-app .mobile-sidebar-btn { display: flex; }

    #runroute-app .sidebar-scrim {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 949;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition);
    }

    #runroute-app .sidebar-scrim.visible { opacity: 1; visibility: visible; }

    #runroute-app .topbar-center { display: none; }

    #runroute-app .mobile-search-btn { display: flex !important; }

    #runroute-app .logo-text { display: none; }

    /* Mobile bottom bar - always visible with prominent distance */
    #runroute-app .bottombar {
        display: flex !important;
        gap: 8px;
        padding: 8px 12px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        height: auto;
        min-height: 54px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }

    /* Primary stat - Distance (larger, prominent) */
    #runroute-app .bottombar .stat-chip.dist {
        flex: 1;
        font-size: 1rem;
        font-weight: 600;
        padding: 10px 14px;
        background: rgba(255,255,255,0.10);
        border-radius: 12px;
    }

    #runroute-app .bottombar .stat-chip.dist i {
        font-size: 1.1rem;
    }

    /* Secondary stats - Elevation + Calories (smaller, compact) */
    #runroute-app .bottombar .stat-chip.gain,
    #runroute-app .bottombar .stat-chip.loss,
    #runroute-app .bottombar .stat-chip.cal {
        flex: 0 0 auto;
        font-size: 0.75rem;
        padding: 8px 10px;
        opacity: 0.85;
    }

    /* Map padding to account for bottom bar */
    #runroute-app .map-wrap {
        padding-bottom: calc(54px + env(safe-area-inset-bottom));
    }

    /* Elevation panel removed */

    #runroute-app .toast-container { left: 16px; right: 16px; }
    #runroute-app .toast { max-width: none; }
}

@media (max-width: 480px) {
    #runroute-app .topbar { padding: 0 10px; }

    /* Keep distance visible, hide secondary stats text on very small screens */
    #runroute-app .bottombar .stat-chip.gain span,
    #runroute-app .bottombar .stat-chip.loss span,
    #runroute-app .bottombar .stat-chip.cal span {
        display: none;
    }

    /* Distance remains visible and prominent */
    #runroute-app .bottombar .stat-chip.dist {
        font-size: 0.95rem;
    }
}

/* --- Mobile search overlay --- */
#runroute-app .mobile-search-btn { display: none; }

#runroute-app .mobile-search-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-base);
    z-index: 10000;
    padding: 12px 16px;
    display: none;
}

#runroute-app .mobile-search-overlay.visible { display: block; }

#runroute-app .mobile-search-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

#runroute-app .mobile-search-header .search-wrap { flex: 1; }

#runroute-app .mobile-search-results {
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

/* ========================================
   7. PRINT HELPERS (hidden)
   ======================================== */
@media print {
    #runroute-app .topbar, #runroute-app .sidebar, #runroute-app .bottombar, #runroute-app .map-fabs { display: none !important; }
}

/* ========================================
   8. ACCESSIBILITY
   ======================================== */

/* Skip-to-content link */
#runroute-app .skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 5000;
    padding: 8px 16px;
    background: var(--blue);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s ease;
}

#runroute-app .skip-link:focus {
    top: 8px;
}

/* Visible keyboard focus indicators */
#runroute-app :focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

#runroute-app .icon-btn:focus-visible,
#runroute-app .fab:focus-visible,
#runroute-app .btn-pill:focus-visible,
#runroute-app .segment:focus-visible,
#runroute-app .ios-toggle:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    #runroute-app *, #runroute-app *::before, #runroute-app *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- WAYPOINT MODE TOGGLE --- */
#runroute-app .wp-mode-toggle {
    color: var(--text-tertiary);
    padding: 6px;
    font-size: 0.8rem;
    transition: all var(--transition);
    flex-shrink: 0;
    margin-right: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#runroute-app .wp-mode-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

#runroute-app .wp-mode-toggle.active {
    color: var(--orange);
}

/* ========================================
   AUTH MODAL
   ======================================== */
#runroute-app .auth-modal {
    max-width: 400px;
}

#runroute-app .auth-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--separator);
    margin-bottom: 16px;
}

#runroute-app .auth-tab {
    flex: 1;
    padding: 10px 0;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-tertiary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all var(--transition);
}

#runroute-app .auth-tab:hover {
    color: var(--text-secondary);
}

#runroute-app .auth-tab.active {
    color: var(--blue);
    border-bottom-color: var(--blue);
}

#runroute-app .auth-field {
    margin-bottom: 14px;
}

#runroute-app .auth-field label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

#runroute-app .auth-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--separator);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition);
}

#runroute-app .auth-field input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

#runroute-app .auth-field input::placeholder {
    color: var(--text-tertiary);
}

#runroute-app .auth-error {
    display: none;
    color: var(--red);
    font-size: 0.78rem;
    margin-bottom: 12px;
    padding: 8px 10px;
    background: rgba(255, 59, 48, 0.08);
    border-radius: var(--radius-sm);
}

#runroute-app .auth-submit {
    width: 100%;
    margin-top: 4px;
    margin-bottom: 12px;
}

#runroute-app .auth-switch {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-tertiary);
    margin: 0;
}

#runroute-app .auth-switch a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 500;
}

#runroute-app .auth-switch a:hover {
    text-decoration: underline;
}

/* ========================================
   SAVE ROUTE MODAL
   ======================================== */
#runroute-app .save-route-public-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-top: 1px solid var(--separator);
    margin-top: 14px;
}

#runroute-app .save-route-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin: 4px 0 0;
    line-height: 1.4;
}

#runroute-app .save-route-hint i {
    color: var(--blue);
    margin-right: 4px;
}

/* ========================================
   ROUTE BADGES (public/private)
   ======================================== */
#runroute-app .route-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    margin-right: 4px;
    vertical-align: middle;
}

#runroute-app .route-badge.public {
    color: var(--blue);
}

#runroute-app .route-badge.private {
    color: var(--text-tertiary);
}

/* "Mine ruter" list link button */
#runroute-app .saved-route-item .wp-link {
    color: var(--text-tertiary);
    font-size: 0.78rem;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    flex-shrink: 0;
}

#runroute-app .saved-route-item .wp-link:hover {
    color: var(--blue);
    background: var(--bg-tertiary);
}
