/* css/map.css */

/* Map Overlay Container */
.map-overlay {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    height: 100vh;
    background: #1a1a1a;
    z-index: 300;
    display: none;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.map-overlay:not(.hidden) {
    display: flex;
}

.map-overlay.hidden {
    transform: translateX(-50%) translateY(100%);
}

/* Map Header */
.map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(180deg, #1a1a1a 0%, rgba(26, 26, 26, 0.95) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.map-title {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.map-close-btn,
.map-center-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.map-close-btn:hover,
.map-center-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.map-close-btn:active,
.map-center-btn:active {
    transform: scale(0.95);
}

/* Map Filters */
.map-filters {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    background: #1a1a1a;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 0;
}

.map-filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.filter-btn.active {
    background: linear-gradient(135deg, #00D4FF 0%, #0099CC 100%);
    border-color: transparent;
    color: #ffffff;
}

.filter-count {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

/* Map Container */
.map-container-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #0a0a0a;
}

.map-container {
    width: 100%;
    height: 100%;
    background: #0a0a0a;
}

/* Loading Overlay */
.map-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 26, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.map-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.map-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #00D4FF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.map-loading-overlay p {
    margin-top: 16px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Custom Marker Styles */
.business-marker {
    background: #ffffff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.business-marker:hover {
    transform: rotate(-45deg) scale(1.1);
}

.business-marker .marker-icon {
    transform: rotate(45deg);
    font-size: 16px;
}

.restaurant-marker {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
}

.activity-marker {
    background: linear-gradient(135deg, #00D4FF 0%, #0099CC 100%);
}

/* User Location Marker */
.user-location-marker {
    position: relative;
}

.user-location-marker .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4285F4;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.user-location-marker .pulse {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(66, 133, 244, 0.3);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 2s ease-out infinite;
    z-index: 1;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Marker Cluster Styles */
.marker-cluster {
    background: rgba(0, 212, 255, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #ffffff;
    border: 3px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.marker-cluster-small {
    background: rgba(0, 212, 255, 0.6);
    width: 40px;
    height: 40px;
    font-size: 14px;
}

.marker-cluster-medium {
    background: rgba(255, 215, 0, 0.6);
    width: 50px;
    height: 50px;
    font-size: 16px;
}

.marker-cluster-large {
    background: rgba(255, 69, 0, 0.6);
    width: 60px;
    height: 60px;
    font-size: 18px;
}

/* Map Popup Styles */
.leaflet-popup-content-wrapper {
    background: #1a1a1a !important;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaflet-popup-content {
    margin: 0;
    min-width: 200px;
    max-width: 250px;
}

.leaflet-popup-tip {
    background: #1a1a1a !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.map-popup {
    padding: 12px;
    color: #ffffff;
}

.map-popup img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
}

.map-popup h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

.map-popup p {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.map-popup .distance {
    color: #00D4FF;
    font-weight: 500;
}

.map-business-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(26, 26, 26, 0.98) 0%, #1a1a1a 100%);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    max-height: 40vh;
    overflow: hidden;
    display: none;
    flex-direction: column;
}

.map-overlay:not(.hidden) .map-business-panel {
    display: flex;
}

.map-business-panel.active {
    transform: translateY(0);
}

.panel-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1;
    transition: all 0.2s ease;
}

.panel-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.panel-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.panel-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
}

.panel-info {
    flex: 1;
}

.panel-name {
    margin: 0 0 4px 0;
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
}

.panel-category {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #FFD700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-address {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.panel-distance {
    margin: 0;
    font-size: 14px;
    color: #00D4FF;
    font-weight: 500;
}

.panel-actions {
    display: flex;
    gap: 12px;
}

.panel-directions-btn,
.panel-view-btn {
    flex: 1;
    padding: 12px 16px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.panel-directions-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.panel-directions-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.panel-view-btn {
    background: linear-gradient(135deg, #00D4FF 0%, #0099CC 100%);
    color: #ffffff;
}

.panel-view-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

/* Error Toast */
.map-error-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #ff4444;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
}

.map-error-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Map trigger button */
.map-trigger-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.map-trigger-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    color: #00D4FF;
}

/* Responsive Design */
@media (max-width: 430px) {
    .map-overlay {
        max-width: 100vw;
    }
}

@media (min-width: 768px) {
    .map-header {
        padding: 20px 40px;
    }
    
    .map-filters {
        padding: 16px 40px;
    }
    
    .map-business-panel {
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%) translateY(100%);
        border-radius: 20px;
        margin-bottom: 20px;
        max-height: 50vh;
    }
    
    .map-business-panel.active {
        transform: translateX(-50%) translateY(0);
    }
    
    .panel-content {
        flex-direction: row;
        gap: 20px;
    }
    
    .panel-image {
        width: 180px;
        height: 120px;
        flex-shrink: 0;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .map-overlay,
    .map-business-panel,
    .filter-btn,
    .map-error-toast {
        transition: none;
    }
    
    .user-location-marker .pulse {
        animation: none;
        opacity: 0.3;
    }
    
    .map-spinner {
        animation: spin 2s linear infinite;
    }
}

/* Dark mode overrides for Leaflet controls */
.leaflet-control-zoom a {
    background: #1a1a1a !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.leaflet-control-zoom a:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

.leaflet-control-attribution {
    background: rgba(26, 26, 26, 0.8) !important;
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 10px;
}

/* Hide default Leaflet popup close button */
.leaflet-popup-close-btn {
    display: none;
}
