/**
 * map.css — Map container, pins, hover cards,
 * map list panel, and map legend.
 */

/* ── Map view container ── */
.map-container {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: var(--color-gray-100);
    overflow: hidden;
    border-radius: 0.5rem;
}

/* ── Map pin ── */
.map-pin {
    position: absolute;
    transform: translate(-50%, -100%);
    cursor: pointer;
}

.map-pin-icon {
    display: block;
    color: var(--color-navy);
    transition: color 0.15s, transform 0.15s;
    user-select: none;
    fill: currentColor;
}

/* ── Highlighted pin — same style for CSS hover and JS-driven highlight ── */
.map-pin:hover,
.map-pin.is-highlighted {
    z-index: 30;
}

.map-pin:hover .map-pin-icon,
.map-pin.is-highlighted .map-pin-icon {
    color: var(--color-highlight-orange);
    transform: scale(1.65);
    filter: drop-shadow(0 2px 4px var(--color-black-30));
}

/* ── Map hover card ── */
.map-hover-card {
    position: absolute;
    z-index: 20;
    width: 13rem;
    background-color: var(--color-navy);
    color: var(--color-surface);
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px var(--color-black-50);
    padding: 0.75rem;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    display: none;
}

.map-pin:hover .map-hover-card,
.map-pin.is-highlighted .map-hover-card {
    display: block;
}

/* ── Map area wrapper (full width, contains .map-container) ── */
.map-area-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    padding: 0.5rem;
}

/* ── Map list panel (left sidebar) ── */
.map-list-panel {
    width: 14rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--color-surface);
    border-right: 1px solid var(--color-primary-200);
    overflow: hidden;
    transition: width 0.2s ease;
}

.map-list-panel.is-collapsed {
    width: 2.25rem;
}

.map-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--color-primary-200);
    flex-shrink: 0;
    gap: 0.5rem;
    min-width: 0;
}

.map-list-panel.is-collapsed .map-list-header {
    justify-content: center;
    padding: 0.625rem 0;
}

.map-list-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-navy);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    overflow: hidden;
    white-space: nowrap;
}

.map-list-panel.is-collapsed .map-list-title {
    display: none;
}

.map-list-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.125rem;
    color: var(--color-gray-500);
    display: inline-flex;
    align-items: center;
    border-radius: 0.25rem;
    flex-shrink: 0;
    transition: color 0.1s, background-color 0.1s;
}

.map-list-toggle-btn:hover {
    color: var(--color-navy);
    background-color: var(--color-primary-50);
}

.map-list-items {
    flex: 1;
    overflow-y: auto;
}

.map-list-panel.is-collapsed .map-list-items {
    display: none;
}

.map-list-item {
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--color-primary-100);
    transition: background-color 0.1s;
}

.map-list-item:hover {
    background-color: var(--color-primary-50);
}

.map-list-item.is-active {
    background-color: var(--color-primary-100);
    border-left: 3px solid var(--color-navy);
    padding-left: calc(0.75rem - 3px);
}

.map-list-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.0625rem;
}

.map-list-item-dur {
    font-size: 0.7rem;
    color: var(--color-primary-500);
}

.map-list-item-details {
    font-size: 0.6875rem;
    padding: 0.25rem 0.625rem;
    flex-shrink: 0;
}

/* ── Marker popup (custom positioned card) ── */
.map-marker-popup {
    position: absolute;
    width: 230px;
    background: var(--color-surface);
    border-radius: 0.625rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    padding: 0.75rem;
    z-index: 20;
    pointer-events: auto;
    border: 1px solid var(--color-primary-200);
}

.map-marker-popup-close {
    position: absolute;
    top: 0.35rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.1rem 0.3rem;
    cursor: pointer;
    color: var(--color-gray-500);
    border-radius: 0.25rem;
    transition: color 0.1s, background-color 0.1s;
}

.map-marker-popup-close:hover {
    color: var(--color-navy);
    background-color: var(--color-primary-50);
}

/* ── Marker popup content (structural selectors replace map-info-* classes) ── */
.map-marker-popup > p:first-of-type {
    font-weight: 600;
    font-size: 0.875rem;
    margin: 0 0 5px 0;
}

.map-marker-popup > p:nth-of-type(2) {
    font-size: 0.75rem;
    color: var(--color-gray-600);
    margin: 0 0 4px 0;
}

.map-marker-popup > p:nth-of-type(3) {
    font-size: 0.72rem;
    color: var(--color-gray-500);
    margin: 0 0 10px 0;
}

.map-marker-popup-details {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 20px;
    cursor: pointer;
    background-color: var(--color-navy);
    color: var(--color-surface);
    border: none;
    border-radius: 0.375rem;
    transition: opacity 0.15s;
}

.map-marker-popup-details:hover {
    opacity: 0.85;
}

/* ── Google Maps InfoWindow overrides ── */
/* -- Exempt from !important disallowance since these are necessary overrides for Google Maps' inline styles. -- */

/* Remove Google's default card padding so .map-info-window controls all spacing. */
.gm-style-iw-c {
    padding: 0 !important;
}

/* Remove the extra right/bottom padding Google adds to the scrollable content div. */
.gm-style-iw-d {
    overflow: hidden !important;
    padding: 0 !important;
}

/* Shrink the close-button row so it doesn't loom over the content. */
.gm-style-iw-chr {
    height: 28px !important;
    padding: 0 6px !important;
}

/* Scale down the X button itself. */
.gm-ui-hover-effect {
    width: 24px !important;
    height: 24px !important;
}

.gm-ui-hover-effect > span {
    width: 14px !important;
    height: 14px !important;
    margin: 5px !important;
}

/* ── Map legend ── */
.map-legend {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    background-color: var(--color-white-90);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: var(--color-gray-600);
    box-shadow: 0 1px 3px var(--color-black-10);
    border-width: 1px;
    border-style: solid;
    border-color: var(--color-primary-100);
}

