/* room77 right-to-left overrides (spec 2026-11-23 room77/hotelguides locale+currency, Rev 2 R4, §7).
   Hand-written, no generator. Linked only on RTL pages (`<html lang="ar-SA" dir="rtl">`, i.e. when
   `is_rtl()`), after the legacy stylesheets (main, head, list, list-head, hotel, hotel-head, dates,
   calendar, rslider). Those are byte-parity ports written in physical properties and are never
   edited, so this file overrides them. Every rule is scoped under [dir="rtl"], which also out-ranks
   the legacy single-class selectors.
   Convention: new declarations use logical properties only. Where a legacy physical declaration must
   be cancelled, the cancel uses the same physical property and carries `rtl-allow: <reason>` on that
   declaration. LTR islands (`direction: ltr`) are also marked rtl-allow with the reason.
   Logos are never mirrored. Flex rows (footer nav, copyright row, modal head, card header, chart
   title) mirror on their own and need no rule. room77 has no pagination markup (list pages load
   more results by script), so there is nothing to override for it. */

/* Base: the legacy body is `text-align: left`. */
[dir="rtl"] body {
  text-align: start;
}

[dir="rtl"] .tiny-text {
  margin-left: 0; /* rtl-allow: cancels legacy margin-left */
  margin-inline-start: 1px;
}

/* Footer */
[dir="rtl"] .footer__phone {
  /* Phone numbers stay LTR inside RTL text. */
  unicode-bidi: isolate;
  direction: ltr; /* rtl-allow: LTR island, phone number digits */
  margin-left: 0; /* rtl-allow: cancels legacy margin-left */
  /* This element is direction:ltr, so its inline end is the physical side facing the RTL label. */
  margin-inline-end: 0.25rem;
}

@media (min-width: 768px) {
  [dir="rtl"] .slogan {
    text-align: end;
  }
}

/* Phone numbers and prices: isolate so digits, "+", "$" and separators do not reorder. */
[dir="rtl"] .phone__number,
[dir="rtl"] .room-option__rate-price,
[dir="rtl"] .room-option__total-price,
[dir="rtl"] .list-item___total {
  unicode-bidi: isolate;
  direction: ltr; /* rtl-allow: LTR island, phone number / amount */
}

/* These hold a translated sentence around the amount ("Starting at {price} per night"), so forcing
   LTR would scramble the Arabic word order. plaintext isolates and takes the direction from the
   content: RTL for the Arabic sentence, LTR for the script-filled "$89 night" form. */
[dir="rtl"] a.list-item__price,
[dir="rtl"] .nearby-hotel__starting {
  unicode-bidi: plaintext;
}

/* Search form / list-dates (list-head, hotel-head, dates) */
[dir="rtl"] .dates__form-group {
  border-right: 0; /* rtl-allow: cancels legacy border-right */
  border-inline-end: 1px solid var(--light-gray);
}

[dir="rtl"] .dates__form-input,
[dir="rtl"] .dates__form-select {
  background-position: center left; /* rtl-allow: background-position has no logical keyword; mirrors legacy "center right" */
}

[dir="rtl"] .dates__form-select,
[dir="rtl"] .dropdown__item {
  text-align: start;
}

[dir="rtl"] .dates__form-select::after {
  margin-left: 0; /* rtl-allow: cancels legacy margin-left */
  margin-inline-start: 1.255em;
}

[dir="rtl"] .dates__processing-message {
  padding-left: 0; /* rtl-allow: cancels legacy padding-left */
  padding-inline-start: 4rem;
}

[dir="rtl"] .dropdown {
  margin-left: 0; /* rtl-allow: cancels legacy margin-left */
  margin-inline-start: -0.75rem;
}

@media (min-width: 768px) {
  [dir="rtl"] .dates-summary__quantities::before {
    padding-right: 0; /* rtl-allow: cancels legacy padding-right */
    padding-inline-end: 0.5rem;
  }
}

/* hotel-head only: the hotel page's date bar (it follows .hotel-graphics; list pages nest it in .left). */
@media (min-width: 960px) {
  [dir="rtl"] .hotel-graphics ~ .dates .dates__form-group {
    margin-left: 0; /* rtl-allow: cancels legacy margin shorthand's left value */
    margin-inline-start: 1.5rem;
    padding-right: 0; /* rtl-allow: cancels legacy padding shorthand's right value */
    padding-inline-end: 1.5rem;
  }
}

/* Calendar (Pikaday): documented LTR island. Its script positions it with style.left from the
   trigger's left edge and lays out week rows itself. */
[dir="rtl"] .check-in-calendar-container,
[dir="rtl"] .check-out-calendar-container,
[dir="rtl"] .check-in-picker-container,
[dir="rtl"] .check-out-picker-container,
[dir="rtl"] .pika-single {
  direction: ltr; /* rtl-allow: LTR island, Pikaday calendar positions and lays out in physical pixels */
}

/* Listing cards (list-item-card, city-listing-card, list-item-template) */
[dir="rtl"] .list-item__sub-header {
  padding-right: 0; /* rtl-allow: cancels legacy padding-right */
  padding-inline-end: 4px;
}

[dir="rtl"] .list-item__info {
  margin-left: 0; /* rtl-allow: cancels legacy margin-left */
  margin-inline-start: 12px;
}

[dir="rtl"] .list-item__pricing,
[dir="rtl"] a.list-item__price {
  text-align: end;
}

/* Photo galleries (listing card carousel, hotel page carousel): documented LTR islands. list.js and
   hotel.js page them with scrollTo({ left: n * width }) from 0, which an RTL scroller (0 to
   negative) clamps to the first photo. Inside the island the ‹ › / < > glyphs, which are
   Bidi_Mirrored text, render unmirrored and still point the way the track moves, so no scaleX. */
[dir="rtl"] .list-item__carousel-wrapper,
[dir="rtl"] .carousel-container {
  direction: ltr; /* rtl-allow: LTR island, carousel script scrolls with positive scrollLeft */
}

/* List sidebar filters (list-sidebar-filters, suggestions) */
[dir="rtl"] .suggestion__filter-summary {
  padding-left: 0; /* rtl-allow: cancels legacy padding-left */
  padding-inline-start: 5px;
}

[dir="rtl"] .suggestion-icon,
[dir="rtl"] .suggestion-img {
  margin-right: 0; /* rtl-allow: cancels legacy margin-right */
  margin-inline-end: 12px;
}

[dir="rtl"] .suggestion-sort,
[dir="rtl"] .suggestion-see-all,
[dir="rtl"] .suggestion-apply {
  margin-left: 0; /* rtl-allow: cancels legacy margin-left */
  margin-inline-start: 8px;
}

/* Price chart + slider: documented LTR island. rslider.js places pointers with style.left from
   pageX, and the histogram bars must line up under it, low price to high. */
[dir="rtl"] .rs-container,
[dir="rtl"] .slider,
[dir="rtl"] .chart-all,
[dir="rtl"] .chart-filtered {
  direction: ltr; /* rtl-allow: LTR island, rslider and its histogram run low to high in physical pixels */
}

/* The sidebar is an in-flow sticky flex item beside `.left` (list-head.scss, 960px+), so the flex
   row puts it at the inline end on its own and only the list's gutter moves. It needs no inset:
   the old fixed-position mirror (`inset-inline-end: calc(50% + 252px)`, i.e. `left` in RTL) made
   the sticky sidebar slide right over the hotel list. */
@media (min-width: 960px) {
  [dir="rtl"] .left {
    padding-right: 0; /* rtl-allow: cancels legacy padding-right */
    padding-inline-end: 2rem;
  }
}

@media (min-width: 1200px) {
  [dir="rtl"] .left {
    padding-inline-end: 0;
  }
}

/* Modals. .modal__container is full-width and .total-rate-info-modal is centred, so only the
   close buttons and the info-modal padding move. */
[dir="rtl"] .total-rate-info-modal__close,
[dir="rtl"] .info-modal__close {
  right: auto; /* rtl-allow: cancels legacy right */
  inset-inline-end: 10px;
}

[dir="rtl"] .info-modal__title {
  padding-right: 0; /* rtl-allow: cancels legacy padding-right */
  padding-inline-end: 1.5rem;
}

[dir="rtl"] .info-modal__list {
  padding-left: 0; /* rtl-allow: cancels legacy padding-left */
  padding-inline-start: 1.25rem;
}

/* Hotel page details */
[dir="rtl"] .hotel-map__button,
[dir="rtl"] .room-rates__tab {
  right: auto; /* rtl-allow: cancels legacy right */
  inset-inline-end: 0;
}

[dir="rtl"] .room-header__icon,
[dir="rtl"] .room-option__amenity-icon,
[dir="rtl"] .hotel-location__phone-icon {
  margin-right: 0; /* rtl-allow: cancels legacy margin-right */
}

[dir="rtl"] .room-header__icon {
  margin-inline-end: 0.2rem;
}

[dir="rtl"] .room-option__amenity-icon {
  margin-inline-end: 0.25rem;
}

[dir="rtl"] .hotel-location__phone-icon {
  margin-inline-end: 0.375rem;
}

[dir="rtl"] .room__amenity,
[dir="rtl"] .hotel-amenities__item {
  background-position: top right; /* rtl-allow: background-position has no logical keyword; mirrors legacy "top left" */
  padding-left: 0; /* rtl-allow: cancels legacy padding-left */
}

[dir="rtl"] .room__amenity {
  padding-inline-start: 1rem;
}

[dir="rtl"] .hotel-amenities__item {
  padding-inline-start: 2rem;
}

@media (min-width: 768px) {
  [dir="rtl"] .hotel-location__address {
    text-align: end;
  }
}
