/*
 * RTL (Right-to-Left) Support for Kajireh Website
 * Comprehensive Persian/Farsi language support
 * 
 * Features:
 * - Complete RTL layout conversion
 * - Persian typography optimization
 * - RTL-compatible navigation and arrows
 * - RTL form layouts and search interfaces
 * - RTL product grids and cards
 * - Persian number formatting
 * - RTL-compatible animations
 * 
 * Version: RTL Implementation v1.0
 * Author: Kajireh Development Team
 * Date: October 2025
 */

/* RTL Root Variables */
:root[dir="rtl"] {
    /* RTL-specific spacing */
    --rtl-margin-left: var(--spacing-md);
    --rtl-margin-right: var(--spacing-md);
    --rtl-padding-left: var(--spacing-md);
    --rtl-padding-right: var(--spacing-md);
    
    /* RTL-specific colors */
    --rtl-accent: #9333ea;
    --rtl-secondary: #ec4899;
    --rtl-text: #1f2937;
    --rtl-muted: #6b7280;
}

/* Base RTL Layout */
html[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] body {
    font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
    direction: rtl;
    text-align: right;
}

/* RTL Typography */
html[dir="rtl"] {
    font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6 {
    font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
    text-align: right;
    line-height: 1.6;
}

html[dir="rtl"] p,
html[dir="rtl"] span,
html[dir="rtl"] div {
    text-align: right;
    direction: rtl;
}

/* RTL Navigation */
html[dir="rtl"] .navbar {
    direction: rtl;
}

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

html[dir="rtl"] .navbar-brand {
    margin-left: 1rem;
    margin-right: 0;
}

html[dir="rtl"] .nav-item {
    margin-left: 1rem;
    margin-right: 0;
}

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

/* RTL Dropdown Menus */
html[dir="rtl"] .dropdown-menu {
    right: 0;
    left: auto;
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] .dropdown-item {
    text-align: right;
    padding-right: 1rem;
    padding-left: 1rem;
}

/* RTL Mega Menu */
html[dir="rtl"] .mega-menu {
    right: 0;
    left: auto;
    text-align: right;
}

html[dir="rtl"] .mega-menu .mega-menu-column {
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] .mega-menu .mega-menu-column h6 {
    text-align: right;
}

html[dir="rtl"] .mega-menu .mega-menu-column ul {
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] .mega-menu .mega-menu-column li {
    text-align: right;
}

html[dir="rtl"] .mega-menu .mega-menu-column a {
    text-align: right;
    direction: rtl;
}

/* RTL Arrows and Icons */
html[dir="rtl"] .fa-arrow-right:before {
    content: "\f060"; /* fa-arrow-left */
}

html[dir="rtl"] .fa-arrow-left:before {
    content: "\f061"; /* fa-arrow-right */
}

html[dir="rtl"] .fa-chevron-right:before {
    content: "\f053"; /* fa-chevron-left */
}

html[dir="rtl"] .fa-chevron-left:before {
    content: "\f054"; /* fa-chevron-right */
}

html[dir="rtl"] .fa-angle-right:before {
    content: "\f104"; /* fa-angle-left */
}

html[dir="rtl"] .fa-angle-left:before {
    content: "\f105"; /* fa-angle-right */
}

html[dir="rtl"] .fa-chevron-circle-right:before {
    content: "\f137"; /* fa-chevron-circle-left */
}

html[dir="rtl"] .fa-chevron-circle-left:before {
    content: "\f138"; /* fa-chevron-circle-right */
}


/* RTL Promotional Banner - Centered */
html[dir="rtl"] .sephora-promo-banner {
    text-align: center;
    direction: rtl;
}

html[dir="rtl"] .sephora-promo-banner .container {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    direction: rtl;
}

/* RTL Secondary Banner - Centered */
html[dir="rtl"] .sephora-secondary-banner {
    text-align: center;
    direction: rtl;
}

html[dir="rtl"] .sephora-secondary-banner .container {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    direction: rtl;
}


/* RTL Carousel Navigation Arrows - Override general RTL flipping for carousels */
html[dir="rtl"] .product-carousel-nav .fa-chevron-left:before {
    content: "\f053"; /* fa-chevron-left - keep pointing left */
}

html[dir="rtl"] .product-carousel-nav .fa-chevron-right:before {
    content: "\f054"; /* fa-chevron-right - keep pointing right */
}

/* RTL About Page - Our Story Section Centered */
html[dir="rtl"] #our-story .text-center {
    text-align: center !important;
}

html[dir="rtl"] #our-story h2 {
    text-align: center;
}

html[dir="rtl"] #our-story p {
    text-align: center;
}

/* RTL About Page - Our Team Section Centered */
html[dir="rtl"] #our-team .text-center {
    text-align: center !important;
}

html[dir="rtl"] #our-team h2 {
    text-align: center;
}

html[dir="rtl"] #our-team p {
    text-align: center;
}

/* RTL About Page - All sections centered */
html[dir="rtl"] .container section .text-center {
    text-align: center !important;
}

html[dir="rtl"] .container section h2 {
    text-align: center;
}

html[dir="rtl"] .container section p {
    text-align: center;
}

/* RTL About Page - Complete text centering for all sections */

/* Target the actual About page structure */
html[dir="rtl"] .team-content,
html[dir="rtl"] .team-content h4,
html[dir="rtl"] .team-content p,
html[dir="rtl"] .team-content a,
html[dir="rtl"] .team-social,
html[dir="rtl"] .team-social a {
    text-align: center !important;
}

/* Target values cards */
html[dir="rtl"] .value-content,
html[dir="rtl"] .value-content h5,
html[dir="rtl"] .value-content p {
    text-align: center !important;
}

/* Target the CTA section */
html[dir="rtl"] .cta-content,
html[dir="rtl"] .cta-content h3,
html[dir="rtl"] .cta-content p,
html[dir="rtl"] .cta-buttons {
    text-align: center !important;
}

/* Additional overrides for any Bootstrap or conflicting styles */
html[dir="rtl"] .team-card .team-content,
html[dir="rtl"] .value-card .value-content,
html[dir="rtl"] .cta-section .cta-content {
    text-align: center !important;
}

/* Force center all text in About page sections */
html[dir="rtl"] #our-team *,
html[dir="rtl"] .team-card *,
html[dir="rtl"] .value-card *,
html[dir="rtl"] .cta-section * {
    text-align: center !important;
}

/* RTL Contact Page Styling */
html[dir="rtl"] .contact-page .card-header h4 {
    text-align: right;
}

html[dir="rtl"] .contact-page .card-body h6,
html[dir="rtl"] .contact-page .form-label,
html[dir="rtl"] .contact-page .btn {
    text-align: center;
}

/* RTL Contact Form */
html[dir="rtl"] .contact-page .form-control,
html[dir="rtl"] .contact-page .form-select,
html[dir="rtl"] .contact-page textarea {
    text-align: right;
    direction: rtl;
}

/* RTL Contact Information Cards */
html[dir="rtl"] .contact-page .card-body p,
html[dir="rtl"] .contact-page .text-muted {
    text-align: right;
    direction: rtl;
}

/* RTL Phone Numbers - Force LTR for numbers */
html[dir="rtl"] .contact-page .card-body p:has(br),
html[dir="rtl"] .contact-page .text-muted:has(br) {
    direction: rtl;
    text-align: right;
}

/* RTL Phone Numbers - Ensure proper line breaks */
html[dir="rtl"] .contact-page .card-body p br,
html[dir="rtl"] .contact-page .text-muted br {
    display: block;
    margin: 0.5rem 0;
}

/* Force RTL for phone numbers */
html[dir="rtl"] .contact-page .card-body p,
html[dir="rtl"] .contact-page .text-muted {
    direction: rtl !important;
    text-align: right !important;
    unicode-bidi: bidi-override;
}

/* Force phone numbers to display RTL */
html[dir="rtl"] .contact-page .card-body p:contains("+98"),
html[dir="rtl"] .contact-page .text-muted:contains("+98") {
    direction: rtl !important;
    text-align: right !important;
}

/* RTL Phone Numbers with Persian digits */
html[dir="rtl"] .contact-page .phone-numbers {
    direction: rtl !important;
    text-align: right !important;
    unicode-bidi: bidi-override;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
}

/* Force RTL for phone number content */
html[dir="rtl"] .contact-page .phone-numbers * {
    direction: rtl !important;
    unicode-bidi: embed;
}

/* Override browser LTR behavior for phone numbers */
html[dir="rtl"] .contact-page .phone-numbers {
    direction: rtl !important;
    text-align: right !important;
    unicode-bidi: bidi-override !important;
    display: block;
}

/* Force RTL for phone number span */
html[dir="rtl"] .contact-page .phone-numbers span[dir="rtl"] {
    direction: rtl !important;
    text-align: right !important;
    unicode-bidi: bidi-override !important;
    display: block;
}

/* Additional RTL override for phone numbers */
html[dir="rtl"] .contact-page .phone-numbers span {
    direction: rtl !important;
    unicode-bidi: bidi-override !important;
}

/* NUCLEAR OVERRIDE - Maximum specificity for phone numbers */
html[dir="rtl"] body .contact-page .card .card-body .text-muted.phone-numbers span[dir="rtl"],
html[dir="rtl"] .contact-page .phone-numbers span[dir="rtl"] {
    direction: rtl !important;
    text-align: right !important;
    unicode-bidi: bidi-override !important;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    display: block !important;
    float: right !important;
    clear: both !important;
}

/* Specific RTL phone number targeting */
html[dir="rtl"] .contact-page .phone-numbers .rtl-phone {
    direction: rtl !important;
    text-align: right !important;
    unicode-bidi: bidi-override !important;
    display: block !important;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
}

/* Persian phone numbers - force RTL display */
html[dir="rtl"] .contact-page .rtl-phone {
    direction: rtl !important;
    text-align: right !important;
    display: block !important;
    unicode-bidi: bidi-override !important;
}

/* Move entire email section down - including icon */
html[dir="rtl"] .contact-page .card-body .mb-4:nth-of-type(4) {
    margin-top: 3rem !important;
    clear: both !important;
    position: relative !important;
}

/* Target email section directly with class */
html[dir="rtl"] .contact-page .email-section {
    margin-top: 5rem !important;
    clear: both !important;
    position: relative !important;
    display: block !important;
}

/* Footer phone numbers RTL formatting */
html[dir="rtl"] footer .rtl-phone {
    direction: rtl !important;
    text-align: right !important;
    display: block !important;
    unicode-bidi: bidi-override !important;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
}

/* Force RTL for all Persian phone numbers */
html[dir="rtl"] .rtl-phone {
    direction: rtl !important;
    text-align: right !important;
    unicode-bidi: bidi-override !important;
    display: block !important;
}

/* Google Maps Styling */
#map {
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Distributors Page RTL Styling */
html[dir="rtl"] .distributor-card .card-title,
html[dir="rtl"] .distributor-card .text-muted,
html[dir="rtl"] .distributor-card .fw-bold,
html[dir="rtl"] .distributor-card .card-body p,
html[dir="rtl"] .distributor-card .card-body h6,
html[dir="rtl"] .distributor-card .card-footer,
html[dir="rtl"] .distributor-card .btn {
    text-align: right !important;
    direction: rtl !important;
}

/* Distributors page search form RTL */
html[dir="rtl"] .distributors-page .form-label,
html[dir="rtl"] .distributors-page .form-control,
html[dir="rtl"] .distributors-page .form-select {
    text-align: right;
    direction: rtl;
}

/* Distributors page search form placeholders */
html[dir="rtl"] .distributors-page .form-control::placeholder {
    text-align: right;
    direction: rtl;
}

/* Distributors page icons alignment */
html[dir="rtl"] .distributor-card .fas {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Distributors page flex alignment */
html[dir="rtl"] .distributor-card .d-flex {
    flex-direction: row-reverse;
}

/* Distributors page badge alignment */
html[dir="rtl"] .distributor-card .badge {
    margin-left: 0.25rem;
    margin-right: 0;
}

/* Distributors page button alignment */
html[dir="rtl"] .distributor-card .btn .fas {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Comprehensive distributor card RTL styling */
html[dir="rtl"] .distributor-card * {
    text-align: right !important;
    direction: rtl !important;
}

/* Override specific elements that should remain centered */
html[dir="rtl"] .distributor-card .d-grid,
html[dir="rtl"] .distributor-card .d-flex,
html[dir="rtl"] .distributor-card .card-footer .d-grid,
html[dir="rtl"] .distributor-card .card-footer .d-flex {
    text-align: center !important;
    direction: ltr !important;
}

/* Ensure buttons are centered in distributor cards */
html[dir="rtl"] .distributor-card .btn {
    text-align: center !important;
    direction: ltr !important;
}

/* Distributor card body content RTL */
html[dir="rtl"] .distributor-card .card-body {
    text-align: right !important;
    direction: rtl !important;
}

/* Distributor card footer RTL */
html[dir="rtl"] .distributor-card .card-footer {
    text-align: right !important;
    direction: rtl !important;
}

/* Distributors page search tips list RTL */
html[dir="rtl"] .distributors-page .alert ul {
    text-align: right;
    direction: rtl;
}

/* Distributor card phone numbers LTR formatting (like contact page) */
html[dir="rtl"] .distributor-card .rtl-phone {
    direction: ltr !important;
    text-align: left !important;
    display: inline-block !important;
    unicode-bidi: bidi-override !important;
}

/* Distributors page header centering for RTL */
html[dir="rtl"] .distributors-page .text-center h1,
html[dir="rtl"] .distributors-page .text-center p {
    text-align: center !important;
}

/* Distributors page "Become a Distributor" section centering */
html[dir="rtl"] .distributors-page .card.bg-light .card-body h3,
html[dir="rtl"] .distributors-page .card.bg-light .card-body p,
html[dir="rtl"] .distributors-page .card.bg-light .card-body a {
    text-align: center !important;
}

/* Distributor Detail Page RTL Styling */
html[dir="rtl"] .distributor-detail-page .breadcrumb,
html[dir="rtl"] .distributor-detail-page .breadcrumb-item,
html[dir="rtl"] .distributor-detail-page .breadcrumb-item a {
    text-align: right !important;
    direction: rtl !important;
}

/* Distributor detail page content RTL - only for main content area */
html[dir="rtl"] .distributor-detail-page .col-lg-8 .card-title,
html[dir="rtl"] .distributor-detail-page .col-lg-8 .card-text,
html[dir="rtl"] .distributor-detail-page .col-lg-8 .fw-bold,
html[dir="rtl"] .distributor-detail-page .col-lg-8 .text-muted,
html[dir="rtl"] .distributor-detail-page .col-lg-8 .card-body p,
html[dir="rtl"] .distributor-detail-page .col-lg-8 .card-body h6,
html[dir="rtl"] .distributor-detail-page .col-lg-8 .card-body h4,
html[dir="rtl"] .distributor-detail-page .col-lg-8 .card-body h3,
html[dir="rtl"] .distributor-detail-page .display-5,
html[dir="rtl"] .distributor-detail-page .lead {
    text-align: right !important;
    direction: rtl !important;
}

/* Distributor detail page icons */
html[dir="rtl"] .distributor-detail-page .fas {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Distributor detail page flex containers */
html[dir="rtl"] .distributor-detail-page .d-flex {
    flex-direction: row-reverse;
}

/* Distributor detail page header section - force RTL alignment */
html[dir="rtl"] .distributor-detail-page .row .col-lg-8 .d-flex div:last-child {
    text-align: right !important;
    direction: rtl !important;
}

/* Distributor detail page header content */
html[dir="rtl"] .distributor-detail-page .row .col-lg-8 .d-flex div:last-child h1,
html[dir="rtl"] .distributor-detail-page .row .col-lg-8 .d-flex div:last-child p {
    text-align: right !important;
    direction: rtl !important;
}

/* Nuclear approach - target all distributor detail header elements */
html[dir="rtl"] .distributor-detail-page .col-lg-8 .d-flex > div:last-child *,
html[dir="rtl"] .distributor-detail-page .col-lg-8 .d-flex div:last-child h1,
html[dir="rtl"] .distributor-detail-page .col-lg-8 .d-flex div:last-child p,
html[dir="rtl"] .distributor-detail-page .col-lg-8 .d-flex div:last-child .display-5,
html[dir="rtl"] .distributor-detail-page .col-lg-8 .d-flex div:last-child .lead {
    text-align: right !important;
    direction: rtl !important;
}

/* Force RTL on the entire header section */
html[dir="rtl"] .distributor-detail-page .row.mb-5 .col-lg-8 .d-flex {
    text-align: right !important;
    direction: rtl !important;
}

html[dir="rtl"] .distributor-detail-page .row.mb-5 .col-lg-8 .d-flex * {
    text-align: right !important;
    direction: rtl !important;
}

/* Target the exact structure - distributor name and location */
html[dir="rtl"] .distributor-detail-page .d-flex.align-items-center.mb-4 div:last-child {
    text-align: right !important;
    direction: rtl !important;
}

html[dir="rtl"] .distributor-detail-page .d-flex.align-items-center.mb-4 div:last-child h1,
html[dir="rtl"] .distributor-detail-page .d-flex.align-items-center.mb-4 div:last-child p {
    text-align: right !important;
    direction: rtl !important;
}

/* Force RTL on distributor name specifically */
html[dir="rtl"] .distributor-detail-page .display-5.fw-bold.text-dark.mb-2 {
    text-align: right !important;
    direction: rtl !important;
}

/* Force RTL on location text specifically */
html[dir="rtl"] .distributor-detail-page .lead.text-muted.mb-0 {
    text-align: right !important;
    direction: rtl !important;
}

/* Distributor detail page buttons - keep centered */
html[dir="rtl"] .distributor-detail-page .btn,
html[dir="rtl"] .distributor-detail-page .d-grid {
    text-align: center !important;
    direction: ltr !important;
}

/* Distributor detail page badges */
html[dir="rtl"] .distributor-detail-page .badge {
    margin-left: 0.25rem;
    margin-right: 0;
}

/* Distributor detail page phone numbers LTR formatting */
html[dir="rtl"] .distributor-detail-page .rtl-phone {
    direction: ltr !important;
    text-align: left !important;
    display: inline-block !important;
    unicode-bidi: bidi-override !important;
}

/* Distributor detail page email LTR formatting */
html[dir="rtl"] .distributor-detail-page a[href^="mailto:"] span[dir="ltr"] {
    direction: ltr !important;
    unicode-bidi: embed !important;
    display: inline-block !important;
}

/* Distributor detail page back button arrow */
html[dir="rtl"] .distributor-detail-page .fa-arrow-left {
    transform: scaleX(-1);
}

/* Trust Indicators specific RTL styling - only for the last card */
html[dir="rtl"] .distributor-detail-page .col-lg-4 .card:last-child .card-body h4,
html[dir="rtl"] .distributor-detail-page .col-lg-4 .card:last-child .card-body h6,
html[dir="rtl"] .distributor-detail-page .col-lg-4 .card:last-child .card-body small,
html[dir="rtl"] .distributor-detail-page .col-lg-4 .card:last-child .card-body .d-flex,
html[dir="rtl"] .distributor-detail-page .col-lg-4 .card:last-child .card-body .d-flex div {
    text-align: right !important;
    direction: rtl !important;
}

html[dir="rtl"] .distributor-detail-page .col-lg-4 .card:last-child .card-body .d-flex .fas {
    margin-left: 0.75rem !important;
    margin-right: 0 !important;
}

/* Distributor detail page phone number LTR formatting */
html[dir="rtl"] .distributor-detail-page .ltr-phone {
    direction: ltr !important;
    text-align: left !important;
    display: inline-block !important;
    unicode-bidi: embed !important;
}

/* Brand Logos Centering */
html[dir="rtl"] .brand-logo-container,
html[dir="rtl"] .brand-logo,
html[dir="rtl"] .brand-logo-placeholder {
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

html[dir="rtl"] .brand-logo {
    display: block !important;
    margin: 0 auto !important;
}

html[dir="rtl"] .brand-logo-placeholder {
    margin: 0 auto !important;
}

/* Brand Detail Page RTL Styling */
html[dir="rtl"] .brand-detail-hero-section .brand-info-content,
html[dir="rtl"] .brand-detail-hero-section .brand-title,
html[dir="rtl"] .brand-detail-hero-section .brand-description-large,
html[dir="rtl"] .brand-detail-hero-section .brand-story,
html[dir="rtl"] .brand-detail-hero-section .story-title,
html[dir="rtl"] .brand-detail-hero-section .story-text {
    text-align: right !important;
    direction: rtl !important;
}

html[dir="rtl"] .brand-detail-hero-section .btn-brand-website {
    direction: rtl !important;
}

html[dir="rtl"] .brand-detail-hero-section .btn-brand-website .fas {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

/* Brand Products Section RTL */
html[dir="rtl"] .brand-products-section .section-header,
html[dir="rtl"] .brand-products-section .section-title,
html[dir="rtl"] .brand-products-section .section-subtitle,
html[dir="rtl"] .brand-products-section .products-count {
    text-align: center !important;
}

html[dir="rtl"] .brand-products-section .product-card .card-body,
html[dir="rtl"] .brand-products-section .product-card .card-title,
html[dir="rtl"] .brand-products-section .product-card .card-text {
    text-align: right !important;
    direction: rtl !important;
}

html[dir="rtl"] .brand-products-section .btn {
    direction: rtl !important;
}

/* No Products Message RTL */
html[dir="rtl"] .no-products-message .no-products-content,
html[dir="rtl"] .no-products-message h4,
html[dir="rtl"] .no-products-message p {
    text-align: center !important;
}

html[dir="rtl"] .no-products-message .btn-brand-primary {
    direction: rtl !important;
}

html[dir="rtl"] .no-products-message .btn-brand-primary .fas {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

/* Back to Brands Section RTL */
html[dir="rtl"] .back-to-brands-section .back-content,
html[dir="rtl"] .back-to-brands-section .back-title,
html[dir="rtl"] .back-to-brands-section .back-text {
    text-align: center !important;
}

html[dir="rtl"] .back-to-brands-section .btn-back-to-brands {
    direction: rtl !important;
}

html[dir="rtl"] .back-to-brands-section .btn-back-to-brands .fas {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

/* Products Page RTL Styling */
html[dir="rtl"] .products-page .card-header h5,
html[dir="rtl"] .products-page .form-label,
html[dir="rtl"] .products-page .list-group-item,
html[dir="rtl"] .products-page .card-title,
html[dir="rtl"] .products-page .card-text,
html[dir="rtl"] .products-page .btn,
html[dir="rtl"] .products-page h1,
html[dir="rtl"] .products-page h4,
html[dir="rtl"] .products-page p {
    text-align: right !important;
    direction: rtl !important;
}

html[dir="rtl"] .products-page .input-group .form-control {
    text-align: right !important;
    direction: rtl !important;
}

html[dir="rtl"] .products-page .input-group .btn {
    direction: ltr !important;
}

html[dir="rtl"] .products-page .list-group-item {
    text-align: right !important;
    direction: rtl !important;
}

html[dir="rtl"] .products-page .product-card .card-body {
    text-align: right !important;
    direction: rtl !important;
}

html[dir="rtl"] .products-page .product-card .card-title,
html[dir="rtl"] .products-page .product-card .card-text {
    text-align: right !important;
    direction: rtl !important;
}

html[dir="rtl"] .products-page .product-card .btn {
    direction: ltr !important;
}

html[dir="rtl"] .products-page .pagination .page-link {
    direction: ltr !important;
}

/* Cache refresh - Updated: Products Page RTL */
/* Map loading state */
.map-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Map error state */
.map-error {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
}

/* Ensure email stays RTL and right-aligned - more specific */
html[dir="rtl"] .contact-page .card-body .text-muted:not(.phone-numbers) {
    direction: rtl !important;
    text-align: right !important;
    clear: both !important;
    display: block !important;
    unicode-bidi: normal !important;
}

/* Fix email display to prevent reversal */
html[dir="rtl"] .contact-page .card-body .mb-4:nth-of-type(4) .text-muted {
    unicode-bidi: embed !important;
    direction: ltr !important;
}

/* Force email to display correctly */
html[dir="rtl"] .contact-page .email-address {
    direction: rtl !important;
    text-align: right !important;
}

html[dir="rtl"] .contact-page .email-address span[dir="ltr"] {
    direction: ltr !important;
    unicode-bidi: embed !important;
}

/* Phone numbers container - very specific */
html[dir="rtl"] .contact-page .phone-numbers {
    direction: rtl !important;
    text-align: right !important;
    clear: both !important;
    display: block !important;
    margin-bottom: 1rem !important;
}

/* RTL Contact Icons */
html[dir="rtl"] .contact-page .fas {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* RTL Contact Page Layout */
html[dir="rtl"] .contact-page .card {
    text-align: right;
    direction: rtl;
}

/* RTL Contact Form Labels */
html[dir="rtl"] .contact-page .form-label {
    text-align: right;
    direction: rtl;
}

/* RTL Contact Information Headers */
html[dir="rtl"] .contact-page .card-body h6 {
    text-align: right;
    direction: rtl;
}

/* RTL Contact Map Section */
html[dir="rtl"] .contact-page .card-body .text-center {
    text-align: center !important;
}

/* RTL Contact Form Buttons */
html[dir="rtl"] .contact-page .btn {
    direction: rtl;
}

/* RTL Contact Form Input Groups */
html[dir="rtl"] .contact-page .input-group {
    direction: rtl;
}

html[dir="rtl"] .contact-page .input-group-text {
    border-radius: 0 0.375rem 0.375rem 0;
}

html[dir="rtl"] .contact-page .form-control:first-child {
    border-radius: 0.375rem 0 0 0.375rem;
}

/* RTL Brands Page Styling */
html[dir="rtl"] .brands-hero-section .hero-content,
html[dir="rtl"] .brands-hero-section .hero-title,
html[dir="rtl"] .brands-hero-section .hero-subtitle {
    text-align: center;
}

/* RTL Brands Grid */
html[dir="rtl"] .brands-grid-section .section-header,
html[dir="rtl"] .brands-grid-section .section-title,
html[dir="rtl"] .brands-grid-section .section-subtitle {
    text-align: center;
}

/* RTL Brand Cards */
html[dir="rtl"] .brand-card .brand-content,
html[dir="rtl"] .brand-card .brand-name,
html[dir="rtl"] .brand-card .brand-description,
html[dir="rtl"] .brand-card .brand-features {
    text-align: center;
    direction: rtl;
}

/* RTL Brand Actions */
html[dir="rtl"] .brand-card .brand-actions {
    text-align: center;
}

html[dir="rtl"] .brand-card .btn-brand-primary {
    direction: rtl;
}

/* RTL CTA Section */
html[dir="rtl"] .brands-cta-section .cta-content,
html[dir="rtl"] .brands-cta-section .cta-title,
html[dir="rtl"] .brands-cta-section .cta-text {
    text-align: center;
}

/* RTL Brand Features Tags */
html[dir="rtl"] .brand-features .feature-tag {
    direction: rtl;
}

/* Force override all conflicting brand card styles */
html[dir="rtl"] .brand-card,
html[dir="rtl"] .brand-card.modern-card,
html[dir="rtl"] .brand-card .brand-content,
html[dir="rtl"] .brand-card .brand-name,
html[dir="rtl"] .brand-card .brand-description,
html[dir="rtl"] .brand-card .brand-features,
html[dir="rtl"] .brand-card .brand-actions {
    text-align: center !important;
    direction: rtl !important;
}

/* Force override hero section styles */
html[dir="rtl"] .brands-hero-section .hero-content,
html[dir="rtl"] .brands-hero-section .hero-title,
html[dir="rtl"] .brands-hero-section .hero-subtitle {
    text-align: center !important;
}

/* Force override section header styles */
html[dir="rtl"] .brands-grid-section .section-header,
html[dir="rtl"] .brands-grid-section .section-title,
html[dir="rtl"] .brands-grid-section .section-subtitle {
    text-align: center !important;
}

/* Force override CTA section styles */
html[dir="rtl"] .brands-cta-section .cta-content,
html[dir="rtl"] .brands-cta-section .cta-title,
html[dir="rtl"] .brands-cta-section .cta-text {
    text-align: center !important;
}

/* Override any conflicting card styles */
html[dir="rtl"] .brand-card .card-title,
html[dir="rtl"] .brand-card .card-text,
html[dir="rtl"] .brand-card .card-body {
    text-align: center !important;
}

/* RTL Footer - Quick Links positioning only */
html[dir="rtl"] footer .col-md-3:nth-child(2) h6 {
    text-align: right;
    direction: rtl;
    margin-right: 2rem; /* Move Quick Links header further left to align with menu items */
}

html[dir="rtl"] footer .col-md-3:nth-child(2) .list-unstyled {
    text-align: right;
    direction: rtl;
    /* Remove margin from list items - keep them in normal position */
}

html[dir="rtl"] footer .list-unstyled li {
    margin-bottom: 0.5rem;
}

/* RTL Header Icons - Centered text */
html[dir="rtl"] .sephora-header-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

html[dir="rtl"] .sephora-header-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.25rem;
}

html[dir="rtl"] .sephora-header-icon i {
    display: block;
    margin: 0 auto;
}

html[dir="rtl"] .sephora-header-icon span {
    display: block;
    text-align: center;
    font-size: 0.875rem;
    line-height: 1.2;
}

/* Specific RTL adjustments for header icons */
html[dir="rtl"] .sephora-header-icon .fa-handshake {
    transform: scaleX(-1); /* Flip handshake icon */
}

html[dir="rtl"] .sephora-header-icon .fa-envelope {
    transform: none; /* Envelope doesn't need flipping */
}

html[dir="rtl"] .sephora-header-icon .fa-user {
    transform: none; /* User icon doesn't need flipping */
}

html[dir="rtl"] .sephora-header-icon .fa-tachometer-alt {
    transform: none; /* Dashboard icon doesn't need flipping */
}

/* RTL Buttons */
html[dir="rtl"] .btn {
    text-align: center;
}

html[dir="rtl"] .btn i {
    margin-left: 0.5rem;
    margin-right: 0;
}

html[dir="rtl"] .btn i:first-child {
    margin-left: 0.5rem;
    margin-right: 0;
}

html[dir="rtl"] .btn i:last-child {
    margin-right: 0.5rem;
    margin-left: 0;
}

/* RTL Forms */
html[dir="rtl"] .form-control,
html[dir="rtl"] .form-select {
    text-align: right;
    direction: rtl;
}

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

html[dir="rtl"] .input-group {
    direction: rtl;
}

html[dir="rtl"] .input-group-text {
    border-right: 1px solid #ced4da;
    border-left: 0;
}

html[dir="rtl"] .input-group .form-control {
    border-left: 1px solid #ced4da;
    border-right: 0;
}

html[dir="rtl"] .input-group-prepend {
    margin-right: -1px;
    margin-left: 0;
}

html[dir="rtl"] .input-group-append {
    margin-left: -1px;
    margin-right: 0;
}

/* RTL Search */
html[dir="rtl"] .search-container {
    direction: rtl;
}

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

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

/* RTL Search Input Wrapper - Fix text hiding under search icon */
html[dir="rtl"] .search-input-wrapper {
    position: relative;
    direction: rtl;
}

html[dir="rtl"] .search-input-wrapper .search-input {
    text-align: right;
    direction: rtl;
    padding-right: 15px; /* Normal right padding */
    padding-left: 50px; /* Space for search icon on the left */
}

html[dir="rtl"] .search-input-wrapper .search-btn {
    position: absolute;
    left: 5px;
    right: auto;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #6c757d;
    padding: 12px;
    z-index: 10;
}

html[dir="rtl"] .search-input-wrapper .search-btn:hover {
    color: #6f42c1;
}

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

html[dir="rtl"] .product-card .card-body {
    text-align: right;
    direction: rtl;
}

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

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

/* RTL Product Grid */
html[dir="rtl"] .products-grid {
    direction: rtl;
}

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

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

html[dir="rtl"] .brand-card .card-body {
    text-align: right;
    direction: rtl;
}

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

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

/* RTL Pagination */
html[dir="rtl"] .pagination {
    direction: rtl;
}

html[dir="rtl"] .pagination .page-item {
    margin-left: 0.25rem;
    margin-right: 0;
}

html[dir="rtl"] .pagination .page-link {
    text-align: center;
}

/* RTL Tables */
html[dir="rtl"] .table {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .table th,
html[dir="rtl"] .table td {
    text-align: right;
}

/* RTL User Profile */
html[dir="rtl"] .profile-section {
    direction: rtl;
    text-align: right;
}

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

html[dir="rtl"] .profile-form {
    direction: rtl;
}

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

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

html[dir="rtl"] .profile-form .form-control {
    text-align: right;
    direction: rtl;
}

/* RTL Dashboard */
html[dir="rtl"] .dashboard {
    direction: rtl;
}

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

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

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

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

/* RTL Admin Panel */
html[dir="rtl"] .admin-dashboard {
    direction: rtl;
}

html[dir="rtl"] .admin-nav {
    direction: rtl;
}

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

html[dir="rtl"] .admin-table {
    direction: rtl;
}

html[dir="rtl"] .admin-table th,
html[dir="rtl"] .admin-table td {
    text-align: right;
}

html[dir="rtl"] .admin-form {
    direction: rtl;
}

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

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

html[dir="rtl"] .admin-form .form-control {
    text-align: right;
    direction: rtl;
}

/* RTL Modals */
html[dir="rtl"] .modal {
    direction: rtl;
}

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

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

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

/* RTL Alerts */
html[dir="rtl"] .alert {
    text-align: right;
    direction: rtl;
}

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

/* RTL Breadcrumbs */
html[dir="rtl"] .breadcrumb {
    direction: rtl;
}

html[dir="rtl"] .breadcrumb-item {
    margin-left: 0.5rem;
    margin-right: 0;
}

html[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
    content: "\f054"; /* fa-chevron-right */
    margin-left: 0.5rem;
    margin-right: 0;
}

/* RTL Carousel */
html[dir="rtl"] .carousel {
    direction: rtl;
}

html[dir="rtl"] .carousel-control-prev {
    right: 0;
    left: auto;
}

html[dir="rtl"] .carousel-control-next {
    left: 0;
    right: auto;
}

html[dir="rtl"] .carousel-control-prev-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath d='m5.25 0-4 4 4 4 1.5-1.5L4.25 4l2.5-2.5L5.25 0z'/%3e%3c/svg%3e");
}

html[dir="rtl"] .carousel-control-next-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath d='m2.75 0 4 4-4 4-1.5-1.5L3.75 4 1.25 1.5 2.75 0z'/%3e%3c/svg%3e");
}

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

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

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

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

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

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

/* RTL List Groups */
html[dir="rtl"] .list-group {
    text-align: right;
    direction: rtl;
}

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

/* RTL Utilities */
html[dir="rtl"] .text-left {
    text-align: right !important;
}

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

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

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

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

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

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

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

html[dir="rtl"] .my-0 {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

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

html[dir="rtl"] .py-0 {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* RTL Margins and Padding */
html[dir="rtl"] .me-1 { margin-left: 0.25rem !important; margin-right: 0 !important; }
html[dir="rtl"] .me-2 { margin-left: 0.5rem !important; margin-right: 0 !important; }
html[dir="rtl"] .me-3 { margin-left: 1rem !important; margin-right: 0 !important; }
html[dir="rtl"] .me-4 { margin-left: 1.5rem !important; margin-right: 0 !important; }
html[dir="rtl"] .me-5 { margin-left: 3rem !important; margin-right: 0 !important; }

html[dir="rtl"] .ms-1 { margin-right: 0.25rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ms-2 { margin-right: 0.5rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ms-3 { margin-right: 1rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ms-4 { margin-right: 1.5rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ms-5 { margin-right: 3rem !important; margin-left: 0 !important; }

html[dir="rtl"] .pe-1 { padding-left: 0.25rem !important; padding-right: 0 !important; }
html[dir="rtl"] .pe-2 { padding-left: 0.5rem !important; padding-right: 0 !important; }
html[dir="rtl"] .pe-3 { padding-left: 1rem !important; padding-right: 0 !important; }
html[dir="rtl"] .pe-4 { padding-left: 1.5rem !important; padding-right: 0 !important; }
html[dir="rtl"] .pe-5 { padding-left: 3rem !important; padding-right: 0 !important; }

html[dir="rtl"] .ps-1 { padding-right: 0.25rem !important; padding-left: 0 !important; }
html[dir="rtl"] .ps-2 { padding-right: 0.5rem !important; padding-left: 0 !important; }
html[dir="rtl"] .ps-3 { padding-right: 1rem !important; padding-left: 0 !important; }
html[dir="rtl"] .ps-4 { padding-right: 1.5rem !important; padding-left: 0 !important; }
html[dir="rtl"] .ps-5 { padding-right: 3rem !important; padding-left: 0 !important; }

/* RTL Persian Number Formatting */
html[dir="rtl"] .persian-numbers {
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

html[dir="rtl"] .price,
html[dir="rtl"] .currency,
html[dir="rtl"] .number {
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

/* RTL Animations */
html[dir="rtl"] .fade-in-right {
    animation: fadeInLeft 0.5s ease-in-out;
}

html[dir="rtl"] .fade-in-left {
    animation: fadeInRight 0.5s ease-in-out;
}

html[dir="rtl"] .slide-in-right {
    animation: slideInLeft 0.5s ease-in-out;
}

html[dir="rtl"] .slide-in-left {
    animation: slideInRight 0.5s ease-in-out;
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* RTL Responsive Design */
@media (max-width: 768px) {
    html[dir="rtl"] .navbar-collapse {
        direction: rtl;
    }
    
    html[dir="rtl"] .navbar-nav {
        flex-direction: column;
        text-align: right;
    }
    
    html[dir="rtl"] .nav-item {
        margin-left: 0;
        margin-right: 0;
        text-align: right;
    }
    
    html[dir="rtl"] .dropdown-menu {
        position: static;
        float: none;
        width: auto;
        margin-top: 0;
        background-color: transparent;
        border: 0;
        box-shadow: none;
    }
}

/* RTL Print Styles */
@media print {
    html[dir="rtl"] {
        direction: rtl;
    }
    
    html[dir="rtl"] body {
        direction: rtl;
        text-align: right;
    }
    
    html[dir="rtl"] .no-print {
        display: none !important;
    }
}

/* RTL Accessibility */
html[dir="rtl"] [role="button"] {
    cursor: pointer;
}

html[dir="rtl"] [role="button"]:focus {
    outline: 2px solid var(--rtl-accent);
    outline-offset: 2px;
}

html[dir="rtl"] .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;
}

/* RTL High Contrast Mode */
@media (prefers-contrast: high) {
    html[dir="rtl"] {
        --rtl-accent: #000000;
        --rtl-secondary: #000000;
        --rtl-text: #000000;
        --rtl-muted: #000000;
    }
}

/* RTL Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    html[dir="rtl"] * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* RTL Dark Mode Support */
@media (prefers-color-scheme: dark) {
    html[dir="rtl"] {
        --rtl-accent: #a855f7;
        --rtl-secondary: #f472b6;
        --rtl-text: #f9fafb;
        --rtl-muted: #9ca3af;
    }
    
    html[dir="rtl"] body {
        background-color: #111827;
        color: #f9fafb;
    }
    
    html[dir="rtl"] .card {
        background-color: #1f2937;
        border-color: #374151;
    }
    
    html[dir="rtl"] .form-control {
        background-color: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
}
