/*
 * RTL Utility Classes
 * Helper classes for common RTL scenarios
 * Add these classes directly in Elementor or WordPress editor
 */

/* ==========================================================================
   Direction Utilities
   ========================================================================== */

/* Force LTR direction for specific elements (e.g., email, phone, code) */
.force-ltr,
.ltr-force,
.ltr-only {
    direction: ltr !important;
    text-align: left !important;
}

/* Force RTL direction */
.force-rtl,
.rtl-force,
.rtl-only {
    direction: rtl !important;
    text-align: right !important;
}

/* Center alignment (override RTL) */
.text-center-rtl {
    text-align: center !important;
}

/* ==========================================================================
   Spacing Utilities (RTL-aware)
   ========================================================================== */

/* Margin utilities */
.mr-rtl-0 { margin-right: 0 !important; margin-left: auto; }
.mr-rtl-1 { margin-right: 0.5rem !important; margin-left: auto; }
.mr-rtl-2 { margin-right: 1rem !important; margin-left: auto; }
.mr-rtl-3 { margin-right: 1.5rem !important; margin-left: auto; }
.mr-rtl-4 { margin-right: 2rem !important; margin-left: auto; }
.mr-rtl-5 { margin-right: 3rem !important; margin-left: auto; }

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

/* Padding utilities */
.pr-rtl-0 { padding-right: 0 !important; }
.pr-rtl-1 { padding-right: 0.5rem !important; }
.pr-rtl-2 { padding-right: 1rem !important; }
.pr-rtl-3 { padding-right: 1.5rem !important; }
.pr-rtl-4 { padding-right: 2rem !important; }
.pr-rtl-5 { padding-right: 3rem !important; }

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

/* ==========================================================================
   Float Utilities (RTL-aware)
   ========================================================================== */

.float-start-rtl {
    float: right !important;
}

.float-end-rtl {
    float: left !important;
}

.float-none-rtl {
    float: none !important;
}

/* Clear floats */
.clearfix-rtl::after {
    content: "";
    display: table;
    clear: both;
}

/* ==========================================================================
   Flex Utilities (RTL-aware)
   ========================================================================== */

.flex-rtl {
    display: flex !important;
    direction: rtl;
}

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

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

.justify-start-rtl {
    justify-content: flex-start !important;
}

.justify-end-rtl {
    justify-content: flex-end !important;
}

.justify-center-rtl {
    justify-content: center !important;
}

.justify-between-rtl {
    justify-content: space-between !important;
}

/* ==========================================================================
   Text Alignment Utilities
   ========================================================================== */

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

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

.text-center-rtl {
    text-align: center !important;
}

.text-justify-rtl {
    text-align: justify !important;
}

/* ==========================================================================
   Icon Position Utilities
   ========================================================================== */

/* Icon on the right (start in RTL) */
.icon-start-rtl .icon,
.icon-start-rtl i,
.icon-start-rtl svg {
    margin-left: 0.5rem;
    margin-right: 0;
    order: 2;
}

/* Icon on the left (end in RTL) */
.icon-end-rtl .icon,
.icon-end-rtl i,
.icon-end-rtl svg {
    margin-right: 0.5rem;
    margin-left: 0;
    order: -1;
}

/* Flip icon horizontally */
.icon-flip-rtl .icon,
.icon-flip-rtl i,
.icon-flip-rtl svg {
    transform: scaleX(-1);
}

/* Flip icon vertically */
.icon-flip-vertical-rtl .icon,
.icon-flip-vertical-rtl i,
.icon-flip-vertical-rtl svg {
    transform: scaleY(-1);
}

/* ==========================================================================
   Border Utilities (RTL-aware)
   ========================================================================== */

.border-start-rtl {
    border-right: 1px solid var(--color-border, #e7e7e7) !important;
    border-left: none !important;
}

.border-end-rtl {
    border-left: 1px solid var(--color-border, #e7e7e7) !important;
    border-right: none !important;
}

.border-start-primary-rtl {
    border-right: 2px solid var(--e-global-color-primary, #fc551d) !important;
    border-left: none !important;
}

.border-end-primary-rtl {
    border-left: 2px solid var(--e-global-color-primary, #fc551d) !important;
    border-right: none !important;
}

/* ==========================================================================
   Position Utilities (RTL-aware)
   ========================================================================== */

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

.position-end-rtl {
    left: 0 !important;
    right: auto !important;
}

/* ==========================================================================
   List Utilities (RTL-aware)
   ========================================================================== */

.list-rtl {
    padding-right: 2em !important;
    padding-left: 0 !important;
    direction: rtl;
    text-align: right;
}

.list-rtl li {
    text-align: right;
}

/* Remove list indent */
.list-no-indent-rtl {
    padding-right: 0 !important;
    padding-left: 0 !important;
    list-style: none;
}

/* ==========================================================================
   Grid Utilities (RTL-aware)
   ========================================================================== */

.grid-rtl {
    display: grid !important;
    direction: rtl;
}

/* ==========================================================================
   Number & Code Display
   ========================================================================== */

/* For phone numbers, emails, codes that should stay LTR */
.phone-number,
.email-address,
.code-block,
.numeric-display {
    direction: ltr !important;
    text-align: left !important;
    display: inline-block;
    unicode-bidi: embed;
}

/* ==========================================================================
   Form Utilities (RTL-aware)
   ========================================================================== */

.form-rtl {
    direction: rtl;
}

.form-rtl input,
.form-rtl textarea,
.form-rtl select {
    text-align: right;
}

.form-label-rtl {
    text-align: right !important;
    display: block;
}

.form-checkbox-rtl {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* ==========================================================================
   Button Utilities (RTL-aware)
   ========================================================================== */

.btn-rtl {
    direction: rtl;
    text-align: center;
}

.btn-icon-start-rtl {
    flex-direction: row-reverse;
}

.btn-icon-end-rtl {
    flex-direction: row;
}

/* ==========================================================================
   Card & Box Utilities (RTL-aware)
   ========================================================================== */

.card-rtl {
    direction: rtl;
    text-align: right;
}

.card-body-rtl {
    direction: rtl;
    text-align: right;
}

.card-title-rtl {
    text-align: right;
}

/* ==========================================================================
   Table Utilities (RTL-aware)
   ========================================================================== */

.table-rtl {
    direction: rtl;
}

.table-rtl th,
.table-rtl td {
    text-align: right;
}

/* ==========================================================================
   Navigation Utilities (RTL-aware)
   ========================================================================== */

.nav-rtl {
    direction: rtl;
}

.nav-rtl .nav-item {
    text-align: right;
}

/* ==========================================================================
   Image & Media Utilities (RTL-aware)
   ========================================================================== */

.img-start-rtl {
    float: right !important;
    margin-left: 1rem;
    margin-right: 0;
}

.img-end-rtl {
    float: left !important;
    margin-right: 1rem;
    margin-left: 0;
}

/* ==========================================================================
   Visibility Utilities
   ========================================================================== */

/* Hide in RTL mode */
.hide-rtl {
    display: none !important;
}

/* Show only in RTL mode */
.show-rtl {
    display: block !important;
}

/* ==========================================================================
   Animation & Transform Utilities
   ========================================================================== */

.rotate-180-rtl {
    transform: rotate(180deg);
}

.scale-x-flip-rtl {
    transform: scaleX(-1);
}

.scale-y-flip-rtl {
    transform: scaleY(-1);
}

/* ==========================================================================
   Responsive Utilities
   ========================================================================== */

@media (max-width: 766.98px) {
    .mobile-center-rtl {
        text-align: center !important;
    }
    
    .mobile-right-rtl {
        text-align: right !important;
    }
    
    .mobile-left-rtl {
        text-align: left !important;
    }
}

@media (min-width: 767px) and (max-width: 1024px) {
    .tablet-center-rtl {
        text-align: center !important;
    }
    
    .tablet-right-rtl {
        text-align: right !important;
    }
    
    .tablet-left-rtl {
        text-align: left !important;
    }
}

@media (min-width: 1024.02px) {
    .desktop-center-rtl {
        text-align: center !important;
    }
    
    .desktop-right-rtl {
        text-align: right !important;
    }
    
    .desktop-left-rtl {
        text-align: left !important;
    }
}

/* ==========================================================================
   Hebrew Typography Utilities
   ========================================================================== */

/* Hebrew-specific font adjustments */
.hebrew-text {
    direction: rtl;
    text-align: right;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

/* Improve Hebrew readability */
.hebrew-readable {
    line-height: 1.8;
    letter-spacing: 0.01em;
}

/* Mixed content (Hebrew + English) */
.mixed-content {
    direction: rtl;
    text-align: right;
    unicode-bidi: embed;
}

.mixed-content .english {
    direction: ltr;
    display: inline-block;
    unicode-bidi: embed;
}

/* ==========================================================================
   Print Utilities
   ========================================================================== */

@media print {
    .print-rtl {
        direction: rtl !important;
        text-align: right !important;
    }
}

/* ==========================================================================
   Accessibility Utilities
   ========================================================================== */

/* Screen reader only (maintains proper reading direction) */
.sr-only-rtl {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
    direction: rtl;
}

/* Focus visible for RTL */
.focus-visible-rtl:focus-visible {
    outline: 2px solid var(--e-global-color-primary, #fc551d);
    outline-offset: 2px;
}
