/* Map Page Specific Styles - Dark Theme with Glassmorphism */

/* Body Override for Map Page */
body {
    background: #0a0a0b;
    color: #e4e4e7;
    overflow-x: hidden;
}

/* Animated Background */
.map-page-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(217, 70, 239, 0.06) 0%, transparent 50%),
        #0a0a0b;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Map Container with Glassmorphism */
.map-container {
    position: relative;
    margin: 1rem;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(24, 24, 27, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 4px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#map {
    height: 75vh;
    width: 100%;
    border-radius: 20px;
    position: relative;
    z-index: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#map:hover {
    transform: scale(1.005);
}

/* Glowing Map Border Effect */
.map-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        rgba(99, 102, 241, 0.3), 
        rgba(139, 92, 246, 0.3), 
        rgba(217, 70, 239, 0.3),
        rgba(99, 102, 241, 0.3)
    );
    border-radius: 22px;
    z-index: -1;
    animation: borderGlow 3s linear infinite;
    opacity: 0.6;
}

@keyframes borderGlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Map Header with Gradient Text */
.map-header {
    text-align: center;
    padding: 2rem 2rem 1rem;
    position: relative;
    overflow: hidden;
}

.map-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 50%, rgba(217, 70, 239, 0.1) 100%);
    z-index: -1;
}

.map-header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    position: relative;
}

.map-header h2 {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: #a1a1aa;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    margin: 0;
    opacity: 0.8;
}



/* Floating Back Button with Glassmorphism */
.back-button {
    position: fixed;
    top: 30px;
    left: 30px;
    z-index: 1000;
    background: 
        linear-gradient(135deg, rgba(24, 24, 27, 0.95) 0%, rgba(39, 39, 42, 0.9) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.4rem;
    color: #f4f4f5;
    font-weight: 600;
    overflow: hidden;
    text-decoration: none;
}

.back-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.back-button:hover {
    transform: scale(1.08) translateY(-2px);
    background: 
        linear-gradient(135deg, rgba(99, 102, 241, 0.9) 0%, rgba(139, 92, 246, 0.8) 100%);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 12px 35px rgba(99, 102, 241, 0.4),
        0 6px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.back-button:hover::before {
    opacity: 1;
}

.back-button:active {
    transform: scale(1.02);
}

/* Floating Stats Panel */
.map-stats {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    background: 
        linear-gradient(135deg, rgba(24, 24, 27, 0.95) 0%, rgba(39, 39, 42, 0.9) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.map-stats.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.map-stats-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #a1a1aa;
}

.map-stats-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.map-stats-label {
    color: #71717a;
}

.map-stats-value {
    color: #f4f4f5;
    font-weight: 500;
}

/* Enhanced Loading Indicator */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: 
        linear-gradient(135deg, rgba(24, 24, 27, 0.98) 0%, rgba(39, 39, 42, 0.95) 100%);
    backdrop-filter: blur(30px);
    padding: 2rem 3rem;
    border-radius: 20px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 8px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2000;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.map-loading.show {
    display: flex;
}

.map-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-top: 3px solid #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.map-loading-text {
    color: #f4f4f5;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Toast */
.map-error-toast {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 3000;
    background: 
        linear-gradient(135deg, rgba(239, 68, 68, 0.95) 0%, rgba(220, 38, 38, 0.9) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 
        0 8px 25px rgba(239, 68, 68, 0.4),
        0 4px 12px rgba(220, 38, 38, 0.3);
    animation: slideInFromRight 0.3s ease, fadeOut 0.3s ease 4.7s forwards;
    max-width: 300px;
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Enhanced Custom Marker Styles */
.custom-div-icon {
    background: transparent !important;
    border: none !important;
}

/* Marker Container for Pin + Label */
.marker-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    animation: markerFadeIn 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

.marker-container:hover .marker-label {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px) scale(1.05);
}

.marker-container:hover .custom-marker-pin {
    transform: scale(1.1);
}

/* Marker Label - Location Name Above Pin */
.marker-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: 
        linear-gradient(135deg, rgba(24, 24, 27, 0.95) 0%, rgba(39, 39, 42, 0.9) 100%);
    backdrop-filter: blur(12px);
    color: #f4f4f5;
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.2);
    margin-bottom: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.9;
    z-index: 1000;
    pointer-events: auto;
}

/* Responsive marker labels for mobile */
.marker-label {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    margin-bottom: 0.3rem;
    border-radius: 6px;
    max-width: 120px;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* Category-specific label styling to match pins */
.marker-container .marker-label {
    border-left: 3px solid #6366f1;
}

.breakfast .marker-label {
    border-left-color: #f59e0b;
    background: 
        linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(24, 24, 27, 0.95) 30%);
}

.lunch-dinner .marker-label {
    border-left-color: #ef4444;
    background: 
        linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(24, 24, 27, 0.95) 30%);
}

.snack-night .marker-label {
    border-left-color: #8b5cf6;
    background: 
        linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(24, 24, 27, 0.95) 30%);
}

.coffee .marker-label {
    border-left-color: #06b6d4;
    background: 
        linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(24, 24, 27, 0.95) 30%);
}

.tour .marker-label {
    border-left-color: #10b981;
    background: 
        linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(24, 24, 27, 0.95) 30%);
}

.fuel .marker-label {
    border-left-color: #f97316;
    background: 
        linear-gradient(135deg, rgba(249, 115, 22, 0.15) 0%, rgba(24, 24, 27, 0.95) 30%);
}

.people .marker-label {
    border-left-color: #ec4899;
    background: 
        linear-gradient(135deg, rgba(236, 72, 153, 0.15) 0%, rgba(24, 24, 27, 0.95) 30%);
}

/* People Marker Specific Styles */
.people-marker .marker-pin {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
    box-shadow: 
        0 4px 12px rgba(236, 72, 153, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.3);
}

.people-marker .marker-icon {
    font-size: 14px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 1; 
    }
    50% { 
        transform: scale(1.1); 
        opacity: 0.8; 
    }
}

.people-marker:hover .marker-pin {
    transform: scale(1.15);
    box-shadow: 
        0 6px 20px rgba(236, 72, 153, 0.6),
        0 3px 10px rgba(0, 0, 0, 0.4);
}

/* People Popup Styles */
.people-popup .leaflet-popup-content-wrapper {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1) 0%, rgba(24, 24, 27, 0.95) 30%);
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.people-popup .popup-category.people {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
    color: white;
}

/* Marker entrance animation */
.marker-container {
    animation: markerFadeIn 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes markerFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    60% {
        opacity: 0.8;
        transform: translateY(-2px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Different marker colors for categories */
.marker-pin.breakfast {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
}

.marker-pin.lunch-dinner {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.marker-pin.snack-night {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.marker-pin.coffee {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.marker-pin.tour {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.marker-pin.fuel {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

/* Custom Pin Design using CSS Variables for Dynamic Colors */
.custom-marker-pin {
    position: relative;
    width: 32px;
    height: 45px;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: markerPulse 2s infinite;
    /* Smooth transitions for zoom-based scaling */
    will-change: transform;
    backface-visibility: hidden;
}

/* Marker container smooth scaling */
.marker-container {
    transition: transform 0.2s ease-out;
    will-change: transform;
    backface-visibility: hidden;
}

.pin-head {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    background: var(--marker-color, linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%));
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-shadow: 
        0 4px 12px var(--marker-shadow, rgba(99, 102, 241, 0.4)),
        0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.pin-head::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: white;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.pin-head::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: var(--marker-color, linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%));
    border-radius: 50%;
    opacity: 0.3;
    z-index: -1;
    animation: markerGlow 2s ease-in-out infinite alternate;
}

.pin-point {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 16px solid;  
    border-top-color: var(--marker-solid-color, #6366f1);
    filter: drop-shadow(0 2px 4px var(--marker-shadow, rgba(99, 102, 241, 0.3)));
    z-index: 1;
}

/* Enhanced Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    background: 
        linear-gradient(135deg, rgba(24, 24, 27, 0.98) 0%, rgba(39, 39, 42, 0.95) 100%) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 8px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    padding: 0 !important;
}

.leaflet-popup-content {
    margin: 1.5rem !important;
    font-family: 'Inter', sans-serif !important;
    color: #f4f4f5 !important;
}

.leaflet-popup-content h3 {
    margin: 0 0 0.75rem 0 !important;
    color: #f4f4f5 !important;
    font-size: 1.2rem !important;
    font-weight: 600 !important;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.leaflet-popup-content p {
    margin: 0 !important;
    color: #a1a1aa !important;
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
}

/* Navigation button in popup */
.leaflet-popup-content button {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: white !important;
    border: none !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.5rem !important;
    cursor: pointer !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    font-family: 'Inter', sans-serif !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

.leaflet-popup-content button:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
}

.leaflet-popup-content button:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3) !important;
}

.leaflet-popup-tip {
    background: 
        linear-gradient(135deg, rgba(24, 24, 27, 0.98) 0%, rgba(39, 39, 42, 0.95) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Map Control Styles */
.leaflet-control-locate {
    background: 
        linear-gradient(135deg, rgba(24, 24, 27, 0.95) 0%, rgba(39, 39, 42, 0.9) 100%) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.leaflet-control-locate a {
    background: transparent !important;
    color: #f4f4f5 !important;
    border-radius: 12px !important;
}

.leaflet-control-locate:hover {
    background: 
        linear-gradient(135deg, rgba(99, 102, 241, 0.9) 0%, rgba(139, 92, 246, 0.8) 100%) !important;
}

.leaflet-control-scale {
    background: 
        linear-gradient(135deg, rgba(24, 24, 27, 0.95) 0%, rgba(39, 39, 42, 0.9) 100%) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    color: #f4f4f5 !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.8rem !important;
}

/* Compact Interactive Map Legend - Bottom Left */
.map-legend {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background: 
        linear-gradient(135deg, rgba(24, 24, 27, 0.98) 0%, rgba(39, 39, 42, 0.95) 100%);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 0.8rem;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    min-width: 160px;
    max-width: 180px;
}

.map-legend.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.map-legend-title {
    color: #f4f4f5;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-align: left;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    padding: 0.4rem 0.6rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: #a1a1aa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
    background: rgba(39, 39, 42, 0.2);
}

.map-legend-item:last-child {
    margin-bottom: 0;
}

.map-legend-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.03), transparent);
    transition: left 0.3s ease;
    z-index: 1;
}

.map-legend-item:hover::before {
    left: 100%;
}

.map-legend-item:hover {
    color: #f4f4f5;
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.2);
    transform: translateX(2px);
}

.map-legend-item.active {
    color: #f4f4f5;
    background: 
        linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 
        0 2px 8px rgba(99, 102, 241, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transform: translateX(3px);
    font-weight: 500;
}

.map-legend-item.active .map-legend-color {
    box-shadow: 
        0 0 8px rgba(99, 102, 241, 0.3),
        0 1px 4px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

.map-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.map-legend-item:hover .map-legend-color {
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.02);
}

/* Remove pulse animation for more subtle look */
.map-legend-item.active::after {
    display: none;
}

/* Refresh People Button */
.refresh-people-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.refresh-people-btn button {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.refresh-people-btn button:hover {
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.6);
}

.refresh-people-btn button:active {
    transform: scale(0.95);
}

/* Set Name Dialog Styles */
.set-name-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.set-name-overlay.show {
    opacity: 1;
}

.set-name-modal {
    background: linear-gradient(135deg, rgba(24, 24, 27, 0.95) 0%, rgba(39, 39, 42, 0.9) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.set-name-overlay.show .set-name-modal {
    transform: scale(1);
}

.set-name-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.set-name-header h3 {
    margin: 0;
    color: #f4f4f5;
    font-size: 1.125rem;
    font-weight: 600;
}

.set-name-close {
    background: none;
    border: none;
    color: #a1a1aa;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.set-name-close:hover {
    color: #f4f4f5;
    background: rgba(255, 255, 255, 0.1);
}

.set-name-content {
    padding: 1.5rem;
}

.set-name-content p {
    margin: 0 0 1rem 0;
    color: #d4d4d8;
    font-size: 0.9rem;
}

.set-name-field {
    margin-bottom: 1rem;
}

.set-name-field label {
    display: block;
    margin-bottom: 0.5rem;
    color: #e4e4e7;
    font-weight: 500;
    font-size: 0.9rem;
}

.set-name-field input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(24, 24, 27, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #f4f4f5;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.set-name-field input:focus {
    outline: none;
    border-color: #ec4899;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

.set-name-field small {
    display: block;
    margin-top: 0.5rem;
    color: #a1a1aa;
    font-size: 0.8rem;
}

.set-name-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    justify-content: flex-end;
}

.set-name-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 70px;
}

.set-name-btn.cancel {
    background: rgba(156, 163, 175, 0.2);
    color: #d1d5db;
}

.set-name-btn.cancel:hover {
    background: rgba(156, 163, 175, 0.3);
}

.set-name-btn.clear {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.set-name-btn.clear:hover {
    background: rgba(239, 68, 68, 0.3);
}

.set-name-btn.save {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
    color: white;
}

.set-name-btn.save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

/* Success Toast Styles */
.map-success-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2001;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95) 0%, rgba(5, 150, 105, 0.9) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    color: white;
    font-size: 0.875rem;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 4px 16px rgba(0, 0, 0, 0.2);
    animation: slideInRight 0.3s ease-out forwards;
    max-width: 300px;
    word-wrap: break-word;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Popup Actions Styling */
.popup-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.popup-btn.set-name {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 100px;
}

.popup-btn.set-name:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

/* Battery Status and Power Saving Mode */
.battery-status-indicator {
    position: fixed;
    top: 120px;
    right: 20px;
    background: rgba(24, 24, 27, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 0.75rem;
    color: #a1a1aa;
    z-index: 1001;
    max-width: 200px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    display: none;
}

.battery-status-indicator.show {
    display: block;
}

.power-saving-toggle {
    position: fixed;
    top: 160px;
    right: 20px;
    background: rgba(24, 24, 27, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px;
    z-index: 1001;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #a1a1aa;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.power-saving-toggle.show {
    display: flex;
}

.power-saving-switch {
    position: relative;
    width: 36px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.power-saving-switch.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.power-saving-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.power-saving-switch.active::after {
    transform: translateX(16px);
}

/* Responsive Design with Enhanced Mobile Experience */
@media (max-width: 1024px) {
    .map-legend {
        bottom: 15px;
        left: 15px;
        min-width: 150px;
        max-width: 170px;
        padding: 0.7rem;
    }
}

@media (max-width: 768px) {
    .map-header {
        padding: 1.5rem 1rem 1rem;
    }
    
    .map-header h1 {
        font-size: clamp(1.5rem, 4vw, 2rem);
    }
    
    .map-header h2 {
        font-size: clamp(0.8rem, 2vw, 0.9rem);
    }
    
    .map-container {
        margin: 0.5rem;
        border-radius: 16px;
    }
    
    #map {
        height: 75vh;
        border-radius: 16px;
    }
    
    .back-button {
        top: 20px;
        left: 20px;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .map-stats {
        bottom: 20px;
        right: 20px;
        padding: 0.8rem 1rem;
    }
    
    .map-legend {
        bottom: 12px;
        left: 12px;
        min-width: 140px;
        max-width: 160px;
        padding: 0.6rem;
    }
    
    .map-legend-item {
        padding: 0.35rem 0.5rem;
        font-size: 0.7rem;
        margin-bottom: 0.3rem;
        gap: 0.4rem;
    }
    
    .map-legend-color {
        width: 10px;
        height: 10px;
        border-width: 1px;
    }
    
    .map-legend-title {
        font-size: 0.75rem;
        margin-bottom: 0.4rem;
    }
}

@media (max-width: 480px) {
    .map-header {
        padding: 1rem 0.5rem 0.5rem;
    }
    
    .map-container {
        margin: 0.25rem;
        border-radius: 12px;
    }
    
    #map {
        height: 70vh;
        border-radius: 12px;
    }
    
    .back-button {
        top: 15px;
        left: 15px;
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .map-stats {
        bottom: 15px;
        right: 15px;
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .map-legend {
        bottom: 10px;
        left: 10px;
        min-width: 130px;
        max-width: 150px;
        padding: 0.5rem;
    }
    
    .map-legend-item {
        padding: 0.3rem 0.4rem;
        font-size: 0.65rem;
        margin-bottom: 0.25rem;
        gap: 0.35rem;
    }
    
    .map-legend-color {
        width: 9px;
        height: 9px;
        border-width: 1px;
    }
    
    .map-legend-title {
        font-size: 0.7rem;
        margin-bottom: 0.35rem;
    }
    
    .map-loading {
        padding: 1.5rem 2rem;
        border-radius: 16px;
    }
    
    .map-loading-text {
        font-size: 0.9rem;
    }
    
    .map-error-toast {
        top: 15px;
        right: 15px;
        max-width: 280px;
        font-size: 0.85rem;
    }
}

/* Dark mode media query for systems that prefer dark */
@media (prefers-color-scheme: dark) {
    /* Already using dark theme, but can add specific adjustments */
    .map-container::before {
        opacity: 0.8;
    }
    
    .marker-pin {
        box-shadow: 
            0 4px 12px rgba(99, 102, 241, 0.5),
            0 2px 6px rgba(0, 0, 0, 0.4);
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .map-nav a {
        border-width: 2px;
        border-color: rgba(255, 255, 255, 0.3);
    }
    
    .back-button {
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
    
    .marker-pin {
        border-width: 4px;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .map-container::before {
        animation: none;
    }
    
    .marker-pin::before,
    .marker-pin {
        animation: none;
    }
    
    .map-nav a::after {
        animation: none;
    }
}

/* Print styles */
@media print {
    .back-button,
    .map-stats,
    .map-legend,
    .map-nav {
        display: none !important;
    }
    
    .map-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    #map {
        height: 80vh !important;
    }
}

/* Navigation System Styles */
.navigation-panel {
    position: fixed;
    z-index: 1000;
    background: 
        linear-gradient(135deg, rgba(24, 24, 27, 0.95) 0%, rgba(39, 39, 42, 0.9) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    min-width: 280px;
    max-width: 320px;
}

.navigation-panel.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Minimized state */
.navigation-panel.minimized {
    min-width: 200px;
    max-width: 200px;
}

.navigation-panel.minimized .navigation-content {
    max-height: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.navigation-panel:not(.minimized) .navigation-content {
    max-height: 500px;
    opacity: 1;
    padding: 1rem 0;
    margin-top: 0.5rem;
    transition: all 0.3s ease;
}

.navigation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.navigation-title {
    color: #f4f4f5;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navigation-controls-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navigation-toggle {
    background: none;
    border: none;
    color: #71717a;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.navigation-toggle:hover {
    color: #f4f4f5;
    background: rgba(59, 130, 246, 0.1);
}

.navigation-close {
    background: none;
    border: none;
    color: #71717a;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.navigation-close:hover {
    color: #f4f4f5;
    background: rgba(239, 68, 68, 0.1);
}

.navigation-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.navigation-info {
    margin-bottom: 1rem;
}

.navigation-destination {
    color: #f4f4f5;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.navigation-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #a1a1aa;
    margin-top: 0.5rem;
}

.nav-stat-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-stat-row span {
    display: block;
}

#navDistance {
    color: #3b82f6;
    font-weight: 600;
}

#navDuration {
    color: #10b981;
    font-weight: 500;
}

#navRouteType {
    font-size: 0.8rem;
    font-weight: 500;
}

#navStatus {
    color: #f4f4f5;
    font-weight: 500;
}

.navigation-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.navigation-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.navigation-btn.start {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.navigation-btn.start:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.navigation-btn.stop {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.navigation-btn.stop:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* Battery Warning Modal */
.battery-warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.battery-warning-overlay.show {
    display: flex;
}

.battery-warning-modal {
    background: 
        linear-gradient(135deg, rgba(24, 24, 27, 0.98) 0%, rgba(39, 39, 42, 0.95) 100%);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    margin: 1rem;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 8px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.battery-warning-icon {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.battery-warning-title {
    color: #f4f4f5;
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.battery-warning-text {
    color: #a1a1aa;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    text-align: center;
    margin-bottom: 1.5rem;
}

.battery-warning-actions {
    display: flex;
    gap: 0.75rem;
}

.battery-warning-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.battery-warning-btn.cancel {
    background: rgba(71, 85, 105, 0.3);
    color: #a1a1aa;
    border: 1px solid rgba(71, 85, 105, 0.5);
}

.battery-warning-btn.cancel:hover {
    background: rgba(71, 85, 105, 0.5);
    color: #f4f4f5;
}

.battery-warning-btn.proceed {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
}

.battery-warning-btn.proceed:hover {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

/* Navigation Status Indicator */
.navigation-status {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.navigation-status.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.navigation-status.tracking {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Mobile Responsive Navigation */
@media (max-width: 768px) {
    .navigation-panel {
        bottom: 150px;
        right: 10px;
        min-width: auto;
        max-width: none;
    }
    
    .battery-warning-modal {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .navigation-status {
        top: 15px;
        left: 50%;
        right: auto;
        max-width: calc(100% - 30px);
    }
}
