/* RTL Support Styles for Health Apps */

/* Base RTL Overrides */
body.rtl {
    direction: rtl;
    text-align: right;
}

/* Flip horizontal margins and paddings */
body.rtl .ms-auto { margin-right: auto !important; margin-left: 0 !important; }
body.rtl .me-auto { margin-left: auto !important; margin-right: 0 !important; }

body.rtl .ms-1 { margin-right: 0.25rem !important; margin-left: 0 !important; }
body.rtl .ms-2 { margin-right: 0.5rem !important; margin-left: 0 !important; }
body.rtl .ms-3 { margin-right: 1rem !important; margin-left: 0 !important; }
body.rtl .ms-4 { margin-right: 1.5rem !important; margin-left: 0 !important; }
body.rtl .ms-5 { margin-right: 3rem !important; margin-left: 0 !important; }

body.rtl .me-1 { margin-left: 0.25rem !important; margin-right: 0 !important; }
body.rtl .me-2 { margin-left: 0.5rem !important; margin-right: 0 !important; }
body.rtl .me-3 { margin-left: 1rem !important; margin-right: 0 !important; }
body.rtl .me-4 { margin-left: 1.5rem !important; margin-right: 0 !important; }
body.rtl .me-5 { margin-left: 3rem !important; margin-right: 0 !important; }

/* Flip padding */
body.rtl .ps-1 { padding-right: 0.25rem !important; padding-left: 0 !important; }
body.rtl .ps-2 { padding-right: 0.5rem !important; padding-left: 0 !important; }
body.rtl .ps-3 { padding-right: 1rem !important; padding-left: 0 !important; }
body.rtl .ps-4 { padding-right: 1.5rem !important; padding-left: 0 !important; }
body.rtl .ps-5 { padding-right: 3rem !important; padding-left: 0 !important; }

body.rtl .pe-1 { padding-left: 0.25rem !important; padding-right: 0 !important; }
body.rtl .pe-2 { padding-left: 0.5rem !important; padding-right: 0 !important; }
body.rtl .pe-3 { padding-left: 1rem !important; padding-right: 0 !important; }
body.rtl .pe-4 { padding-left: 1.5rem !important; padding-right: 0 !important; }
body.rtl .pe-5 { padding-left: 3rem !important; padding-right: 0 !important; }

/* Navigation */
body.rtl .bottom-nav .nav-box {
    text-align: center;
}

/* Swiper RTL */
body.rtl .swiper {
    direction: rtl;
}

body.rtl .swiper-slide {
    direction: rtl;
}

/* Back button arrows (fi-rr-angle-small-left) - NOT flipped, stay as < */
/* Forward/navigate arrows (fi-rr-angle-small-right) - flipped to < for RTL */
body.rtl .fi-rr-angle-small-right::before,
body.rtl .fi-rr-arrow-right::before {
    transform: scaleX(-1);
    display: inline-block;
}

body.rtl .mdi-chevron-right::before {
    content: "\F0141"; /* chevron-left */
}

body.rtl .mdi-chevron-left::before {
    content: "\F0142"; /* chevron-right */
}

/* Form field with icon (phone, OTP) */
body.rtl .form__field .field-icon {
    left: auto;
    right: 0;
}

body.rtl .form__field--with-icon input {
    padding-left: 14px;
    padding-right: 48px;
}

/* Form elements */
body.rtl input,
body.rtl textarea,
body.rtl select {
    text-align: right;
}

body.rtl input[type="tel"],
body.rtl input[type="number"] {
    text-align: left; /* Numbers stay LTR */
    direction: ltr;
}

body.rtl input::placeholder {
    text-align: right;
}

/* Float overrides */
body.rtl .float-start { float: right !important; }
body.rtl .float-end { float: left !important; }

/* Text alignment overrides */
body.rtl .text-start { text-align: right !important; }
body.rtl .text-end { text-align: left !important; }

/* Flex direction for horizontal layouts */
body.rtl .d-flex:not(.flex-column):not(.flex-column-reverse) {
    flex-direction: row-reverse;
}

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

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

/* Keep column direction unchanged */
body.rtl .d-flex.flex-column {
    flex-direction: column !important;
}

body.rtl .d-flex.flex-column-reverse {
    flex-direction: column-reverse !important;
}

/* Specific component fixes */
body.rtl .name-menu {
    margin-right: 10px;
    margin-left: 0;
}

body.rtl .items-menu .d-flex {
    flex-direction: row !important;
}

body.rtl .title-section {
    flex-direction: row !important;
}

body.rtl .see-more,
body.rtl .see-all {
    margin-right: auto;
    margin-left: 0;
}

/* Profile and account sections */
body.rtl .name {
    margin-right: 15px;
    margin-left: 0;
}

/* Cards */
body.rtl .card-custom,
body.rtl .card-journal,
body.rtl .card-video {
    text-align: right;
}

/* Buttons with icons */
body.rtl .btn i.me-1,
body.rtl .btn i.me-2 {
    margin-left: 0.25rem;
    margin-right: 0 !important;
}

body.rtl .btn i.ms-1,
body.rtl .btn i.ms-2 {
    margin-right: 0.25rem;
    margin-left: 0 !important;
}

/* Modal adjustments - let direction:rtl handle layout naturally */
/* No row-reverse needed, direction:rtl already places close btn on LEFT */

body.rtl .btn-close {
    margin-left: 0;
    margin-right: auto;
}

/* Search input with icon */
body.rtl .search-box input {
    padding-right: 15px;
    padding-left: 40px;
}

body.rtl .search-box button,
body.rtl .search-box .search-icon {
    left: 10px;
    right: auto;
}

/* Accordion for FAQ */
body.rtl .accordion-button::after {
    margin-left: 0;
    margin-right: auto;
}

body.rtl .accordion-button {
    text-align: right;
}

/* Top content header */
body.rtl .top-content {
    text-align: right;
}

body.rtl .top-content .d-flex {
    flex-direction: row !important;
}

/* Profile settings back button */
body.rtl .nav-top .d-flex {
    flex-direction: row !important;
}

/* Journal/Vision board items */
body.rtl .item-journal .d-flex,
body.rtl .item-vision-board .d-flex {
    flex-direction: row-reverse;
}

body.rtl .detail {
    margin-right: 15px;
    margin-left: 0;
}

/* Payment method cards */
body.rtl .payment-method-card .d-flex {
    flex-direction: row-reverse;
}

/* Toast positioning for RTL */
body.rtl .toast-container {
    right: auto;
    left: 15px;
}

/* Back button */
body.rtl .back-btn {
    transform: scaleX(-1);
}

/* List items */
body.rtl ul,
body.rtl ol {
    padding-right: 1.5rem;
    padding-left: 0;
}

/* Badge positioning */
body.rtl .position-absolute.end-0 {
    left: 0 !important;
    right: auto !important;
}

body.rtl .position-absolute.start-0 {
    right: 0 !important;
    left: auto !important;
}

/* Grid items alignment */
body.rtl .row {
    direction: rtl;
}

/* Profile menu items */
body.rtl .menu-profile {
    padding-right: 0;
    padding-left: 0;
}

body.rtl .menu-profile .items-menu a i {
    margin-left: 14px;
    margin-right: 0;
}

body.rtl .menu-profile .items-menu a .flag {
    margin-left: 14px;
    margin-right: 0;
}

body.rtl .profile-menu-item {
    flex-direction: row-reverse;
}

body.rtl .profile-menu-item .icon {
    margin-left: 15px;
    margin-right: 0;
}

body.rtl .profile-menu-item .arrow {
    transform: scaleX(-1);
}

/* Category cards */
body.rtl .category-card {
    text-align: right;
}

/* Fitplan cards */
body.rtl .fitplan-card .d-flex {
    flex-direction: row-reverse;
}

/* Fitplan work-plan and exercise pages - fix double-flip from direction:rtl + row-reverse */
body.rtl .items-highlight .d-flex {
    flex-direction: row !important;
}

body.rtl .detail-playing {
    text-align: center;
}

body.rtl .playing-plan {
    direction: ltr;
}

body.rtl .set-title {
    direction: ltr;
}

body.rtl .minutes-circle .text {
    direction: ltr;
}

/* Fitplan modal detail */
body.rtl .title-detail {
    text-align: right;
}

body.rtl .card-detail .d-flex {
    flex-direction: row !important;
}

body.rtl .card-detail .cals {
    margin-left: 0 !important;
    margin-right: 1rem;
    text-align: right;
}

/* Fitplan work-planday list items */
body.rtl .list-song .items-song .detail {
    flex-direction: row !important;
}

body.rtl .list-song .items-song .detail .title {
    text-align: right;
}

/* Input groups */
body.rtl .input-group {
    flex-direction: row-reverse;
}

body.rtl .input-group > .form-control {
    border-radius: 0 0.375rem 0.375rem 0 !important;
}

body.rtl .input-group > .btn:last-child {
    border-radius: 0.375rem 0 0 0.375rem !important;
}

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

body.rtl .dropdown-menu-end {
    left: 0;
    right: auto;
}

/* Border radius flip */
body.rtl .rounded-start {
    border-radius: 0 0.375rem 0.375rem 0 !important;
}

body.rtl .rounded-end {
    border-radius: 0.375rem 0 0 0.375rem !important;
}

/* Fix for Arabic font rendering */
body.rtl {
    font-family: 'Segoe UI', 'Tahoma', 'Arial', 'Noto Sans Arabic', sans-serif;
}

/* Calendar/Date icon alignment */
body.rtl .date i,
body.rtl .time i {
    margin-left: 8px;
    margin-right: 0;
}

/* Progress bars */
body.rtl .progress {
    direction: rtl;
}

/* Tabs */
body.rtl .nav-tabs,
body.rtl .nav-pills {
    flex-direction: row-reverse;
}

/* Breadcrumbs */
body.rtl .breadcrumb {
    flex-direction: row-reverse;
}

body.rtl .breadcrumb-item + .breadcrumb-item::before {
    content: "\2190"; /* Left arrow */
    padding-right: 0;
    padding-left: 0.5rem;
}

/* Language switcher */
body.rtl .language-switcher .dropdown-menu {
    text-align: right;
}

/* Fix specific swiper issues */
body.rtl .swiper-button-next {
    right: auto;
    left: 10px;
    transform: rotate(180deg);
}

body.rtl .swiper-button-prev {
    left: auto;
    right: 10px;
    transform: rotate(180deg);
}

/* Fix pagination */
body.rtl .swiper-pagination {
    direction: ltr;
}

/* Bottom navigation */
body.rtl .bottom-nav {
    direction: rtl;
}

body.rtl .bottom-nav .nav-box {
    direction: rtl;
}

/* Floating action button */
/* body.rtl .fab,
body.rtl .floating-btn {
    left: 20px;
    right: auto;
}

body.rtl .floating-fit {
    right: auto;
    left: 20px;
} */

/* Checkbox and radio labels */
body.rtl .form-check {
    padding-right: 1.5em;
    padding-left: 0;
}

body.rtl .form-check-input {
    float: right;
    margin-right: -1.5em;
    margin-left: 0;
}

/* Alert close button */
body.rtl .alert .btn-close {
    left: 0;
    right: auto;
}

/* Calculator - Gender selection */
body.rtl .select-custom.plan-question.gender {
    flex-direction: row-reverse !important;
}

body.rtl .select-custom.plan-question.gender .select .btn-primary {
    margin-right: 0;
    margin-left: 10px;
    text-align: right;
}

body.rtl .select-custom.plan-question.gender .select .btn-primary .circle {
    margin-left: 0;
    margin-right: auto;
}

body.rtl .select-custom.plan-question.gender .select .btn-check:checked+.btn .circle {
    margin-left: 0;
    margin-right: auto;
}

body.rtl .select-custom.plan-question.gender .select .btn .d-flex {
    flex-direction: row-reverse !important;
}

/* Calculator - CM/KG unit labels stay on right (numbers are LTR) */
body.rtl .cm-text.bmi,
body.rtl .kg-text.bmi {
    right: 16%;
    left: auto;
}

/* Keep numbers LTR */
body.rtl .price,
body.rtl .number,
body.rtl .phone-number,
body.rtl [dir="ltr"] {
    direction: ltr;
    display: inline-block;
}
