/**
 * City Split View Styles
 * Split view layout: listings grid (left) + sticky map (right)
 */

/* ═══════════════════════════════════════
   SPLIT VIEW CONTAINER
   ═══════════════════════════════════════ */

.city-split-view {
    display: flex;
    min-height: calc(100vh - 80px); /* Account for header */
    max-width: 100%;
    position: relative;
}

/* ═══════════════════════════════════════
   LISTINGS PANEL (LEFT SIDE)
   ═══════════════════════════════════════ */

.city-listings-panel {
    flex: 0 0 60%;
    max-width: 60%;
    padding: 24px 32px 48px; /* Extra bottom padding before footer */
    background: var(--bg-page, #FFFFFF);
    /* No height constraint - let page scroll naturally */
}

/* Scrollbar styling */
.city-listings-panel::-webkit-scrollbar {
    width: 8px;
}

.city-listings-panel::-webkit-scrollbar-track {
    background: transparent;
}

.city-listings-panel::-webkit-scrollbar-thumb {
    background: var(--border, #E2E8F0);
    border-radius: 4px;
}

.city-listings-panel::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted, #94A3B8);
}

/* ═══════════════════════════════════════
   MAP PANEL (RIGHT SIDE)
   ═══════════════════════════════════════ */

.city-map-panel {
    flex: 0 0 40%;
    max-width: 40%;
    position: sticky;
    top: 88px; /* Below header + 8px gap */
    height: calc(100vh - 88px);
    background: var(--bg-surface, #F8FAFC);
    align-self: flex-start;
    /* Professional separation */
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.04);
}

#cityMap {
    width: 100%;
    height: 100%;
}

/* ═══════════════════════════════════════
   3-COLUMN LISTINGS GRID
   ═══════════════════════════════════════ */

.city-listings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

/* ═══════════════════════════════════════
   LISTING CARD
   ═══════════════════════════════════════ */

.city-listings-grid .listing-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 12px;
    overflow: visible;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    border: 2px solid transparent;
}

/* Highlight when hovering map pin */
.city-listings-grid .listing-card.map-highlighted {
    border-color: var(--accent, #3B82F6);
    box-shadow: 0 0 0 2px var(--accent, #3B82F6), 0 4px 16px rgba(59, 130, 246, 0.2);
}

/* ═══════════════════════════════════════
   LISTING GALLERY (Image Carousel)
   ═══════════════════════════════════════ */

.listing-gallery {
    position: relative;
    width: 100%;
    padding-bottom: 75%; /* 4:3 aspect ratio = 3/4 = 75% */
    height: 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-surface, #F8FAFC);
}

/* Gallery images container */
.listing-gallery-images {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.listing-gallery-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.listing-gallery-slide.active {
    opacity: 1;
    pointer-events: auto;
}

.listing-gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Guest favorite badge */
.listing-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary, #1E293B);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.listing-badge::before {
    content: '\1F3C6'; /* Trophy emoji */
    font-size: 14px;
}

/* Save/heart button */
.listing-save {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: white;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
    transition: transform 0.15s ease;
}

.listing-save:hover {
    transform: scale(1.1);
}

.listing-save:hover svg {
    fill: rgba(255, 56, 92, 0.3);
    stroke: #ff385c;
}

.listing-save.saved svg {
    fill: #ff385c;
    stroke: #ff385c;
}

.listing-save svg {
    fill: rgba(0, 0, 0, 0.5);
    stroke: white;
    stroke-width: 2;
    transition: fill 0.15s ease, stroke 0.15s ease;
}

/* Navigation arrows */
.listing-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.15s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.listing-gallery:hover .listing-gallery-nav {
    opacity: 1;
}

.listing-gallery-nav:hover {
    background: white;
    transform: translateY(-50%) scale(1.05);
}

.listing-gallery-nav:disabled {
    opacity: 0.3 !important;
    cursor: default;
}

.listing-gallery-prev {
    left: 8px;
}

.listing-gallery-next {
    right: 8px;
}

.listing-gallery-nav svg {
    color: #222;
}

/* Dot indicators */
.listing-gallery-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 5px;
}

.listing-gallery-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transition: background 0.2s ease, transform 0.2s ease;
}

.listing-gallery-dot.active {
    background: white;
    transform: scale(1.2);
}

/* ═══════════════════════════════════════
   LISTING INFO (Below Gallery)
   ═══════════════════════════════════════ */

.listing-info {
    display: block;
    text-decoration: none;
    color: inherit;
    padding-top: 10px;
}

.city-listings-grid .listing-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1E293B);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.city-listings-grid .listing-details {
    font-size: 14px;
    color: var(--text-secondary, #64748B);
    margin-top: 4px;
}

.city-listings-grid .listing-price {
    font-size: 14px;
    color: var(--text-primary, #1E293B);
    margin-top: 6px;
}

.city-listings-grid .listing-price strong {
    font-weight: 600;
}

/* ═══════════════════════════════════════
   LEAFLET MAP PRICE PINS
   ═══════════════════════════════════════ */

/* Wrapper for Leaflet marker */
.city-map-marker-wrapper {
    background: transparent !important;
    border: none !important;
}

/* Price pin styling */
.city-map-price-pin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid #222222;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #222222;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.15s ease;
    transform-origin: center bottom;
}

.city-map-price-pin:hover,
.city-map-price-pin.highlighted {
    background: #222222;
    color: white;
    transform: scale(1.1);
    z-index: 1000 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Ensure highlighted pins are on top */
.leaflet-marker-icon.highlighted-marker {
    z-index: 1000 !important;
}

/* ═══════════════════════════════════════
   PAGE HEADER & INFO
   ═══════════════════════════════════════ */

.city-page-header {
    margin-bottom: 24px;
}

.city-page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary, #1E293B);
    margin: 0 0 8px 0;
}

.city-results-info {
    font-size: 14px;
    color: var(--text-secondary, #64748B);
    margin-bottom: 20px;
}

/* ═══════════════════════════════════════
   BREADCRUMB
   ═══════════════════════════════════════ */

.city-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary, #64748B);
    margin-bottom: 16px;
}

.city-breadcrumb a {
    color: var(--text-secondary, #64748B);
    text-decoration: none;
}

.city-breadcrumb a:hover {
    color: var(--accent, #3B82F6);
    text-decoration: underline;
}

.city-breadcrumb-separator {
    color: var(--text-muted, #94A3B8);
}

/* ═══════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════ */

.city-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 24px 0;
}

.city-pagination a,
.city-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}

.city-pagination a {
    color: var(--text-primary, #1E293B);
    background: var(--bg-surface, #F8FAFC);
    border: 1px solid var(--border, #E2E8F0);
}

.city-pagination a:hover {
    background: var(--bg-page, #FFFFFF);
    border-color: var(--text-muted, #94A3B8);
}

.city-pagination span.current {
    background: var(--text-primary, #1E293B);
    color: white;
    border: 1px solid var(--text-primary, #1E293B);
}

.city-pagination span.ellipsis {
    background: transparent;
    border: none;
    color: var(--text-muted, #94A3B8);
}

/* ═══════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════ */

/* Medium screens */
@media (max-width: 1200px) {
    .city-listings-panel {
        flex: 0 0 55%;
        max-width: 55%;
        padding: 20px 24px;
    }

    .city-map-panel {
        flex: 0 0 45%;
        max-width: 45%;
    }

    .city-listings-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Tablet and mobile */
@media (max-width: 768px) {
    .city-split-view {
        flex-direction: column-reverse; /* Map on top when stacked */
        min-height: auto;
    }

    .city-listings-panel {
        flex: 1;
        max-width: 100%;
        height: auto;
        overflow-y: visible;
        padding: 16px;
    }

    .city-map-panel {
        flex: 0 0 280px;
        max-width: 100%;
        width: 100%;
        position: relative;
        top: 0;
        height: 280px;
    }

    .city-listings-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .city-page-header h1 {
        font-size: 22px;
    }

    .city-listings-grid .listing-title {
        font-size: 14px;
    }

    .city-listings-grid .listing-details,
    .city-listings-grid .listing-price {
        font-size: 13px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .city-listings-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .city-map-panel {
        height: 220px;
    }

    .city-listings-panel {
        padding: 12px;
    }
}

/* ═══════════════════════════════════════
   LEAFLET OVERRIDES
   ═══════════════════════════════════════ */

/* Make sure Leaflet containers fill their space */
.leaflet-container {
    width: 100%;
    height: 100%;
    font-family: inherit;
}

/* Attribution styling */
.leaflet-control-attribution {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.8) !important;
}

/* Zoom controls */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-control-zoom a {
    background: white !important;
    color: #222 !important;
    border: none !important;
}

.leaflet-control-zoom a:hover {
    background: #f5f5f5 !important;
}

/* ═══════════════════════════════════════
   NO LISTINGS STATE
   ═══════════════════════════════════════ */

.city-no-listings {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary, #64748B);
}

.city-no-listings h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary, #1E293B);
    margin-bottom: 8px;
}

.city-no-listings p {
    font-size: 15px;
}
