/**
 * FIFE Core — Impact Projects Globe widget styles.
 *
 * Copied verbatim (same selectors, same values) from page-our-impact.php's
 * own inline <style> block — the "Projects Map Section" (star-field globe,
 * zoom controls, markers, continent clusters, legend) — per the explicit
 * 1:1 migration requirement.
 */

.impact-map-section {
    padding: 4rem 0;
    background: #000;
    position: relative;
    overflow: hidden;
}

/* Star field */
.impact-map-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 15% 25%, rgba(255,255,255,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 35% 65%, rgba(255,255,255,0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 55% 15%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 75% 75%, rgba(255,255,255,0.4) 0%, transparent 100%),
        radial-gradient(2px 2px at 90% 30%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 5%  85%, rgba(255,255,255,0.5) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.impact-map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    position: relative;
    z-index: 2;
}

.impact-map-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #ffffff;
}

.impact-map-header-copy {
    color: rgba(255,255,255,0.65);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.impact-map-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.impact-map-filter-btn {
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.impact-map-filter-btn:hover,
.impact-map-filter-btn:focus {
    border-color: #933183;
    background: rgba(147,49,131,0.25);
    color: #fff;
}

select.impact-map-filter-btn option {
    background: #1e1b4b;
    color: #fff;
}

.impact-map-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 2;
}

.impact-map-control-btn {
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255,255,255,0.85);
    backdrop-filter: blur(8px);
    transition: all 0.2s;
}

.impact-map-control-btn:hover {
    border-color: #933183;
    background: rgba(147,49,131,0.25);
    color: #fff;
}

/* Globe container */
.impact-map-container {
    position: relative;
    border-radius: 1.5rem;
    overflow: hidden;
    background: #000;
    z-index: 2;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
.impact-map-container:active { cursor: grabbing; }

/* Globe wrapper */
.globe-container {
    position: relative;
    width: 100%;
    transform-origin: center center;
    transition: transform 0.2s ease;
    will-change: transform;
}

/* Zoom controls */
.map-zoom-controls {
    position: absolute;
    right: 1rem;
    top: 1rem;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.map-zoom-btn {
    width: 36px;
    height: 36px;
    background: rgba(20,20,30,0.8);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 0.5rem;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
}
.map-zoom-btn:hover {
    background: #933183;
    border-color: #933183;
}
.map-zoom-btn:active { transform: scale(0.92); }
.map-zoom-reset {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

/* Zoom level indicator */
.map-zoom-level {
    background: rgba(20,20,30,0.75);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 0.375rem;
    color: rgba(255,255,255,0.8);
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
    padding: 0.25rem;
    backdrop-filter: blur(8px);
    min-width: 36px;
}

/* Earth photo */
.globe-earth-img {
    width: 100%;
    height: 520px;
    object-fit: cover;
    object-position: center 30%;
    display: block;
    filter: brightness(0.85) saturate(1.1);
}

/* Overlay gradient for depth */
.globe-earth-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(0,0,0,0.0) 0%, rgba(0,0,0,0.45) 100%),
        linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, transparent 20%, transparent 80%, rgba(0,0,0,0.5) 100%);
    pointer-events: none;
}

/* Project dot markers */
.impact-map-markers { position: absolute; inset: 0; pointer-events: none; }

.impact-map-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    z-index: 10;
    cursor: pointer;
}

.impact-map-marker-dot {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: 2px solid #933183;
    box-shadow: 0 0 0 3px rgba(147,49,131,0.3), 0 2px 8px rgba(0,0,0,0.4);
    transition: all 0.2s;
    animation: markerPulse 2.5s ease-in-out infinite;
}

.impact-map-marker[data-status="Current"] .impact-map-marker-dot {
    background: #4ade80;
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(74,222,128,0.35), 0 2px 8px rgba(0,0,0,0.4);
}

@keyframes markerPulse {
    0%,100% { box-shadow: 0 0 0 3px rgba(147,49,131,0.3), 0 2px 8px rgba(0,0,0,0.4); }
    50%      { box-shadow: 0 0 0 7px rgba(147,49,131,0.12), 0 2px 8px rgba(0,0,0,0.4); }
}

.impact-map-marker:hover .impact-map-marker-dot {
    transform: scale(1.5);
    z-index: 20;
}

/* Hover tooltip */
.impact-map-marker-text {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10,10,20,0.92);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 0.4rem;
    white-space: nowrap;
    pointer-events: none;
    border: 1px solid rgba(147,49,131,0.5);
    backdrop-filter: blur(6px);
    z-index: 50;
    max-width: 200px;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
}

.impact-map-marker-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(10,10,20,0.92);
}

.impact-map-marker:hover .impact-map-marker-text { display: block; }

/* Continent cluster buttons */
.map-cluster {
    position: absolute;
    transform: translate(-50%, -50%);
    background: none;
    border: none;
    cursor: pointer;
    z-index: 15;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.map-cluster-count {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: #933183;
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 0 0 3px rgba(147,49,131,0.35), 0 4px 16px rgba(0,0,0,0.5);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: clusterPulse 2.5s ease-in-out infinite;
}

@keyframes clusterPulse {
    0%,100% { box-shadow: 0 0 0 3px rgba(147,49,131,0.35), 0 4px 16px rgba(0,0,0,0.5); }
    50%      { box-shadow: 0 0 0 9px rgba(147,49,131,0.15), 0 6px 24px rgba(0,0,0,0.5); }
}

.map-cluster:hover .map-cluster-count {
    transform: scale(1.2);
    box-shadow: 0 0 0 9px rgba(147,49,131,0.2), 0 8px 28px rgba(0,0,0,0.55);
    animation-play-state: paused;
}

.map-cluster-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 6px rgba(0,0,0,0.9);
    margin-top: 0.3rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
}

.map-cluster:hover .map-cluster-label { opacity: 1; }

/* Legend */
.globe-legend {
    position: absolute;
    bottom: 1.25rem;
    left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    z-index: 20;
}

.globe-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.globe-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.globe-legend-cluster {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #933183;
    flex-shrink: 0;
}

/* Top-right tip */
.globe-hover-tip {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 0.6rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.75);
    z-index: 20;
    pointer-events: none;
}

/* Continent name labels */
.impact-map-continent-names { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.map-continent-name {
    position: absolute;
    color: rgba(255,255,255,0.28);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transform: translate(-50%, -50%);
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
