/* ── Map wrapper ────────────────────────────────────────────────────── */

.xd-gmap-wrap {
    display: flex;
    flex-direction: row;
    width: 100%;
    position: relative;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 13px;
    color: #1d2327;
    border: 1px solid #c3c4c7;
    border-radius: 2px;
}

.xd-gmap-wrap .maplibregl-canvas { outline: none; }

/* ── Sidebar ─────────────────────────────────────────────────────────── */

.xd-gmap-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #c3c4c7;
    z-index: 10;
    overflow: hidden;                   /* clips content during collapse */
    transition: width 0.2s ease, border-right-color 0.2s ease;
}

.xd-gmap-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;                 /* anchors the absolute detail panel */
}

/* ── Sidebar toggle button ───────────────────────────────────────────── */

.xd-sidebar-toggle-btn {
    position: absolute;                 /* in .xd-gmap-wrap (position:relative) */
    left: 300px;                        /* right at the sidebar/canvas boundary */
    top: 12px;
    z-index: 20;
    width: 22px;
    height: 38px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-left: none;
    border-radius: 0 3px 3px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #50575e;
    padding: 0;
    box-shadow: 2px 0 4px rgba(0,0,0,0.08);
    transition: left 0.2s ease, background 0.12s, color 0.12s;
}

.xd-sidebar-toggle-btn:hover {
    background: #f6f7f7;
    color: #1d2327;
}

.xd-gmap-wrap.xd-sidebar-collapsed .xd-gmap-sidebar {
    width: 0;
    border-right-color: transparent;
}

.xd-gmap-wrap.xd-sidebar-collapsed .xd-sidebar-toggle-btn {
    left: 0;
}

/* ── Sidebar header ─────────────────────────────────────────────────── */

.xd-gsb-header {
    padding: 12px 14px 10px;
    border-bottom: 1px solid #c3c4c7;
    flex-shrink: 0;
    background: #f6f7f7;
}

.xd-gsb-title {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 9px 0;
    color: #1d2327;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xd-gsb-search {
    width: 100%;
    padding: 5px 10px;
    border: 1px solid #c3c4c7;
    border-radius: 3px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    background: #fff;
    color: #1d2327;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.xd-gsb-search:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* ── Layer toggles ──────────────────────────────────────────────────── */

.xd-gsb-layers-wrap { flex-shrink: 0; }

.xd-gsb-layers {
    padding: 4px 0;
    border-bottom: 1px solid #c3c4c7;
    background: #fff;
}

.xd-gsl-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 14px;
    cursor: pointer;
    font-size: 12px;
    color: #2c3338;
    line-height: 1.4;
    user-select: none;
}

.xd-gsl-item:hover { background: #f6f7f7; }

.xd-gsl-check { cursor: pointer; }

/* ── POI list ───────────────────────────────────────────────────────── */

.xd-gsb-pois {
    flex: 1;
    overflow-y: auto;
    padding: 2px 0;
    background: #fff;
}

.xd-gsp-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 8px 14px;
    background: none;
    border: none;
    border-bottom: 1px solid #f0f0f1;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    color: inherit;
    transition: background 0.1s;
}

.xd-gsp-item:last-child { border-bottom: none; }
.xd-gsp-item:hover  { background: #f6f7f7; }
.xd-gsp-item.is-active { background: #f0f6fc; border-left: 3px solid #2271b1; padding-left: 11px; }

.xd-gsp-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
    border: 1.5px solid rgba(0,0,0,0.15);
}

.xd-gsp-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.xd-gsp-title {
    font-size: 13px;
    font-weight: 500;
    color: #1d2327;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xd-gsp-sub {
    font-size: 11px;
    color: #646970;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.xd-gsb-empty {
    padding: 24px 14px;
    color: #646970;
    font-size: 13px;
    text-align: center;
}

/* ── Detail panel ────────────────────────────────────────────────────── */

.xd-gsb-detail {
    position: absolute;
    inset: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 2;
}

.xd-gsd-head {
    padding: 8px 14px;
    border-bottom: 1px solid #c3c4c7;
    flex-shrink: 0;
    background: #f6f7f7;
}

.xd-gsd-back {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: #2271b1;
    padding: 3px 0;
    font: inherit;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.xd-gsd-back:hover { text-decoration: underline; }

.xd-gsd-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}

.xd-gsd-title-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 10px;
}

.xd-gsd-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
    border: 1.5px solid rgba(0,0,0,0.15);
}

.xd-gsd-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: #1d2327;
    line-height: 1.3;
}

.xd-gsd-desc {
    font-size: 13px;
    color: #646970;
    line-height: 1.55;
    margin: 0 0 12px 0;
}

.xd-gsd-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
    font-size: 12px;
    border-bottom: 1px solid #f0f0f1;
    padding-bottom: 7px;
}

.xd-gsd-label {
    color: #646970;
    min-width: 52px;
    flex-shrink: 0;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.04em;
}

.xd-gsd-val { color: #1d2327; font-weight: 500; }

.xd-gsd-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
}

.xd-gsd-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 4px 0 10px;
}

.xd-gsd-tag {
    padding: 2px 7px;
    background: #f0f0f1;
    color: #50575e;
    border-radius: 3px;
    font-size: 11px;
}

.xd-gsd-visited {
    color: #00a32a;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.xd-gsd-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 14px;
    border-top: 1px solid #c3c4c7;
    padding-top: 12px;
}

.xd-gsd-action {
    display: block;
    padding: 7px 12px;
    background: #f6f7f7;
    color: #2271b1;
    border: 1px solid #c3c4c7;
    border-radius: 3px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    transition: background 0.1s, border-color 0.1s;
}

.xd-gsd-action:hover { background: #fff; border-color: #2271b1; }

/* ── Map canvas ─────────────────────────────────────────────────────── */

.xd-gmap-canvas {
    flex: 1;
    min-width: 0;
    position: relative;
}

/* ── MapLibre UI overrides ──────────────────────────────────────────── */

.xd-map-popup { font-size: 13px; }

.maplibregl-ctrl-group {
    border-radius: 3px !important;
}

/* ── Mobile ─────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .xd-gmap-wrap { flex-direction: column; }

    .xd-gmap-sidebar {
        width: 100% !important;
        height: 240px;
        border-right: none;
        border-top: 1px solid #c3c4c7;
        order: 2;
        flex-shrink: 0;
        overflow: hidden;
    }

    .xd-gmap-sidebar-inner { width: 100%; }

    .xd-sidebar-toggle-btn { display: none; }

    .xd-gmap-canvas {
        order: 1;
        flex: 1;
        min-height: 0;
    }
}
