/* RTL CSS for Persian/Farsi Localization */

/* Vazir Font Face */
@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazir-Regular.woff2') format('woff2'),
         url('../fonts/Vazir-Regular.woff') format('woff'),
         url('../fonts/Vazir-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazir-Bold.woff2') format('woff2'),
         url('../fonts/Vazir-Bold.woff') format('woff'),
         url('../fonts/Vazir-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazir-Medium.woff2') format('woff2'),
         url('../fonts/Vazir-Medium.woff') format('woff'),
         url('../fonts/Vazir-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazir-Light.woff2') format('woff2'),
         url('../fonts/Vazir-Light.woff') format('woff'),
         url('../fonts/Vazir-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

/* Global RTL Styles */
html[dir="rtl"],
html[lang="fa"] {
    direction: rtl;
}

body {
    font-family: 'Vazirmatn RD UI FD NL', 'Vazir', 'Tahoma', 'Arial', sans-serif !important;
    direction: rtl;
    text-align: right;
}

/* Override all text elements - use font with Persian digits for correct number display */
h1, h2, h3, h4, h5, h6,
p, span, a, li, td, th,
label, input, textarea, select,
button, .btn {
    font-family: 'Vazirmatn RD UI FD NL', 'Vazir', 'Tahoma', 'Arial', sans-serif !important;
}

/* RTL Text Alignment */
.text-left {
    text-align: right !important;
}

.text-right {
    text-align: left !important;
}

/* RTL Float */
.float-left,
.pull-left {
    float: right !important;
}

.float-right,
.pull-right {
    float: left !important;
}

/* RTL Margins */
.ml-auto { margin-right: auto !important; margin-left: 0 !important; }
.mr-auto { margin-left: auto !important; margin-right: 0 !important; }

/* RTL Padding adjustments */
.pl-0 { padding-right: 0 !important; }
.pr-0 { padding-left: 0 !important; }

/* List styles */
ul, ol {
    padding-right: 2rem;
    padding-left: 0;
}

/* Form elements */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
textarea,
select {
    text-align: right;
    direction: rtl;
}

/* Placeholder text */
input::placeholder,
textarea::placeholder {
    text-align: right;
    direction: rtl;
}

/* Tables */
table {
    direction: rtl;
}

th, td {
    text-align: right;
}

/* Breadcrumb */
.breadcrumb {
    direction: rtl;
}

.breadcrumb-item + .breadcrumb-item::before {
    float: right;
    padding-left: 0.5rem;
    padding-right: 0;
}

/* Dropdown menus */
.dropdown-menu {
    text-align: right;
}

/* Modal */
.modal-header .close {
    margin: -1rem auto -1rem -1rem;
}

/* Alerts */
.alert {
    text-align: right;
}

/* Cards */
.card {
    text-align: right;
}

/* Navigation */
.navbar-nav {
    padding-right: 0;
}

.nav {
    padding-right: 0;
}

/* Swiper/Slider RTL */
.swiper-container {
    direction: rtl;
}

/* Icons spacing */
.fa, .fas, .far, .fab, .fal {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Button icons */
.btn .fa,
.btn .fas,
.btn .far {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Custom scrollbar for RTL */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

/* Persian number styling */
.persian-number {
    font-feature-settings: "ss01";
}

/* Price styling: numbers must always be LTR to prevent reversed display (e.g. 000,023 → 23,000) */
.price,
.product-price,
.product-price-section .product-price,
.product-card__price,
.product-current-price,
.product-original-price,
.product-old-price,
.old-price,
.current-price,
.mini-cart-item-price,
.mini-cart-total-value,
.cart-item-price,
.cart-item-old-price,
.related-product-price,
.recently-viewed-price,
.price-free-value,
.product-savings-info,
.row-total[data-product-id] {
    direction: ltr;
    unicode-bidi: embed;
    text-align: left;
}

/* Footer */
footer {
    text-align: right;
}

/* Specific site overrides */
.header__menu,
.header__nav,
.main-menu {
    direction: rtl;
}

.product-card,
.catalog-item {
    text-align: right;
}

/* Fix for flex containers */
.d-flex {
    flex-direction: row-reverse;
}

.flex-row {
    flex-direction: row-reverse !important;
}

/* Keep some elements LTR */
.ltr,
.phone-number,
.email-address,
code,
pre {
    direction: ltr;
    unicode-bidi: embed;
}

