/*
 * Enhanced RTL Styles for Elementor and Advanced Elements
 * This file contains additional RTL adjustments for complex layouts
 */

/* ==========================================================================
   Elementor RTL Enhancements
   ========================================================================== */

/* Elementor Containers & Sections */
.elementor-section .elementor-container {
    direction: rtl;
}

.elementor-column-gap-default > .elementor-column > .elementor-element-populated {
    direction: rtl;
}

/* Elementor Headings */
.elementor-widget-heading .elementor-heading-title {
    text-align: inherit;
}

/* Elementor Text Editor */
.elementor-widget-text-editor {
    text-align: right;
}

.elementor-widget-text-editor ul,
.elementor-widget-text-editor ol {
    padding-right: 2em;
    padding-left: 0;
}

/* Elementor Buttons */
.elementor-button-wrapper {
    direction: rtl;
}

.elementor-button .elementor-button-icon {
    margin-left: 0;
}

.elementor-button .elementor-button-icon.elementor-align-icon-left {
    margin-right: 0;
    margin-left: 10px;
}

.elementor-button .elementor-button-icon.elementor-align-icon-right {
    margin-left: 0;
    margin-right: 10px;
}

/* Elementor Icon List */
.elementor-icon-list-items {
    padding-right: 0;
    text-align: right;
}

.elementor-icon-list-item {
    direction: rtl;
}

.elementor-icon-list-icon {
    margin-right: 0;
    margin-left: 8px;
}

.elementor-icon-list-text {
    text-align: right;
}

/* Elementor Image Box */
.elementor-image-box-wrapper {
    direction: rtl;
}

.elementor-image-box-img {
    margin-left: 15px;
    margin-right: 0;
}

/* Elementor Icon Box */
.elementor-icon-box-wrapper {
    direction: rtl;
}

.elementor-icon-box-icon {
    margin-left: 15px;
    margin-right: 0;
}

/* Elementor Testimonials */
.elementor-testimonial-wrapper {
    direction: rtl;
}

.elementor-testimonial__text {
    text-align: right;
}

.elementor-testimonial__cite {
    text-align: right;
}

/* Elementor Counter */
.elementor-counter {
    text-align: center;
}

.elementor-counter-title {
    text-align: center;
}

/* Elementor Progress Bar */
.elementor-progress-wrapper {
    direction: rtl;
}

.elementor-progress-bar {
    left: auto;
    right: 0;
}

/* Elementor Tabs */
.elementor-tabs {
    direction: rtl;
}

.elementor-tabs-wrapper {
    direction: rtl;
}

.elementor-tab-title {
    text-align: right;
}

.elementor-tab-content {
    text-align: right;
}

/* Elementor Accordion */
.elementor-accordion {
    direction: rtl;
}

.elementor-accordion-item {
    direction: rtl;
}

.elementor-accordion-title {
    text-align: right;
}

.elementor-accordion-icon {
    margin-left: 0;
    margin-right: 15px;
}

.elementor-accordion-icon-closed {
    float: left;
}

.elementor-accordion-icon-opened {
    float: left;
}

/* Elementor Toggle */
.elementor-toggle {
    direction: rtl;
}

.elementor-toggle-title {
    text-align: right;
}

.elementor-toggle-icon {
    margin-left: 0;
    margin-right: 15px;
    float: left;
}

/* Elementor Social Icons */
.elementor-social-icons-wrapper {
    direction: rtl;
}

.elementor-social-icon {
    margin-left: 10px;
    margin-right: 0;
}

.elementor-social-icon:first-child {
    margin-left: 0;
}

.elementor-social-icon:last-child {
    margin-left: 10px;
}

/* Elementor Star Rating */
.elementor-star-rating {
    direction: ltr;
    text-align: left;
}

/* Elementor Alert */
.elementor-alert {
    direction: rtl;
    text-align: right;
}

.elementor-alert-title {
    text-align: right;
}

.elementor-alert-description {
    text-align: right;
}

/* Elementor Divider */
.elementor-divider-separator {
    direction: rtl;
}

/* Elementor Spacer */
.elementor-spacer-inner {
    direction: rtl;
}

/* Elementor Call to Action */
.elementor-cta {
    direction: rtl;
}

.elementor-cta__content {
    text-align: right;
}

/* Elementor Posts Grid */
.elementor-posts-container {
    direction: rtl;
}

.elementor-post {
    direction: rtl;
}

.elementor-post__title {
    text-align: right;
}

.elementor-post__excerpt {
    text-align: right;
}

.elementor-post__meta-data {
    direction: rtl;
}

/* Elementor Form */
.elementor-form {
    direction: rtl;
}

.elementor-field-group {
    direction: rtl;
}

.elementor-field-label {
    text-align: right;
}

.elementor-field-textual {
    text-align: right;
}

.elementor-button[type="submit"] {
    direction: rtl;
}

.elementor-field-type-checkbox .elementor-field-subgroup,
.elementor-field-type-radio .elementor-field-subgroup {
    direction: rtl;
}

.elementor-field-type-checkbox .elementor-field-option,
.elementor-field-type-radio .elementor-field-option {
    direction: rtl;
}

.elementor-field-type-checkbox label,
.elementor-field-type-radio label {
    padding-right: 0;
    padding-left: 5px;
}

/* Elementor Navigation Menu */
.elementor-nav-menu {
    direction: rtl;
}

.elementor-nav-menu__layout-horizontal .elementor-nav-menu > li {
    margin-left: 0;
    margin-right: 20px;
}

.elementor-nav-menu__layout-horizontal .elementor-nav-menu > li:first-child {
    margin-right: 0;
}

.elementor-nav-menu__layout-horizontal .elementor-nav-menu > li:last-child {
    margin-right: 20px;
}

.elementor-nav-menu--dropdown .elementor-nav-menu--dropdown-tablet,
.elementor-nav-menu--dropdown-mobile {
    direction: rtl;
}

.elementor-nav-menu--toggle .elementor-menu-toggle {
    margin-right: 0;
    margin-left: auto;
}

/* Elementor Carousel & Sliders */
.elementor-swiper {
    direction: rtl;
}

.elementor-swiper-button-prev {
    left: auto;
    right: 10px;
}

.elementor-swiper-button-next {
    right: auto;
    left: 10px;
}

.swiper-button-prev {
    left: auto;
    right: 10px;
}

.swiper-button-next {
    right: auto;
    left: 10px;
}

/* Elementor Lightbox */
.elementor-lightbox-item {
    direction: rtl;
}

/* Elementor Video */
.elementor-video-wrapper {
    direction: ltr;
}

/* Elementor Gallery */
.elementor-gallery {
    direction: rtl;
}

.elementor-gallery__item {
    direction: ltr;
}

/* Elementor Price Table */
.elementor-price-table {
    direction: rtl;
    text-align: center;
}

.elementor-price-table__header {
    text-align: center;
}

.elementor-price-table__features-list {
    text-align: center;
    padding-right: 0;
}

/* Elementor Flip Box */
.elementor-flip-box {
    direction: rtl;
}

.elementor-flip-box__front,
.elementor-flip-box__back {
    text-align: center;
}

/* ==========================================================================
   Advanced Grid Layouts RTL
   ========================================================================== */

.elementor-grid {
    direction: rtl;
}

/* Masonry Layout */
.elementor-posts-masonry {
    direction: rtl;
}

/* ==========================================================================
   Mobile Responsive RTL Adjustments
   ========================================================================== */

@media (max-width: 1024px) {
    .elementor-nav-menu--dropdown {
        text-align: right;
    }
    
    .elementor-nav-menu--dropdown li {
        text-align: right;
    }
    
    .elementor-nav-menu--dropdown a {
        padding-right: 20px;
        padding-left: 20px;
    }
}

@media (max-width: 766.98px) {
    .elementor-column {
        direction: rtl;
    }
    
    .elementor-widget-wrap {
        direction: rtl;
    }
}

/* ==========================================================================
   Custom Animations & Transitions RTL
   ========================================================================== */

/* Ensure animations work properly in RTL */
.elementor-invisible[data-settings*="animation"] {
    direction: rtl;
}

/* Slide animations need special handling */
[data-settings*="slideInRight"] {
    animation-name: slideInLeft;
}

[data-settings*="slideInLeft"] {
    animation-name: slideInRight;
}

/* ==========================================================================
   Fix for specific theme elements
   ========================================================================== */

/* Logo positioning */
.site-branding {
    direction: rtl;
}

.custom-logo {
    margin-left: 0;
}

/* Header elements */
.site-header .keydesign-container {
    direction: rtl;
}

.main-navigation-wrapper {
    direction: rtl;
}

/* Footer widgets */
.footer-widget-section .keydesign-container {
    direction: rtl;
}

.footer-widget-area-wrapper {
    text-align: right;
}

/* Pagination */
.woocommerce nav.woocommerce-pagination ul {
    border-right: 0;
    border-left: 1px solid;
}

.woocommerce nav.woocommerce-pagination ul li {
    border-right: 1px solid;
    border-left: 0;
}

/* ==========================================================================
   Third-Party Plugin Support
   ========================================================================== */

/* Contact Form 7 RTL */
.wpcf7 {
    direction: rtl;
}

.wpcf7-form {
    text-align: right;
}

.wpcf7-list-item {
    margin-right: 0;
    margin-left: 1em;
}

/* Gravity Forms RTL */
.gform_wrapper {
    direction: rtl;
}

.gfield {
    text-align: right;
}

/* WPForms RTL */
.wpforms-container {
    direction: rtl;
}

.wpforms-field {
    text-align: right;
}

/* ==========================================================================
   Performance & Print Styles
   ========================================================================== */

@media print {
    body {
        direction: rtl;
        text-align: right;
    }
}

/* ==========================================================================
   Accessibility RTL Improvements
   ========================================================================== */

/* Screen reader text remains LTR for proper reading */
.screen-reader-text {
    direction: ltr;
    text-align: left;
}

/* Skip links */
.skip-link {
    direction: rtl;
}

/* Focus styles */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline-offset: 2px;
}
