/* RTL Support for Arabic Language */
/* Add this file to your public/assets/css folder */

/* RTL Base Styles */
html[dir="rtl"] {
    direction: rtl;
    text-align: right;
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

html[dir="rtl"] body {
    text-align: right;
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

/* RTL Font Support - Using Cairo for Arabic */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@200;300;400;500;600;700;800;900&display=swap');

html[dir="rtl"] body,
html[dir="rtl"] * {
    font-family: 'Cairo', 'Jost', sans-serif;
}

/* Flexbox Direction Flip */
html[dir="rtl"] .d-flex:not(.flex-column):not(.flex-row-reverse) {
    flex-direction: row;
}

.header-tools__item {
    margin-right: 1rem;
}

html[dir="rtl"] .flex-row {
    flex-direction: row-reverse !important;
}

/* Keep some flex items in normal order */
html[dir="rtl"] .navigation__list,
html[dir="rtl"] .social-links,
html[dir="rtl"] .reviews-group,
html[dir="rtl"] .qty-control,
html[dir="rtl"] .product-card__price,
html[dir="rtl"] .product-card__review {
    flex-direction: row !important;
}

/* Header RTL Adjustments */
/* Header RTL Adjustments - Fix Alignment */
html[dir="rtl"] .header-desk_type_1 {
    /* flex-direction: row-reverse;  <-- REMOVED: This was causing double-reverse */
    width: 100%;
}


html[dir="rtl"] .header-desk {
    padding-left: 0;
    padding-right: 0;
}

html[dir="rtl"] .logo {
    margin-right: 0;
    margin-left: auto;
    /* Push logo to the Right edge if needed */
}

/* Ensure Logo stays on Right and Tools on Left naturally with RTL */
html[dir="rtl"] .header__logo {
    margin-right: 0;
    margin-left: 2rem;
    /* Give some space from menu */
}

html[dir="rtl"] .navigation__list {
    flex-direction: row !important;
    padding-right: 0;
    width: auto !important;
    /* Allow shrink */
}

html[dir="rtl"] .header-desk_type_1 .container {
    display: flex;
    justify-content: flex-start !important;
    /* Start from Right */
    align-items: center;
}

/* Push Tools to the Far Left */
html[dir="rtl"] .header-tools {
    margin-right: auto !important;
    margin-left: 0 !important;
    display: flex !important;
    flex-shrink: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

html[dir="rtl"] .header-tools__item,
html[dir="rtl"] .header-tools .hover-container {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}
html[dir="rtl"] .header-tools .hover-container { display: flex !important; }

/* إظهار أيقونتي السيرش والكارت في النافبار (ديسكتوب) */
html[dir="rtl"] .header-desk_type_1 .header-tools .js-hover__open,
html[dir="rtl"] .header-desk_type_1 .header-tools .search-field__actor,
html[dir="rtl"] .header-desk_type_1 .header-tools .search-field__actor svg,
html[dir="rtl"] .header-desk_type_1 .header-tools__cart,
html[dir="rtl"] .header-desk_type_1 .header-tools__cart svg {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}
html[dir="rtl"] .header-desk_type_1 .header-tools .search-field__actor svg,
html[dir="rtl"] .header-desk_type_1 .header-tools__cart svg {
    display: block !important;
}

/* Improve Header Stability */
html[dir="rtl"] header.header {
    width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    transition: none !important;
}

/* Prevent layout shift */
html[dir="rtl"] .header_sticky {
    transform: none !important;
}

/* Logo Spacing */
html[dir="rtl"] .logo {
    margin-left: 3rem !important;
    /* Space between Logo and Menu */
    margin-right: 0 !important;
}

/* Position Adjustments */
html[dir="rtl"] .start-0 {
    left: auto !important;
    right: 0 !important;
}

html[dir="rtl"] .end-0 {
    right: auto !important;
    left: 0 !important;
}

html[dir="rtl"] .start-50 {
    left: auto !important;
    right: 50% !important;
}

html[dir="rtl"] .translate-middle {
    transform: translate(50%, -50%) !important;
}

html[dir="rtl"] .translate-middle-y {
    transform: translateY(-50%) !important;
}

/* Margins & Paddings */
html[dir="rtl"] .ms-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
}

html[dir="rtl"] .me-auto {
    margin-right: 0 !important;
    margin-left: auto !important;
}

html[dir="rtl"] .ms-1 {
    margin-left: 0 !important;
    margin-right: 0.25rem !important;
}

html[dir="rtl"] .ms-2 {
    margin-left: 0 !important;
    margin-right: 0.5rem !important;
}

html[dir="rtl"] .ms-3 {
    margin-left: 0 !important;
    margin-right: 1rem !important;
}

html[dir="rtl"] .me-1 {
    margin-right: 0 !important;
    margin-left: 0.25rem !important;
}

html[dir="rtl"] .me-2 {
    margin-right: 0 !important;
    margin-left: 0.5rem !important;
}

html[dir="rtl"] .me-3 {
    margin-right: 0 !important;
    margin-left: 1rem !important;
}

html[dir="rtl"] .ps-0 {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

html[dir="rtl"] .pe-0 {
    padding-right: 0 !important;
    padding-left: 0 !important;
}

/* Text Alignment */
html[dir="rtl"] .text-start {
    text-align: right !important;
}

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

/* Slideshow RTL */
/* Slideshow RTL */
html[dir="rtl"] .slideshow-character {
    right: auto;
    left: 0;
}

/* Mirror the character position from right to left in RTL */
html[dir="rtl"] .pos_right-center {
    right: auto !important;
    left: 8% !important;
    transform: none !important;
}

@media (min-width: 992px) {
    html[dir="rtl"] .pos_right-center {
        right: auto !important;
        left: 8% !important;
    }
}

/* Header Sticky RTL Fix - Stabilize layout */
html[dir="rtl"] .header_sticky-active {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100% !important;
    z-index: 1000;
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

html[dir="rtl"] .slideshow-social-follow {
    left: auto;
    right: 0;
}

html[dir="rtl"] .slideshow-scroll {
    right: auto;
    left: 0;
}

html[dir="rtl"] .text_dash::before {
    left: 100%;
    right: auto;
    margin-right: 0.5rem;
}

html[dir="rtl"] .text_dash {
    padding-left: 0;
    padding-right: 3.25rem;
}

/* Header Sticky RTL Fix - prevent size changes on scroll */
html[dir="rtl"] .header_sticky,
html[dir="rtl"] .header_sticky-active {
    width: 100%;
}

html[dir="rtl"] .header.position-absolute {
    width: 100%;
}

/* Content Absolute Positioning */
html[dir="rtl"] .content_left,
html[dir="rtl"] .content_left-md,
html[dir="rtl"] .content_left-lg {
    left: auto !important;
    right: 30px !important;
    text-align: right;
}

/* Product Cards RTL */
html[dir="rtl"] .product-card {
    text-align: right;
}

html[dir="rtl"] .pc__btn-wl {
    left: 0;
    right: auto;
}

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

/* Cart Drawer RTL */
html[dir="rtl"] .aside_right {
    right: auto;
    left: 0;
    transform: translateX(-100%);
}

html[dir="rtl"] .aside_right.aside_visible {
    transform: translateX(0);
}

html[dir="rtl"] .cart-drawer-item {
    flex-direction: row;
}

html[dir="rtl"] .cart-drawer-item__info {
    padding-right: 15px;
    padding-left: 0;
}

html[dir="rtl"] .btn-close-xs {
    right: auto;
    left: 0;
}

/* Navigation Mobile RTL */
html[dir="rtl"] .header-mobile .mobile-nav-activator {
    order: 2;
}

html[dir="rtl"] .header-mobile .logo {
    order: 1;
}

html[dir="rtl"] .header-mobile .header-tools__cart {
    order: 2;
}

/* Footer RTL */
html[dir="rtl"] .footer-column {
    text-align: right;
}

html[dir="rtl"] .footer-newsletter__form input[type="submit"] {
    right: auto;
    left: 0;
}

/* Form Controls RTL */
html[dir="rtl"] .form-control {
    text-align: right;
}

html[dir="rtl"] .form-select {
    background-position: left 0.75rem center;
    padding-right: 0.75rem;
    padding-left: 2.25rem;
}

/* Qty Control RTL */
html[dir="rtl"] .qty-control__reduce {
    left: auto;
    right: 0;
}

html[dir="rtl"] .qty-control__increase {
    right: auto;
    left: 0;
}

/* Collection Grid RTL */
html[dir="rtl"] .collection-grid__item .content_abs {
    text-align: right;
}

/* Deal Timer RTL */
html[dir="rtl"] .deal-timer-wrapper {
    text-align: right;
}

html[dir="rtl"] .js-countdown {
    justify-content: flex-end;
}

/* Banners RTL */
html[dir="rtl"] .grid-banner__item .content_abs {
    text-align: right;
}

/* Service Promotion RTL */
html[dir="rtl"] .service-promotion {
    text-align: center;
}

/* Button Link RTL */
html[dir="rtl"] .btn-link.default-underline::after {
    left: auto;
    right: 0;
}

/* Search Popup RTL - نفس شكل الإنجليزي */
html[dir="rtl"] .search-popup__submit {
    right: 0;
    left: auto;
}

html[dir="rtl"] .search-popup__reset {
    right: 40px;
    left: auto;
}

html[dir="rtl"] .search-field__actor i {
    right: auto;
    left: 0;
}

/* Search popup - ترتيب وعرض مثل الإنجليزي */
html[dir="rtl"] .search-popup {
    text-align: right;
    direction: rtl;
}

/* إلغاء flex على الفورم: السيرش لوحده فوق، والسيليكتات تحته (زي الإنجليزي) */
html[dir="rtl"] .search-popup form.container,
html[dir="rtl"] .search-popup .search-field.container {
    display: block !important;
}

html[dir="rtl"] .search-popup .search-field,
html[dir="rtl"] .search-popup form {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .search-popup .search-popup__input,
html[dir="rtl"] .search-popup .search-field__input {
    text-align: right !important;
    padding-right: 3rem !important;
    padding-left: 0.75rem !important;
}

html[dir="rtl"] .search-popup .search-popup__input-wrap {
    direction: rtl;
    display: block !important;
    width: 100% !important;
}

/* صف الفلاتر: نفس التوزيع الأفقي والمسافات مثل الإنجليزي — تحت السيرش */
html[dir="rtl"] .search-popup__filters.row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    margin-right: -0.25rem;
    margin-left: -0.25rem;
    margin-top: 0.75rem !important;
    width: 100%;
    gap: 0.5rem 0;
}

html[dir="rtl"] .search-popup__filters .col-6,
html[dir="rtl"] .search-popup__filters .col-md-3 {
    padding-right: 0.25rem;
    padding-left: 0.25rem;
}

html[dir="rtl"] .search-popup__filters .form-label {
    text-align: right;
    display: block;
}

html[dir="rtl"] .search-popup__filters .form-select {
    text-align: right;
    width: 100%;
}

html[dir="rtl"] .search-popup__results {
    direction: rtl;
    text-align: right;
    margin-top: 1rem;
    display: block;
    width: 100%;
}

html[dir="rtl"] .search-popup .search-result {
    left: auto;
    right: 0;
    text-align: right;
}

/* Tab Navigation RTL */
html[dir="rtl"] .nav-tabs {
    flex-direction: row;
}

html[dir="rtl"] .nav-link_underscore::after {
    left: auto;
    right: 0;
}

/* Swiper/Carousel RTL */
html[dir="rtl"] .swiper-container {
    direction: ltr;
}

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

html[dir="rtl"] .products-carousel__prev {
    right: auto;
    left: -50px;
}

html[dir="rtl"] .products-carousel__next {
    left: auto;
    right: -50px;
}

/* Modal/Sitemap RTL */
html[dir="rtl"] .sitemap__links {
    margin-left: 0;
    margin-right: auto;
}

html[dir="rtl"] .sitemap .modal-header .btn-close-lg {
    margin-left: 0;
    margin-right: auto;
}

/* Customer Forms RTL */
html[dir="rtl"] .customer-forms__wrapper {
    flex-direction: row-reverse;
}

/* Language Switcher Styles */
.language-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 15px;
    margin-right: 15px;
    padding: 5px 10px;
    background-color: #f8f8f8;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
}

.language-switcher .lang-icon {
    font-size: 16px;
    margin-right: 4px;
}

.language-switcher .lang-divider {
    color: #ccc;
    font-weight: 300;
}

.language-switcher a {
    padding: 4px 8px;
    text-decoration: none;
    color: #555;
    font-weight: 600;
    font-size: 12px;
    border-radius: 12px;
    transition: all 0.3s ease;
    border: none;
    background: transparent;
}

.language-switcher a:hover {
    color: #222;
    background-color: rgba(0, 0, 0, 0.05);
}

.language-switcher a.active {
    background-color: #222;
    color: #fff;
}

html[dir="rtl"] .language-switcher {
    flex-direction: row;
}

/* Mobile Language Switcher */
.language-switcher-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.language-switcher-mobile a {
    padding: 8px 20px;
    text-decoration: none;
    color: #222;
    font-weight: 500;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.3s ease;
    border: 1px solid #ddd;
}

.language-switcher-mobile a:hover {
    background-color: #f5f5f5;
}

.language-switcher-mobile a.active {
    background-color: #222;
    color: #fff;
    border-color: #222;
}

/* Fix for some absolute positioned elements */
html[dir="rtl"] .cart-amount {
    right: auto;
    left: -5px;
}

html[dir="rtl"] .wishlist-amount {
    right: auto;
    left: -5px;
}

/* Animation adjustments for RTL */
html[dir="rtl"] .animate_rtl {
    animation-name: fadeInLeft;
}

html[dir="rtl"] .animate_btt {
    animation-name: fadeInUp;
}

/* Border radius adjustments */
html[dir="rtl"] .rounded-start {
    border-radius: 0 0.25rem 0.25rem 0 !important;
}

html[dir="rtl"] .rounded-end {
    border-radius: 0.25rem 0 0 0.25rem !important;
}

/* Float adjustments */
html[dir="rtl"] .float-start {
    float: right !important;
}

html[dir="rtl"] .float-end {
    float: left !important;
}

/* List styles */
html[dir="rtl"] ul,
html[dir="rtl"] ol {
    padding-right: 0;
    padding-left: inherit;
}

/* Fix products grid */
html[dir="rtl"] .row {
    flex-direction: row;
}

/* Fix navigation dropdown position */
html[dir="rtl"] .navigation__item .sub-menu {
    left: auto;
    right: 0;
}

/* Mobile Navigation RTL */
html[dir="rtl"] .navigation__link.js-nav-right::after {
    left: 0;
    right: auto;
    transform: rotate(180deg);
}

/* Breadcrumb RTL */
html[dir="rtl"] .breadcrumb-item+.breadcrumb-item::before {
    float: right;
    padding-right: 0;
    padding-left: 0.5rem;
}

/* Fix for icon arrows */
html[dir="rtl"] .icon_prev_sm,
html[dir="rtl"] .icon_next_sm {
    transform: rotate(180deg);
}

html[dir="rtl"] #icon_prev_md,
html[dir="rtl"] #icon_next_md {
    transform: rotate(180deg);
}

/* =========================================
   Mobile RTL Fixes
   ========================================= */

/* 1. Mobile Header Layout */
@media (max-width: 991px) {
    html[dir="rtl"] .header-mobile .container {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        position: relative;
        /* For absolute logo positioning */
    }

    /* Force Logo to Absolute Center */
    html[dir="rtl"] .header-mobile .logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        margin: 0 !important;
        z-index: 5;
    }

    /* Burger Menu Activator - Ensure it stays on the Right (Start) */
    html[dir="rtl"] .mobile-nav-activator {
        order: -1;
        /* First visual item */
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Cart - Ensure it stays on the Left (End) */
    html[dir="rtl"] .header-tools__cart {
        order: 2;
        /* Last visual item */
        margin-right: auto !important;
        margin-left: 0 !important;
    }

    /* 2. Mobile Navigation Drawer Alignment */
    html[dir="rtl"] .header-mobile__navigation .navigation__link {
        text-align: right !important;
        justify-content: flex-start !important;
        /* Align content to Right */
        padding-right: 0 !important;
        width: 100%;
    }

    /* Force text alignment for all links inside nav */
    html[dir="rtl"] .navigation__item {
        text-align: right !important;
    }

    /* Search Input Alignment */
    html[dir="rtl"] .search-field__input {
        text-align: right !important;
        padding-right: 15px !important;
    }
}