body {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', Arial, sans-serif;
    background-color: #ffffff;
    color: #222;
    overflow: hidden;
}

/* ───── Type tab bar (primary navigation) ───── */
.type-tabs {
    display: flex;
    gap: 28px;
    padding: 0 28px;
    border-bottom: 1px solid #ebebeb;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 30;
}

.type-tab {
    position: relative;
    padding: 14px 0 14px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    color: #717171;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
    margin-bottom: -1px;
}
.type-tab:hover { color: #222; }
.type-tab.active {
    color: #222;
    border-bottom-color: #222;
    font-weight: 600;
}

/* ───── Split layout ───── */
.split {
    display: flex;
    height: calc(100vh - 80px - 49px); /* header 80px, tabs ~49px */
}

.results {
    flex: 1 1 50%;
    overflow-y: auto;
    padding: 20px 28px 60px;
    box-sizing: border-box;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 12px;
}

.results-title-group {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    flex-wrap: wrap;
}

.results-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
}

.results-count {
    font-size: 14px;
    color: #717171;
    flex-shrink: 0;
}

/* ───── Title-bar region dropdown ───── */
.results-title-chevron {
    color: #c0c0c0;
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
    user-select: none;
}

.region-dropdown-btn {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 22px;
    font-weight: 600;
    color: #222;
    cursor: pointer;
    border-radius: 999px;
    transition: background-color 0.15s ease;
}
.region-dropdown-btn:hover { background: #f7f7f7; }

.region-dropdown-label.is-placeholder {
    color: #b0b0b0;
    font-weight: 400;
}

.region-dropdown-caret { display: none; }

.pill-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.pill-dropdown[hidden],
.results-title-chevron[hidden] { display: none; }

.region-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    min-width: 180px;
    background: white;
    border: 1px solid #ebebeb;
    border-radius: 12px;
    box-shadow: 0 8px 24px -6px rgba(0,0,0,0.15);
    padding: 6px;
    display: none;
    z-index: 50;
}
.region-dropdown-menu.open { display: block; }

.region-dropdown-menu button {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 9px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    color: #222;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.region-dropdown-menu button:hover { background: #f5f5f5; }
.region-dropdown-menu button.active { background: #222; color: white; }

.filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-chip {
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 999px;
    background: white;
    font-family: inherit;
    font-size: 13px;
    color: #222;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.filter-chip:hover { border-color: #222; }
.filter-chip.active {
    background: #222;
    color: white;
    border-color: #222;
}

/* ───── Listing cards (matches profile/saved card style) ───── */
.listings-grid {
    /* Default: 3 columns, only on very wide viewports (≥ 1700px).
       Below that, prefer 2 columns to keep card width ~260–410px
       (Airbnb-style: card size > column count). */
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px 18px;
}
@media (max-width: 1699px) {
    .listings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    /* Below 900px the split also stacks (see below) → full-width single column */
    .listings-grid { grid-template-columns: 1fr; }
}

.place-card {
    position: relative;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    background: white;
    border: 1px solid #ebebeb;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.2s ease;
}
.place-card:hover,
.place-card.is-hovered {
    transform: scale(1.01);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
    border-color: #d0d0d0;
}

.place-card-img {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    margin: 0;
    background: #ececec;
}

.place-card-bookmark {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease;
    border: none;
    background: transparent;
    padding: 0;
}
.place-card:hover .place-card-bookmark { transform: scale(1.08); }
.place-card-bookmark svg {
    width: 26px;
    height: 26px;
    stroke: white;
    stroke-width: 1.7;
    fill: rgba(0,0,0,0.35);
    transition: fill 0.2s ease, stroke 0.2s ease;
}
.place-card-bookmark.active svg {
    fill: #23d3d3;
    stroke: #23d3d3;
}

.place-card-region {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(4px);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    color: #222;
    white-space: nowrap;
    line-height: 1;
}

.place-card-eyebrow {
    font-size: 13px;
    color: #717171;
    margin: 0 0 2px;
    padding: 14px 16px 0;
    line-height: 1.3;
}
.place-card-title {
    font-size: 16px;
    font-weight: 500;
    color: #222;
    margin: 0;
    padding: 0 16px;
    line-height: 1.3;
    min-height: 2.6em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.place-card-category {
    font-size: 13px;
    color: #717171;
    margin: 2px 0 0;
    padding: 0 60px 14px 16px;
    line-height: 1.3;
}

.place-card-votes {
    position: absolute;
    right: 14px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    color: #717171;
    line-height: 1;
}
.place-card-votes svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* ───── Map fullscreen control ───── */
.map-fullscreen-btn {
    width: 36px;
    height: 36px;
    background: white;
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.06);
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #222;
    padding: 0;
    transition: background-color 0.15s ease, transform 0.15s ease;
}
.map-fullscreen-btn:hover {
    background: #f7f7f7;
    transform: scale(1.04);
}
.map-fullscreen-btn svg { width: 18px; height: 18px; }

/* When the map pane goes fullscreen, fill viewport edge-to-edge.
   Flex parent sizing doesn't apply in fullscreen, so we set width/height
   explicitly with !important to override the inherited flex basis. */
.map-pane:fullscreen,
.map-pane:-webkit-full-screen {
    padding: 0 !important;
    margin: 0 !important;
    background: white;
    width: 100vw !important;
    height: 100vh !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: none !important;
}
.map-pane:fullscreen #map,
.map-pane:-webkit-full-screen #map {
    border-radius: 0 !important;
    width: 100% !important;
    height: 100% !important;
    box-shadow: none !important;
}

/* ───── Pagination (matches profile/saved pattern) ───── */
.map-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
    padding-bottom: 8px;
}
.map-pagination:empty { display: none; }

.map-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border: none;
    background: transparent;
    color: #222;
    font-family: inherit;
    font-size: 14px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.map-page-btn:hover { background: #f7f7f7; }
.map-page-btn:disabled {
    color: #ccc;
    cursor: default;
    background: transparent;
}
.map-page-btn.active {
    background: #222;
    color: white;
    font-weight: 500;
}
.map-page-btn.active:hover { background: #222; }
.map-page-btn--arrow { width: 32px; }
.map-page-btn--arrow svg {
    width: 14px;
    height: 14px;
}
.map-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    color: #717171;
}

/* ───── Map pane ───── */
.map-pane {
    flex: 1 1 50%;
    position: relative;
    min-width: 360px;
    padding: 12px 16px 16px 0;
    box-sizing: border-box;
}
#map {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: #eef0f2;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px -6px rgba(0,0,0,0.08);
}

.price-pin {
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 999px;
    padding: 6px 10px;
    font-family: 'Outfit', Arial, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #222;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
    white-space: nowrap;
    transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
    cursor: pointer;
}
.price-pin:hover,
.price-pin.is-active {
    transform: scale(1.08);
    background: #222;
    color: white;
    border-color: #222;
}

/* ───── In-map InfoWindow popup (mirrors left listing card) ───── */
.place-popup .leaflet-popup-content-wrapper {
    background: white;
    border-radius: 16px;
    padding: 0;
    border: 1px solid #ebebeb;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}
.place-popup .leaflet-popup-content {
    margin: 0;
    width: 260px !important;
    line-height: normal;
}
/* Hide Leaflet's default tail + close button — popup floats clean over the pin */
.place-popup .leaflet-popup-tip-container { display: none; }
.place-popup .leaflet-popup-close-button { display: none; }

.popup-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: #ececec;
    background-image: url('/image/Gyeongbokgung%20Palace/inhyeok-park-bkDo9iEGk7w-unsplash.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.popup-content {
    padding: 14px 16px;
}

.popup-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

/* Leaflet sets a default link color on .leaflet-container a — override with
   higher-specificity selectors. */
.place-popup a.popup-title,
.leaflet-container a.popup-title {
    display: block;
    font-family: 'Outfit', Arial, sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #222;
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease-in-out;
}
.place-popup a.popup-title:hover,
.leaflet-container a.popup-title:hover { color: #23d3d3; }

.popup-category {
    font-family: 'Outfit', Arial, sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #717171;
    margin: 0;
    line-height: 1;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.popup-votes {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    color: #717171;
    line-height: 1;
    flex-shrink: 0;
}
.popup-votes svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
}

@media (max-width: 900px) {
    .split { flex-direction: column; height: auto; }
    body { overflow: auto; }
    .map-pane { height: 320px; min-width: 0; padding: 0; }
    #map { border-radius: 0; }
    .results { overflow: visible; }
    .type-tabs { overflow-x: auto; gap: 20px; }
}
