/**
 * Frontend CSS for GOR Custom Map Plugin
 * Styles for public-facing map display with mobile optimizations
 */

/* Map Container */
.gor-map-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: #fff;
}

.gor-map-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.gor-map {
    width: 100%;
    height: 700px;
    border-radius: 8px;
    z-index: 1;
}

/* Map Controls */
.gor-fullscreen-btn,
.gor-location-btn {
    position: absolute;
    top: 10px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #ddd;
    border-radius: 8px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.gor-fullscreen-btn:hover,
.gor-location-btn:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.gor-fullscreen-btn {
    right: 10px;
}

.gor-location-btn {
    right: 68px;
}

.gor-fullscreen-btn svg,
.gor-location-btn svg {
    width: 20px;
    height: 20px;
    stroke: #333;
}

.gor-filter-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.gor-filter-btn:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.gor-filter-btn svg {
    width: 20px;
    height: 20px;
    stroke: #333;
}

/* Loading State */
.gor-map-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    border-radius: 8px;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e0e0e0;
    border-top: 5px solid #0073aa;
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    margin-bottom: 16px;
}

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

.gor-map-loading p {
    color: #333;
    font-size: 15px;
    font-weight: 500;
    margin: 0;
}

/* Skeleton Loader */
.gor-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-marker {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-popup {
    width: 280px;
    height: 200px;
}

/* Toast Notifications */
.gor-toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.gor-toast {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: toastSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
    max-width: 90vw;
}

.gor-toast.success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.gor-toast.error {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.gor-toast.info {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.gor-toast.warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.gor-toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.gor-toast-message {
    flex: 1;
}

.gor-toast.hiding {
    animation: toastSlideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

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

/* Route Overview Card */
.gor-route-overview {
    position: absolute;
    top: 10px;
    right: 78px;
    background: rgba(255, 255, 255, 0.97);
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 12px;
    z-index: 1000;
    max-width: 400px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

.gor-route-overview.collapsed {
    width: 52px;
    height: 52px;
    padding: 8px;
    overflow: hidden;
}

.gor-route-overview.collapsed .overview-content {
    display: none;
}

.overview-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background-color 0.2s ease;
    width: 100%;
}

.overview-toggle:hover {
    background-color: #f0f0f0;
}

.overview-toggle svg {
    width: 16px;
    height: 16px;
    stroke: #333;
    flex-shrink: 0;
}

.overview-toggle .overview-text {
    font-size: 12px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.overview-content {
    margin-top: 8px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.overview-routes {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.route-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s ease;
}

.route-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #0073aa;
}

.route-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.route-card-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.route-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
}

.stat-item svg {
    flex-shrink: 0;
    stroke: #999;
}

.stat-label {
    font-weight: 500;
}

.stat-value {
    margin-left: auto;
    font-weight: 600;
    color: #333;
}

.route-select-btn {
    width: 100%;
    padding: 8px 12px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.route-select-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.route-card.active {
    border-color: #0073aa;
    background: #f0f8ff;
}

/* Filter Controls - Desktop Design */
.gor-map-filters {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.97);
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 16px;
    z-index: 1000;
    max-width: 320px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

/* Desktop-Specific Enhancements */
@media (min-width: 1025px) {
    /* Larger map on desktop */
    .gor-map {
        height: 800px;
    }

    /* Desktop: Override map height in fullscreen mode */
    .gor-map-container.fullscreen .gor-map {
        height: 100vh !important;
    }

    /* Desktop: Ensure fullscreen container covers entire screen */
    .gor-map-container.fullscreen {
        width: 100vw !important;
        height: 100vh !important;
    }

    /* Desktop: Always show filters by default (not collapsed) */
    .gor-map-filters {
        max-width: 380px;
    }

    /* Larger popups on desktop */
    .leaflet-popup-content {
        width: 420px !important;
    }

    /* Desktop hover effects for markers */
    .leaflet-marker-icon {
        transition: all 0.2s ease;
    }

    .leaflet-marker-icon:hover {
        z-index: 10000 !important;
        filter: brightness(1.1);
    }

    /* Desktop: Show tooltips on hover */
    .gor-fullscreen-btn:hover::after,
    .gor-location-btn:hover::after {
        content: attr(title);
        position: absolute;
        top: 100%;
        right: 0;
        margin-top: 8px;
        padding: 6px 12px;
        background: rgba(0, 0, 0, 0.9);
        color: white;
        font-size: 12px;
        border-radius: 6px;
        white-space: nowrap;
        z-index: 10001;
        pointer-events: none;
    }

    /* Desktop: Larger route overview */
    .gor-route-overview {
        max-width: 450px;
    }

    /* Desktop: Multi-column quick filters */
    .quick-filter-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    /* Desktop: Smooth scrollbar */
    .filter-content::-webkit-scrollbar {
        width: 8px;
    }

    .filter-content::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }

    .filter-content::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }

    .filter-content::-webkit-scrollbar-thumb:hover {
        background: #555;
    }

    /* Desktop: Keyboard navigation hints */
    .gor-keyboard-hint {
        display: block;
        font-size: 11px;
        color: #999;
        margin-top: 16px;
        padding: 12px;
        background: #f9f9f9;
        border-radius: 8px;
        border: 1px solid #e0e0e0;
        text-align: center;
    }

    .gor-keyboard-hint kbd {
        display: inline-block;
        padding: 3px 6px;
        font-size: 10px;
        font-weight: 600;
        line-height: 1;
        color: #333;
        background: white;
        border: 1px solid #ccc;
        border-radius: 4px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
        font-family: monospace;
    }

    /* Desktop: Better image grid */
    .popup-images-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

.gor-map-filters.collapsed {
    width: 52px;
    height: 52px;
    padding: 8px;
    overflow: hidden;
}

.gor-map-filters.collapsed .filter-content {
    display: none;
}

.filter-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background-color 0.2s ease;
    position: relative;
}

.filter-toggle:hover {
    background-color: #f0f0f0;
}

.filter-toggle svg {
    width: 20px;
    height: 20px;
    stroke: #333;
}

.filter-toggle .filter-badge {
    background: #0073aa;
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 10px;
    padding: 2px 6px;
    min-width: 18px;
    text-align: center;
}

.filter-toggle .filter-text {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

/* Route Overview Mobile */
@media (max-width: 768px) {
    .gor-route-overview {
        position: fixed;
        top: 10px;
        right: 10px;
        left: auto;
        max-width: 44px;
    }

    .gor-route-overview:not(.collapsed) {
        max-width: 90vw;
        max-height: 60vh;
        overflow-y: auto;
    }

    .overview-content {
        max-height: 50vh;
    }
}

/* Mobile Bottom Sheet Design */
@media (max-width: 768px) {
    .gor-map-filters {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 0;
        box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.25);
        transform: translateY(0);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        max-height: 50vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .gor-map-filters.collapsed {
        transform: translateY(calc(100% - 70px));
        width: 100%;
        height: auto;
        padding: 0;
    }

    .gor-map-filters.half-open {
        transform: translateY(50%);
    }

    .gor-map-filters .filter-toggle {
        width: 100%;
        min-height: 70px;
        border-radius: 20px 20px 0 0;
        padding: 24px 24px 16px 24px;
        justify-content: space-between;
        background: white;
        border-bottom: 2px solid #eee;
        position: relative;
        display: flex;
        align-items: center;
    }

    .gor-map-filters.collapsed .filter-toggle {
        border-bottom: none;
    }

    .filter-toggle .filter-left {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-top: 8px;
    }

    .filter-toggle .filter-text {
        font-size: 16px;
        font-weight: 600;
    }

    .filter-toggle .filter-badge {
        font-size: 12px;
        padding: 4px 8px;
    }

    /* Swipe handle at top */
    .filter-toggle::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 48px;
        height: 5px;
        background: #ccc;
        border-radius: 3px;
    }

    .filter-content {
        overflow-y: auto;
        padding: 16px 20px;
        flex: 1;
    }

    .gor-map-filters.collapsed .filter-content {
        display: none;
    }
}

.filter-content {
    margin-top: 8px;
}

/* Quick Filters */
.quick-filters {
    margin-bottom: 16px;
}

.quick-filters h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #333;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quick-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.quick-filter-btn {
    padding: 8px 16px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
}

.quick-filter-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.quick-filter-btn:hover {
    background: #f5f5f5;
    border-color: #999;
    transform: translateY(-1px);
}

.quick-filter-btn.active {
    background: #0073aa;
    border-color: #0073aa;
    color: white;
}

.route-quick-btn.route-4km {
    border-color: #2ecc71;
}

.route-quick-btn.route-4km.active {
    background: #2ecc71;
    border-color: #2ecc71;
}

.route-quick-btn.route-8-5km {
    border-color: #3498db;
}

.route-quick-btn.route-8-5km.active {
    background: #3498db;
    border-color: #3498db;
}

.route-quick-btn.route-13km {
    border-color: #9b59b6;
}

.route-quick-btn.route-13km.active {
    background: #9b59b6;
    border-color: #9b59b6;
}

.filter-divider {
    height: 1px;
    background: #eee;
    margin: 12px 0;
}

.filter-group {
    margin-bottom: 10px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #333;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    transition: color 0.2s ease;
    padding: 4px 0;
}

.filter-checkbox:hover {
    color: #333;
}

.filter-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    position: relative;
    height: 18px;
    width: 18px;
    background-color: #eee;
    border-radius: 4px;
    margin-right: 10px;
    transition: all 0.2s ease;
    border: 2px solid #ccc;
}

.filter-checkbox:hover .checkmark {
    background-color: #e0e0e0;
}

.filter-checkbox input:checked ~ .checkmark {
    background-color: #0073aa;
    border-color: #0073aa;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 3px;
    top: 1px;
    width: 3px;
    height: 6px;
    border: solid white;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}

.filter-checkbox input:checked ~ .checkmark:after {
    display: block;
}

/* Search Input - Compact */
.gor-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.gor-search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

/* Filter Actions - Compact */
.filter-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.gor-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    min-width: 80px;
}

.gor-btn-primary {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.gor-btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.gor-btn-primary:active::before {
    width: 300px;
    height: 300px;
}

.gor-btn-primary:hover {
    background: linear-gradient(135deg, #005a87 0%, #004568 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.gor-btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.gor-btn-secondary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.gor-btn-secondary:active::before {
    width: 300px;
    height: 300px;
}

.gor-btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* Route Badges */
.route-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    color: white;
    margin-right: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.route-4km { background-color: #2ecc71; }
.route-8-5km { background-color: #3498db; }
.route-13km { background-color: #9b59b6; }

/* Fullscreen Mode */
.gor-map-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    border-radius: 0;
    margin: 0;
    background: #000;
}

.gor-map-container.fullscreen .gor-map {
    height: 100vh;
    border-radius: 0;
}

/* Hide all controls in fullscreen initially */
.gor-map-container.fullscreen .gor-map-filters,
.gor-map-container.fullscreen .gor-route-overview {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Show controls on hover/interaction */
.gor-map-container.fullscreen.show-controls .gor-map-filters,
.gor-map-container.fullscreen.show-controls .gor-route-overview {
    opacity: 1;
    pointer-events: auto;
}

/* Fullscreen controls overlay */
.gor-map-container.fullscreen .gor-fullscreen-btn,
.gor-map-container.fullscreen .gor-location-btn {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.gor-map-container.fullscreen .gor-fullscreen-btn svg,
.gor-map-container.fullscreen .gor-location-btn svg {
    stroke: #fff;
}

.gor-map-container.fullscreen .gor-fullscreen-btn:hover,
.gor-map-container.fullscreen .gor-location-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Fullscreen exit button change */
.gor-map-container.fullscreen .gor-fullscreen-btn {
    width: 56px;
    height: 56px;
}

.gor-map-container.fullscreen .gor-fullscreen-btn svg {
    width: 24px;
    height: 24px;
}

/* User Location Indicator */
.user-location-circle {
    background: rgba(0, 115, 170, 0.2);
    border: 2px solid #0073aa;
    border-radius: 50%;
}

.user-location-marker {
    background: #0073aa;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Custom Marker Styles */
.custom-obstacle-icon {
    background: none !important;
    border: none !important;
}

.obstacle-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.obstacle-marker:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.obstacle-marker.selected {
    animation: markerPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes markerPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(0, 115, 170, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 10px rgba(0, 115, 170, 0);
    }
}

.poi-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    padding: 4px;
    border: 1px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Map Popups - Card Design */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 0;
    animation: popupSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.leaflet-popup-content {
    margin: 0;
    line-height: 1.6;
    font-size: 14px;
    width: 380px !important;
    max-width: 90vw;
}

.obstacle-popup-card {
    padding: 0;
}

.popup-header {
    padding: 16px 16px 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.popup-numero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 700;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 10px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.popup-title {
    margin: 0;
    font-size: 19px;
    color: #1a1a1a;
    font-weight: 700;
    line-height: 1.4;
    flex: 1;
}

.popup-routes {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 0 16px 12px 16px;
}

.popup-description {
    padding: 12px 16px;
    border-top: 1px solid #f0f0f0;
}

.popup-description p {
    margin: 0;
    color: #4a4a4a;
    font-size: 14px;
    line-height: 1.6;
}

.popup-images-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
    border-top: 1px solid #f0f0f0;
    margin: 0;
}

.popup-image-wrapper {
    position: relative;
    width: 100%;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    background: #f5f5f5;
}

.popup-image-wrapper:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    border-color: #0073aa;
}

.popup-image-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    pointer-events: none;
}

.popup-image-wrapper:hover::after {
    background: rgba(0, 0, 0, 0.1);
}

.popup-image-wrapper:active {
    transform: translateY(0) scale(0.98);
}

.popup-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-counter {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 4px;
    z-index: 2;
}

/* Zoom icon overlay */
.popup-image-wrapper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><line x1="11" y1="8" x2="11" y2="14"></line><line x1="8" y1="11" x2="14" y2="11"></line></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px;
}

.popup-image-wrapper:hover::before {
    opacity: 1;
}

.popup-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #f0f0f0;
    flex-wrap: wrap;
}

.popup-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.popup-btn svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.popup-btn-primary {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
}

.popup-btn-primary:hover {
    background: linear-gradient(135deg, #005a87 0%, #004568 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.popup-btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #e0e0e0;
}

.popup-btn-secondary:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.popup-distance {
    padding: 8px 16px 12px 16px;
    text-align: center;
    color: #666;
}

.popup-distance small {
    display: inline-block;
    background: #f8f8f8;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
}

/* Image Gallery Modal */
.gor-image-gallery {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.2s ease;
}

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

.gallery-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gallery-counter {
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.gallery-close {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.gallery-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0 80px;
}

.gallery-images {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-image {
    position: absolute;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.gallery-image.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.gallery-prev {
    left: 20px;
}

.gallery-next {
    right: 20px;
}

@media (max-width: 768px) {
    .gallery-content {
        padding: 0 60px;
    }

    .gallery-nav {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .gallery-header {
        padding: 16px;
    }

    .gallery-counter {
        font-size: 14px;
    }

    .gallery-close {
        width: 38px;
        height: 38px;
        font-size: 24px;
    }

    .popup-images-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 12px;
    }

    .leaflet-popup-content {
        width: 300px !important;
    }

    .popup-header {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .popup-numero {
        font-size: 14px;
        padding: 6px 12px;
    }

    .popup-title {
        font-size: 16px;
    }

    .popup-routes {
        padding: 0 12px 10px 12px;
    }

    .popup-description {
        padding: 10px 12px;
    }

    .popup-actions {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }

    .popup-btn {
        width: 100%;
        padding: 12px;
    }

    /* Mobile: Always show tap indicator on images */
    .popup-image-wrapper::before {
        opacity: 0.8;
        width: 36px;
        height: 36px;
        background-size: 20px;
    }

    .popup-image-wrapper:active::before {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* Route Lines */
.leaflet-interactive {
    cursor: pointer;
}

/* North Arrow / Compass */
.gor-north-arrow {
    position: absolute;
    bottom: 20px;
    left: 10px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    font-weight: 700;
    font-size: 18px;
    color: #c0392b;
    transition: all 0.3s ease;
}

.gor-north-arrow:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.gor-north-arrow svg {
    width: 24px;
    height: 24px;
    fill: #c0392b;
}

/* Empty States */
.gor-empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 32px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 320px;
    z-index: 999;
}

.gor-empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.gor-empty-state h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #333;
}

.gor-empty-state p {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* Zoom Level Indicator */
.gor-zoom-indicator {
    position: absolute;
    bottom: 20px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gor-zoom-indicator.visible {
    opacity: 1;
}

/* Enhanced Route Badge Contrast */
.route-badge {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Filter Badge Count with Animation */
.filter-badge {
    animation: badgePulse 0.3s ease;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Marker Clustering */
.marker-cluster-small {
    background-color: rgba(181, 226, 140, 0.8);
    border: 2px solid rgba(110, 204, 57, 0.8);
}

.marker-cluster-small div {
    background-color: rgba(110, 204, 57, 0.8);
    border-radius: 15px;
}

.marker-cluster-medium {
    background-color: rgba(241, 211, 87, 0.8);
    border: 2px solid rgba(240, 194, 12, 0.8);
}

.marker-cluster-medium div {
    background-color: rgba(240, 194, 12, 0.8);
    border-radius: 20px;
}

.marker-cluster-large {
    background-color: rgba(253, 156, 115, 0.8);
    border: 2px solid rgba(241, 128, 23, 0.8);
}

.marker-cluster-large div {
    background-color: rgba(241, 128, 23, 0.8);
    border-radius: 25px;
}

.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
    line-height: 30px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .gor-map-container {
        margin: 0;
        border-radius: 0;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for better mobile support */
    }

    .gor-map {
        height: 100%;
        border-radius: 0;
    }

    .gor-map-wrapper {
        height: 100%;
    }

    /* Mobile: Hide desktop-only elements */
    .gor-keyboard-hint {
        display: none;
    }

    /* Mobile: Larger tap targets */
    .gor-fullscreen-btn,
    .gor-location-btn {
        width: 52px;
        height: 52px;
    }

    .gor-location-btn {
        right: 72px;
    }

    /* Mobile: Simplified controls */
    .gor-north-arrow {
        bottom: 80px; /* Above bottom sheet */
        left: 10px;
        width: 48px;
        height: 48px;
    }

    /* Mobile: Larger touch-friendly checkboxes */
    .checkmark {
        height: 22px;
        width: 22px;
        margin-right: 12px;
    }

    .filter-checkbox {
        padding: 8px 0;
        margin-bottom: 8px;
    }

    /* Mobile: Quick filters in single column */
    .quick-filter-buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .quick-filter-btn {
        width: 100%;
        justify-content: flex-start;
        padding: 14px 18px;
        font-size: 15px;
    }

    /* Mobile: Better search input */
    .gor-search-input {
        padding: 14px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 12px;
    }

    /* Mobile: Larger filter actions */
    .filter-actions {
        margin-top: 16px;
        gap: 12px;
    }

    .gor-btn {
        padding: 14px 20px;
        font-size: 15px;
        border-radius: 12px;
    }

    /* Mobile: Route cards optimized */
    .route-card {
        margin-bottom: 16px;
        padding: 16px;
    }

    .route-select-btn {
        padding: 14px;
        font-size: 15px;
    }

    /* Mobile: Prevent zoom on double-tap */
    * {
        touch-action: manipulation;
    }

    /* Mobile: Safe area for notch devices */
    .gor-map-filters {
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Mobile: Swipe indicator more prominent */
    .filter-toggle::before {
        width: 60px !important;
        height: 6px !important;
        top: 10px !important;
        background: #999 !important;
    }

    /* Mobile: Filter groups spacing */
    .filter-group {
        margin-bottom: 24px;
    }

    .filter-group h4 {
        font-size: 14px;
        margin-bottom: 12px;
    }

    /* Mobile: Bottom sheet backdrop */
    .gor-map-filters:not(.collapsed)::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: -1;
        backdrop-filter: blur(2px);
    }

    /* Mobile: Optimize popup animations */
    .leaflet-popup {
        animation: mobilePopupBounce 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    }

    @keyframes mobilePopupBounce {
        0% {
            opacity: 0;
            transform: scale(0.8) translateY(20px);
        }
        100% {
            opacity: 1;
            transform: scale(1) translateY(0);
        }
    }

    /* Mobile: Larger gallery controls */
    .gallery-nav {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }

    .gallery-close {
        width: 48px;
        height: 48px;
        font-size: 28px;
    }

    /* Mobile: Prevent text selection on interactive elements */
    .popup-image-wrapper,
    .quick-filter-btn,
    .route-select-btn,
    .filter-toggle {
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Tablet Optimizations (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Tablet: Medium map height */
    .gor-map {
        height: 600px;
    }

    /* Tablet: Side-by-side layout for filters */
    .gor-map-container {
        display: flex;
        flex-direction: column;
    }

    /* Tablet: Wider filters */
    .gor-map-filters {
        max-width: 280px;
    }

    /* Tablet: 2-column image grid */
    .popup-images-gallery {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Tablet: Larger popups than mobile */
    .leaflet-popup-content {
        width: 350px !important;
    }

    /* Tablet: Horizontal quick filters */
    .quick-filter-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    /* Tablet: Split button layout */
    .popup-actions {
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .popup-btn {
        flex: 1;
        min-width: 0;
    }

    /* Tablet: Better route overview */
    .gor-route-overview {
        max-width: 350px;
    }
}
    
    .filter-actions {
        flex-direction: column;
    }
    
    .gor-btn {
        width: 100%;
        padding: 6px 8px;
        font-size: 9px;
    }
    
    .gor-fullscreen-btn,
    .gor-location-btn {
        width: 42px;
        height: 42px;
        top: 15px;
    }
    
    .gor-fullscreen-btn {
        right: 15px;
    }
    
    .gor-location-btn {
        right: 67px;
    }
    
    .gor-fullscreen-btn svg,
    .gor-location-btn svg {
        width: 18px;
        height: 18px;
    }
    
    /* Touch-friendly marker sizing */
    .obstacle-marker {
        min-width: 32px;
        min-height: 32px;
    }
    
    .poi-marker {
        min-width: 28px;
        min-height: 28px;
    }
    
    /* Improved popup sizing for mobile */
    .leaflet-popup-content {
        margin: 10px 12px;
        max-width: 250px;
    }
    
    .popup-images {
        gap: 4px;
    }
    
    .popup-image {
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    /* Map fills viewport on small screens */
    .gor-map-container {
        height: 100vh;
        height: 100dvh;
    }
    
    .gor-map-filters {
        padding: 10px 12px;
    }
    
    .filter-group {
        margin-bottom: 12px;
    }
    
    .gor-search-input {
        font-size: 14px; /* Prevent zoom on iOS */
    }
    
    .leaflet-popup-content {
        max-width: 200px;
    }
    
    /* Collapsible filters for very small screens */
    .gor-map-filters.collapsed {
        max-height: 60px;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .gor-map-filters.expanded {
        max-height: 500px;
        transition: max-height 0.3s ease;
    }
    
    .filter-toggle {
        display: block;
        width: 100%;
        background: none;
        border: none;
        padding: 8px 0;
        font-size: 13px;
        font-weight: 600;
        color: #333;
        cursor: pointer;
        text-align: left;
    }
}

/* High DPI / Retina Display Support */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi),
       (min-resolution: 2dppx) {
    .obstacle-marker,
    .poi-marker {
        border-width: 1px;
    }
    
    .gor-fullscreen-btn,
    .gor-location-btn {
        border-width: 0.5px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .gor-map-filters {
        background: #2c2c2c;
        border-bottom-color: #444;
        color: #e0e0e0;
    }
    
    .filter-group h4 {
        color: #f0f0f0;
    }
    
    .filter-checkbox {
        color: #d0d0d0;
    }
    
    .filter-checkbox:hover {
        color: #f0f0f0;
    }
    
    .checkmark {
        background-color: #444;
        border-color: #666;
    }
    
    .filter-checkbox:hover .checkmark {
        background-color: #555;
    }
    
    .gor-search-input {
        background: #444;
        border-color: #666;
        color: #e0e0e0;
    }
    
    .gor-search-input:focus {
        border-color: #0073aa;
    }
    
    .gor-fullscreen-btn,
    .gor-location-btn {
        background: rgba(44, 44, 44, 0.9);
        border-color: #666;
    }
    
    .gor-fullscreen-btn:hover,
    .gor-location-btn:hover {
        background: #2c2c2c;
    }
    
    .gor-fullscreen-btn svg,
    .gor-location-btn svg {
        stroke: #e0e0e0;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .gor-fullscreen-btn,
    .gor-location-btn,
    .filter-checkbox,
    .checkmark,
    .gor-btn,
    .obstacle-marker,
    .popup-image {
        transition: none;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: #666;
    }
}

/* Focus States for Accessibility */
.gor-fullscreen-btn:focus-visible,
.gor-location-btn:focus-visible,
.gor-filter-btn:focus-visible,
.gor-btn:focus-visible,
.filter-toggle:focus-visible,
.overview-toggle:focus-visible {
    outline: 3px solid #0073aa;
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(0, 115, 170, 0.2);
}

.filter-checkbox input:focus-visible + .checkmark {
    box-shadow: 0 0 0 3px #0073aa, 0 0 0 6px rgba(0, 115, 170, 0.2);
}

.gor-search-input:focus-visible {
    outline: 3px solid #0073aa;
    outline-offset: 2px;
}

.quick-filter-btn:focus-visible {
    outline: 3px solid #0073aa;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 115, 170, 0.2);
}

.popup-btn:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Skip to content link */
.skip-to-map {
    position: absolute;
    top: -40px;
    left: 0;
    background: #0073aa;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100000;
    border-radius: 0 0 4px 0;
}

.skip-to-map:focus {
    top: 0;
}

/* Print Styles */
@media print {
    .gor-map-filters,
    .gor-fullscreen-btn,
    .gor-location-btn,
    .gor-map-loading {
        display: none !important;
    }
    
    .gor-map-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .gor-map {
        height: 400px !important;
    }
}
/* ============================================
   DARK MODE & THEME SUPPORT
   ============================================ */

/* Dark Mode Variables */
.gor-map-container.theme-dark,
.gor-map-container.theme-auto {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #404040;
    --shadow-color: rgba(0, 0, 0, 0.5);
}

/* Auto theme detection */
@media (prefers-color-scheme: dark) {
    .gor-map-container.theme-auto {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --bg-tertiary: #3a3a3a;
        --text-primary: #ffffff;
        --text-secondary: #b0b0b0;
        --border-color: #404040;
        --shadow-color: rgba(0, 0, 0, 0.5);
    }
}

/* Dark Mode Styles */
.gor-map-container.theme-dark,
.gor-map-container.theme-auto {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.theme-dark .gor-map-filters,
.theme-auto .gor-map-filters {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.theme-dark .filter-toggle,
.theme-auto .filter-toggle {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.theme-dark .gor-route-overview,
.theme-auto .gor-route-overview {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.theme-dark .route-card,
.theme-auto .route-card {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.theme-dark .gor-btn-primary,
.theme-auto .gor-btn-primary {
    background: #0066cc;
    color: white;
}

.theme-dark .gor-btn-secondary,
.theme-auto .gor-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.theme-dark .leaflet-popup-content-wrapper,
.theme-auto .leaflet-popup-content-wrapper {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.theme-dark .popup-description,
.theme-auto .popup-description {
    color: var(--text-secondary);
}

.theme-dark .gor-search-input,
.theme-auto .gor-search-input {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Dark mode for map tiles */
.theme-dark .leaflet-tile-pane,
.theme-auto .leaflet-tile-pane {
    filter: brightness(0.6) invert(1) contrast(1.2) hue-rotate(200deg);
}

/* ============================================
   ACTIVE FILTER CHIPS
   ============================================ */

.gor-active-filters {
    position: absolute;
    top: 72px;
    left: 10px;
    right: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    z-index: 999;
    padding: 0 10px;
    pointer-events: none;
}

.gor-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 115, 170, 0.95);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: chipSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gor-filter-chip:hover {
    background: rgba(0, 90, 135, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gor-filter-chip svg {
    width: 14px;
    height: 14px;
    stroke: white;
    stroke-width: 2.5px;
}

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

.theme-dark .gor-filter-chip,
.theme-auto .gor-filter-chip {
    background: rgba(0, 150, 230, 0.95);
}

@media (max-width: 768px) {
    .gor-active-filters {
        top: auto;
        bottom: 90px;
        left: 10px;
        right: 10px;
    }
}

/* ============================================
   SMART SEARCH AUTOCOMPLETE
   ============================================ */

.gor-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #0073aa;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 280px;
    overflow-y: auto;
    z-index: 1001;
    display: none;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

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

.search-result-item:hover {
    background: #f5f9ff;
}

.result-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.result-text {
    flex: 1;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.search-no-results {
    padding: 16px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.theme-dark .gor-search-dropdown,
.theme-auto .gor-search-dropdown {
    background: var(--bg-secondary);
    border-color: #0096e6;
}

.theme-dark .search-result-item:hover,
.theme-auto .search-result-item:hover {
    background: var(--bg-tertiary);
}

.theme-dark .result-text,
.theme-auto .result-text {
    color: var(--text-primary);
}

/* ============================================
   QUICK FILTER PRESETS
   ============================================ */

.gor-filter-presets {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.gor-filter-presets h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #333;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preset-btn {
    padding: 10px 16px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
}

.preset-btn svg {
    width: 16px;
    height: 16px;
}

.preset-btn:hover {
    background: #f0f8ff;
    border-color: #0073aa;
    color: #0073aa;
    transform: translateY(-1px);
}

.preset-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

.theme-dark .preset-btn,
.theme-auto .preset-btn {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.theme-dark .preset-btn:hover,
.theme-auto .preset-btn:hover {
    background: rgba(0, 150, 230, 0.2);
    border-color: #0096e6;
    color: #0096e6;
}

/* ============================================
   MOBILE BOTTOM NAVIGATION
   ============================================ */

.gor-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid #e0e0e0;
    padding: 8px 0;
    z-index: 1001;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
}

.bottom-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 8px;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
    border-radius: 12px;
    min-width: 70px;
}

.bottom-nav-item.active {
    color: #0073aa;
    background: #f0f8ff;
}

.bottom-nav-item svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
}

.bottom-nav-item span {
    font-size: 11px;
    font-weight: 600;
}

.bottom-nav-item:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .gor-bottom-nav {
        display: block;
    }
    
    /* Adjust filter panel height to accommodate bottom nav */
    .gor-map-filters:not(.collapsed) {
        max-height: calc(50vh - 60px);
    }
}

.theme-dark .gor-bottom-nav,
.theme-auto .gor-bottom-nav {
    background: rgba(45, 45, 45, 0.98);
    border-top-color: var(--border-color);
}

.theme-dark .bottom-nav-item.active,
.theme-auto .bottom-nav-item.active {
    background: rgba(0, 150, 230, 0.2);
    color: #0096e6;
}

/* ============================================
   Obstacle Number Badges Enhancement
   ============================================ */

/* Enhanced obstacle marker with visible number badge */
.obstacle-marker {
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.obstacle-marker:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
    z-index: 1000;
}

/* Number badge overlay for better visibility */
.obstacle-marker::after {
    content: attr(data-numero);
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    pointer-events: none;
}

/* Pulse animation for obstacles */
@keyframes obstaclePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }
}

.obstacle-marker-highlight {
    animation: obstaclePulse 2s infinite;
}

/* Dark mode badge styles */
.theme-dark .obstacle-marker::after,
.theme-auto .obstacle-marker::after {
    background: linear-gradient(135deg, #0096e6, #0073aa);
    border-color: #1a1a1a;
}

/* Mobile: Larger badges for touch targets */
@media (max-width: 768px) {
    .obstacle-marker::after {
        width: 28px;
        height: 28px;
        font-size: 13px;
        top: -10px;
        right: -10px;
    }
}

/* ============================================
   Enhanced Route Lines
   ============================================ */

/* Route line animation */
@keyframes routeFlow {
    0% {
        stroke-dashoffset: 0;
    }
    100% {
        stroke-dashoffset: -40;
    }
}

/* Animated route lines */
.leaflet-interactive[stroke] {
    transition: stroke-width 0.2s ease, opacity 0.2s ease;
}

/* Route popup styling */
.gor-route-popup {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
}

.gor-route-popup .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 0;
}

.gor-route-popup .leaflet-popup-content {
    margin: 0;
}

.gor-route-popup .route-popup {
    padding: 16px;
}

.gor-route-popup .route-popup h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
}

.gor-route-popup .route-popup p {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: #7f8c8d;
}

/* Dark mode route popup */
.theme-dark .gor-route-popup .leaflet-popup-content-wrapper,
.theme-auto .gor-route-popup .leaflet-popup-content-wrapper {
    background: rgba(45, 45, 45, 0.98);
}

.theme-dark .gor-route-popup .route-popup h3,
.theme-auto .gor-route-popup .route-popup h3 {
    color: #ffffff;
}

.theme-dark .gor-route-popup .route-popup p,
.theme-auto .gor-route-popup .route-popup p {
    color: #b0b0b0;
}

/* Route direction arrows - visual indicators */
.leaflet-pane svg path[stroke] {
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ============================================
   Image Lazy Loading with Blur Preview
   ============================================ */

/* Blur placeholder background */
.image-blur-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0.3;
    filter: blur(20px);
    transform: scale(1.1);
    z-index: 1;
    transition: opacity 0.4s ease;
}

/* Loading spinner */
.image-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    color: white;
    display: none;
}

/* Lazy image initial state */
.lazy-image {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.4s ease, transform 0.4s ease;
    position: relative;
    z-index: 2;
}

/* Lazy image loaded state */
.lazy-image.loaded {
    opacity: 1;
    transform: scale(1);
}

/* Image error state */
.image-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    z-index: 4;
    opacity: 0.6;
}

/* Progressive enhancement - blur up effect */
@supports (backdrop-filter: blur(10px)) {
    .image-blur-placeholder {
        backdrop-filter: blur(20px);
    }
}

/* Dark mode adjustments */
.theme-dark .image-blur-placeholder,
.theme-auto .image-blur-placeholder {
    background: linear-gradient(135deg, #0096e6 0%, #0073aa 100%);
    opacity: 0.2;
}
