﻿/* RTL Overrides - Arabic Support */
body.rtl {
    direction: rtl;
    text-align: right;
}

/* ===== DO NOT reverse these critical flex containers ===== */
.rtl .fixed.bottom-0 .flex, /* bottom navigation outer */
.rtl .fixed.bottom-0 .nav-btn, /* each nav button */
.rtl header .flex, /* top header */
.rtl .grid-cols-2 .flex, /* dashboard stat cards */
.rtl .flex.justify-between, /* many headers */
.rtl .sticky.top-0 .flex, /* modal header */
.rtl .fc .fc-toolbar, /* calendar toolbar */
.rtl .fc .fc-button-group, /* calendar buttons */
.rtl .horse-tab-container, /* horse tabs container */
.rtl .overflow-x-auto, /* scrollable containers */
.rtl .bg-stable-card .flex.items-center.justify-between, /* dashboard inner stats */
.rtl .nav-btn .flex, /* inner flex inside nav button (icon+text) */
.rtl .flex.items-center.gap-2, /* many inline groups (like search input) */
.rtl .flex.justify-around, /* bottom nav wrapper */
.rtl .flex.justify-between, /* modal headers */
.rtl .flex.gap-2, /* general inline groups */
.rtl .flex.gap-1 /* tab groups */ {
    flex-direction: row !important;
}

/* Force bottom nav buttons to stack vertically (icon above text) */
.rtl .nav-btn {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

    .rtl .nav-btn i {
        margin-bottom: 0.25rem;
        margin-right: 0 !important;
    }

    .rtl .nav-btn span {
        font-size: 0.7rem;
        text-align: center;
    }

/* For form groups that should reverse (like label+input, button+icon) */
.rtl .flex.gap-2:not(.no-reverse):not(.fixed.bottom-0 .flex):not(header .flex):not(.fc .fc-toolbar):not(.fc .fc-button-group):not(.horse-tab-container):not(.flex.items-center.gap-2) {
    flex-direction: row-reverse;
}

/* Buttons with icon+text – reverse them */
.rtl button.flex.items-center.gap-2 {
    flex-direction: row-reverse;
}

    .rtl button.flex.items-center.gap-2 i {
        margin-left: 0.5rem;
        margin-right: 0;
    }

/* Space utilities */
.rtl .space-x-2 > :not([hidden]) ~ :not([hidden]) {
    margin-left: 0;
    margin-right: 0.5rem;
}

.rtl .space-x-3 > :not([hidden]) ~ :not([hidden]) {
    margin-left: 0;
    margin-right: 0.75rem;
}

.rtl .space-x-4 > :not([hidden]) ~ :not([hidden]) {
    margin-left: 0;
    margin-right: 1rem;
}

/* Margin overrides */
.rtl .ml-1 {
    margin-left: 0;
    margin-right: 0.25rem;
}

.rtl .ml-2 {
    margin-left: 0;
    margin-right: 0.5rem;
}

.rtl .ml-3 {
    margin-left: 0;
    margin-right: 0.75rem;
}

.rtl .ml-4 {
    margin-left: 0;
    margin-right: 1rem;
}

.rtl .mr-1 {
    margin-right: 0;
    margin-left: 0.25rem;
}

.rtl .mr-2 {
    margin-right: 0;
    margin-left: 0.5rem;
}

.rtl .mr-3 {
    margin-right: 0;
    margin-left: 0.75rem;
}

.rtl .mr-4 {
    margin-right: 0;
    margin-left: 1rem;
}

/* Padding overrides */
.rtl .pl-1 {
    padding-left: 0;
    padding-right: 0.25rem;
}

.rtl .pl-2 {
    padding-left: 0;
    padding-right: 0.5rem;
}

.rtl .pl-3 {
    padding-left: 0;
    padding-right: 0.75rem;
}

.rtl .pl-4 {
    padding-left: 0;
    padding-right: 1rem;
}

.rtl .pr-1 {
    padding-right: 0;
    padding-left: 0.25rem;
}

.rtl .pr-2 {
    padding-right: 0;
    padding-left: 0.5rem;
}

.rtl .pr-3 {
    padding-right: 0;
    padding-left: 0.75rem;
}

.rtl .pr-4 {
    padding-right: 0;
    padding-left: 1rem;
}

/* Text alignment */
.rtl .text-left {
    text-align: right;
}

.rtl .text-right {
    text-align: left;
}

/* Search icon positioning */
.rtl .absolute.left-3 {
    left: auto !important;
    right: 0.75rem !important;
}

.rtl .pl-10 {
    padding-left: 1rem !important;
    padding-right: 2.5rem !important;
}

/* Form inputs – keep LTR for data entry */
.rtl input, .rtl select, .rtl textarea {
    direction: ltr;
    text-align: left;
}

    .rtl input::placeholder, .rtl textarea::placeholder {
        text-align: right;
    }

/* Tables – keep LTR for numeric data */
.rtl table, .rtl .overflow-x-auto table {
    direction: ltr;
}

.rtl th, .rtl td {
    text-align: inherit;
}

/* Calendar adjustments */
.rtl .fc .fc-button-group .fc-button:first-child {
    border-radius: 0 0.375rem 0.375rem 0;
}

.rtl .fc .fc-button-group .fc-button:last-child {
    border-radius: 0.375rem 0 0 0.375rem;
}

.rtl .fc .fc-daygrid-day-number {
    text-align: left;
}

/* Settings modal sidebar */
.rtl .border-r {
    border-right-width: 0;
    border-left-width: 1px;
}

.rtl .pr-2 {
    padding-right: 0;
    padding-left: 0.5rem;
}

.rtl .pl-4 {
    padding-left: 0;
    padding-right: 1rem;
}

/* Horse tabs – RTL support */
.rtl .horse-tab-container {
    direction: rtl;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.rtl .horse-tab {
    direction: rtl;
}

/* Stall map grid – keep LTR */
.rtl .grid {
    direction: ltr;
}

/* Dashboard weather widget – keep row */
.rtl #weatherContent .flex {
    flex-direction: row !important;
}

/* Bottom navigation – ensure icons and text are centered and stacked */
.rtl .fixed.bottom-0 .nav-btn {
    display: flex;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center;
}

    .rtl .fixed.bottom-0 .nav-btn i {
        margin-bottom: 0.25rem;
        margin-right: 0 !important;
    }

    .rtl .fixed.bottom-0 .nav-btn span {
        font-size: 0.7rem;
    }
