/* ============================================================
   RTL overlay — loaded only when <html lang="ar" dir="rtl">.

   `dir="rtl"` already reverses flex row order and the default inline
   start. This file flips the physical leftovers the existing sheets
   still spell as left/right: auto-margins, absolute pins, accent
   borders, select chevrons, and directional SVG arrows.

   Do not import this into styles.css. A Polish page must never see it.
   ============================================================ */

/* ── Header / navigation ─────────────────────────────────────────────────── */

html.rtl .header-utilities {
    margin-left: 0;
    margin-right: auto;
}

html.rtl .header-search {
    padding: 0 0.4rem 0 1.1rem;
}

html.rtl .header-search-icon {
    transform: scaleX(-1);
}

html.rtl .header-cart__badge {
    right: auto;
    left: 0.05rem;
}

@media (max-width: 768px) {
    html.rtl .logo {
        margin-right: 0;
        margin-left: auto;
    }

    html.rtl .header-cart__badge {
        right: auto;
        left: -0.35rem;
    }
}

/* ── Directional icons (chevrons, back arrows) ─────────────────────────────
   Prev/next stay bound to start/end. Flipping the glyph makes the button
   on the inline-start side point toward start, which is now the right. */

html.rtl .product-rail__arrow svg,
html.rtl .photo-lightbox__nav .icon,
html.rtl .dashboard-nav-link--back .icon,
html.rtl .passport-hero-badge__arrow {
    transform: scaleX(-1);
}

/* ── Product rails (listings / home) ─────────────────────────────────────── */

html.rtl .product-rail__see-all {
    margin-right: 0;
    margin-left: 0.25rem;
}

html.rtl .product-rail__scroller {
    scroll-padding-left: 0;
    scroll-padding-right: 0.25rem;
}

html.rtl .product-rail__track::before {
    left: auto;
    right: 0;
    background: linear-gradient(to left, var(--bg-color), transparent);
}

html.rtl .product-rail__track::after {
    right: auto;
    left: 0;
    background: linear-gradient(to right, var(--bg-color), transparent);
}

html.rtl .top-rated.product-rail--scrollable .product-rail__prev {
    left: auto;
    right: -0.4rem;
}

html.rtl .top-rated.product-rail--scrollable .product-rail__next {
    right: auto;
    left: -0.4rem;
}

html.rtl .top-rated-card__rank,
html.rtl .product-rail .product-card__overlay {
    left: auto;
    right: 0.75rem;
}

html.rtl .product-rail .product-card__overlay {
    right: 0.9rem;
}

/* ── Explore facet rail ──────────────────────────────────────────────────── */

html.rtl .locate-field__input {
    padding-right: 0.75rem;
    padding-left: 2.5rem;
}

html.rtl .locate-field__btn {
    right: auto;
    left: 0.25rem;
}

html.rtl .service-point-map__query {
    padding-right: 0.75rem;
    padding-left: 2.5rem;
}

html.rtl .facet-group__count {
    margin-left: 0;
    margin-right: auto;
}

html.rtl .facet-group__summary::after {
    margin-right: 0;
    margin-left: 0.15rem;
}

@media (max-width: 900px) {
    html.rtl .facet-rail {
        left: auto;
        right: 0;
        border-right: none;
        border-left: 1px solid var(--hairline);
        transform: translateX(100%);
    }

    html.rtl .explore__sheet-state:checked ~ .explore__layout .facet-rail {
        transform: none;
    }
}

/* ── Cart ────────────────────────────────────────────────────────────────── */

html.rtl .cart-line__total {
    text-align: left;
}

/* ── File inputs (the select chevron lives in controls.css — that file
   owns the gutter, and tests/test_control_styles.py refuses any other
   sheet to reset padding-right on a select) ── */

html.rtl input[type="file"]::file-selector-button {
    margin-right: 0;
    margin-left: 0.85rem;
}

/* ── Accent bars that were drawn on the physical left ────────────────────── */

html.rtl .owner-preview {
    border-left-width: 1px;
    border-left-color: var(--hairline);
    border-right: 3px solid var(--primary-color);
}

html.rtl .legal-draft-notice {
    border-left: none;
    border-right: 3px solid var(--primary-color);
}

html.rtl .listing-badge-status__row {
    border-left: none;
    border-right: 3px solid var(--hairline);
}

html.rtl .listing-badge-status__row--badged {
    border-right-color: var(--verified-color);
}

html.rtl .listing-badge-status__row--not-badged {
    border-right-color: var(--alert-warning-text);
}

html.rtl .passport-conflict {
    border-left: none;
    border-right: 3px solid var(--primary-color);
    border-radius: 4px 0 0 4px;
}

[data-theme="high-contrast"] html.rtl .passport-conflict,
html.rtl[data-theme="high-contrast"] .passport-conflict {
    border-right-width: 4px;
}

html.rtl .quota-note--blocked {
    border-left: 1px solid var(--hairline);
    border-right: 3px solid var(--primary-color);
}

html.rtl .checkbox-hint {
    margin-left: 0;
    margin-right: 1.5rem;
}

html.rtl .edit-profile-container .subtitle {
    text-align: right;
}
