.campus-map-component {
    font: inherit
}

/* =========================
   Map container
========================= */
.campus-map-component #campus-map {
    width: 100%;
    height: clamp(420px, 70vh, 800px);
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #f9fafb;
    isolation: isolate;
    z-index: 0
}

@media(max-width:767px) {
    .campus-map-component #campus-map {
        height: clamp(340px, 60vh, 520px)
    }
}

/* =========================
   Status / fallback
========================= */
.campus-map-component .campus-map-status {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 1rem;
    text-align: center;
    color: #111827;
    background: #f9fafb
}

/* =========================
   Mobile helper text
========================= */
.campus-map-component .campus-map-mobile-hint {
    display: none;
    margin: 0 0 .75rem;
    color: #111827
}

/* =========================
   Marker (stable)
========================= */
.campus-map-component .campus-marker-trigger {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #fff;
    background-color: #0057b8;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .3);
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 3L1 9l11 6 9-4.91V17h2V9L12 3zm0 13L5 12.27v2.91l7 3.82 7-3.82v-2.91L12 16z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 14px;
    transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease
}

.campus-map-component .campus-marker-trigger:hover,
.campus-map-component .campus-marker-trigger:focus,
.campus-map-component .campus-marker-trigger.is-active {
    transform: scale(1.1);
    background-color: #ffb819;
    box-shadow: 0 0 0 2px #111827;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23111827'%3E%3Cpath d='M12 3L1 9l11 6 9-4.91V17h2V9L12 3zm0 13L5 12.27v2.91l7 3.82 7-3.82v-2.91L12 16z'/%3E%3C/svg%3E")
}

.campus-map-component .campus-marker-trigger.is-active {
    transform: scale(1.15)
}

.campus-map-component .campus-marker-trigger:focus {
    outline: 3px solid #111827;
    outline-offset: 3px
}

/* =========================
   Popup
========================= */
.campus-map-component .campus-popup {
    position: absolute;
    min-width: 220px;
    max-width: 280px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 14px 14px 12px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .2);
    z-index: 20;
    color: #111827;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .18s ease, transform .18s ease;
    will-change: opacity, transform
}

.campus-map-component .campus-popup[hidden] {
    display: none
}

.campus-map-component .campus-popup.is-visible {
    opacity: 1;
    transform: translateY(0)
}

.campus-map-component .campus-popup.is-closing {
    opacity: 0;
    transform: translateY(6px)
}

/* =========================
   Popup header (final layout)
========================= */
.campus-map-component .campus-popup-header {
    position: relative;
    margin-bottom: 0.5rem;
    padding-top: 28px;
}

.campus-map-component .campus-popup-title {
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
}

/* =========================
   Popup content
========================= */
.campus-map-component .campus-popup p {
    margin: 0 0 .5rem
}

.campus-map-component .campus-popup p:last-child {
    margin-bottom: 0
}

.campus-map-component .campus-popup ul {
    margin: 0 0 .75rem 1.25rem;
    padding: 0
}

.campus-map-component .campus-popup li {
    margin-bottom: .25rem
}

.campus-map-component .campus-popup-group-label {
    margin-bottom: .25rem
}

/* =========================
   Close button (enhanced)
========================= */
.campus-map-component .campus-popup-close {
    position: absolute;
    top: 0;
    right: 0;

    display: inline-flex;
    align-items: center;
    gap: 0.25rem;

    padding: 4px 8px;

    font-size: 0.75rem;
    font-weight: 600;

    background: #f3f4f6;
    color: #111827;

    border: 1px solid #d1d5db;
    border-radius: 4px;

    cursor: pointer;

    transition: background .12s ease, transform .12s ease;
}

.campus-map-component .campus-popup-close:hover {
    background: #e5e7eb;
    transform: scale(1.05);
}

.campus-map-component .campus-popup-close:focus,
.campus-map-component .campus-popup-close:focus-visible {
    outline: 2px solid #111827;
    outline-offset: 2px;
    background: #e5e7eb;
}

.campus-map-component .campus-popup-close-icon {
    font-size: 0.9rem;
    line-height: 1;
}

/* =========================
   Focus styles
========================= */
.campus-map-component .campus-popup a:focus,
.campus-map-component .map-reset-control:focus,
.campus-map-component .campus-popup:focus {
    outline: 3px solid #111827;
    outline-offset: 2px;
    border-radius: 2px
}

/* =========================
   Reset button
========================= */
.campus-map-component .map-reset-control {
    width: 30px;
    height: 30px;
    background: #fff;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    border: none;
    cursor: pointer
}

.campus-map-component .map-reset-control:hover {
    background: #f3f4f6
}

.campus-map-component .map-reset-control svg {
    width: 16px;
    height: 16px;
    fill: currentColor
}

/* =========================
   Mobile tweaks
========================= */
@media(max-width:767px) {
    .campus-map-component .campus-marker-trigger {
        width: 32px;
        height: 32px;
        background-size: 16px
    }

    .campus-map-component .campus-popup {
        width: min(280px, calc(100vw - 32px))
    }

    .campus-map-component .map-reset-control {
        width: 36px;
        height: 36px
    }

    .campus-map-component .campus-map-mobile-hint {
        display: block
    }
}

/* =========================
   Reduced motion
========================= */
@media (prefers-reduced-motion: reduce) {
    .campus-map-component .campus-popup,
    .campus-map-component .campus-popup-close {
        transition: none;
        transform: none
    }

    .campus-map-component .campus-popup.is-visible,
    .campus-map-component .campus-popup.is-closing,
    .campus-map-component .campus-popup-close:hover,
    .campus-map-component .campus-popup-close:focus,
    .campus-map-component .campus-popup-close:focus-visible {
        transform: none
    }
}