/* World Map Styles */
.world-map-container {
    margin-bottom: 4rem;
    background: var(--dark-card);
    border-radius: 30px;
    padding: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.world-map-header {
    text-align: center;
    margin-bottom: 2rem;
}

.world-map-header h3 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.world-map-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.world-map-leaflet,
.world-map-echarts {
    width: 100%;
    height: 600px;
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid rgba(0, 102, 255, 0.4);
    box-shadow: 0 20px 60px rgba(0, 102, 255, 0.3), 
                inset 0 0 100px rgba(0, 102, 255, 0.1);
    background: url('../images/bj.png') center center / cover no-repeat,
                linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(243, 244, 248, 0.9) 100%);
    background-blend-mode: overlay;
    position: relative;
}

/* Tech-style grid background */
.world-map-echarts::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(0, 102, 255, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 102, 255, 0.15) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    opacity: 0.4;
    border-radius: 20px;
    z-index: 0;
}

/* Background image overlay */
.world-map-echarts::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/bj.png') center center / cover no-repeat;
    opacity: 0.3;
    border-radius: 20px;
    z-index: -1;
    filter: blur(1px);
}

/* Ensure the canvas itself carries the background image */
.world-map-echarts canvas {
    background: url('../images/bj.png') center center / cover no-repeat;
}

.map-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.map-btn {
    background: var(--gradient-1);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.map-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 102, 255, 0.4);
}

.map-btn.active {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
}

/* Custom Leaflet Styles */
.leaflet-container {
    background: var(--dark-bg);
    font-family: 'Inter', sans-serif;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}

.leaflet-control-zoom a {
    background: var(--dark-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    transition: var(--transition);
}

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

/* Custom Popup Styles */
.leaflet-popup-content-wrapper {
    background: var(--dark-card) !important;
    border-radius: 15px !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-popup-content {
    color: var(--text-primary) !important;
    margin: 1rem !important;
    min-width: 250px;
}

.leaflet-popup-tip {
    background: var(--dark-card) !important;
}

.office-popup h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.office-popup p {
    color: var(--text-secondary);
    margin: 0.3rem 0;
    font-size: 0.95rem;
}

.office-popup .contact-info {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.office-popup .contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.3rem 0;
    font-size: 0.9rem;
}

.office-popup .contact-item i {
    color: var(--primary-color);
    width: 16px;
}

/* Custom Marker Styles */
.custom-marker {
    background: var(--gradient-1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 4px 20px rgba(0, 102, 255, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.6);
    transition: var(--transition);
    cursor: pointer;
}

.custom-marker:hover {
    transform: scale(1.2);
    box-shadow: 0 6px 30px rgba(0, 102, 255, 0.6);
}

.custom-marker.headquarters {
    background: linear-gradient(135deg, #0066ff 0%, #00d4ff 100%);
    animation: pulse 2s infinite;
}

.custom-marker.regional {
    background: linear-gradient(135deg, #00d4ff 0%, #0066ff 100%);
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(0, 102, 255, 0.4);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 6px 30px rgba(0, 102, 255, 0.6);
    }
}

/* Connection Lines */
.connection-line {
    stroke: var(--primary-color);
    stroke-width: 2;
    stroke-dasharray: 5, 5;
    fill: none;
    opacity: 0.6;
    animation: dash 20s linear infinite;
}

/* Map Ripple Effect */
.world-map-echarts canvas {
    border-radius: 20px;
}

@keyframes dash {
    to {
        stroke-dashoffset: -100;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .world-map-leaflet,
    .world-map-echarts {
        height: 450px;
    }
    
    .map-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .map-btn {
        width: 200px;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .world-map-container {
        padding: 1.5rem;
    }
    
    .world-map-header h3 {
        font-size: 1.5rem;
    }
    
    .world-map-leaflet,
    .world-map-echarts {
        height: 350px;
    }
    
    .leaflet-popup-content {
        min-width: 200px;
        margin: 0.8rem !important;
    }
    
    .custom-marker {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }
}

/* Loading Animation */
.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 500px;
    background: var(--dark-card);
    border-radius: 20px;
}

.map-loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 0, 0, 0.12);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 3D Globe Enhancements */
.world-map-echarts canvas {
    border-radius: 20px;
}

/* Globe Info Popup Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Map Glow Effect */
.world-map-echarts::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(0, 102, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
    animation: pulse-glow 3s ease-in-out infinite;
    border-radius: 20px;
}

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