/* ========================================
   ROUTE PLANNER STYLES
   Desktop-First Design (70% Map | 30% Panel)
   ======================================== */

:root {
    --color-primary: #000000;
    --color-secondary: #333333;
    --color-accent: #f5f5f5;
    --color-highlight: #fafafa;
    --color-dark: #000000;
    --color-text: #1a1a1a;
    --color-text-light: #666;
    --color-border: #e0e0e0;
    
    --font-display: 'JetBrains Mono', monospace;
    --font-body: 'Public Sans', sans-serif;
    
    /* Category Colors */
    --color-hut: #eab308;
    --color-trekking: #f97316;
    --color-camping: #dc2626;
    --color-hotel: #3b82f6;
    --color-restaurant: #10b981;
    --color-fast_food: #f59e0b;
    --color-bakery: #f97316;
    --color-supermarket: #8b5cf6;
    --color-fuel: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    overflow: hidden;
    height: 100vh;
}

/* ========================================
   HEADER
   ======================================== */

.site-header {
    background: white;
    border-bottom: 1px solid #f0f0f0;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    height: 60px;
}

.site-header img {
    height: 50px;
    width: auto;
}

.site-header .domain {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-primary);
    text-decoration: none;
    margin-right: auto;
    transition: opacity 0.2s ease;
}

.site-header .domain:hover {
    opacity: 0.7;
}

.header-nav {
    margin-left: auto;
    display: flex;
    gap: 1.5rem;
}

.header-nav a {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--color-text-light);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.header-nav a:hover {
    background: var(--color-accent);
    color: var(--color-text);
}

.header-nav a.active {
    background: var(--color-primary);
    color: white;
}

/* ========================================
   MAIN LAYOUT (Desktop: 70/30 Split)
   ======================================== */

.planner-container {
    display: flex;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
}

/* LEFT: Map Section (70%) */
.map-section {
    flex: 0 0 70%;
    position: relative;
    background: #f8f8f8;
}

#map {
    width: 100%;
    height: 100%;
}

/* RIGHT: Control Panel (30%) */
.control-panel {
    flex: 0 0 30%;
    display: flex;
    flex-direction: column;
    background: white;
    border-left: 1px solid var(--color-border);
    overflow-y: auto;
}

/* ========================================
   GPX UPLOAD OVERLAY
   ======================================== */

.gpx-upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.gpx-upload-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.upload-card {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    text-align: center;
    max-width: 400px;
    border: 2px dashed var(--color-border);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-card h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--color-primary);
}

.upload-card p {
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.upload-button {
    display: inline-block;
    padding: 0.8rem 2rem;
    background: var(--color-primary);
    color: white;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-display);
}

.upload-button:hover {
    background: var(--color-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.upload-hint {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.btn-clear-route {
    margin-top: 1.5rem;
    padding: 0.6rem 1.2rem;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear-route:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

/* ========================================
   MODE SWITCHER
   ======================================== */

.mode-switcher {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    background: white;
    border-bottom: 1px solid var(--color-border);
    padding: 0.5rem;
}

.mode-btn {
    padding: 0.8rem 0.5rem;
    background: transparent;
    border: none;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-light);
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.mode-btn:hover {
    background: var(--color-accent);
    color: var(--color-text);
}

.mode-btn.active {
    background: var(--color-primary);
    color: white;
}

/* ========================================
   MODE-SPECIFIC CONTROLS
   ======================================== */

.mode-controls {
    position: relative;
    background: var(--color-highlight);
    border-bottom: 1px solid var(--color-border);
}

.mode-panel {
    display: none;
    padding: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.mode-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.mode-panel h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
    color: var(--color-primary);
}

.mode-description {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Route Info Display */
.route-info {
    background: var(--color-accent);
    padding: 0.8rem 1rem;
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--color-text);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.route-info-label {
    font-weight: 600;
    color: var(--color-text-light);
}

.route-info-separator {
    color: var(--color-border);
    font-weight: 300;
}

.route-info span:not(.route-info-label):not(.route-info-separator) {
    font-weight: 700;
    color: var(--color-primary);
}

.filter-group {
    margin-bottom: 1.2rem;
}

.filter-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.control-select {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: white;
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.control-select:hover {
    border-color: var(--color-secondary);
}

.control-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.control-select.small {
    width: auto;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
}

/* Progress Slider (Plan Mode) */
.progress-slider-container {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--color-border);
}

.progress-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--color-accent);
    outline: none;
    -webkit-appearance: none;
}

.progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.progress-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.progress-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: none;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-top: 0.8rem;
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--color-text);
}

/* Category Chips (Explore Mode) */
.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--color-border);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip:hover {
    border-color: var(--color-secondary);
    transform: translateY(-1px);
}

.chip.active[data-category="hut"] {
    background: var(--color-hut);
    border-color: var(--color-hut);
    color: #422006;
}

.chip.active[data-category="trekking"] {
    background: var(--color-trekking);
    border-color: var(--color-trekking);
    color: white;
}

.chip.active[data-category="camping"] {
    background: var(--color-camping);
    border-color: var(--color-camping);
    color: white;
}

.chip.active[data-category="hotel"] {
    background: var(--color-hotel);
    border-color: var(--color-hotel);
    color: white;
}

.chip.active[data-category="restaurant"] {
    background: var(--color-restaurant);
    border-color: var(--color-restaurant);
    color: white;
}

.chip.active[data-category="fast_food"] {
    background: var(--color-fast_food);
    border-color: var(--color-fast_food);
    color: white;
}

.chip.active[data-category="bakery"] {
    background: var(--color-bakery);
    border-color: var(--color-bakery);
    color: white;
}

.chip.active[data-category="supermarket"] {
    background: var(--color-supermarket);
    border-color: var(--color-supermarket);
    color: white;
}

.chip.active[data-category="fuel"] {
    background: var(--color-fuel);
    border-color: var(--color-fuel);
    color: white;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Restart Button (subtle, right-aligned) */
.btn-restart-subtle {
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-restart-subtle:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.btn-restart {
    padding: 0.6rem 1.2rem;
    background: white;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-restart:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* ========================================
   SPOT LIST
   ======================================== */

.spot-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    background: white;
}

.list-header h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--color-primary);
}

.spot-count {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* Info Message */
.info-message {
    padding: 1rem 1.5rem;
    background: #fff8e1;
    border-left: 4px solid #ffc107;
    margin: 0.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-message.warning {
    background: #ffebee;
    border-left-color: #f44336;
}

.info-message.success {
    background: #e8f5e9;
    border-left-color: #4caf50;
}

.info-icon {
    font-size: 1.2rem;
}

.info-text {
    font-size: 0.85rem;
    color: var(--color-text);
    line-height: 1.4;
}

/* Load More Button */
.load-more-container {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-highlight);
    text-align: center;
}

.btn-load-more {
    width: 100%;
    padding: 0.8rem 1.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-load-more:hover {
    background: var(--color-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-load-more:disabled {
    background: var(--color-border);
    cursor: not-allowed;
    transform: none;
}

.load-more-hint {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-light);
}

.spot-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.spot-item {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background 0.2s ease;
}

.spot-item:hover {
    background: var(--color-highlight);
}

.spot-item.selected {
    background: var(--color-accent);
    border-left: 3px solid var(--color-primary);
}

.spot-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.spot-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text);
    flex: 1;
}

.spot-category {
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.spot-category.hut {
    background: var(--color-hut);
    color: #422006;
}

.spot-category.trekking {
    background: var(--color-trekking);
    color: white;
}

.spot-category.camping {
    background: var(--color-camping);
    color: white;
}

.spot-category.hotel {
    background: var(--color-hotel);
    color: white;
}

.spot-category.restaurant {
    background: var(--color-restaurant);
    color: white;
}

.spot-category.fast_food {
    background: var(--color-fast_food);
    color: white;
}

.spot-category.bakery {
    background: var(--color-bakery);
    color: white;
}

.spot-category.supermarket {
    background: var(--color-supermarket);
    color: white;
}

.spot-category.fuel {
    background: var(--color-fuel);
    color: white;
}

.spot-metrics {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.metric {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.metric-icon {
    font-size: 1rem;
}

.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--color-text-light);
}

/* ========================================
   SPOT DETAIL PANEL
   ======================================== */

.spot-detail {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    background: white;
    box-shadow: -4px 0 16px rgba(0,0,0,0.1);
    overflow-y: auto;
    z-index: 100;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.close-detail {
    position: sticky;
    top: 0;
    right: 0;
    float: right;
    background: var(--color-primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    margin: 1rem;
    transition: transform 0.2s ease;
    z-index: 10;
}

.close-detail:hover {
    transform: scale(1.1);
}

.detail-content {
    padding: 1.5rem;
}

.detail-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--color-primary);
}

.detail-category {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.detail-category.hut {
    background: var(--color-hut);
    color: #422006;
}

.detail-category.trekking {
    background: var(--color-trekking);
    color: white;
}

.detail-category.camping {
    background: var(--color-camping);
    color: white;
}

.detail-category.hotel {
    background: var(--color-hotel);
    color: white;
}

.detail-category.restaurant {
    background: var(--color-restaurant);
    color: white;
}

.detail-category.fast_food {
    background: var(--color-fast_food);
    color: white;
}

.detail-category.bakery {
    background: var(--color-bakery);
    color: white;
}

.detail-category.supermarket {
    background: var(--color-supermarket);
    color: white;
}

.detail-category.fuel {
    background: var(--color-fuel);
    color: white;
}

.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section h4 {
    font-family: var(--font-display);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    color: var(--color-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.detail-label {
    color: var(--color-text-light);
}

.detail-value {
    font-weight: 600;
    color: var(--color-text);
}

.detail-link {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.detail-link:hover {
    background: var(--color-secondary);
    transform: translateY(-1px);
}

/* ========================================
   LOADING OVERLAY
   ======================================== */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 10000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--color-accent);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

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

.loading-overlay p {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--color-text);
}

/* Map Legend */
.map-legend {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ========================================
   MAP STYLES (Leaflet Customization)
   ======================================== */

/* Route line */
.route-line {
    stroke: #000000;
    stroke-width: 3;
    stroke-opacity: 0.7;
    fill: none;
}

/* Detour line (Route → Spot) */
.detour-line {
    stroke: #666;
    stroke-width: 2;
    stroke-dasharray: 5, 5;
    stroke-opacity: 0.5;
    fill: none;
}

/* Custom marker styles */
.custom-marker {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: transform 0.2s ease;
}

.custom-marker:hover {
    transform: scale(1.2);
}

.custom-marker.hut {
    background: var(--color-hut);
}

.custom-marker.trekking {
    background: var(--color-trekking);
}

.custom-marker.camping {
    background: var(--color-camping);
}

.custom-marker.hotel {
    background: var(--color-hotel);
}

/* ========================================
   POPUP STYLES
   ======================================== */

/* ========================================
   FIXED SPOT POPUP (Bottom-Left Corner)
   ======================================== */

.fixed-spot-popup {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 260px;
    max-height: 400px;
    overflow-y: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popup-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.popup-close-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

#fixedSpotContent {
    padding: 0.7rem;
}

/* ========================================
   POPUP POSITIONING & SIZE
   ======================================== */

/* Hide default Leaflet popups */
.leaflet-popup {
    display: none !important;
}

/* Smaller, more compact popup */
.leaflet-popup-content-wrapper {
    max-width: 220px !important;
    font-size: 0.85rem;
    border-radius: 6px;
}

.leaflet-popup-content {
    margin: 0.6rem 0.7rem !important;
}

/* Position popup tip at top-right (popup is far left of marker) */
.leaflet-popup-tip-container {
    left: auto !important;
    right: 5px !important; /* Far right to point at marker */
    top: -10px !important;
}

.popup-content {
    padding: 0.5rem;
}

.popup-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--color-primary);
    margin-bottom: 0.3rem;
    line-height: 1.3;
}

.popup-type {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--color-accent);
    color: var(--color-primary);
    border-radius: 3px;
    font-size: 0.65rem;
    font-family: var(--font-display);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.popup-type.hut { background: #eab308; color: #422006; }
.popup-type.trekking { background: #f97316; color: white; }
.popup-type.camping { background: #dc2626; color: white; }
.popup-type.hotel { background: #3b82f6; color: white; }

.popup-info {
    font-size: 0.75rem; /* Reduced from 0.8rem */
    color: var(--color-text-light);
    line-height: 1.5; /* Reduced from 1.6 */
    margin-bottom: 0.4rem; /* Reduced from 0.5rem */
}

.popup-info-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.3rem; /* Reduced from 0.4rem */
}

.popup-info-label {
    font-weight: 600;
    color: var(--color-text);
    min-width: 60px; /* Reduced from 70px */
    font-size: 0.7rem; /* Reduced from 0.75rem */
}

.popup-info-value {
    flex: 1;
    color: var(--color-text-light);
    font-size: 0.75rem; /* Reduced from 0.8rem */
}

.popup-link {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-right: 0.3rem;
}

.popup-link:hover {
    background: var(--color-secondary);
    transform: translateY(-1px);
}

.popup-link-search {
    background: #4285f4;
}

.popup-link-search:hover {
    background: #1967d2;
}
/* ========================================
   ROUTE INFO & SURFACE BREAKDOWN
   ======================================== */

.route-info-container {
    margin: 1rem 0;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
}

.route-loading {
    text-align: center;
    color: var(--color-text-light);
    font-size: 0.85rem;
    padding: 0.5rem;
}

.route-error {
    text-align: center;
    color: #ef4444;
    font-size: 0.85rem;
    padding: 0.5rem;
}

.route-info-box {
    font-size: 0.75rem; /* Reduced from 0.85rem */
}

.route-info-header {
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.5rem; /* Reduced from 0.75rem */
    font-size: 0.8rem; /* Reduced from 0.9rem */
    text-align: center;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 0.4rem; /* Reduced from 0.5rem */
}

.route-stats {
    display: flex;
    gap: 0.75rem; /* Reduced from 1rem */
    justify-content: space-around;
    margin-bottom: 0.5rem; /* Reduced from 0.75rem */
}

.route-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-value {
    font-size: 0.95rem; /* Reduced from 1.1rem */
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    font-size: 0.65rem; /* Reduced from 0.7rem */
    color: var(--color-text-light);
    text-transform: uppercase;
}

.surface-breakdown {
    margin: 0.5rem 0; /* Reduced from 0.75rem */
}

.surface-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem; /* Reduced from 0.5rem */
    margin-bottom: 0.4rem; /* Reduced from 0.5rem */
}

.surface-icon {
    font-size: 0.9rem; /* Reduced from 1rem */
    flex-shrink: 0;
}

.surface-progress {
    flex: 1;
    height: 6px; /* Reduced from 8px */
    background: #e5e7eb;
    border-radius: 3px; /* Reduced from 4px */
    overflow: hidden;
}

.surface-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.surface-fill.paved {
    background: #3b82f6;
}

.surface-fill.gravel {
    background: #f97316;
}

.surface-fill.trail {
    background: #10b981;
}

.surface-label {
    font-size: 0.75rem;
    color: var(--color-text);
    white-space: nowrap;
    min-width: 80px;
}

.elevation-info {
    display: flex;
    justify-content: space-around;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.75rem;
}

.elev-gain {
    color: #ef4444;
    font-weight: 600;
}

.elev-loss {
    color: #10b981;
    font-weight: 600;
}

/* ========================================
   SAVE SPOT BUTTON
   ======================================== */

.popup-actions {
    margin: 0.6rem 0 0.3rem;
}

.btn-save-spot {
    width: 100%;
    padding: 0.45rem 0.8rem;
    background: white;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-save-spot:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-1px);
}

.btn-save-spot.saved {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.btn-save-spot.saved:hover {
    background: #059669;
    border-color: #059669;
}

/* ========================================
   GPX EXPORT BUTTON (in header)
   ======================================== */

.btn-export-gpx {
    padding: 0.6rem 1.2rem;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-export-gpx:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-export-gpx:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

.saved-count {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    font-size: 0.8rem;
}

/* ========================================
   DETOUR CONTROL BUTTONS
   ======================================== */

.detour-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: white;
    border: 2px solid #e5e7eb;
    color: var(--color-text);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.detour-btn:hover {
    border-color: var(--color-primary);
    background: #f9fafb;
}

.detour-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.detour-btn.active:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* Profile Buttons */
.profile-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: white;
    border: 2px solid #e5e7eb;
    color: var(--color-text);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-btn:hover {
    border-color: #10b981;
    background: #f9fafb;
}

.profile-btn.active {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.profile-btn.active:hover {
    background: #059669;
    border-color: #059669;
}
