/* Routes Map Styles */

/* CSS Variables for consistent theming (from vehicle-tracking) */
:root {
  --primary-color: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #dbeafe;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --background-color: #f5f5dc;
  --surface-color: #ffffff;
  --surface-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden; /* Prevent any scrolling on the page */
    position: fixed; /* Prevent any scrolling on the page */
    width: 100%;
    top: 0;
    left: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-color);
    overflow: hidden; /* Prevent any scrolling on the page */
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height for better mobile support */
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1.5rem 1rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    position: relative;
    flex-shrink: 0; /* Prevent header from shrinking */
    width: 100%; /* Ensure header takes full width */
    top: 0; /* Ensure header stays at top */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.header-left {
    flex: 1;
    display: flex;
    justify-content: flex-start;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

/* Header content should not move when sidebar is open - sidebar overlays */
.sidebar-open .header-content {
    transform: translateX(0);
}

/* Center title styles */
.header-center h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: white;
}

/* Logo display styles */
.logo-display {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: transparent;
}

.company-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

/* Legacy logo styles for any remaining usage */
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    font-size: 1.5rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0; /* Allow flex item to shrink below content size */
}

/* Sidebar */
.sidebar {
    width: 380px;
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height for better mobile support */
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    z-index: 10001;
}

/* Sidebar open state for all screens when .open class is applied */
.sidebar.open {
    transform: translateX(0);
}

/* App container should not move when sidebar is open - sidebar overlays */
.app-container.sidebar-open {
    margin-left: 0; /* No margin adjustment - sidebar overlays the content */
}

/* Mobile specific styles */
@media (max-width: 768px) {
    .app-container.sidebar-open {
        margin-left: 0; /* No margin adjustment on mobile */
    }
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    pointer-events: none;
}

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    position: relative;
    z-index: 1;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.brand-text h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    margin: 0;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    transform: scale(1.05);
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-hover);
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    color: white;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 0 2px 2px 0;
}

.nav-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.nav-badge {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    margin-left: auto;
    min-width: 20px;
    text-align: center;
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.content-section {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    transition: all 0.3s ease;
    padding: 0 1.25rem 0 1.25rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.content-section.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Sticky Header Section */
.sticky-header-section {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    margin: -1.25rem -1.25rem 0 -1.25rem;
    padding: 1.25rem;
}

/* Search Container */
.search-container {
    margin-bottom: 1.5rem;
    position: relative;
}

.search-box {
    position: relative;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.12) 100%);
    border-radius: 16px;
    padding: 4px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-box:hover {
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.search-box:focus-within {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    z-index: 2;
    transition: all 0.3s ease;
    pointer-events: none;
}

.search-box:focus-within .search-icon {
    color: rgba(255, 255, 255, 0.8);
    transform: translateY(-50%) scale(1);
}

.search-box input {
    width: 100%;
    padding: 1rem 1.25rem 1rem 3rem;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    letter-spacing: 0.025em;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
    transition: all 0.3s ease;
}

.search-box input:focus::placeholder {
    color: rgba(255, 255, 255, 0.5);
    transform: translateY(0);
}

.search-box input:focus {
    background: transparent;
}

.search-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    font-size: 0.9rem;
}

.search-btn:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, var(--primary-dark), #1d4ed8);
}

.search-btn:active {
    transform: translateY(-50%) scale(0.95);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.clear-search-btn {
    position: absolute;
    right: 4.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3;
    font-size: 0.85rem;
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
}

.clear-search-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
}

.clear-search-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.clear-search-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* Search box loading state */
.search-box.loading .search-icon {
    animation: searchPulse 1.5s ease-in-out infinite;
}

@keyframes searchPulse {
    0%, 100% {
        opacity: 0.6;
        transform: translateY(-50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-50%) scale(1.1);
    }
}

/* Search suggestions dropdown */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    border-radius: 0 0 16px 16px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.search-suggestions.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-suggestion {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-suggestion:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(4px);
}

.search-suggestion:last-child {
    border-bottom: none;
}

.search-suggestion-icon {
    color: var(--primary-color);
    font-size: 0.8rem;
    width: 16px;
    text-align: center;
}

.search-suggestion-text {
    flex: 1;
}

.search-suggestion-highlight {
    color: var(--primary-color);
    font-weight: 600;
}

/* Search box micro-interactions */
.search-box input:not(:placeholder-shown) + .search-icon {
    color: rgba(255, 255, 255, 0.8);
    transform: translateY(-50%) scale(1);
}

.search-box input:not(:placeholder-shown) ~ .clear-search-btn {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
}


/* Search button ripple effect */
.search-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.search-btn:active::before {
    width: 100%;
    height: 100%;
}

/* Enhanced search container with subtle animation */
.search-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark), #8b5cf6);
    border-radius: 18px;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.search-container:hover::before {
    opacity: 0.1;
}


/* Search suggestions scrollbar */
.search-suggestions::-webkit-scrollbar {
    width: 4px;
}

.search-suggestions::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.search-suggestions::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.search-suggestions::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Filter Container */
.filter-container {
    margin-bottom: 1rem;
    position: relative;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.25rem;
}

.filter-label i {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

.filter-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.12) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.7)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.filter-select:hover {
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.filter-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.filter-select option {
    background: #1e293b;
    color: rgba(255, 255, 255, 0.9);
    padding: 0.5rem;
}

/* Region Filter Container */
#region-filter-container {
    transition: all 0.3s ease;
}

#region-filter-container.hidden {
    display: none !important;
}

/* Filter container micro-interactions */
.filter-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(147, 51, 234, 0.1));
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.filter-container:hover::before {
    opacity: 0.1;
}


.filter-actions {
    display: flex;
    gap: 0.5rem;
}

.filter-btn, .sort-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.filter-btn:hover, .sort-btn:hover {
    background: var(--surface-hover);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Route List Container */
.route-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    padding-top: 1rem;
    height: calc(100vh - 400px); /* Ensure it takes remaining space */
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    padding: 0;
}

.list-header h3 {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.list-actions {
    display: flex;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.25rem;
}

.export-routes-btn,
.toggle-all-btn {
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 0.5rem;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.export-routes-btn:hover,
.toggle-all-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.export-routes-btn:active,
.toggle-all-btn:active {
    transform: translateY(1px);
}

.toggle-all-btn.selected {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.toggle-all-btn.selected i {
    color: var(--primary-color);
}

.view-toggle {
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 0.5rem;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-toggle.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.view-toggle:hover {
    color: white;
}

/* Route Accordion */
.route-accordion {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.5rem 0 0;
    transition: all 0.3s ease;
    height: 100%;
    min-height: 200px;
}

/* Route Checkbox Styling */
.route-checkbox-container {
    display: flex;
    align-items: center;
    margin-right: 0.75rem;
}

.route-checkbox {
    display: none;
}

.route-checkbox-label {
    position: relative;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.route-checkbox-label:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.route-checkbox:checked + .route-checkbox-label {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.route-checkbox:checked + .route-checkbox-label::after {
    content: "✓";
    color: white;
    font-size: 12px;
    font-weight: bold;
    position: absolute;
}

.route-checkbox:checked + .route-checkbox-label:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* Route List (fallback) */
.route-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    transition: all 0.3s ease;
}

.route-list.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.route-list.grid-view .route-item {
    margin-bottom: 0;
}

.route-list::-webkit-scrollbar {
    width: 4px;
}

.route-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.route-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.route-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.route-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.route-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.route-item:hover {
    border-color: rgba(102, 126, 234, 0.3);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.route-item:hover::before {
    opacity: 1;
}

.route-item.selected {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.15);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.route-title-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.route-color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.route-color-indicator:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.route-item h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: white;
    flex: 1;
}

.route-status {
    display: flex;
    align-items: center;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

.status-indicator.active {
    background: var(--success-color);
}

.status-indicator.inactive {
    background: var(--secondary-color);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

.route-item p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
    line-height: 1.4;
}

.route-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
}

.route-distance,
.route-points,
.route-stops {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-weight: 500;
}

.route-stops {
    color: var(--accent-color, #4CAF50);
    background: rgba(76, 175, 80, 0.2);
}

.route-color-code {
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.route-actions {
    display: flex;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
}

.route-actions button {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.route-actions button:first-child {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.route-actions button:nth-child(2) {
    background: linear-gradient(135deg, var(--success-color), #20c997);
    color: white;
}

.route-actions button:last-child {
    background: linear-gradient(135deg, var(--error-color), #e74c3c);
    color: white;
}

.route-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Accordion Styles */
.accordion-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.accordion-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.accordion-item:hover {
    border-color: rgba(102, 126, 234, 0.3);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.accordion-item:hover::before {
    opacity: 1;
}

.accordion-item.active {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.15);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.accordion-header {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.accordion-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.accordion-title-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    width: 100%;
    margin-bottom: 0.5rem;
}

.accordion-color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.accordion-color-indicator:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.accordion-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: white;
    flex: 1;
    width: 100%;
}

.accordion-meta {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
    margin-right: 1rem;
    width: 100%;
}

.accordion-stats {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    align-items: center;
    flex: 1;
    justify-content: flex-start;
}

.accordion-stat {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-weight: 500;
}

.accordion-toggle {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0.5rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.accordion-toggle:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.accordion-toggle.active {
    transform: rotate(180deg);
    color: var(--primary-color);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.1);
}

.accordion-content.active {
    max-height: 400px; /* Reduced from 1000px to a more reasonable height */
    overflow-y: auto; /* Enable vertical scrolling */
}

.accordion-body {
    padding: 0 1rem 1rem 1rem;
    max-height: 400px; /* Ensure body doesn't exceed container */
    overflow-y: auto; /* Enable scrolling within the body */
}

/* Custom scrollbar for accordion content */
.accordion-content::-webkit-scrollbar,
.accordion-body::-webkit-scrollbar {
    width: 6px;
}

.accordion-content::-webkit-scrollbar-track,
.accordion-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.accordion-content::-webkit-scrollbar-thumb,
.accordion-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    transition: background 0.2s ease;
}

.accordion-content::-webkit-scrollbar-thumb:hover,
.accordion-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Timeline Styles */
.timeline {
    position: relative;
    padding-left: 2rem;
    margin-top: 1rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--primary-color), rgba(102, 126, 234, 0.3));
    border-radius: 1px;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

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

.timeline-marker {
    position: absolute;
    left: -1.55rem;
    top: 0.5rem;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    transition: all 0.2s ease;
}

.timeline-item:hover .timeline-marker {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.3);
}

.timeline-content {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.timeline-content:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateX(4px);
}

.timeline-stop-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    margin: -0.25rem -0.5rem 0.25rem -0.5rem;
}

.timeline-stop-name:hover {
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
    transform: translateX(2px);
}

.timeline-stop-name:active {
    transform: translateX(2px) scale(0.98);
    background: rgba(59, 130, 246, 0.2);
}

/* Highlighted stop animation */
.timeline-stop-name.highlighted {
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.2);
    animation: highlightPulse 0.6s ease-in-out;
}

@keyframes highlightPulse {
    0% {
        background: rgba(59, 130, 246, 0.1);
        transform: translateX(2px) scale(1);
    }
    50% {
        background: rgba(59, 130, 246, 0.3);
        transform: translateX(2px) scale(1.02);
    }
    100% {
        background: rgba(59, 130, 246, 0.2);
        transform: translateX(2px) scale(1);
    }
}

.timeline-stop-icon {
    color: var(--primary-color);
    font-size: 0.8rem;
}

.timeline-stop-coords {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Courier New', monospace;
    margin-bottom: 0.25rem;
}

.timeline-stop-properties {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.timeline-stop-property {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: 500;
}

.timeline-stop-property.elevation {
    color: #10b981;
    background: rgba(16, 185, 129, 0.2);
}

.timeline-stop-property.id {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.2);
}

/* No stops message */
.timeline-no-stops {
    text-align: center;
    padding: 2rem 1rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

.timeline-no-stops i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
    color: rgba(255, 255, 255, 0.3);
}

/* Analytics Section */
.analytics-container h3 {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.stat-item i {
    font-size: 1.5rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    display: block;
}

.stat-value {
    font-weight: 700;
    color: white;
    font-size: 1.2rem;
    display: block;
}

.chart-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    height: 200px;
}

/* Settings Section */
.settings-container h3 {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.setting-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.setting-item span:first-child {
    color: white;
    font-weight: 500;
}

.setting-item input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.setting-item input[type="checkbox"]:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.setting-item input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(20px);
}


/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--surface-hover);
}

.footer-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.footer-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    padding: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

.footer-stats .stat-item i {
    color: var(--primary-color);
    font-size: 0.9rem;
}

.footer-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.footer-btn {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.footer-btn:hover {
    background: var(--surface-hover);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 0; /* Allow flex item to shrink below content size */
    height: 100%; /* Ensure full height */
    background-color: var(--background-color); /* Match background color to prevent white space */
}

/* Followed-path mode styles */
.app-container.followed-path-mode {
    margin-left: 0;
}

.main-content.followed-path-mode {
    margin-left: 0;
}

.map-container.followed-path-mode {
    width: 100%;
    margin-left: 0;
}

.sidebar.followed-path-hidden,
.sidebar[data-followed-path-mode="true"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Header adjustments for followed-path mode */
.followed-path-mode .header {
    width: 100%;
    padding: 1.5rem 1rem;
    box-shadow: var(--shadow-lg);
}

.followed-path-mode .header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

.followed-path-mode .header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.followed-path-mode .header-right {
    /* Keep the space for balance even when button is hidden */
    min-width: 48px;
}

/* Location Search Bar */
.location-search-container {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
    width: 90%;
    max-width: 500px;
    pointer-events: none;
}

.location-search-box {
    position: relative;
    pointer-events: auto;
    display: flex;
    align-items: center;
    background: white;
    border-radius: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.1);
    padding: 0 16px;
    pointer-events: auto;
    transition: box-shadow 0.2s ease;
}

.location-search-box:hover,
.location-search-box:focus-within {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.location-search-icon {
    color: #5f6368;
    font-size: 18px;
    margin-right: 12px;
    flex-shrink: 0;
}

.location-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 12px 8px;
    background: transparent;
    color: #202124;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.location-search-input::placeholder {
    color: #9aa0a6;
}

.location-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.location-search-clear:hover {
    background-color: #f1f3f4;
    color: #202124;
}

.location-search-clear i {
    font-size: 16px;
}

/* Location Autocomplete Dropdown */
.location-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1002;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #e8eaed;
    transition: background-color 0.2s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background-color: #f1f3f4;
}

.autocomplete-item-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.autocomplete-item-main i {
    color: #8ab4f8;
    font-size: 16px;
    flex-shrink: 0;
}

.autocomplete-item-text {
    flex: 1;
    min-width: 0;
}

.autocomplete-item-primary {
    color: #202124 !important;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Closest Route Marker */
.closest-route-marker {
    background: transparent !important;
    border: none !important;
}

.closest-route-marker > div {
    pointer-events: auto !important;
    display: flex !important;
    visibility: visible !important;
}

.closest-route-marker i {
    color: white;
    font-size: 14px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Map Toggles Container */
.map-toggles-container {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
    background: white;
    border-radius: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.1);
    padding: 12px 16px;
    transition: box-shadow 0.2s ease;
}

.map-toggles-container:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.map-toggle-item {
    pointer-events: auto;
    display: flex;
    align-items: center;
}

.map-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.map-toggle-label.loading {
    cursor: not-allowed;
    opacity: 0.7;
}

.map-toggle-text {
    color: #202124;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    white-space: nowrap;
}

.map-toggle-wrapper {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.map-toggle-checkbox {
    display: none;
}

.map-toggle-checkbox:disabled {
    cursor: not-allowed;
}

.map-toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #cccccc;
    border-radius: 12px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.map-toggle-loading {
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    z-index: 10;
}

.map-toggle-loading i {
    color: #4f46e5;
    font-size: 14px;
}

.map-toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.map-toggle-checkbox:checked + .map-toggle-slider {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.map-toggle-checkbox:checked + .map-toggle-slider::before {
    transform: translateX(20px);
}

/* Date Selector Styles */
.map-date-selector-item {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: center;
}

.map-date-selector-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.map-date-selector-label.loading {
    cursor: not-allowed;
    opacity: 0.7;
}

.map-date-selector-text {
    color: #202124;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    white-space: nowrap;
}

.map-date-input {
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #202124;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.map-date-input:hover {
    border-color: #b0b0b0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.map-date-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.map-date-input:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    background: #f5f5f5;
}

.map-date-loading {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    z-index: 10;
    pointer-events: none;
}

.map-date-loading i {
    color: #4f46e5;
    font-size: 14px;
}

/* Hide toggles in followed-path mode */
.followed-path-mode .map-toggles-container {
    display: none !important;
}

/* Hide toggles in share mode */
.share-mode .map-toggles-container {
    display: none !important;
}

/* Card Reads Summary Card */
.card-reads-summary-card {
    position: absolute;
    top: 140px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.1);
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
}

.card-reads-summary-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.15);
    transform: translateX(-50%) translateY(-2px);
}

.card-reads-summary-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-reads-summary-icon {
    color: #9333ea;
    font-size: 18px;
}

.card-reads-summary-count {
    color: #202124;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Card Reads Popup */
.card-reads-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.card-reads-popup-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card-reads-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.card-reads-popup-header h3 {
    margin: 0;
    color: #202124;
    font-size: 20px;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.card-reads-popup-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #64748b;
    font-size: 18px;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.card-reads-popup-close:hover {
    color: #202124;
    background: #f1f5f9;
}

.card-reads-popup-filter {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-reads-filter-label {
    color: #202124;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    white-space: nowrap;
}

.card-reads-route-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #202124;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-reads-route-select:hover {
    border-color: #9333ea;
}

.card-reads-route-select:focus {
    outline: none;
    border-color: #9333ea;
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

.card-reads-popup-content {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 160px);
}

.card-reads-user-item {
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.card-reads-user-item:last-child {
    border-bottom: none;
}

.card-reads-user-name {
    color: #202124;
    font-size: 15px;
    font-weight: 500;
}

.card-reads-user-time {
    color: #64748b;
    font-size: 13px;
    margin-top: 4px;
}

/* Search Location Marker Styles */
.search-location-marker {
    background: transparent !important;
    border: none !important;
}

.search-location-marker > div {
    pointer-events: auto !important;
    display: flex !important;
    visibility: visible !important;
}

/* Custom Autocomplete Dropdown (server-side secure implementation) */
.location-autocomplete-dropdown {
    position: fixed;
    background: white;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    border: none;
    margin-top: -1px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1001;
    display: none;
}

.location-autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-top: 1px solid #e8eaed;
    transition: background-color 0.2s ease;
}

.autocomplete-item:first-child {
    border-top: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: #f1f3f4;
}

.autocomplete-icon {
    color: #5f6368;
    font-size: 18px;
    margin-right: 12px;
    flex-shrink: 0;
}

.autocomplete-content {
    flex: 1;
    min-width: 0;
}

.autocomplete-main-text {
    color: #202124;
    font-size: 15px;
    font-weight: 400;
    margin-bottom: 2px;
}

.autocomplete-secondary-text {
    color: #5f6368;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobile responsive adjustments for location search */
@media (max-width: 768px) {
    .location-search-container {
        width: calc(100% - 40px);
        top: 10px;
    }

    .location-search-box {
        padding: 0 12px;
    }

    .location-search-input {
        font-size: 14px;
        padding: 10px 6px;
    }

    .location-search-icon {
        font-size: 16px;
        margin-right: 8px;
    }
}

/* Map Loading State */
.map-container.map-loading {
    background-color: #f5f5dc; /* Light background during loading */
}

.map-container.map-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #3b82f6;
    border-top: 3px solid transparent;
    border-radius: 50%;
    animation: map-loading-spin 1s linear infinite;
    z-index: 1000;
}

@keyframes map-loading-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.map {
    width: 100%;
    height: 100%;
    min-height: 100%; /* Ensure map takes full container height */
    background-color: var(--background-color); /* Match background color */
}

/* Ensure Leaflet map container takes full space */
.leaflet-container {
    height: 100% !important;
    width: 100% !important;
    background-color: var(--background-color) !important;
}

/* Prevent white lines during route calculations */
.leaflet-interactive {
    transition: none !important;
}

.leaflet-zoom-animated {
    transition: none !important;
}

.leaflet-pane {
    will-change: auto !important;
}

.leaflet-tile {
    transition: none !important;
}

.leaflet-tile-container {
    transition: none !important;
}

.leaflet-map-pane {
    background-color: var(--background-color) !important;
}

/* Prevent flickering during route updates */
.leaflet-zoom-animated .leaflet-zoom-animated {
    transition: none !important;
}

/* Ensure smooth polyline rendering without white lines */
.leaflet-overlay-pane {
    background-color: transparent !important;
}

.leaflet-marker-pane {
    background-color: transparent !important;
}

/* Ensure Leaflet zoom controls are visible and properly positioned */
.leaflet-control-zoom {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    z-index: 1000 !important;
}

.leaflet-control-zoom a {
    background-color: var(--text-primary) !important;
    color: white !important;
    border: 1px solid var(--secondary-color) !important;
    font-size: 18px !important;
    font-weight: bold !important;
    text-decoration: none !important;
    display: block !important;
    width: 30px !important;
    height: 30px !important;
    line-height: 30px !important;
    text-align: center !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4) !important;
}

.leaflet-control-zoom a:hover {
    background-color: var(--secondary-color) !important;
    color: white !important;
}

.leaflet-control-zoom a:active {
    background-color: var(--primary-dark) !important;
}

/* Map Controls */
.map-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
    align-items: center;
    pointer-events: none; /* Allow clicks to pass through to map */
}

.map-controls .btn-control {
    pointer-events: auto; /* Re-enable pointer events for buttons */
}

.map-controls .btn-control {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: center;
}

/* Layer Controls */
.layer-controls {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 200px;
}

.layer-controls h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.layer-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Style Controls */
.style-controls {
    position: absolute;
    top: 200px;
    left: 1rem;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 200px;
}

.style-controls h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.style-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}



/* Mobile Menu Button */
.mobile-menu-button {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    pointer-events: auto; /* Ensure button is clickable */
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--text-muted);
    transform: translateY(-1px);
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-icon:hover {
    background: var(--surface-hover);
    color: var(--primary-color);
}


/* Side Menu Button */
#side-menu-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    transition: all 0.3s ease;
}

#side-menu-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Search Header */
.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding: 0 0.5rem;
}

.search-header h3 {
    margin: 0;
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Close Sidebar Button */
.btn-close-sidebar {
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
    flex-shrink: 0;
    position: relative;
    z-index: 10002;
}

.btn-close-sidebar:hover {
    background: #dc2626;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-close-sidebar:active {
    transform: scale(0.95);
}

.btn-control {
    background: var(--surface-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.btn-control:hover {
    background: var(--surface-hover);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-mobile-menu {
    display: none;
}

/* Layer and Style Toggle Buttons */
.layer-toggle,
.style-toggle {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.layer-toggle:hover,
.style-toggle:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
}

.layer-toggle.active,
.style-toggle.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 400px;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateX(0);
    opacity: 1;
}

.toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    border-radius: 12px 12px 0 0;
}

.toast.success::before {
    background: var(--success-color);
}

.toast.error::before {
    background: var(--error-color);
}

.toast.info::before {
    background: var(--primary-color);
}

.toast.warning::before {
    background: var(--warning-color);
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.875rem;
    margin-top: 0.125rem;
}

.toast.success .toast-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.toast.error .toast-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.toast.info .toast-icon {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

.toast.warning .toast-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-message {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    margin: 0;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    margin-top: -0.25rem;
    margin-right: -0.25rem;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

/* Toast Animations */
@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.toast.slide-out {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* Dark mode adjustments for toast */
.dark-mode .toast {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.dark-mode .toast-message {
    color: var(--text-primary);
}

.dark-mode .toast-close {
    color: var(--text-muted);
}

.dark-mode .toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid #e0e0e0;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.form-group input[type="range"] {
    width: 100%;
}

/* Search Results */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-result {
    padding: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result:hover {
    background: #f8f9fa;
}

.search-result h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.search-result p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Custom Marker Styles */
.custom-marker {
    background: var(--primary-color);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

/* Popup Styles */
.route-popup,
.marker-popup,
.stop-popup {
    min-width: 200px;
    color: #1e293b !important;
    background: white !important;
}

/* Ensure Leaflet popup content is properly styled */
.leaflet-popup-content-wrapper {
    background: white !important;
    color: #1e293b !important;
}

.leaflet-popup-content {
    color: #1e293b !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.route-popup h3,
.marker-popup h3,
.stop-popup h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1e293b !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.route-popup p,
.marker-popup p,
.stop-popup p {
    font-size: 0.9rem;
    color: #64748b !important;
    margin-bottom: 0.25rem;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.route-info,
.point-info,
.stop-info {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e0e0e0;
}

.route-info p,
.point-info p,
.stop-info p {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    color: #64748b !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.route-stops {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e0e0e0;
}

.route-stops h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #4CAF50 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.route-stops ul {
    margin: 0;
    padding-left: 1rem;
    list-style-type: disc;
}

.route-stops li {
    font-size: 0.8rem;
    margin-bottom: 0.2rem;
    color: #64748b !important;
    display: list-item !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 320px;
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    }

    /* Header should not move on mobile - sidebar overlays */
    .sidebar-open .header-content {
        transform: translateX(0);
    }

    .mobile-menu-button {
        display: block;
        background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    }

    /* Close button is now visible on all screen sizes when sidebar is open */

    .layer-controls,
    .style-controls {
        position: relative;
        top: auto;
        left: auto;
        margin: 1rem;
        width: auto;
    }

    .header-content {
        padding: 0 1rem;
    }

    .logo h1 {
        font-size: 1.2rem;
    }

    .sidebar-header {
        padding: 1rem;
    }

    .brand-text h2 {
        font-size: 1.1rem;
    }

    .brand-subtitle {
        font-size: 0.75rem;
    }

    .nav-item {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }

    .content-section {
        padding: 1rem 1rem 0 1rem;
    }

    .search-box {
        padding: 3px;
        border-radius: 14px;
    }

    .search-box input {
        padding: 0.8rem 1rem 0.8rem 2.5rem;
        font-size: 0.9rem;
    }

    .search-icon {
        left: 1rem;
        font-size: 0.9rem;
    }

    .search-btn {
        width: 32px;
        height: 32px;
        right: 0.5rem;
        font-size: 0.8rem;
    }

    .clear-search-btn {
        width: 32px;
        height: 32px;
        right: 3.5rem;
        font-size: 0.75rem;
    }

    .search-suggestions {
        max-height: 150px;
        border-radius: 0 0 14px 14px;
    }

    .search-suggestion {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .route-item {
        padding: 0.8rem;
    }

    .route-item h4 {
        font-size: 0.9rem;
    }

    .route-item p {
        font-size: 0.8rem;
    }

    .route-actions button {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }

    /* No slide animation on very small screens as sidebar takes full width */
    .sidebar-open .header-content {
        transform: translateX(0);
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }


    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* Edit Mode Styles */
.accordion-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.edit-route-btn {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.375rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
}

.edit-route-btn:hover {
    background: var(--surface-hover);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

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

.edit-route-btn i {
    font-size: 0.875rem;
}

/* Draggable Stop Styles */
.stop-marker {
    cursor: grab !important;
    transition: all 0.2s ease;
}

.stop-marker:hover {
    transform: scale(1.1);
    z-index: 1000;
}

.stop-marker.dragging {
    cursor: grabbing !important;
    transform: scale(1.2);
    z-index: 1001;
}

.stop-marker.editable-stop {
    animation: pulse 2s infinite;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3) !important;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

/* Dark mode adjustments for edit mode */
.dark-mode .edit-route-btn {
    background: var(--surface-color);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.dark-mode .edit-route-btn:hover {
    background: var(--surface-hover);
    color: var(--primary-color);
}

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

/* Routing Status Styles */
.routing-status-container {
    margin: 1rem 0 0 0;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.routing-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.routing-status.available {
    color: var(--success-color);
}

.routing-status.unavailable {
    color: var(--warning-color);
}

.routing-status i {
    font-size: 1rem;
}

/* Dark mode adjustments for routing status */
.dark-mode .routing-status-container {
    background: var(--surface-color);
    border-color: var(--border-color);
}

/* Force dark theme - always applied */
:root {
  --background-color: #f5f5dc;
  --surface-color: #1e293b;
  --surface-hover: #334155;
  --border-color: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
}

.loading-overlay {
  background: rgba(15, 23, 42, 0.9);
}

/* Context Menu Styles */
.route-context-menu {
    position: absolute;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    min-width: 160px;
    z-index: 1000;
    font-family: inherit;
}

.context-menu-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
    color: #1f2937;
    font-weight: 500;
}

.context-menu-item:hover {
    background-color: #f3f4f6;
}

.context-menu-item i {
    width: 16px;
    text-align: center;
    font-size: 0.9rem;
}

/* Stop context menu specific styles */
.stop-context-menu .context-menu-item {
    color: #dc2626;
}

.stop-context-menu .context-menu-item:hover {
    background-color: #fef2f2;
}

/* Mobile responsive adjustments for context menu */
@media (max-width: 768px) {
    .route-context-menu {
        min-width: 140px;
    }

    .context-menu-item {
        padding: 0.625rem 0.875rem;
        font-size: 0.85rem;
    }
}

/* Custom Delete Confirmation Popup */
.delete-confirmation-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

.delete-confirmation-popup.show {
    display: flex;
}

.delete-confirmation-content {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease-out;
    border: 1px solid var(--border-color);
}

.delete-confirmation-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.delete-confirmation-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #fef3c7, #fbbf24);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.delete-confirmation-icon i {
    font-size: 1.5rem;
    color: #d97706;
}

.delete-confirmation-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.delete-confirmation-body {
    padding: 1.5rem;
}

.delete-confirmation-body p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
}

.delete-confirmation-details {
    background: var(--surface-hover);
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.stop-info,
.stop-coords {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.stop-info:last-child,
.stop-coords:last-child {
    margin-bottom: 0;
}

.stop-info i,
.stop-coords i {
    width: 16px;
    text-align: center;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.stop-info span,
.stop-coords span {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.stop-coords i {
    color: var(--text-muted);
}

.stop-coords span {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.delete-confirmation-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem 1.5rem 1.5rem;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
}

.delete-confirmation-actions .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    justify-content: center;
}

.delete-confirmation-actions .btn-secondary {
    background: var(--surface-color);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.delete-confirmation-actions .btn-secondary:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.delete-confirmation-actions .btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.delete-confirmation-actions .btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.delete-confirmation-actions .btn-danger:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile responsive adjustments for delete popup */
@media (max-width: 768px) {
    .delete-confirmation-content {
        width: 95%;
        margin: 1rem;
    }

    .delete-confirmation-header {
        padding: 1.25rem 1.25rem 0.75rem 1.25rem;
    }

    .delete-confirmation-icon {
        width: 40px;
        height: 40px;
    }

    .delete-confirmation-icon i {
        font-size: 1.25rem;
    }

    .delete-confirmation-header h3 {
        font-size: 1.125rem;
    }

    .delete-confirmation-body {
        padding: 1.25rem;
    }

    .delete-confirmation-actions {
        padding: 0.75rem 1.25rem 1.25rem 1.25rem;
        flex-direction: column;
    }

    .delete-confirmation-actions .btn {
        width: 100%;
        min-width: auto;
    }
}

/* Loading States */
.loading-stat {
    color: var(--primary-color) !important;
    font-style: italic;
}

.loading-stat i {
    margin-right: 0.25rem;
}

.stat-value:contains("Calculating") {
    color: var(--text-muted);
    font-style: italic;
}

/* Share functionality styles */
.share-routes-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.share-routes-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.share-routes-btn:active {
    transform: translateY(0);
}

/* View-only mode styles */
.view-only-mode .route-item {
    opacity: 0.8;
    pointer-events: none;
}

/* Edit button is now completely removed from HTML in view-only mode */

/* Keep route checkboxes visible in view-only mode for better UX */
.view-only-mode .route-item .route-checkbox {
    display: block !important;
}

.view-only-indicator {
    color: #ff6b6b !important;
    font-size: 0.8em !important;
    font-weight: 500;
    margin-left: 8px;
}

/* Hide editing controls in view-only mode */
.view-only-mode .add-route-btn,
.view-only-mode .share-routes-btn {
    display: none !important;
}

/* Keep toggle-all-btn visible in view-only mode for route visibility control */
.view-only-mode .toggle-all-btn {
    display: flex !important;
}
