/* RTL foundation for internal Hebrew preview. Hebrew remains hidden publicly. */

html[dir="rtl"] {
  direction: rtl;
}

html[dir="rtl"] body {
  direction: rtl;
  text-align: start;
}

html[dir="rtl"] :where(
  p,
  li,
  label,
  legend,
  summary,
  blockquote,
  figcaption,
  .card,
  .surface-card,
  .metric-card,
  .blog-card,
  .blog-article-card,
  .blog-featured__body,
  .blog-post-content,
  .recommendation-card,
  .recommendation-panel,
  .trip-card,
  .hotel-card,
  .car-card,
  .shop-card,
  .shop-product-card,
  .transport-card,
  .standalone-header,
  .standalone-main,
  .modal__dialog,
  .auth-modal,
  .trip-modal-content,
  .comments-modal-dialog
) {
  direction: rtl;
  text-align: start;
}

html[dir="rtl"] :where(
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  .blog-list-hero__title,
  .blog-post-title,
  .shop-title,
  .trip-modal-title,
  .recommendation-title
) {
  text-align: start;
  overflow-wrap: anywhere;
}

html[dir="rtl"] :where(
  input,
  textarea,
  select,
  [contenteditable="true"],
  .tiptap,
  .ProseMirror,
  .blog-post-content
) {
  direction: rtl;
  text-align: start;
  unicode-bidi: plaintext;
}

html[dir="rtl"] :where(
  input[type="email"],
  input[type="url"],
  input[type="tel"],
  input[type="number"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  input[type="range"],
  code,
  pre,
  kbd,
  samp,
  .price,
  .currency,
  .amount,
  .metric-value,
  .metric-progress-text,
  .trip-price-value,
  .shop-price,
  .shop-product-price,
  .cart-item-price,
  .checkout-total,
  .booking-price,
  .phone,
  .email,
  .sku,
  .coupon-code
) {
  direction: ltr;
  text-align: start;
  unicode-bidi: isolate;
}

html[dir="rtl"] :where(ul, ol) {
  padding-inline-start: 0;
  padding-inline-end: 1.5rem;
}

html[dir="rtl"] :where(.btn, button, .badge, .chip, .badge-pill, .blog-filter-chip, .nav-chip) {
  max-width: 100%;
}

html[dir="rtl"] :where(.btn, button) {
  unicode-bidi: plaintext;
}

html[dir="rtl"] :where(
  .btn,
  .header-link,
  .header-coupon-button,
  .blog-cta-button,
  .blog-featured__link,
  .blog-cta-card__link,
  .booking-submit
) {
  text-align: center;
}

html[dir="rtl"] :where(
  .header-top,
  .header-top-actions,
  .header-actions,
  .header-actions-primary,
  .auth-actions,
  .auth-controls,
  .auth-bar,
  .header-metrics,
  .header-tabs,
  .ce-modal-title-row,
  .blog-meta-row,
  .blog-list-hero__metrics,
  .shop-toolbar,
  .shop-check,
  .filter-item,
  .cart-item,
  .checkout-row,
  .mobile-tabbar,
  .place-badges,
  .place-badges-left,
  .modal-header-actions,
  .comments-modal-topbar,
  .modal-poi-gallery-header,
  .language-mobile-menu-header
) {
  direction: rtl;
}

html[dir="rtl"] :where(
  .brand,
  .nav-modern__brand-link,
  .language-switcher,
  .language-selector-dialog,
  .mobile-nav,
  .leaflet-control-container,
  .leaflet-control,
  .leaflet-control a,
  .leaflet-control button
) {
  direction: ltr;
}

html[dir="rtl"] .language-switcher {
  right: auto;
  left: clamp(0.75rem, 4vw, 1.9rem);
  align-items: flex-start;
}

html[dir="rtl"] :where(.language-switcher-menu, .language-mobile-menu, .language-selector-dialog) {
  text-align: left;
}

html[dir="rtl"] :where(.language-mobile-menu .language-switcher-btn) {
  direction: ltr;
}

html[dir="rtl"] :where(.modal__close, .trip-modal-close, .auth-modal__close, .comments-modal-close) {
  right: auto;
  left: 1rem;
}

html[dir="rtl"] .trip-modal-close {
  left: 16px;
}

html[dir="rtl"] :where(.modal__dialog, .trip-modal-content, .comments-modal-dialog) {
  overscroll-behavior: contain;
}

html[dir="rtl"] :where(
  .blog-card__title,
  .blog-card__summary,
  .blog-featured__title,
  .blog-featured__summary,
  .blog-post-lead,
  .recommendation-title,
  .recommendation-description,
  .shop-product-title,
  .shop-product-description,
  .trip-card-title,
  .hotel-card-title,
  .car-card-title
) {
  overflow-wrap: anywhere;
  word-break: normal;
}

html[dir="rtl"] :where(
  .blog-filter-bar,
  .blog-meta-row,
  .chip-row,
  .tag-list,
  .badges,
  .place-badges,
  .shop-filter-options,
  .recommendation-tags,
  .recommendation-meta
) {
  flex-wrap: wrap;
}

html[dir="rtl"] :where(.blog-filter-chip, .badge-pill, .chip, .nav-chip) {
  white-space: normal;
  text-align: center;
}

html[dir="rtl"] :where(.shop-layout, .blog-featured, .recommendations-layout, .transport-layout) {
  direction: rtl;
}

html[dir="rtl"] :where(.shop-main, .recommendations-main, .trips-container, .standalone-page) {
  width: 100%;
  max-width: 100vw;
  overflow-x: clip;
  box-sizing: border-box;
}

html[dir="rtl"] :where(.trips-container, .city-grid, .city-card, .city-card-overlay, .recommendations-section, .shop-container) {
  min-width: 0;
  box-sizing: border-box;
}

html[dir="rtl"] :where(.shop-grid, .blog-grid, .recommendations-grid, .trips-grid, .hotels-grid, .cars-grid) {
  direction: rtl;
}

html[dir="rtl"] :where(.trips-tabs, .filters-container) {
  direction: ltr;
  max-width: 100%;
  justify-content: flex-start;
  scroll-padding-inline: 1rem;
}

html[dir="rtl"] :where(.filters-grid) {
  direction: ltr;
}

html[dir="rtl"] :where(.trips-tab, .filter-btn, .recommendations-home-tab) {
  direction: rtl;
  flex: 0 0 auto;
  white-space: nowrap;
}

html[dir="rtl"] :where(.city-card-title, .city-card-count, .trip-bestseller-badge, .trip-media-badge) {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

html[dir="rtl"] .city-card-count {
  flex-wrap: wrap;
}

html[dir="rtl"] .product-card-price {
  direction: ltr;
  justify-content: flex-end;
  flex-wrap: wrap;
  min-width: 0;
}

html[dir="rtl"] .product-card-price :where(.current, .original) {
  white-space: nowrap;
}

html[dir="rtl"] :where(.shop-search-input, .poi-search-input, input[type="search"]) {
  direction: rtl;
  text-align: start;
}

html[dir="rtl"] .shop-price-slider,
html[dir="rtl"] .shop-price-slider__inputs,
html[dir="rtl"] .shop-price-slider__track,
html[dir="rtl"] input[type="range"] {
  direction: ltr;
}

html[dir="rtl"] :where(.map-poi-picker, .map-poi-picker__menu, .rec-map-popup, .leaflet-popup-content) {
  direction: rtl;
  text-align: start;
}

html[dir="rtl"] :where(.map-poi-picker__toggle, .map-poi-picker__option) {
  direction: rtl;
}

html[dir="rtl"] :where(.map-poi-picker__count, .map-filter-counter) {
  direction: ltr;
  unicode-bidi: isolate;
}

html[dir="rtl"] :where(.notifications-panel, .notifications-list) {
  right: auto;
  left: 0;
  direction: rtl;
  text-align: start;
}

html[dir="rtl"] :where(.carousel, .slider, .horizontal-scroll, .modal-poi-gallery-track) {
  direction: rtl;
  scroll-padding-inline: 1rem;
}

html[dir="rtl"] :where(.carousel img, .slider img, .modal-poi-gallery-track img) {
  direction: ltr;
}

html[dir="rtl"] :where(.swipe-hint, .panorama-hint, .trip-modal-panorama-hint) {
  direction: rtl;
  text-align: center;
}

html[dir="rtl"] .link::before {
  content: "←";
}

html[dir="ltr"] .link::before {
  content: "→";
}

@media (max-width: 900px) {
  html[dir="rtl"] .shop-filters {
    left: 0;
    right: auto;
    margin-left: 0;
    margin-right: auto;
    border-radius: 0 18px 18px 0;
    transform: translateX(-100%);
  }

  html[dir="rtl"] .shop-filters:not(.is-open) {
    display: none;
    visibility: hidden;
    pointer-events: none;
  }

  html[dir="rtl"] .shop-filters.is-open {
    display: block;
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }
}

@media (max-width: 768px) {
  html[dir="rtl"] :where(.trips-container, .recommendations-section, .shop-main, .standalone-main) {
    max-width: 100%;
    overflow-x: clip;
    box-sizing: border-box;
  }

  html[dir="rtl"] :where(.trips-tabs, .filters-container) {
    width: 100%;
    min-width: 0;
  }

  html[dir="rtl"] body.transport-booking-page :where(.transport-booking-main, .transport-booking-header__inner) {
    max-width: 100%;
    overflow-x: clip;
    box-sizing: border-box;
  }

  html[dir="rtl"] body.transport-booking-page .app-footer {
    width: auto;
    max-width: calc(100% - 24px);
    margin-inline: 12px;
    box-sizing: border-box;
  }

  html[dir="rtl"] :where(.modal__dialog, .trip-modal-content, .comments-modal-dialog) {
    max-width: min(100%, calc(100vw - 16px));
  }

  html[dir="rtl"] .modal__close {
    left: 1rem;
  }

  html[dir="rtl"] .trip-modal-close {
    left: 12px;
  }

  html[dir="rtl"] :where(.mobile-nav-link, .mobile-tabbar-btn) {
    min-width: 0;
  }

  html[dir="rtl"] :where(.mobile-nav-label, .mobile-tabbar-label) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
