/* ================= MAP SECTION ================= */

.map-section {
    position: relative;
    width: 100%;
    height: calc(100vh - 200px); /* Adjust based on header height */
    min-height: 600px;
    background: var(--light);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

body.dark-mode .map-section {
    border-top: 1px solid rgba(255, 0, 0, 0.05);
}

body.dark-mode #map {
    background-color: var(--light); /* #182426 */
}

/* Blend the black map tiles with the background color */
body.dark-mode .leaflet-tile-pane {
    opacity: 0.65;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
    background: transparent; /* Since we use nolabels, let background be clean */
    outline: none !important;
}

.leaflet-container {
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
}

/* ================= CITY POLYGONS ================= */

/* Styling for the GeoJSON city polygons is handled mostly in JS, 
   but we can add some transitions for path elements */
.leaflet-interactive {
    transition: fill-opacity 0.3s ease, stroke-opacity 0.3s ease;
    outline: none !important;
}

/* ================= CREATOR AVATARS ON MAP ================= */

.creator-avatar-container {
    overflow: visible !important;
}

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

.creator-map-avatar-wrapper {
    display: flex;
    align-items: center;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    animation: mapPopIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.creator-map-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s;
    background: var(--light);
    flex-shrink: 0;
    z-index: 2; /* keep above the panel */
    position: relative;
}

body.dark-mode .creator-map-avatar {
    background: #2a2a2a;
}

.creator-map-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top; /* Keeps faces from being cut off */
}

.creator-info-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(42, 211, 216, 0.4);
    color: var(--dark);
    border-radius: 15px; /* Full rounded corners */
    padding: 10px 0; 
    margin-left: 15px; /* Gap from avatar */
    font-family: 'Cairo', sans-serif;
    box-shadow: 8px 8px 30px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    
    /* Animation start state */
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease, padding 0.3s ease;
    z-index: 1;
}

body.dark-mode .creator-info-panel {
    background: rgba(20, 24, 28, 0.85);
    border: 1px solid rgba(42, 211, 216, 0.3);
    color: #fff;
    box-shadow: 8px 8px 30px rgba(0, 0, 0, 0.6);
}

/* Pulse Animation for Active State */
@keyframes avatarPulse {
    0% { box-shadow: 0 0 0 0 rgba(42, 211, 216, 0.6); }
    70% { box-shadow: 0 0 0 15px rgba(42, 211, 216, 0); }
    100% { box-shadow: 0 0 0 0 rgba(42, 211, 216, 0); }
}

/* Hover and Active State on the Wrapper */
.creator-map-avatar-wrapper:hover,
.creator-map-avatar-wrapper.active {
    z-index: 1000 !important;
}

.creator-map-avatar-wrapper:hover .creator-map-avatar,
.creator-map-avatar-wrapper.active .creator-map-avatar {
    transform: scale(1.3);
    box-shadow: 0 6px 20px rgba(42, 211, 216, 0.6);
    border-color: #fff;
}

.creator-map-avatar-wrapper.active .creator-map-avatar {
    animation: avatarPulse 2s infinite cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: scale(1.4);
    border: 3px solid var(--primary);
}

.creator-map-avatar-wrapper:hover .creator-info-panel,
.creator-map-avatar-wrapper.active .creator-info-panel {
    max-width: 320px; /* Enough to show content */
    opacity: 1;
    padding: 15px 20px; /* Symmetrical padding */
}

/* Internal text styling */
.creator-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 4px;
}

.creator-tooltip-name {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0;
    color: var(--primary);
}

.creator-tooltip-role {
    font-size: 0.85rem;
    color: var(--muted);
    display: block;
    margin-bottom: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

body.dark-mode .creator-tooltip-role {
    color: #bbb;
}

.creator-tooltip-city {
    font-size: 0.75rem;
    color: var(--primary);
    background: rgba(42, 211, 216, 0.1);
    border: 1px solid rgba(42, 211, 216, 0.3);
    padding: 3px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
}

body.dark-mode .creator-tooltip-city {
    background: rgba(42, 211, 216, 0.15);
}

.creator-tooltip-socials {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    border-top: 1px solid rgba(0,0,0,0.08);
    padding-top: 10px;
}

body.dark-mode .creator-tooltip-socials {
    border-top: 1px solid rgba(255,255,255,0.08);
}

.creator-tooltip-socials a {
    color: var(--dark);
    opacity: 0.6;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.03);
}

body.dark-mode .creator-tooltip-socials a {
    color: #fff;
    background: rgba(255,255,255,0.05);
    opacity: 0.8;
}

.creator-tooltip-socials a:hover {
    color: #fff;
    background: var(--primary); /* Fallback */
    opacity: 1;
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(42, 211, 216, 0.4);
}

/* Platform specific hover colors */
.creator-tooltip-socials a.social-youtube:hover {
    background: #FF0000;
    box-shadow: 0 4px 10px rgba(255, 0, 0, 0.4);
}

.creator-tooltip-socials a.social-twitch:hover {
    background: #9146FF;
    box-shadow: 0 4px 10px rgba(145, 70, 255, 0.4);
}

.creator-tooltip-socials a.social-instagram:hover {
    background: #E1306C;
    box-shadow: 0 4px 10px rgba(225, 48, 108, 0.4);
}

.creator-tooltip-socials a.social-kick:hover {
    background: #53fc18;
    color: #000;
    box-shadow: 0 4px 10px rgba(83, 252, 24, 0.4);
}

/* City Name Tooltip */
.city-hover-tooltip {
    background: rgba(42, 211, 216, 0.85); /* Glassmorphism look */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    border-radius: 8px;
    padding: 6px 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    max-width: 180px;
    white-space: normal;
    text-align: center;
    z-index: 10000;
}
.city-hover-tooltip::before {
    display: none;
}

/* Remove Leaflet Default styling for custom tooltips */
.leaflet-tooltip.transparent-leaflet-tooltip {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}
.leaflet-tooltip.transparent-leaflet-tooltip::before {
    display: none;
}

/* ================= MOBILE RESPONSIVENESS ================= */
@media (max-width: 768px) {
    .map-section {
        height: calc(100vh - 120px);
        min-height: 400px;
    }
    
    .creator-map-avatar {
        width: 40px;
        height: 40px;
    }
    
    .creator-info-panel {
        padding: 8px 0;
        margin-left: -20px;
    }
    
    .creator-map-avatar-wrapper:hover .creator-info-panel {
        max-width: 220px;
        padding: 8px 12px 8px 25px;
    }
    
    .creator-map-avatar-wrapper:hover .creator-map-avatar {
        transform: scale(1.15);
    }
    
    .creator-tooltip-name {
        font-size: 0.95rem;
    }
    
    .creator-tooltip-role {
        font-size: 0.75rem;
    }
    
    .creator-tooltip-city {
        font-size: 0.65rem;
        padding: 2px 6px;
        margin-bottom: 5px;
    }
    
    .creator-tooltip-socials {
        margin-top: 4px;
        padding-top: 6px;
    }
    
    .creator-tooltip-socials svg {
        width: 14px;
        height: 14px;
    }
    
    .city-hover-tooltip {
        font-size: 0.85rem;
        padding: 3px 8px;
    }
    
    .page-header {
        padding-top: 20px !important;
        padding-bottom: 10px !important;
    }
    .page-header h1 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }
    .page-header p {
        font-size: 0.9rem;
        margin-bottom: 0;
    }
}
