/**
 * Advanced Leaflet Map Styles
 * Neo Design System Compatible
 * Custom controls and enhanced UI
 */

/* Map container enhancements */
.leaflet-container {
    font-family:
        'Inter',
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;
}

/* Search control styling */
.leaflet-control-search {
    min-width: 320px;
    max-width: 400px;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: none;
    border-radius: 0.5rem;
}

.leaflet-control-search input {
    transition: all 0.2s ease-in-out;
}

.leaflet-control-search input:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Map type switcher */
.map-type-switcher {
    display: flex;
    flex-direction: column;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.map-type-switcher button {
    padding: 10px 12px;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #e5e7eb;
}

.map-type-switcher button:hover {
    background: #f3f4f6;
}

/* Neo Map Container */
.neo-map-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.neo-map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.neo-map-title {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.neo-map-controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.neo-map-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.neo-map-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.neo-map-btn:active {
    transform: translateY(0);
}

.map-type-switcher button:last-child {
    border-bottom: none;
}

.map-type-switcher button:active {
    background: #e5e7eb;
}

/* Custom GPS control */
.leaflet-control-custom {
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.2);
    background-clip: padding-box;
}

.leaflet-control-custom:hover {
    background: #f9f9f9;
}

/* Enhanced markers */
.nearby-marker {
    background: white;
    border-radius: 50%;
    border: 2px solid #374151;
    text-align: center;
    line-height: 21px;
    font-size: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.nearby-marker:hover {
    transform: scale(1.1);
}

.current-location-marker {
    background: #007bff;
    border-radius: 50%;
    text-align: center;
    line-height: 26px;
    font-size: 18px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Environment analysis markers */
.environment-marker {
    animation: markerPulse 2s infinite;
}

@keyframes markerPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* AI Analysis Loading */
.ai-analysis-loading {
    position: relative;
    overflow: hidden;
}

.ai-analysis-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.3), transparent);
    animation: aiScan 2s infinite;
}

@keyframes aiScan {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Distance input color coding */
.distance-close {
    color: #10b981 !important;
    font-weight: 600;
}
.distance-medium {
    color: #f59e0b !important;
    font-weight: 500;
}
.distance-far {
    color: #ef4444 !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);
    }
}

/* Enhanced popup styling */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.leaflet-popup-content {
    margin: 16px 20px;
    line-height: 1.4;
}

.leaflet-popup-tip {
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.18);
}

/* Drawing controls enhancement */
.leaflet-draw-toolbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.leaflet-draw-toolbar a {
    background-color: white;
    border-bottom: 1px solid #ddd;
    transition: background-color 0.2s ease;
}

.leaflet-draw-toolbar a:hover {
    background-color: #f0f0f0;
}

.leaflet-draw-toolbar a:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.leaflet-draw-toolbar a:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    border-bottom: none;
}

/* Layer control enhancements */
.leaflet-control-layers {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    border: none;
}

.leaflet-control-layers-expanded {
    padding: 12px 16px;
}

.leaflet-control-layers-base label,
.leaflet-control-layers-overlays label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: color 0.2s ease;
}

.leaflet-control-layers-base label:hover,
.leaflet-control-layers-overlays label:hover {
    color: #3b82f6;
}

.leaflet-control-layers input[type='radio'],
.leaflet-control-layers input[type='checkbox'] {
    margin-right: 8px;
}

/* Zoom control styling */
.leaflet-control-zoom {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    border: none;
}

.leaflet-control-zoom a {
    width: 32px;
    height: 32px;
    line-height: 32px;
    font-size: 18px;
    font-weight: bold;
    background-color: white;
    border-bottom: 1px solid #ddd;
    transition: all 0.2s ease;
}

.leaflet-control-zoom a:hover {
    background-color: #f0f0f0;
    color: #3b82f6;
}

.leaflet-control-zoom-in {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.leaflet-control-zoom-out {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    border-bottom: none;
}

/* Scale control styling */
.leaflet-control-scale {
    font-size: 12px;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Search suggestions styling */
#search-suggestions {
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#search-suggestions > div {
    transition: background-color 0.2s ease;
}

#search-suggestions > div:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

/* Category buttons */
.neo-btn-outline {
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    transition: all 0.2s ease;
}

.neo-btn-outline:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

/* Loading animation */
.leaflet-control-loading {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Fullscreen control */
.leaflet-control-fullscreen {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.leaflet-control-fullscreen a {
    background-color: white;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.leaflet-control-fullscreen a:hover {
    background-color: #f0f0f0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .leaflet-control-search {
        min-width: 280px;
        max-width: 320px;
    }

    .map-type-switcher button {
        padding: 8px 10px;
        font-size: 14px;
    }

    .leaflet-control-layers-expanded {
        padding: 10px 12px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .leaflet-control-search,
    .leaflet-control-layers,
    .leaflet-control-zoom a,
    .leaflet-control-fullscreen a,
    .map-type-switcher button {
        background-color: #374151;
        color: white;
        border-color: #4b5563;
    }

    .leaflet-control-search input {
        background-color: #374151;
        color: white;
        border-color: #4b5563;
    }

    .leaflet-control-search input::placeholder {
        color: #9ca3af;
    }

    #search-suggestions {
        background: rgba(55, 65, 81, 0.95);
        border-color: #4b5563;
    }

    .neo-btn-outline {
        background-color: #374151;
        color: white;
        border-color: #4b5563;
    }
}
