/**
 * FIFE Core — Projects Map widget styles.
 *
 * Scoped under .fifecore-projects-map* — a new namespace. Literal color
 * values only throughout (no var(--...) tokens): this plugin is designed
 * to keep working even if the FIFE theme is ever replaced/deactivated
 * (see class-fife-core-widget-base.php's header comment), so it cannot
 * depend on the theme's style.css custom properties.
 *
 * The filter *controls* (.fifecore-live-filter__bar/__topic-select) stay
 * on the shared classes from fifecore-live-filter.css, unchanged — those
 * are reused by 3 other widgets. Only the new .fifecore-projects-map__filter-*
 * wrapper/title below is specific to this widget, so no other widget's
 * appearance is affected.
 */

.fifecore-projects-map__heading {
    margin: 0 0 1rem;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.15;
    color: hsl(311, 50%, 37%);
}

/* ==========================================================================
   Filter panel
   ========================================================================== */
.fifecore-projects-map__filter-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    margin: 0 0 1.5rem;
    padding: 1.25rem 1.5rem;
    background-color: #ffffff;
    border: 1px solid rgba(147, 49, 131, 0.12);
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(26, 26, 46, 0.08);
}

.fifecore-projects-map__filter-title {
    flex: 0 0 auto;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #933183;
}

.fifecore-projects-map__filter-bar {
    flex: 1 1 auto;
    margin: 0;
}

.fifecore-projects-map__filter-bar .fifecore-live-filter__topic-select {
    border-radius: 999px;
    padding: 0.6rem 1.25rem;
    border-color: rgba(147, 49, 131, 0.25);
}

.fifecore-projects-map__filter-bar .fifecore-live-filter__topic-select:focus-visible {
    border-color: #933183;
    box-shadow: 0 0 0 3px rgba(147, 49, 131, 0.18);
}

/* ==========================================================================
   Layout (map + synced project list side by side)
   ========================================================================== */
.fifecore-projects-map__layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
    align-items: start;
}

/* ==========================================================================
   Map wrap (positioning context for the map + its overlays)
   ========================================================================== */
.fifecore-projects-map__map-wrap {
    position: relative;
    width: 100%;
}

.fifecore-projects-map__container {
    width: 100%;
    height: 500px;
    background-color: #0d0118;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.75rem;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(13, 1, 24, 0.45), 0 4px 16px rgba(13, 1, 24, 0.3);
}

.fifecore-projects-map__container[aria-busy="true"] {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

/* Leaflet's own base tile/pane background, so partially-loaded tiles and
   ocean/empty areas match the dark theme instead of flashing white. */
.fifecore-projects-map__container .leaflet-container {
    background-color: #0d0118;
    font-family: inherit;
}

/* ==========================================================================
   Custom zoom / reset control
   ========================================================================== */
.fifecore-projects-map__zoom-control {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: transparent;
    border: none;
    box-shadow: none;
}

.fifecore-projects-map__zoom-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    background-color: rgba(13, 1, 24, 0.85);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0.65rem;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.fifecore-projects-map__zoom-btn:hover {
    background-color: rgba(147, 49, 131, 0.9);
    border-color: rgba(147, 49, 131, 0.9);
}

.fifecore-projects-map__zoom-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.fifecore-projects-map__zoom-btn--reset {
    width: auto;
    padding: 0 0.6rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ==========================================================================
   Project dot markers
   ========================================================================== */
.fifecore-projects-map__dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.25), 0 0 12px rgba(255, 79, 195, 0.5);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fifecore-projects-map__dot:hover,
.fifecore-projects-map__dot:focus-visible {
    transform: scale(1.35);
}

.fifecore-projects-map__dot:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.fifecore-projects-map__dot--current {
    background-color: #ff4fc3;
}

.fifecore-projects-map__dot--completed {
    background-color: #22d3ee;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.25), 0 0 12px rgba(34, 211, 238, 0.5);
}

.fifecore-projects-map__dot--upcoming {
    background-color: #fbbf24;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.25), 0 0 12px rgba(251, 191, 36, 0.5);
}

/* Hover tooltip (project title) */
.fifecore-projects-map__container .leaflet-tooltip.fifecore-projects-map__tooltip {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1a1a2e;
    background-color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 6px 20px rgba(13, 1, 24, 0.3);
}

.fifecore-projects-map__container .leaflet-tooltip.fifecore-projects-map__tooltip::before {
    display: none;
}

/* ==========================================================================
   Region cluster circles
   ========================================================================== */
.fifecore-projects-map__cluster {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: rgba(147, 49, 131, 0.35);
    border: 2px solid rgba(255, 79, 195, 0.9);
    box-shadow: 0 0 0 6px rgba(147, 49, 131, 0.12), 0 8px 24px rgba(13, 1, 24, 0.4);
    color: #ffffff;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.fifecore-projects-map__cluster:hover,
.fifecore-projects-map__cluster:focus-visible {
    transform: scale(1.08);
    background-color: rgba(147, 49, 131, 0.55);
}

.fifecore-projects-map__cluster:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

.fifecore-projects-map__cluster-count {
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.1;
}

.fifecore-projects-map__cluster-label {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
}

/* ==========================================================================
   Legend
   ========================================================================== */
.fifecore-projects-map__legend {
    position: absolute;
    left: 1rem;
    bottom: 1rem;
    z-index: 400;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.9rem;
    padding: 0.6rem 0.9rem;
    background-color: rgba(13, 1, 24, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    pointer-events: none;
}

.fifecore-projects-map__legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
}

.fifecore-projects-map__legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.fifecore-projects-map__legend-dot--current {
    background-color: #ff4fc3;
}

.fifecore-projects-map__legend-dot--completed {
    background-color: #22d3ee;
}

.fifecore-projects-map__legend-dot--upcoming {
    background-color: #fbbf24;
}

/* ==========================================================================
   Instruction label
   ========================================================================== */
.fifecore-projects-map__instructions {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    z-index: 400;
    margin: 0;
    padding: 0.5rem 0.9rem;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.75);
    background-color: rgba(13, 1, 24, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    pointer-events: none;
}

/* ==========================================================================
   Leaflet popup content (project card)
   ========================================================================== */
.fifecore-projects-map__container .leaflet-popup-content-wrapper {
    background-color: #170a22;
    color: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 20px 50px rgba(13, 1, 24, 0.5);
}

.fifecore-projects-map__container .leaflet-popup-tip {
    background-color: #170a22;
}

.fifecore-projects-map__container .leaflet-popup-close-button {
    color: rgba(255, 255, 255, 0.6) !important;
}

.fifecore-projects-map__container .leaflet-popup-close-button:hover {
    color: #ffffff !important;
}

.fifecore-projects-map__popup {
    max-width: 240px;
    font-family: inherit;
}

.fifecore-projects-map__popup-title {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    line-height: 1.3;
    color: #ffffff;
}

.fifecore-projects-map__popup-meta {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.65);
}

.fifecore-projects-map__popup-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 0 0.5rem;
}

.fifecore-projects-map__popup-badge {
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #ff8fdb;
    background-color: rgba(255, 79, 195, 0.15);
    border-radius: 999px;
}

.fifecore-projects-map__popup-badge--completed {
    color: #22d3ee;
    background-color: rgba(34, 211, 238, 0.15);
}

.fifecore-projects-map__popup-badge--upcoming {
    color: #fbbf24;
    background-color: rgba(251, 191, 36, 0.15);
}

.fifecore-projects-map__popup-description {
    margin: 0 0 0.6rem;
    font-size: 0.85rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.8);
}

.fifecore-projects-map__popup-link {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #ff4fc3;
    text-decoration: none;
}

.fifecore-projects-map__popup-link:hover,
.fifecore-projects-map__popup-link:focus-visible {
    text-decoration: underline;
}

/* ==========================================================================
   Synced project list
   ========================================================================== */
.fifecore-projects-map__list-panel {
    display: flex;
    flex-direction: column;
    height: 500px;
    background-color: #170a22;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.75rem;
    box-shadow: 0 30px 70px rgba(13, 1, 24, 0.45), 0 4px 16px rgba(13, 1, 24, 0.3);
    overflow: hidden;
}

.fifecore-projects-map__list-panel-title {
    flex: 0 0 auto;
    margin: 0;
    padding: 1rem 1.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

.fifecore-projects-map__list-empty {
    margin: 0;
    padding: 0 1.25rem 1rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
}

.fifecore-projects-map__list {
    flex: 1 1 auto;
    margin: 0;
    padding: 0 0.75rem 0.75rem;
    list-style: none;
    overflow-y: auto;
}

.fifecore-projects-map__list-item {
    margin: 0 0 0.4rem;
}

.fifecore-projects-map__list-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: 0.75rem;
    color: #ffffff;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.fifecore-projects-map__list-btn:hover,
.fifecore-projects-map__list-btn:focus-visible {
    background-color: rgba(147, 49, 131, 0.25);
    border-color: rgba(147, 49, 131, 0.5);
}

.fifecore-projects-map__list-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.fifecore-projects-map__list-item.is-active .fifecore-projects-map__list-btn {
    background-color: rgba(147, 49, 131, 0.55);
    border-color: #933183;
}

.fifecore-projects-map__list-dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Kept literally identical to .fifecore-projects-map__dot--* and .fifecore-projects-map__legend-dot--* above — marker, legend, and list dot colors must always match. */
.fifecore-projects-map__list-dot--current {
    background-color: #ff4fc3;
}

.fifecore-projects-map__list-dot--completed {
    background-color: #22d3ee;
}

.fifecore-projects-map__list-dot--upcoming {
    background-color: #fbbf24;
}

.fifecore-projects-map__list-text {
    flex: 1 1 auto;
    min-width: 0;
}

.fifecore-projects-map__list-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fifecore-projects-map__list-meta {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1023px) {
    .fifecore-projects-map__filter-panel {
        gap: 0.85rem 1.1rem;
    }

    .fifecore-projects-map__legend,
    .fifecore-projects-map__instructions {
        font-size: 0.65rem;
        padding: 0.45rem 0.7rem;
    }

    .fifecore-projects-map__cluster {
        width: 56px;
        height: 56px;
    }

    .fifecore-projects-map__layout {
        grid-template-columns: 3fr 2fr;
    }
}

@media (max-width: 767px) {
    .fifecore-projects-map__filter-panel {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
    }

    .fifecore-projects-map__filter-title {
        margin-bottom: 0.25rem;
    }

    .fifecore-projects-map__filter-bar .fifecore-live-filter__topic-select {
        width: 100%;
        min-height: 44px;
    }

    .fifecore-projects-map__container {
        border-radius: 1.25rem;
        min-height: 320px;
    }

    .fifecore-projects-map__zoom-btn {
        width: 2.5rem;
        height: 2.5rem;
    }

    .fifecore-projects-map__legend,
    .fifecore-projects-map__instructions {
        position: static;
        width: 100%;
        margin-top: 0.5rem;
        border-radius: 0.75rem;
    }

    .fifecore-projects-map__map-wrap {
        display: flex;
        flex-direction: column;
    }

    .fifecore-projects-map__layout {
        grid-template-columns: 1fr;
    }

    .fifecore-projects-map__list-panel {
        height: 320px;
        border-radius: 1.25rem;
        margin-top: 1rem;
    }

    .fifecore-projects-map__cluster {
        width: 48px;
        height: 48px;
    }

    .fifecore-projects-map__cluster-count {
        font-size: 0.95rem;
    }

    .fifecore-projects-map__cluster-label {
        font-size: 0.55rem;
    }

    .fifecore-projects-map__popup {
        max-width: min(240px, 70vw);
    }
}

@media (prefers-reduced-motion: reduce) {
    .fifecore-projects-map__container[aria-busy="true"],
    .fifecore-projects-map__dot,
    .fifecore-projects-map__cluster,
    .fifecore-projects-map__zoom-btn {
        transition-duration: 0.01ms !important;
    }
}
