/* Map of the hotels of the list page (list.php), the same map as the one of the stay search (stay.css): a big map that stays on the screen while the list scrolls,
   one price pin per hotel of the page. The filters stay in their column on the right, so the map only goes beside the list on a wide screen. */
.container.hlm-wide { max-width: 1760px; }
.hotel-results-container { min-width: 0; } /* a flex item is never narrower than its content unless told: without this the cards pushed the whole page wider than the screen */
.hlm-head { flex-wrap: wrap; gap: 8px; }
.hlm-head button { white-space: nowrap; }
.hlm-split { display: flex; gap: 24px; align-items: flex-start; }
.hlm-split__list { flex: 1 1 0; min-width: 0; }
.hlm-split__scroll { min-width: 0; }
.hlm-split__map { flex: 0 0 40%; max-width: 40%; position: sticky; top: calc(var(--hlm-top, 80px) + 12px); height: var(--hlm-h, calc(100dvh - var(--hlm-top, 80px) - 24px)); min-height: 0; } /* --hlm-top (list-map.js) is the height of whatever is pinned to the top of the screen (the site header); --hlm-h is what is left of the screen under the column's real place, so the map is never taller than the screen */
.hlm-split__map:has(.hlm-mapbox[hidden]) { display: none; } /* no hotel of the page has a position: no map */

/* wide screen: the column is as tall as the map under the header, the title and sort buttons stay on top of it and only the cards scroll (the page itself stays still while a pin of the map brings its hotel into view) */
@media (min-width: 1280px) {
    .hlm-split__list { display: flex; flex-direction: column; position: sticky; top: calc(var(--hlm-top, 80px) + 12px); height: var(--hlm-h, calc(100dvh - var(--hlm-top, 80px) - 24px)); }
    .hlm-split__list > .hlm-head { flex: none; }
    .hlm-split__scroll { flex: 1 1 0; min-height: 0; overflow-y: auto; padding-inline-end: 8px; scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
}

/* the filters are taller than the screen (list-map.js sets .hlm-flow and --hlm-side-h): the page is as tall as the filters, so the list box is too: it starts where the filters
   start and ends where they end instead of stopping at the bottom of the screen. It still scrolls inside itself, only when the mouse is over it. */
@media (min-width: 1280px) {
    .hlm-split.hlm-flow .hlm-split__list { position: static; height: var(--hlm-side-h); }
}

.hlm-mapbox { isolation: isolate; /* Leaflet's own layers have z-index 400-1000: kept inside the box, the map goes under the site header when the page scrolls, not over it */ background: #fff; border: 1px solid var(--ds-border, #e1e7ef); border-radius: 14px; overflow: hidden; box-shadow: 0 4px 18px rgba(0,0,0,.1); height: 100%; max-height: 100%; display: flex; flex-direction: column; }
.hlm-mapbox[hidden] { display: none; }
.hlm-mapbox__head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-weight: 700; font-size: 14px; color: var(--ds-text, #101828); }
.hlm-mapbox__head small { font-weight: 500; color: var(--ds-muted, #596579); }
.hlm-mapbox__head button { display: none; border: 1px solid var(--ds-border, #e1e7ef); background: #fff; border-radius: 8px; padding: 4px 12px; font: inherit; font-size: 12px; color: var(--ds-secondary, #14365c); cursor: pointer; }
#hlmMapView { flex: 1 1 0; width: 100%; min-height: 0; }
#hlmMapView[hidden] { display: none; }
.hlm-mapbox__note { padding: 6px 14px; font-size: 11px; color: #9ca3af; border-top: 1px solid var(--ds-surface-2, #eef2f7); }

/* narrower screens: the map goes above the list and scrolls with the page (it can be hidden) */
@media (max-width: 1279px) {
    .hlm-split { flex-direction: column; align-items: stretch; }
    .hlm-split__list { flex: none; width: 100%; max-width: 100%; }
    .hlm-split__map { position: static; flex: none; max-width: none; width: 100%; height: auto; min-height: 0; order: -1; }
    .hlm-mapbox { height: auto; }
    #hlmMapView { height: 280px; flex: none; }
    .hlm-mapbox__head button { display: inline-block; }
}
/* the cashback box of a card: small, only as wide as its content (it was as wide as the price box, with the number as big as a price).
   It stands before the rules below so the one-row layout of a narrow card beside the map still applies. */
.hotel-card .ds-cashback { width: fit-content; min-width: 7.5rem; margin-left: auto; margin-right: auto; padding: 5px 10px 2px; border-radius: 8px; }
.hotel-card .ds-cashback img { width: 16px; height: 16px; }
.hotel-card .hotel-card__cashback { font-size: .875rem; line-height: 1.25rem; }

/* beside the map the list has less room. The cards stay sideways (photo on the right, a narrow one: stretched over the whole width it was
   a 3:1 or 4:1 strip); below 1760px a card narrower than 700px also puts the price box under the name, as one wide strip, and the button under it */
@media (min-width: 1280px) and (max-width: 1759px) {
    .hlm-split__list .hotel-card__imgwrap { width: 14rem; }
    @container hotelcard (max-width: 700px) {
        .hotel-card__head { flex-direction: column; align-items: stretch; gap: 4px; }
        .hotel-card__head > div:first-child { flex: none; }
        .hotel-card__price { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: 8px; row-gap: 10px; }
        .hotel-card__price > * { margin-top: 0 !important; }
        .hotel-card__price > .ds-cashback { flex-direction: row; margin-inline-start: 8px; padding-top: 6px; padding-bottom: 4px; }
        .hotel-card__inner .btn-select { flex: 1; margin-top: 0 !important; padding-top: 12px !important; padding-bottom: 12px !important; }
        .hotel-card__inner div:has(> .btn-select) { flex: 1; gap: 0; } /* the browser leaves an empty link beside it (a link inside the card's link) */
    }
}
@media (min-width: 1760px) {
    .hlm-split__list .hotel-card__imgwrap { width: 14rem; }
}

.hlm-pin span { display: inline-block; transform: translate(-50%, -50%); background: #fff; border: 2px solid var(--ds-secondary, #14365c); color: var(--ds-text, #101828); border-radius: 999px; padding: 2px 9px; font: 700 12px "IRANYekanXFaNum", "IRANYekan", sans-serif; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.hlm-pin.is-hot { z-index: 1000 !important; }
.hlm-pin.is-hot span { background: var(--ds-primary, #00ab6c); border-color: var(--ds-primary, #00ab6c); color: #fff; }
.hlm-pop a { font-weight: 700; color: var(--ds-secondary, #14365c); text-decoration: none; }
.hlm-pop div { font-size: 12px; color: var(--ds-muted, #596579); margin-top: 4px; }

/* the card of the pin the mouse is on (map -> list) */
.hotel-card.is-lit { border-color: var(--ds-primary, #00ab6c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-primary, #00ab6c) 35%, transparent), 0 20px 40px -10px rgba(0,0,0,.2); }

/* infinite scroll (list-more.js): the line under the cards while the next page loads, and the retry button when it failed */
.hlm-more { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px 0 6px; font-size: 13px; color: var(--ds-muted, #596579); }
.hlm-more[hidden], .hlm-more [hidden] { display: none; }
.hlm-more__spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ds-primary, #00ab6c); border-top-color: transparent; animation: hlm-more-spin .9s linear infinite; }
.hlm-more.is-failed .hlm-more__spin { display: none; }
.hlm-more.is-failed { color: #dc2626; }
.hlm-more button { border: 1px solid var(--ds-border, #e1e7ef); background: #fff; border-radius: 8px; padding: 4px 14px; font: inherit; font-size: 12px; color: var(--ds-secondary, #14365c); cursor: pointer; }
@keyframes hlm-more-spin { to { transform: rotate(360deg); } }

/* the card of the hotels list: the price box (price + cashback) is as wide as its big numbers, so in a narrow card (tablet, or the list beside the map)
   it took most of the row and the name / address were squeezed to nothing (before: pushed the price out of the card). The card is a size container;
   when it is narrow the price box gets smaller type. (list.php: .hotel-card__price / __amount / __cashback; the info column has min-w-0) */
.hotel-card__inner { container-type: inline-size; container-name: hotelcard; }
@container hotelcard (max-width: 780px) {
    .hotel-card__price { padding-left: .5rem; padding-right: .5rem; }
    .hotel-card__amount { font-size: 1.4rem; line-height: 1.8rem; }
    .hotel-card__cashback { font-size: 1rem; }
}
@container hotelcard (max-width: 600px) {
    .hotel-card__amount { font-size: 1.2rem; line-height: 1.6rem; }
    .hotel-card__cashback { font-size: .9rem; }
}

/* from a tablet up the card is at least 15rem tall and grows with its content: at a fixed height a price box with a discount (and the total of
   several nights, the cashback) pushed the select-room button out of the card. The photo stretches with it. */
@media (min-width: 768px) {
    .hotel-card__inner { height: auto; min-height: 15rem; }
    .hotel-card__inner .hotel-card__imgwrap { height: auto; align-self: stretch; }
}

/* phone: the card is one column, so the name and the address have the whole width and are written in full (the description stays on one line, cut with … as on a big screen) (they were cut with … to a few letters
   because the price box stood beside them); the price box goes under them and the card is as tall as its content (it was a fixed 410px) */
@media (max-width: 767px) {
    .hotel-card__inner { height: auto; }
    .hotel-card__head { flex-direction: column; align-items: stretch; gap: 8px; }
    .hotel-card__title { display: block; overflow: visible; -webkit-line-clamp: unset; line-clamp: unset; white-space: normal; }
    .hotel-card__addr { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; max-width: none !important; }
    .hotel-card__price { width: 100%; }
    .hotel-card__inner .btn-select { flex: 1; } /* the reserve button takes the whole width of the card */
    .hotel-card__inner div:has(> .btn-select) { gap: 0; } /* the browser leaves an empty link beside it (a link inside the card's link), so the gap would shorten the button */
}
