html, body { height: 100%; margin: 0; padding: 0; font-family: 'Inter', sans-serif; overflow: hidden; /* Prevent body scroll */ }
#map-container { position: relative; flex-grow: 1; overflow: hidden; min-height: 300px; /* Ensure container has min height */ }
#map { height: 100%; min-height: 300px; touch-action: none; /* Prevent default touch actions like page scroll/zoom on the map element */}

/* Loading Overlay */
#loading-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.85); /* Slightly less transparent */
    z-index: 1500;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    font-size: 1.1rem; font-weight: 500; color: #374151;
    text-align: center; padding: 20px;
    pointer-events: none;
}
#loading-overlay.hidden { display: none; }
#loading-details {
    font-size: 0.9rem; /* text-sm */
    color: #4b5563; /* gray-600 */
    margin-top: 0.25rem; /* mt-1 */
    min-height: 1.2em; /* Prevent layout shift */
}

/* Progress Bar Container */
#loading-progress-bar {
    width: 60%; max-width: 250px; height: 8px;
    background-color: #e5e7eb; /* gray-200 */
    border-radius: 4px; overflow: hidden;
    margin-top: 0.5rem; /* Reduced space */
    position: relative;
}

/* Inner Progress Bar Fill - Updated */
#loading-progress-inner {
    height: 100%;
    width: 0%; /* Start at 0%, updated by JS */
    background-color: #3b82f6; /* blue-500 */
    border-radius: 4px;
    transition: width 0.1s linear; /* Smooth transition for updates */
}

/* InfoWindow Styling */
.poi-info-window { font-family: 'Inter', sans-serif; padding: 0.5rem; max-width: 320px; }
.poi-info-window .title-area { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5rem; }
.poi-info-window h3 { font-size: 1.1rem; font-weight: 600; display: inline-block; vertical-align: top; margin-left: 8px; flex-grow: 1; }

/* InfoWindow Actions (Brand + Ignore) - Proper Buttons */
.poi-info-window .info-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.poi-info-window .action-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.poi-info-window .action-group-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.poi-info-window .action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.poi-info-window .action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
}

.poi-info-window .action-btn:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

.poi-info-window .action-btn.active-fav {
    background-color: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}

.poi-info-window .action-btn.active-fav:hover {
    background-color: #fef3c7;
}

.poi-info-window .action-btn.active-blk {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

.poi-info-window .action-btn.active-blk:hover {
    background-color: #fecaca;
}

.poi-info-window .action-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.poi-info-window .info-subtitle { font-size: 0.85rem; color: #6b7280; margin-left: 8px; margin-top: -2px; margin-bottom: 0.4rem; display: block; clear: left; /* Ensure subtitle is below logo/title */}
.poi-info-window img.info-logo { max-width: 30px; max-height: 30px; float: left; margin-right: 8px; border-radius: 4px; display: block; margin-bottom: 0.6rem; background-color: #eee; object-fit: contain; }
.poi-info-window p { margin-bottom: 0.25rem; font-size: 0.9rem; line-height: 1.3; }
.poi-info-window a { color: #2563EB; text-decoration: none; }
.poi-info-window a:hover { text-decoration: underline; }
.poi-info-window .info-section { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid #eee; }
.poi-info-window .info-section:first-of-type { margin-top: 0.3rem; padding-top: 0.3rem; border-top: none; }
.poi-info-window .info-section h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.3rem; color: #4b5563; }
.poi-info-window .detour-info { font-size: 0.85rem; color: #555; font-weight: 600; display: block; /* Changed from inline for breakdown info */ }
.poi-info-window .detour-breakdown {
    font-size: 0.8rem;
    color: #4b5563; /* gray-600 */
    margin-top: 4px;
    line-height: 1.4;
}
.poi-info-window .detour-breakdown span {
    font-weight: 500;
}
/* Detour Retry Button Style */
.poi-info-window .detour-info button.retry-button {
    font-size: 0.75rem; /* text-xs */
    color: #2563EB; /* text-blue-600 */
    text-decoration: underline;
    margin-left: 0.5rem; /* ml-2 */
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    vertical-align: baseline; /* Align with text */
}
.poi-info-window .detour-info button.retry-button:hover {
    color: #1D4ED8; /* text-blue-800 */
}
.poi-info-window .detour-info button.retry-button:focus {
    outline: 1px dotted #2563EB;
}
/* Socket Info Styles */
.poi-info-window .socket-list { list-style: none; padding-left: 0; margin-top: 0; }
.poi-info-window .socket-item {
    padding-bottom: 0.3rem; margin-bottom: 0.3rem; border-bottom: 1px solid #eee;
    display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem;
}
.poi-info-window .socket-item:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.poi-info-window .socket-details { display: flex; flex-direction: column; }
.poi-info-window .socket-type-power { display: flex; align-items: baseline; }
.poi-info-window .socket-power-emoji { margin-left: 5px; font-size: 0.8rem; color: #6b7280; }
.poi-info-window .socket-type { font-weight: 600; margin-right: 4px;}
.poi-info-window .socket-power { color: #374151; font-size: 0.8rem; }
.poi-info-window .socket-price { font-size: 0.8rem; color: #1f2937; margin-top: 1px; min-height: 1em; }
.poi-info-window .socket-status { font-weight: 600; text-align: right; min-width: 60px; }
.poi-info-window .status-free { color: #16A34A; }
.poi-info-window .status-occupied { color: #DC2626; }
.poi-info-window .status-unknown { color: #6B7280; }
.poi-info-window .status-loading { color: #9ca3af; font-style: italic; font-size: 0.8rem;}
.poi-info-window .status-disclaimer {
    font-size: 0.8rem; color: #4b5563; margin-top: 0.6rem;
    padding: 3px 0; border-top: 1px solid #eee;
}
/* Google Maps Link Style */
.poi-info-window .map-link { font-size: 0.85rem; padding: 2px 6px; background-color: #f3f4f6; border-radius: 4px; }
.poi-info-window .map-link:hover { background-color: #e5e7eb; }
/* Section for Links and Static Info */
.poi-info-window .links-static-info-section { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid #eee; }
/* Esc key hint */
.poi-info-window .esc-hint {
    font-size: 0.7rem; /* text-xs */
    color: #9ca3af; /* gray-400 */
    text-align: right;
    margin-top: 0.5rem; /* mt-2 */
}
.poi-info-window .esc-hint .font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
/* --- Rest of your existing styles --- */
.poi-info-window::after { content: ""; clear: both; display: table; }

/* Media Query for Mobile InfoWindow Size */
@media (max-width: 640px) {
    .poi-info-window {
        max-width: 90vw; /* Adjust max-width for smaller screens */
    }
    /* Ensure GM InfoWindow internal structure respects the size */
    .gm-style .gm-style-iw-c { max-width: 90vw !important; }
    .gm-style .gm-style-iw-d { max-width: 90vw !important; overflow-x: hidden !important; } /* Prevent internal scroll */
}

.pac-container { z-index: 1051 !important; border-radius: 8px; font-family: 'Inter', sans-serif; }
.pac-item { padding: 8px 12px; font-size: 0.9rem; }
.pac-item:hover { background-color: #f0f0f0; }
.pac-item-query { font-weight: 500; }
#message-box {
    position: fixed; bottom: 200px; /* Position from bottom of viewport */
    left: 50%;
    transform: translateX(-50%); /* Center horizontally */
    background-color: rgba(239, 68, 68, 0.9); color: white; padding: 10px 20px;
    border-radius: 8px; z-index: 2000; display: none; font-size: 0.9rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    text-align: center;
    max-width: 90%; /* Limit width relative to container */
    /* Pointer events none allows clicking map 'through' the message box if needed */
    pointer-events: none;
}
/* Controls Container for Map Type and Language */
#top-right-controls {
    position: absolute; top: 10px; right: 10px; z-index: 5;
    display: flex; gap: 8px;
    align-items: flex-start; /* Align items to the top */
}
#map-type-control {
    background-color: white;
    border-radius: 8px; box-shadow: 0 1px 5px rgba(0,0,0,0.2); overflow: hidden;
}
#map-type-control button {
    display: inline-block; padding: 6px 10px; font-size: 0.8rem; font-weight: 600; /* Increased weight */
    color: #374151; background-color: white; border: none; cursor: pointer;
    transition: background-color 0.2s ease;
    min-width: 40px; /* Ensure buttons have some width */
}
#map-type-control button:hover { background-color: #f3f4f6; }
#map-type-control button.active { background-color: #e5e7eb; color: #1f2937; }

/* Language Dropdown Styles */
#language-control { position: relative; }
#language-selector-btn {
    background-color: white; border: none;
    padding: 6px 10px; border-radius: 8px; box-shadow: 0 1px 5px rgba(0,0,0,0.2);
    cursor: pointer; display: flex; align-items: center; gap: 4px;
    font-size: 0.8rem; font-weight: 600; color: #374151;
    min-height: 31px; /* Match Map Type Button Height */
}
#language-selector-btn:hover { background-color: #f3f4f6; }
#language-flag { font-size: 1rem; line-height: 1; } /* Adjust flag size */
#language-dropdown {
    display: none; /* Hidden by default */
    position: absolute; top: 100%; right: 0; margin-top: 4px;
    background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 6; overflow: hidden; min-width: 50px; /* Adjusted min-width */
}
#language-dropdown.show { display: block; }
#language-dropdown button {
    display: block; width: 100%; padding: 8px 12px;
    background: none; border: none; cursor: pointer; text-align: center; /* Center flag */
    font-size: 0.85rem; color: #374151; display: flex; align-items: center; justify-content: center; /* Center flag horizontally */ gap: 6px;
}
#language-dropdown button:hover { background-color: #f3f4f6; }
#language-dropdown button .flag { font-size: 1rem; }
#language-dropdown button.active { font-weight: 600; background-color: #e5e7eb; }

/* Styles for POI Marker Pin */
.marker-pin-wrapper {
    /* This element is centered by Google Maps. Give it zero size and a positioning context. */
    position: relative;
    width: 0;
    height: 0;
}
.poi-marker-content-container {
    /* This is the visual marker, positioned absolutely relative to the wrapper */
    position: absolute;
    bottom: 0; /* Anchor the bottom of the marker to the map coordinate */
    left: 50%;
    transform: translateX(-50%); /* Center the marker horizontally */

    /* Original visual styles below */
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;

    padding-bottom: 12px; /* Space for the pin tail, which is part of this container */
    transition: transform 0.15s ease-in-out;
    /* The ::after pseudo-element for the pin will be positioned relative to this container */
}
.poi-marker-content-container:hover {
    /* On hover, maintain horizontal centering and scale up from the bottom */
    transform: translateX(-50%) scale(1.1);
    transform-origin: bottom center; /* Scale from the pin tip */
}
/* The pin tail */
.poi-marker-content-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid #16A34A; /* Green to match default border */
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.4));
    transition: border-top-color 0.15s ease-in-out;
}
.poi-marker-content-container:hover::after {
    border-top-color: #F97316; /* Orange on hover */
}
.marker-fav-badge {
    font-size: 11px;
    line-height: 1;
    margin-top: 4px;
    pointer-events: none;
    display: none; /* Hidden by default, shown by JS */
}
.poi-icon-container {
    width: 36px; height: 36px; border-radius: 50%; border: 2px solid #16A34A;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); background-color: #eee; box-sizing: border-box;
    display: flex; justify-content: center; align-items: center; overflow: hidden;
    transition: border-color 0.15s ease-in-out;
}
.poi-marker-content-container:hover .poi-icon-container {
    border-color: #F97316;
}

/* Selected marker highlight */
.poi-marker-content-container.selected {
    transform: translateX(-50%) scale(1.3);
    transform-origin: bottom center;
    z-index: 9999;
}

.poi-marker-content-container.selected .poi-icon-container {
    border-color: #3b82f6;
    border-width: 4px;
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.4), 0 4px 8px rgba(0, 0, 0, 0.5);
    animation: pulse-selected 1.5s ease-in-out infinite;
}

.poi-marker-content-container.selected::after {
    border-top-color: #3b82f6;
    border-left-width: 10px;
    border-right-width: 10px;
    border-top-width: 15px;
}

@keyframes pulse-selected {
    0%, 100% {
        box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.5), 0 4px 8px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(59, 130, 246, 0.2), 0 0 20px rgba(59, 130, 246, 0.4), 0 4px 8px rgba(0, 0, 0, 0.5);
    }
}

.poi-icon-container svg { width: 70%; height: 70%; display: block; }
.poi-icon-container img.poi-marker-img {
    width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 50%;
    border: none; box-shadow: none; background-color: transparent;
}
/* Marker Badges Container */
.marker-badges {
    display: flex;
    gap: 4px;
    margin-top: 3px;
    align-items: center;
    height: 16px;
}
/* Individual Marker Badge Style */
.marker-badge {
    padding: 1px 5px;
    font-size: 11px;
    font-weight: 600;
    line-height: 14px;
    border-radius: 4px;
    color: white;
    text-align: center;
    white-space: nowrap;
}
.badge-ac { background-color: #3b82f6; }
.badge-dc { background-color: #f97316; }
.badge-power-1 { background-color: #6b7280; color: #fff;}
.badge-power-2 { background-color: #10b981; color: #fff;}
.badge-power-3 { background-color: #ef4444; color: #fff;}

/* Detour Text below badges */
.poi-marker-detour-text {
    font-size: 12px; line-height: 1.2; color: black; background-color: white;
    text-align: center; white-space: nowrap; margin-top: 3px;
    font-weight: 500; padding: 1px 3px; border-radius: 3px;
    min-height: 15px;
}

/* Styles for custom Start/Destination markers */
.custom-marker-content {
    padding: 4px 8px; border-radius: 8px; color: white; font-size: 14px; font-weight: bold;
    text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.3); white-space: nowrap;
}
.start-marker-content { background-color: #EA4335; }
.dest-marker-content { background-color: #4285F4; }

/* Top Left Controls (Filters, Brand Mode) */
#top-left-controls {
    position: absolute; top: 10px; left: 10px; z-index: 5; display: flex; gap: 8px;
}
#filter-toggle-btn, #brand-filter-mode-btn {
    background-color: white; border: none;
    padding: 8px; border-radius: 8px; box-shadow: 0 1px 5px rgba(0,0,0,0.2); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    position: relative;
}
/* Filter Active Indicator Dot */
#filter-toggle-btn.filters-active::after {
    content: '';
    position: absolute;
    top: 4px; right: 4px;
    width: 8px; height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    border: 1px solid white;
    box-shadow: 0 0 3px rgba(0,0,0,0.3);
    pointer-events: none;
}
#filter-toggle-btn svg { width: 20px; height: 20px; fill: #374151; }
#brand-filter-mode-btn svg { width: 20px; height: 20px; fill: #374151; }
#brand-filter-mode-btn span { /* Style for the star emoji if used */
    font-size: 1.25rem; line-height: 1;
    color: #f59e0b;
}
#filter-toggle-btn:hover, #brand-filter-mode-btn:hover:not(:disabled) { background-color: #f3f4f6; }
#brand-filter-mode-btn:disabled {
    opacity: 0.6; cursor: not-allowed; background-color: #f9fafb;
}
#brand-filter-mode-btn:disabled svg { fill: #9ca3af; }


#filter-panel {
    position: absolute; top: 0; left: 0; width: 480px; height: 100%; background-color: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1); z-index: 10; padding: 3rem 1rem 1rem 1rem;
    transform: translateX(-100%); transition: transform 0.3s ease-in-out; overflow-y: auto;
    display: flex; flex-direction: column;
    border-top: 3px solid #3b82f6; /* Blue accent line at top */
}
#filter-panel.open { transform: translateX(0); }
#filter-panel h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.75rem; color: #1f2937; }
#filter-panel .filter-header { display: flex; flex-direction: column; align-items: stretch; margin-bottom: 1rem; }
#filter-panel #reset-filters-btn {
    font-size: 0.8rem;
    font-weight: 500;
    color: #4b5563;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.1s, border-color 0.1s;
    width: 100%; /* Full width */
    text-align: center;
}
#filter-panel #reset-filters-btn:hover { background-color: #e5e7eb; border-color: #9ca3af; }

#filter-panel .filter-section { margin-bottom: 1.25rem; }
#filter-panel .filter-section h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.5rem; color: #4b5563; }
#filter-panel label {
    margin-bottom: 0.4rem; font-size: 0.85rem; color: #374151; cursor: pointer;
    display: flex; align-items: center;
}
#filter-panel label .label-text { margin-left: 0.5rem; /* Space between input and text */}
#filter-panel input[type="radio"], #filter-panel input[type="checkbox"] { margin-right: 0; /* Removed margin-right */ cursor: pointer; flex-shrink: 0; }
/* Power Filter Layout Fix */
#filter-power label.power-label { display: flex; margin-bottom: 0.5rem; align-items: center; /* Vertically align items */ }
#filter-panel .power-label span.power-emoji-span {
    font-size: 1rem; margin-right: 0.25rem; width: 2.5em; /* Increased width for emoji */
    display: inline-block; text-align: left; flex-shrink: 0;
}
#filter-panel .power-label .label-text { flex-grow: 1; /* Allow text to take remaining space */ }

#filter-panel #close-filter-btn {
    position: absolute; top: 8px; right: 8px; background: none; border: none; cursor: pointer;
    padding: 8px; /* Larger click area */
    display: flex; align-items: center; justify-content: center;
}
#filter-panel #close-filter-btn svg { width: 24px; height: 24px; fill: #6b7280; }
#filter-panel #close-filter-btn:hover svg { fill: #1f2937; }
#filter-panel #close-filter-btn:hover { background-color: #f3f4f6; border-radius: 4px; }

/* Brand Filter Styles */
#brand-list-view-controls { display: flex; gap: 8px; margin-bottom: 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid #e5e7eb;}
#brand-list-view-controls button {
    font-size: 0.75rem; font-weight: 500; color: #4b5563; background-color: #f3f4f6;
    border: 1px solid #d1d5db; border-radius: 4px; padding: 3px 8px; cursor: pointer;
    transition: background-color 0.1s, border-color 0.1s;
}
#brand-list-view-controls button:hover { background-color: #e5e7eb; }
#brand-list-view-controls button.active { background-color: #dbeafe; border-color: #93c5fd; color: #1e40af;}

#filter-brands .brand-list { max-height: 150px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 4px; padding: 0.25rem; background-color: #f9fafb; }
#filter-brands .brand-item { display: flex; justify-content: space-between; align-items: center; padding: 0.3rem 0.5rem; border-bottom: 1px solid #e5e7eb; }
#filter-brands .brand-item:last-child { border-bottom: none; }
#filter-brands .brand-item.hidden-by-view { display: none; }
#filter-brands .brand-name { font-size: 0.85rem; color: #1f2937; flex-grow: 1; margin-right: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#filter-brands .brand-controls { display: flex; gap: 5px; flex-shrink: 0; }
#filter-brands .brand-controls button {
    background: none; border: 1px solid #d1d5db; border-radius: 4px;
    padding: 2px 4px; cursor: pointer; font-size: 0.9rem; line-height: 1;
    color: #6b7280;
    transition: background-color 0.1s, border-color 0.1s, color 0.1s;
}
#filter-brands .brand-controls button:hover { background-color: #f3f4f6; }
#filter-brands .brand-controls button.brand-fav.active { color: #f59e0b; border-color: #f59e0b; background-color: #fffbeb; }
#filter-brands .brand-controls button.brand-blk.active { color: #ef4444; border-color: #ef4444; background-color: #fee2e2; }
#filter-brands .brand-controls button.brand-remove {
    color: #ef4444;
    border-color: #ef4444;
    background-color: #fee2e2;
    font-size: 1.1rem;
    font-weight: 700;
}
#filter-brands .brand-controls button.brand-remove:hover {
    background-color: #fecaca;
    border-color: #dc2626;
    color: #dc2626;
}
#filter-brands .brand-controls button { position: relative; }
#filter-brands .brand-controls button::after {
    content: attr(data-tooltip);
    position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%) translateY(-4px);
    background-color: rgba(0,0,0,0.75); color: white; font-size: 0.7rem; padding: 2px 5px; border-radius: 3px;
    white-space: nowrap; z-index: 10; opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s; pointer-events: none;
}
#filter-brands .brand-controls button:hover::after { opacity: 1; visibility: visible; }
/* Status paragraphs for brand/ignored lists */
.filter-status-paragraph {
    font-size: 0.75rem; color: #6b7280; margin-top: 0.25rem;
    padding: 0.25rem 0.5rem; text-align: center;
}


/* Ignored Stations Filter Styles */
#filter-ignored-stations .ignored-list { max-height: 120px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 4px; padding: 0.25rem; background-color: #f9fafb; margin-top: 0.5rem;}
#filter-ignored-stations .ignored-item {
    display: flex;
    flex-direction: column;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.85rem;
}
#filter-ignored-stations .ignored-item:last-child { border-bottom: none; }
#filter-ignored-stations .ignored-line-1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#filter-ignored-stations .ignored-brand {
    flex-grow: 1;
    margin-right: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #374151;
    font-weight: 600;
}
#filter-ignored-stations .ignored-line-2 {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.25rem;
    margin-left: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#filter-ignored-stations .ignored-controls { display: flex; gap: 6px; flex-shrink: 0; }
#filter-ignored-stations .ignored-controls button {
    font-size: 0.75rem; font-weight: 500; color: #1d4ed8; background: none; border: none;
    padding: 2px 5px; cursor: pointer; text-decoration: underline;
}
#filter-ignored-stations .ignored-controls button:hover { color: #1e3a8a; }
#filter-ignored-stations .ignored-controls button.map-btn {
    text-decoration: none;
    padding: 2px;
    color: #4b5563;
}
#filter-ignored-stations .ignored-controls button.map-btn:hover {
    color: #1f2937;
}
#filter-ignored-stations .ignored-controls button.map-btn svg {
    width: 16px; height: 16px; display: block;
}


/* Route Offset Controls Styles */
#offset-controls {
    position: absolute; bottom: 75px; left: 10px; z-index: 5; background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px; box-shadow: 0 1px 5px rgba(0,0,0,0.2); padding: 8px 10px;
    display: none;
    flex-direction: column;
    gap: 6px;
    max-width: 190px;
}
#offset-controls .offset-group {
    display: flex; align-items: center; gap: 8px;
}
#offset-controls .offset-label {
    font-size: 0.75rem; font-weight: 500; color: #4b5563;
    min-width: 35px;
    text-align: right;
}
#offset-controls .offset-value {
    font-size: 0.8rem; font-weight: 600; color: #1f2937;
    min-width: 55px;
    text-align: left;
}
#offset-controls button {
    padding: 4px 10px;
    font-size: 0.85rem;
    font-weight: 700;
    border: 1px solid #d1d5db; border-radius: 4px;
    background-color: white; color: #374151;
    cursor: pointer; line-height: 1.2;
    min-width: 30px;
    text-align: center;
}
#offset-controls button:hover { background-color: #f3f4f6; }
#offset-controls button:active { background-color: #e5e7eb; }
#offset-controls button:disabled {
    opacity: 0.5; cursor: not-allowed; background-color: #f9fafb;
}


/* Styles for Input Field Addons (Clear/Paste/Location Buttons) */
.input-addon-btn {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    padding: 0 0.5rem; /* Adjusted horizontal padding */
    color: #9ca3af; /* text-gray-400 */
    cursor: pointer;
    z-index: 1; /* Ensure buttons are above input background */
}
.input-addon-btn:hover:not(:disabled) { color: #4b5563; /* text-gray-600 */ }
.input-addon-btn:disabled { cursor: not-allowed; opacity: 0.5; }
.input-addon-btn svg { width: 1.25rem; height: 1.25rem; } /* h-5 w-5 */

/* Position Clear button (rightmost) */
.clear-btn { right: 0.1rem; }
/* Position Paste button */
.paste-btn { right: 2.3rem; }
/* Position Use Location button (leftmost addon) */
.use-location-btn { right: 4.5rem; }

/* Adjust input padding to accommodate THREE buttons */
input.with-addons {
    padding-right: 6.9rem; /* Approx space for 3 buttons + padding */
}
/* Style for input when loading/resolving */
input.input-loading {
    opacity: 0.7;
    cursor: wait;
    background-color: #f9fafb; /* gray-50 */
}


/* Shortcut Hint Styles */
.shortcut-hint-x {
    display: none; /* Hidden by default */
}
@media (min-height: 1080px) {
    .shortcut-hint-x {
        display: block; /* Visible only on tall screens */
    }
}

/* Filter Panel text paragraphs */
.filter-text-hint {
    font-size: 0.75rem; /* text-xs */
    color: #6b7280; /* text-gray-500 */
    margin-top: 0.25rem; /* mt-1 */
}
.filter-text-hint-small {
    font-size: 0.7rem; /* Smaller */
    color: #6b7280; /* text-gray-500 */
    margin-top: 0.25rem; /* mt-1 */
}

#route-builder-toggle-btn {
    background-color: white; border: none;
    padding: 8px; border-radius: 8px; box-shadow: 0 1px 5px rgba(0,0,0,0.2); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    position: relative;
}
#route-builder-toggle-btn svg { width: 20px; height: 20px; fill: #374151; }
#route-builder-toggle-btn:hover { background-color: #f3f4f6; }
/* Active route indicator dot */
#route-builder-toggle-btn.route-active::after {
    content: '';
    position: absolute;
    top: 4px; right: 4px;
    width: 8px; height: 8px;
    background-color: #3b82f6; /* Blue for route */
    border-radius: 50%;
    border: 1px solid white;
    box-shadow: 0 0 3px rgba(0,0,0,0.3);
    pointer-events: none;
}


/* Route Builder Panel */
#route-builder-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 480px;
    height: 100%;
    background-color: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    border-top: 3px solid #3b82f6; /* Blue accent line at top */
    z-index: 10;
    padding: 3rem 1rem 1rem 1rem;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#route-builder-panel.open {
    transform: translateX(0);
}

#route-builder-panel .route-builder-header {
    margin-bottom: 1rem;
}

#route-builder-panel h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0;
}

/* Route Sections - Consistent with filter-section */
#route-builder-panel .route-section {
    margin-bottom: 1.25rem;
}

#route-builder-panel .route-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#route-builder-panel .route-section h4 .section-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Route Action Buttons Container */
#route-builder-panel .route-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Action Button Base Styles */
#route-builder-panel .route-action-buttons button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
}

#route-builder-panel .route-action-buttons button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

#route-builder-panel .route-action-buttons button:hover:not(:disabled) {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

#route-builder-panel .route-action-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f9fafb;
}

/* Specific button styles */
#route-builder-panel #optimize-route-btn {
    border-color: #93c5fd;
    background-color: #dbeafe;
    color: #1d4ed8;
}

#route-builder-panel #optimize-route-btn:hover:not(:disabled) {
    background-color: #bfdbfe;
    border-color: #60a5fa;
}

#route-builder-panel #clear-waypoints-btn {
    border-color: #fca5a5;
    background-color: #fee2e2;
    color: #dc2626;
}

#route-builder-panel #clear-waypoints-btn:hover:not(:disabled) {
    background-color: #fecaca;
    border-color: #f87171;
}

#route-builder-panel #close-route-builder-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px; /* Larger click area */
    display: flex;
    align-items: center;
    justify-content: center;
}

#route-builder-panel #close-route-builder-btn svg {
    width: 24px;
    height: 24px;
    fill: #6b7280;
}

#route-builder-panel #close-route-builder-btn:hover svg {
    fill: #1f2937;
}

#route-builder-panel #close-route-builder-btn:hover {
    background-color: #f3f4f6;
    border-radius: 4px;
}

/* Waypoints List */
#route-waypoints-list-container {
    border: 1px solid #e5e7eb; border-radius: 4px; padding: 0.25rem;
    background-color: #f9fafb; flex-grow: 1; overflow-y: auto;
}
.waypoint-item {
    display: flex;
    align-items: flex-start;
    padding: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}
.waypoint-item:last-child { border-bottom: none; }

.waypoint-icon {
    font-size: 1rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
    display: inline-block;
    margin-top: 2px;
}

.waypoint-icon-logo {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50%;
    background-color: #f0f0f0;
    display: inline-flex !important;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border: 2px solid #16A34A;
    vertical-align: middle;
    font-size: 0;
    line-height: 0;
    padding: 0;
}

.waypoint-icon-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    margin: 0;
    padding: 0;
}

.waypoint-icon-logo svg {
    width: 18px;
    height: 18px;
    display: block;
    margin: 0 auto;
}

/* Two-line layout for stations */
.waypoint-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
}

.waypoint-line-1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.waypoint-line-2 {
    font-size: 0.8rem;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 0.5rem;
}

.waypoint-brand {
    font-size: 0.85rem;
    color: #374151;
    font-weight: 600;
    flex-grow: 1;
    margin-right: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.waypoint-station-name {
    display: block;
}

/* Single-line layout for start/destination */
.waypoint-label {
    font-size: 0.85rem;
    color: #1f2937;
    flex-grow: 1;
    margin-right: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.waypoint-controls { display: flex; gap: 6px; flex-shrink: 0; }
.waypoint-controls button {
    background: none; border: 1px solid #d1d5db; border-radius: 6px;
    padding: 4px; cursor: pointer; width: 32px; height: 32px;
    display: flex; justify-content: center; align-items: center;
    transition: background-color 0.15s ease;
}
.waypoint-controls button:hover:not(:disabled) { background-color: #f3f4f6; }
.waypoint-controls button svg { width: 18px; height: 18px; stroke: #6b7280; }
.waypoint-controls button.remove-waypoint-btn svg { stroke: #ef4444; }
.waypoint-controls button:disabled { opacity: 0.4; cursor: not-allowed; background-color: transparent; }
.waypoint-placeholder {
    font-size: 0.8rem; text-align: center; color: #6b7280; padding: 1rem;
}
/* NEW: Styles for the leg info (distance/time) between waypoints */
.waypoint-item-wrapper {
    /* A container for a waypoint and the leg info that follows it */
}
.leg-info {
    font-size: 0.75rem;
    color: #6b7280; /* gray-500 */
    background-color: #f9fafb;
    padding: 0.5rem 0.75rem;
    margin: 0 0.5rem 0.5rem 3rem; /* Indent past the icon */
    border-left: 2px solid #e5e7eb;
    border-radius: 4px;
}
.leg-info span {
    font-weight: 500;
}

/* Route Summary */
#route-summary {
    font-size: 0.85rem;
    color: #374151;
}
#route-summary div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    padding: 0.4rem 0.5rem;
    background-color: #f9fafb;
    border-radius: 4px;
}
#route-summary div:last-child {
    margin-bottom: 0;
}
#route-summary span:first-child {
    font-weight: 600;
    color: #4b5563;
}
#route-summary span:last-child {
    color: #1f2937;
    font-weight: 500;
}

/* Waypoints list placeholder */
.waypoint-placeholder {
    font-size: 0.8rem;
    text-align: center;
    color: #6b7280;
    padding: 1.5rem 1rem;
    font-style: italic;
}

/* InfoWindow "Add to Route" button */
.add-to-route-btn {
    font-size: 0.8rem; font-weight: 500; color: #1d4ed8; background-color: #dbeafe;
    border: 1px solid #93c5fd; border-radius: 4px; padding: 2px 6px;
    cursor: pointer; margin-left: 8px;
}
.add-to-route-btn:hover:not(:disabled) { background-color: #bfdbfe; }
.add-to-route-btn:disabled { opacity: 0.6; cursor: not-allowed; background-color: #e5e7eb; border-color: #d1d5db; color: #6b7280; }

/* Custom Waypoint Marker on the Map */
.waypoint-marker-wrapper {
    position: relative;
    width: 0;
    height: 0;
    cursor: pointer;
}

.waypoint-marker-container {
    position: absolute;
    bottom: 0; /* Anchors the pin tip to the map coordinate */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.15s ease-in-out;
}
.waypoint-marker-wrapper:hover .waypoint-marker-container {
    transform: translateX(-50%) scale(1.1);
    transform-origin: bottom center;
}

.waypoint-marker-logo-container {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid #3b82f6; /* Blue border for route waypoints */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    z-index: 2; /* Ensures logo is on top of the pin */
}

.waypoint-marker-logo-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 50%;
}

.waypoint-marker-pin {
    position: relative;
    top: -8px; /* Pull the pin up to overlap with the logo */
    width: 24px;
    height: 24px;
    background-color: #3b82f6;
    color: white;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    font-size: 13px;
    font-weight: 700;
    line-height: 24px; /* Vertically center the number */
    text-align: center;
    border: 1px solid white;
    z-index: 1;
}

.waypoint-marker-pin .waypoint-number {
    display: inline-block;
    transform: rotate(45deg); /* Counter-rotate the number */
}

/* Station Info Panel - Desktop (Left Side Panel) */
#station-info-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 480px; /* Consistent with other panels */
    max-width: 90vw;
    height: 100%;
    background-color: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    border-top: 3px solid #3b82f6; /* Blue accent line at top */
    z-index: 15; /* Higher than filter panel */
    padding: 3rem 1rem 1rem 1rem;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#station-info-panel.open {
    transform: translateX(0);
}

#station-info-panel #close-station-info-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px; /* Larger click area */
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#station-info-panel #close-station-info-btn svg {
    width: 24px;
    height: 24px;
    fill: #6b7280;
}

#station-info-panel #close-station-info-btn:hover svg {
    fill: #1f2937;
}

#station-info-panel #close-station-info-btn:hover {
    background-color: #f3f4f6;
    border-radius: 4px;
}

#station-info-content {
    flex: 1;
    overflow-y: auto;
}

/* Mobile: Bottom Sheet */
@media (max-width: 768px) {
    /* Filter Panel - Full width on mobile */
    #filter-panel {
        width: 100%;
        max-width: 100%;
    }

    /* Route Builder Panel - Full width on mobile */
    #route-builder-panel {
        width: 100%;
        max-width: 100%;
    }

    #station-info-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 60vh;
        max-height: 80vh;
        transform: translateY(100%);
        border-radius: 16px 16px 0 0;
        border-top: 3px solid #3b82f6; /* Blue accent line at top */
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        padding-top: 1.5rem;
        transition: transform 0.3s ease-in-out;
    }

    /* Allow instant transform when dragging (no transition) */
    #station-info-panel.dragging {
        transition: none;
    }

    #station-info-panel.open {
        transform: translateY(0);
    }

    /* Swipe handle for mobile */
    #station-info-panel::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 48px;
        height: 5px;
        background-color: #9ca3af;
        border-radius: 3px;
        z-index: 10;
    }

    /* Make top area more touch-friendly */
    #station-info-panel {
        padding-top: 2.5rem;
    }

    #station-info-panel #close-station-info-btn {
        top: 16px;
        right: 16px;
    }
}
