/* MarketNest RTL overrides — scoped to html[dir=rtl] only (LTR unaffected). */

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

html[dir="rtl"] {
    overflow-x: clip;
}

html[dir="rtl"] .mn-lang-switch__select {
    text-align: right;
}

/* Header search / nav spacing stays flexible via flex; mirror ml-auto */
html[dir="rtl"] header .ml-auto {
    margin-left: 0;
    margin-right: auto;
}

html[dir="rtl"] .mn-rtl-flip {
    transform: scaleX(-1);
}

/* Product carousels: keep horizontal scroll; natural RTL scrolling */
html[dir="rtl"] .mn-product-row,
html[dir="rtl"] .mn-category-row,
html[dir="rtl"] [data-product-carousel],
html[dir="rtl"] .mn-home .overflow-x-auto {
    direction: rtl;
}

html[dir="rtl"] .mn-banner__content {
    text-align: start;
}

/* Prevent English punctuation flipping (leading ".") inside RTL hero/promo overlays */
html[dir="rtl"] .mn-hero__eyebrow,
html[dir="rtl"] .mn-hero__title,
html[dir="rtl"] .mn-hero__text,
html[dir="rtl"] .mn-hero__cta,
html[dir="rtl"] .mn-promo-tile__title,
html[dir="rtl"] .mn-promo-tile__text,
html[dir="rtl"] .mn-promo-tile__cta,
html[dir="rtl"] .mn-banner__title,
html[dir="rtl"] .mn-banner__text,
html[dir="rtl"] .mn-banner__cta {
    unicode-bidi: plaintext;
    text-align: start;
}

html[dir="rtl"] .mn-promo-tile__cta,
html[dir="rtl"] .mn-hero__cta {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

html[dir="rtl"] .mn-banner__overlay {
    background: linear-gradient(
        260deg,
        rgba(0, 35, 80, 0.82) 0%,
        rgba(0, 40, 90, 0.5) 48%,
        rgba(0, 40, 90, 0.2) 100%
    );
}

/* Forms */
html[dir="rtl"] form input,
html[dir="rtl"] form textarea,
html[dir="rtl"] form select {
    text-align: start;
}

html[dir="rtl"] .text-left {
    text-align: right;
}

html[dir="rtl"] .text-right {
    text-align: left;
}

/* List padding mirrors for FAQ / agreement bullets */
html[dir="rtl"] .list-disc.pl-5,
html[dir="rtl"] ul.pl-5 {
    padding-left: 0;
    padding-right: 1.25rem;
}

html[dir="rtl"] .space-x-2 > :not([hidden]) ~ :not([hidden]),
html[dir="rtl"] .space-x-3 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 1;
}

/* Longer translated buttons — avoid overflow/clip on cards */
html[dir="rtl"] button,
html[dir="rtl"] .mn-product-card button,
html[dir="ltr"] .mn-product-card button {
    white-space: normal;
    min-width: 0;
}

.mn-lang-switch {
    display: inline-flex;
    align-items: center;
}

.mn-lang-switch__select {
    appearance: none;
    -webkit-appearance: none;
    max-width: 9.5rem;
    min-height: 2.25rem;
    padding: 0.35rem 1.75rem 0.35rem 0.65rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background-color: rgba(255, 255, 255, 0.12);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.55rem center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
}

.mn-lang-switch__select option {
    color: #151514;
    background: #fff;
}

.mn-lang-switch--compact .mn-lang-switch__select {
    max-width: 7.5rem;
    min-height: 2rem;
    font-size: 0.6875rem;
    padding-inline: 0.5rem 1.5rem;
}

/* Light surfaces (mobile drawer / account menus) */
.mn-lang-switch--on-light .mn-lang-switch__select {
    border-color: #D9E6FF;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230154e2' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    color: #151514;
}

html[dir="rtl"] .mn-lang-switch__select {
    background-position: left 0.55rem center;
    padding: 0.35rem 0.65rem 0.35rem 1.75rem;
}

/* Seller dashboard drawer opens from the right in RTL */
html[dir="rtl"] .seller-dashboard-drawer {
    left: auto;
    right: 0;
    box-shadow: -20px 0 40px rgba(1, 84, 226, 0.08);
    transform: translateX(100%);
    border-radius: 24px 0 0 24px;
}

html[dir="rtl"] body.seller-dashboard-drawer-open .seller-dashboard-drawer {
    transform: translateX(0);
}

html[dir="rtl"] .seller-drawer-link > span:not([data-seller-badge]) {
    text-align: start;
}

/* Directional chevrons / carousel controls */
html[dir="rtl"] .mn-rtl-flip,
html[dir="rtl"] [data-carousel-prev] svg,
html[dir="rtl"] [data-carousel-next] svg {
    transform: scaleX(-1);
}

/*
 * Hero slider: keep track scroll mechanics LTR so each slide’s own title/CTA
 * advances correctly. Body dir=rtl otherwise reverses flex order and breaks
 * scrollLeft indexing (all slides appear to show the same copy).
 */
html[dir="rtl"] .mn-hero__viewport,
html[dir="rtl"] .mn-hero__track {
    direction: ltr;
}

html[dir="rtl"] .mn-hero__content {
    direction: rtl;
    text-align: right;
    margin-inline-start: 0;
    margin-inline-end: auto;
}

html[dir="rtl"] .mn-hero__overlay {
    background: linear-gradient(
        270deg,
        rgba(0, 40, 90, 0.8) 0%,
        rgba(0, 40, 90, 0.4) 50%,
        rgba(0, 40, 90, 0.1) 100%
    );
}

html[dir="rtl"] .mn-hero__nav--prev {
    left: auto;
    right: 0.65rem;
}

html[dir="rtl"] .mn-hero__nav--next {
    right: auto;
    left: 0.65rem;
}

html[dir="rtl"] .mn-hero__nav svg {
    transform: scaleX(-1);
}

/* Footer columns: avoid overflow from long translated labels */
html[dir="rtl"] footer a,
html[dir="rtl"] footer p,
html[dir="rtl"] footer li {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Product cards: prevent long Urdu/Arabic CTA overflow */
html[dir="rtl"] .mn-product-card,
html[dir="ltr"] .mn-product-card {
    min-width: 0;
}

.mn-product-card__btn,
button[type="submit"] {
    white-space: normal;
    line-height: 1.25;
}

/* Legal / FAQ prose */
html[dir="rtl"] .container-custom h1,
html[dir="rtl"] .container-custom h2,
html[dir="rtl"] .container-custom p {
    text-align: start;
}

/* Mobile: prevent page-level horizontal scroll from translated UI */
@media (max-width: 768px) {
    html[dir="rtl"] body,
    html[dir="ltr"] body {
        overflow-x: clip;
    }

    html[dir="rtl"] .mn-product-card,
    html[dir="ltr"] .mn-product-card {
        max-width: 100%;
    }

    html[dir="rtl"] .mn-lang-switch__select {
        max-width: 6.75rem;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
