/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

.swiper {
    --swiper-navigation-color: #111;
    --swiper-navigation-size: 12px;
    --swiper-pagination-color: #fff;
    --swiper-pagination-bullet-size: 8px;
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
}

/* ---- Filter drawer (force constrained height so body can scroll) ---- */
.filter-drawer-panel {
    height: 100%;
    max-height: 100dvh;
    overflow: hidden;
}

.filter-drawer-body {
    min-height: 0;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* ---- Search marketplace layout (bulletproof, no flex % height chain) ---- */
.search-shell {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: 4rem; /* matches h-16 header */
    z-index: 20;
    display: grid;
    grid-template-rows: 3.5rem minmax(0, 1fr);
    overflow: hidden;
    background: var(--color-neutral-bg, #f7f0e8);
}

@media (min-width: 1024px) {
    .search-shell {
        top: 4.25rem; /* matches lg:h-[4.25rem] header */
    }
}

.search-shell__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    border-bottom: 1px solid var(--color-neutral-border, #e2d5c6);
    background: var(--color-neutral-bg, #f7f0e8);
    min-height: 3.5rem;
    z-index: 30;
}

.search-shell__body {
    position: relative;
    min-height: 0;
    overflow: hidden;
}

turbo-frame#search_results {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.search-split {
    --split-list: 38%;
    /* Mobile: leave more vertical room for list cards (toolbar is fixed above scroll) */
    --split-map: 36%;
    --split-handle: 8px;
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) var(--split-handle) var(--split-map);
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.search-split--dragging {
    cursor: row-resize;
    user-select: none;
}

.search-split--dragging .search-split__map,
.search-split--dragging .search-split__list {
    pointer-events: none; /* keep drag smooth over map/list */
}

.search-split__list {
    min-height: 0;
    min-width: 0;
    height: 100%;
    /* Scroll lives on .search-list-scroll so the toolbar can stay pinned */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--color-neutral-bg, #f7f0e8);
}

.search-list-toolbar {
    flex-shrink: 0;
}

.search-list-scroll {
    /* flex-basis 0 forces remaining height in the column (not content-sized) */
    min-height: 0;
    flex: 1 1 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

turbo-frame#search_list {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

/* List refresh while map viewport changes (map_controller setListLoading) */
.search-list-loading {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 4.5rem;
    pointer-events: none;
    background: color-mix(in srgb, var(--color-neutral-bg, #f7f0e8) 55%, transparent);
}

.search-list--loading .search-list-loading {
    display: flex;
}

.search-list--loading .search-list-scroll {
    opacity: 0.45;
}

.search-list-loading__label {
    border-radius: 9999px;
    border: 1px solid var(--color-neutral-border, #e2d5c6);
    background: var(--color-neutral-surface, #fffcf8);
    color: var(--color-neutral-muted, #6b5e52);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.25;
    padding: 0.5rem 0.875rem;
    box-shadow: 0 2px 8px rgba(44, 36, 22, 0.08);
}

.search-map-area-btn {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    z-index: 5;
    transform: translateX(-50%);
    min-height: 44px;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    border: 1px solid var(--color-neutral-border, #e2d5c6);
    background: var(--color-neutral-surface, #fffcf8);
    color: var(--color-neutral-text, #2c2416);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(44, 36, 22, 0.14);
    cursor: pointer;
}

.search-map-area-btn:hover {
    background: var(--color-neutral-raised, #efe6db);
}

.search-map-area-btn:focus-visible {
    outline: 2px solid var(--color-primary, #c45c3e);
    outline-offset: 2px;
}

.search-split__handle {
    position: relative;
    z-index: 5;
    touch-action: none;
    background: var(--color-neutral-border, #e2d5c6);
    cursor: row-resize;
}

.search-split__handle::after {
    content: "";
    position: absolute;
    inset: -6px 0; /* larger hit target */
}

.search-split__handle:hover,
.search-split__handle:focus-visible,
.search-split__handle--active {
    background: var(--color-primary, #c45c3e);
    outline: none;
}

.search-split__map {
    position: relative;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    background: var(--color-neutral-raised, #efe6db);
}

.search-split__map #map {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* Prevent Google Maps from expanding the page when interacting */
.search-split__map .gm-style {
    max-width: 100%;
    max-height: 100%;
}

@media (min-width: 1024px) {
    .search-split {
        grid-template-columns: var(--split-list) var(--split-handle) minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr);
    }

    .search-split--dragging {
        cursor: col-resize;
    }

    .search-split__handle {
        cursor: col-resize;
    }

    .search-split__handle::after {
        inset: 0 -6px; /* wider hit target for vertical divider */
    }
}

@media (max-width: 1024px) {
    .swiper {
        --swiper-pagination-bullet-size: 10px;
    }
}

.swiper:hover .swiper-button-prev,
.swiper:hover .swiper-button-next {
    display: flex !important;
}

.swiper-button-prev svg,
.swiper-button-next svg {
    width: 18px !important;
    height: 18px !important;
    fill: #111;
}

.swiper-button-prev,
.swiper-button-next {
    display: none !important;
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 6px;
    border-width: 1px;
    border-color: rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    width: 48px !important;
    height: 48px !important;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

@media (max-width: 1024px) {
    .swiper-button-prev,
    .swiper-button-next {
        width: 48px !important;
        height: 48px !important;
        display: flex !important;
    }
}

.swiper-button-prev::after,
.swiper-button-next::after {
    content: none !important;
}
