/* Housing Wanted's "Availability" panel: rows and editors come from the All Housing panel
   (components/availability-panel.css); this file sizes it and adds what is its own. */
.when {
    position: relative;
}

.when[hidden],
.when [hidden] {
    display: none !important;
}

/* As wide as its rows, like the All Housing panel. */
.when .wanted-availability-panel {
    box-sizing: border-box;
    width: max-content;
    min-width: 240px;
    max-width: min(340px, calc(100vw - 24px));
    white-space: normal;
}

/* On the Housing landing row it matches the other tabs' Availability panels (360px). */
.when[data-when-landing] .wanted-availability-panel {
    width: 360px;
    max-width: calc(100vw - 24px);
}

/* The rows scroll, not the panel, so the buttons stay in reach. */
.filter-panel.wanted-availability-panel {
    max-height: none;
    overflow: visible;
}

/* A long list of terms scrolls, with the buttons always in reach. */
.wanted-availability-panel .when-body {
    max-height: min(60vh, 440px);
    margin: 0 -6px;
    padding: 0 6px 2px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
}

/* A light line between the rows, on every page. */
.wanted-availability-panel .availability-section + .availability-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.wanted-availability-panel [data-when-terms] .availability-option { font-size: .8rem; }

.wanted-availability-panel .availability-date-row select {
    flex: 0 1 128px;
    box-sizing: border-box;
    min-width: 0;
    margin: 0;
    padding: 3px 22px 3px 6px;
    border: 1px solid #c9c9c9;
    border-radius: 6px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%23333' stroke-width='1.4'%3E%3Cpath d='m1 1 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 7px center;
    color: #111;
    font: inherit;
    font-size: .8rem;
    line-height: 1.3;
    text-overflow: ellipsis;
    cursor: pointer;
    appearance: none;
}

.wanted-availability-panel .availability-date-row select:focus-visible {
    outline: 2px solid #005698;
    outline-offset: 2px;
}

.wanted-availability-panel .when-slider .price-range-chart__range {
    touch-action: none;
}

.when .wanted-availability-panel .panel-actions {
    margin-top: 12px;
}

/* Landing page: the pill fills its segment of the search row. */
.category-search-segment .when {
    position: static;
}

.category-search-segment .when.has-value .when-trigger {
    color: #0062cc;
}

.category-search-segment .wanted-availability-panel .when-body {
    max-height: none;
    overflow: visible;
}

@media (max-width: 1200px) {
    /* Stacked: the panel opens inside the segment, below the pill. */
    .category-search-segment .when {
        position: relative;
    }

    .category-search-segment .when .wanted-availability-panel {
        width: 100%;
        max-width: none;
        max-height: none;
    }
}

@media (pointer: coarse) {
    .wanted-availability-panel .availability-option {
        padding-block: 6px;
    }
}

@media (max-width: 500px) {
    /* 16px keeps iOS from zooming the page in on focus. */
    .wanted-availability-panel .availability-date-row select {
        font-size: 16px;
    }
}

/* Where results that only partly fit begin: a section like Related results (.broad-housing-fallback),
   its title and subtitle from .broad-housing-fallback__header in new-listings.css. */
.when-close-heading.broad-housing-fallback__header {
    grid-column: 1 / -1;
    box-sizing: border-box;
    width: 100%;
    margin: 15px 0 4px;
    /* The line runs the full width; the words sit in by 10px, as Related results' do. */
    padding: 5px 0 0 10px;
    border-top: 1px solid #cbcbcb;
}
