/*
 * Easy Custom Skin Theme - RTL Stylesheet
 *
 * Right-to-Left (RTL) language support
 * For: Arabic, Hebrew, Persian, Urdu, etc.
 *
 * KEY TECHNIQUE: Use direction: ltr on flex containers + flex-direction: row-reverse
 * This prevents browser from auto-reversing while we manually control order.
 *
 * @package Easy_Custom_Skin_Theme
 */

/* ==========================================================================
   Base RTL
   ========================================================================== */
html[dir="rtl"],
body.rtl {
    direction: rtl;
    text-align: right;
}

/* ==========================================================================
   Typography RTL
   ========================================================================== */
html[dir="rtl"] ul,
html[dir="rtl"] ol,
body.rtl ul,
body.rtl ol {
    padding-right: var(--ecst-spacing-lg);
    padding-left: 0;
}

html[dir="rtl"] blockquote,
body.rtl blockquote {
    border-right: 4px solid var(--ecst-primary-color);
    border-left: none;
    padding-right: var(--ecst-spacing-lg);
    padding-left: 0;
    margin-right: 0;
    margin-left: var(--ecst-spacing-lg);
}

/* ==========================================================================
   Top Bar RTL
   ========================================================================== */
html[dir="rtl"] .ecst-topbar,
body.rtl .ecst-topbar {
    direction: ltr;
}

html[dir="rtl"] .ecst-topbar .ecst-container,
body.rtl .ecst-topbar .ecst-container {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-topbar-left,
html[dir="rtl"] .ecst-topbar-right,
body.rtl .ecst-topbar-left,
body.rtl .ecst-topbar-right {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-topbar-menu,
body.rtl .ecst-topbar-menu {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-topbar-menu li,
body.rtl .ecst-topbar-menu li {
    direction: rtl;
}

html[dir="rtl"] .ecst-topbar-social,
body.rtl .ecst-topbar-social {
    flex-direction: row-reverse;
}

/* ==========================================================================
   Header Main RTL
   ========================================================================== */
html[dir="rtl"] .ecst-header-main,
body.rtl .ecst-header-main {
    direction: ltr;
}

html[dir="rtl"] .ecst-header-main .ecst-container,
body.rtl .ecst-header-main .ecst-container {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-logo a,
body.rtl .ecst-logo a {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-logo-text,
html[dir="rtl"] .ecst-logo-tagline,
body.rtl .ecst-logo-text,
body.rtl .ecst-logo-tagline {
    direction: rtl;
    text-align: right;
}

/* ==========================================================================
   Search Form RTL
   ========================================================================== */
html[dir="rtl"] .ecst-search-form,
body.rtl .ecst-search-form {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-search-form input[type="search"],
body.rtl .ecst-search-form input[type="search"] {
    padding: 10px 15px 10px 50px;
    text-align: right;
    direction: rtl;
    border-radius: 0 var(--ecst-border-radius) var(--ecst-border-radius) 0;
}

html[dir="rtl"] .ecst-search-form button,
body.rtl .ecst-search-form button {
    right: auto;
    left: 0;
    border-radius: var(--ecst-border-radius) 0 0 var(--ecst-border-radius);
}

/* ==========================================================================
   PRIMARY NAVIGATION RTL - THE KEY FIX
   Using direction: ltr + flex-direction: row-reverse
   ========================================================================== */

/* Main Nav Container - Set LTR to prevent browser auto-reverse */
html[dir="rtl"] .ecst-main-nav,
body.rtl .ecst-main-nav {
    direction: ltr;
}

html[dir="rtl"] .ecst-main-nav .ecst-container,
body.rtl .ecst-main-nav .ecst-container {
    flex-direction: row-reverse;
    justify-content: flex-start;
    direction: ltr;
}

html[dir="rtl"] .ecst-main-nav .ecst-header-actions,
body.rtl .ecst-main-nav .ecst-header-actions {
    margin-left: 0;
    margin-right: auto;
}

/* Primary Menu - LTR with row-reverse for proper RTL visual */
html[dir="rtl"] .ecst-primary-menu,
html[dir="rtl"] ul.ecst-primary-menu,
html[dir="rtl"] #primary-menu,
body.rtl .ecst-primary-menu,
body.rtl ul.ecst-primary-menu,
body.rtl #primary-menu {
    flex-direction: row-reverse;
    direction: ltr;
}

/* Menu Items - RTL for text content */
html[dir="rtl"] .ecst-primary-menu > li,
html[dir="rtl"] #primary-menu > li,
body.rtl .ecst-primary-menu > li,
body.rtl #primary-menu > li {
    direction: rtl;
}

html[dir="rtl"] .ecst-primary-menu > li > a,
html[dir="rtl"] #primary-menu > li > a,
body.rtl .ecst-primary-menu > li > a,
body.rtl #primary-menu > li > a {
    direction: rtl;
    text-align: right;
    flex-direction: row-reverse;
}

/* Dropdown Indicator */
html[dir="rtl"] .ecst-primary-menu > li.menu-item-has-children > a::after,
body.rtl .ecst-primary-menu > li.menu-item-has-children > a::after {
    margin-right: 8px;
    margin-left: 0;
}

/* Dropdown Menu */
html[dir="rtl"] .ecst-primary-menu .sub-menu,
body.rtl .ecst-primary-menu .sub-menu {
    left: auto;
    right: 0;
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] .ecst-primary-menu .sub-menu li a,
body.rtl .ecst-primary-menu .sub-menu li a {
    border-right: 3px solid transparent;
    border-left: none;
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .ecst-primary-menu .sub-menu li a:hover,
body.rtl .ecst-primary-menu .sub-menu li a:hover {
    border-right-color: var(--ecst-primary-color);
}

/* Nested Submenu */
html[dir="rtl"] .ecst-primary-menu .sub-menu .sub-menu,
body.rtl .ecst-primary-menu .sub-menu .sub-menu {
    left: auto;
    right: 100%;
}

/* Mega Menu RTL */
html[dir="rtl"] .ecst-mega-column,
body.rtl .ecst-mega-column {
    border-right: none;
    border-left: 1px solid var(--ecst-border-color);
}

html[dir="rtl"] .ecst-mega-column:last-child,
body.rtl .ecst-mega-column:last-child {
    border-left: none;
}

html[dir="rtl"] .ecst-mega-menu-item > a .ecst-mega-arrow,
body.rtl .ecst-mega-menu-item > a .ecst-mega-arrow {
    margin-left: 0;
    margin-right: 8px;
}

html[dir="rtl"] .ecst-mega-column-title,
body.rtl .ecst-mega-column-title {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .ecst-mega-post-item > a,
body.rtl .ecst-mega-post-item > a {
    direction: rtl;
}

html[dir="rtl"] .ecst-mega-post-title,
html[dir="rtl"] .ecst-mega-post-date,
body.rtl .ecst-mega-post-title,
body.rtl .ecst-mega-post-date {
    text-align: right;
}

/* Mobile Menu Toggle */
html[dir="rtl"] .ecst-menu-toggle,
body.rtl .ecst-menu-toggle {
    order: -1;
}

/* ==========================================================================
   AJAX Live Search RTL
   ========================================================================== */
html[dir="rtl"] .ecst-search-close,
body.rtl .ecst-search-close {
    right: auto;
    left: var(--ecst-spacing-lg);
}

html[dir="rtl"] .ecst-search-input-wrap .ecst-search-icon,
body.rtl .ecst-search-input-wrap .ecst-search-icon {
    left: auto;
    right: 20px;
}

html[dir="rtl"] .ecst-search-overlay-input,
body.rtl .ecst-search-overlay-input {
    padding: 20px 60px 20px 100px;
    text-align: right;
}

html[dir="rtl"] .ecst-search-loader,
body.rtl .ecst-search-loader {
    right: auto;
    left: 70px;
}

html[dir="rtl"] .ecst-search-shortcut,
body.rtl .ecst-search-shortcut {
    right: auto;
    left: 16px;
}

html[dir="rtl"] .ecst-search-results-header,
body.rtl .ecst-search-results-header {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-search-result-link,
body.rtl .ecst-search-result-link {
    flex-direction: row-reverse;
    text-align: right;
}

html[dir="rtl"] .ecst-search-result-meta,
body.rtl .ecst-search-result-meta {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-search-view-all svg,
body.rtl .ecst-search-view-all svg {
    transform: rotate(180deg);
}

html[dir="rtl"] .ecst-search-hints,
body.rtl .ecst-search-hints {
    flex-direction: row-reverse;
}

/* ==========================================================================
   Mobile Menu Drawer RTL
   ========================================================================== */
html[dir="rtl"] .ecst-mobile-menu,
body.rtl .ecst-mobile-menu {
    left: auto;
    right: 0;
    transform: translateX(100%);
}

html[dir="rtl"] .ecst-mobile-menu.active,
body.rtl .ecst-mobile-menu.active {
    transform: translateX(0);
}

html[dir="rtl"] .ecst-mobile-menu-header,
body.rtl .ecst-mobile-menu-header {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-mobile-close,
body.rtl .ecst-mobile-close {
    margin-left: 0;
    margin-right: var(--ecst-spacing-md);
}

html[dir="rtl"] .ecst-mobile-search form,
body.rtl .ecst-mobile-search form {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-mobile-nav-menu > li > a,
html[dir="rtl"] .ecst-mobile-item-wrap > a,
body.rtl .ecst-mobile-nav-menu > li > a,
body.rtl .ecst-mobile-item-wrap > a {
    text-align: right;
}

html[dir="rtl"] .ecst-mobile-item-wrap,
body.rtl .ecst-mobile-item-wrap {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-mobile-submenu-toggle,
body.rtl .ecst-mobile-submenu-toggle {
    border-left: none;
    border-right: 1px solid var(--ecst-border-color);
}

html[dir="rtl"] .ecst-mobile-submenu a,
body.rtl .ecst-mobile-submenu a {
    padding-left: var(--ecst-spacing-lg);
    padding-right: calc(var(--ecst-spacing-lg) + 16px);
    text-align: right;
}

html[dir="rtl"] .ecst-mobile-submenu a::before,
body.rtl .ecst-mobile-submenu a::before {
    left: auto;
    right: var(--ecst-spacing-lg);
}

html[dir="rtl"] .ecst-mobile-submenu .ecst-mobile-submenu a,
body.rtl .ecst-mobile-submenu .ecst-mobile-submenu a {
    padding-right: calc(var(--ecst-spacing-lg) + 32px);
}

html[dir="rtl"] .ecst-mobile-submenu .ecst-mobile-submenu a::before,
body.rtl .ecst-mobile-submenu .ecst-mobile-submenu a::before {
    right: calc(var(--ecst-spacing-lg) + 16px);
}

html[dir="rtl"] .ecst-mobile-dark-mode,
body.rtl .ecst-mobile-dark-mode {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-mobile-dark-toggle::before,
body.rtl .ecst-mobile-dark-toggle::before {
    left: auto;
    right: 3px;
}

html[dir="rtl"] body.ecst-dark-mode .ecst-mobile-dark-toggle::before,
body.rtl body.ecst-dark-mode .ecst-mobile-dark-toggle::before {
    transform: translateX(-22px);
}

html[dir="rtl"] .ecst-mobile-dark-toggle .ecst-dark-mode-icon-sun,
body.rtl .ecst-mobile-dark-toggle .ecst-dark-mode-icon-sun {
    left: auto;
    right: 6px;
}

html[dir="rtl"] .ecst-mobile-dark-toggle .ecst-dark-mode-icon-moon,
body.rtl .ecst-mobile-dark-toggle .ecst-dark-mode-icon-moon {
    right: auto;
    left: 6px;
}

html[dir="rtl"] .ecst-mobile-social,
body.rtl .ecst-mobile-social {
    flex-direction: row-reverse;
}

/* ==========================================================================
   Header Layout 1 - News Style RTL
   ========================================================================== */
html[dir="rtl"] .ecst-header-1 .ecst-main-nav,
body.rtl .ecst-header-1 .ecst-main-nav {
    direction: ltr;
}

html[dir="rtl"] .ecst-header-1 .ecst-main-nav .ecst-container,
body.rtl .ecst-header-1 .ecst-main-nav .ecst-container {
    flex-direction: row-reverse;
    direction: ltr;
}

html[dir="rtl"] .ecst-header-1 .ecst-primary-menu,
body.rtl .ecst-header-1 .ecst-primary-menu {
    flex-direction: row-reverse;
    direction: ltr;
}

html[dir="rtl"] .ecst-header-1 .ecst-primary-menu > li,
body.rtl .ecst-header-1 .ecst-primary-menu > li {
    direction: rtl;
}

/* ==========================================================================
   Header Layout 2 - Centered Logo RTL
   ========================================================================== */
html[dir="rtl"] .ecst-header-2 .ecst-main-nav,
body.rtl .ecst-header-2 .ecst-main-nav {
    direction: ltr;
}

html[dir="rtl"] .ecst-header-2 .ecst-primary-menu,
body.rtl .ecst-header-2 .ecst-primary-menu {
    flex-direction: row-reverse;
    direction: ltr;
}

html[dir="rtl"] .ecst-header-2 .ecst-primary-menu > li,
body.rtl .ecst-header-2 .ecst-primary-menu > li {
    direction: rtl;
}

/* ==========================================================================
   Header Layout 3 - Minimal RTL
   ========================================================================== */
html[dir="rtl"] .ecst-header-3,
body.rtl .ecst-header-3 {
    direction: ltr;
}

html[dir="rtl"] .ecst-header-3 .ecst-header-inner,
body.rtl .ecst-header-3 .ecst-header-inner {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-header-3 .ecst-header-actions,
body.rtl .ecst-header-3 .ecst-header-actions {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-header-3 .ecst-primary-menu,
body.rtl .ecst-header-3 .ecst-primary-menu {
    flex-direction: row-reverse;
    direction: ltr;
}

html[dir="rtl"] .ecst-header-3 .ecst-primary-menu > li,
body.rtl .ecst-header-3 .ecst-primary-menu > li {
    direction: rtl;
}

html[dir="rtl"] .ecst-header-3 .ecst-logo-text,
body.rtl .ecst-header-3 .ecst-logo-text {
    direction: rtl;
}

/* ==========================================================================
   Header Layout 4 - Dark Theme RTL
   ========================================================================== */
html[dir="rtl"] .ecst-header-4 .ecst-main-nav,
body.rtl .ecst-header-4 .ecst-main-nav {
    direction: ltr;
}

html[dir="rtl"] .ecst-header-4 .ecst-main-nav .ecst-container,
body.rtl .ecst-header-4 .ecst-main-nav .ecst-container {
    flex-direction: row-reverse;
    justify-content: flex-start;
    direction: ltr;
}

html[dir="rtl"] .ecst-header-4 .ecst-primary-menu,
html[dir="rtl"] .ecst-header-4 #primary-menu,
body.rtl .ecst-header-4 .ecst-primary-menu,
body.rtl .ecst-header-4 #primary-menu {
    flex-direction: row-reverse;
    direction: ltr;
}

html[dir="rtl"] .ecst-header-4 .ecst-primary-menu > li,
html[dir="rtl"] .ecst-header-4 #primary-menu > li,
body.rtl .ecst-header-4 .ecst-primary-menu > li,
body.rtl .ecst-header-4 #primary-menu > li {
    direction: rtl;
}

html[dir="rtl"] .ecst-header-4 .ecst-primary-menu > li > a,
html[dir="rtl"] .ecst-header-4 #primary-menu > li > a,
body.rtl .ecst-header-4 .ecst-primary-menu > li > a,
body.rtl .ecst-header-4 #primary-menu > li > a {
    direction: rtl;
    text-align: right;
}

/* ==========================================================================
   Header Layout 5 - Business RTL
   ========================================================================== */
html[dir="rtl"] .ecst-header-5 .ecst-main-nav,
body.rtl .ecst-header-5 .ecst-main-nav {
    direction: ltr;
}

html[dir="rtl"] .ecst-header-5 .ecst-header-actions,
body.rtl .ecst-header-5 .ecst-header-actions {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-header-5 .ecst-main-nav .ecst-container,
body.rtl .ecst-header-5 .ecst-main-nav .ecst-container {
    flex-direction: row-reverse;
    direction: ltr;
}

html[dir="rtl"] .ecst-header-5 .ecst-primary-menu,
body.rtl .ecst-header-5 .ecst-primary-menu {
    flex-direction: row-reverse;
    direction: ltr;
}

html[dir="rtl"] .ecst-header-5 .ecst-primary-menu > li,
body.rtl .ecst-header-5 .ecst-primary-menu > li {
    direction: rtl;
}

/* ==========================================================================
   Header Layout 6 - Transparent RTL
   ========================================================================== */
html[dir="rtl"] .ecst-header-6,
body.rtl .ecst-header-6 {
    direction: ltr;
}

html[dir="rtl"] .ecst-header-6 .ecst-header-inner,
body.rtl .ecst-header-6 .ecst-header-inner {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-header-6 .ecst-header-actions,
body.rtl .ecst-header-6 .ecst-header-actions {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-header-6 .ecst-primary-menu,
body.rtl .ecst-header-6 .ecst-primary-menu {
    flex-direction: row-reverse;
    direction: ltr;
}

html[dir="rtl"] .ecst-header-6 .ecst-primary-menu > li,
body.rtl .ecst-header-6 .ecst-primary-menu > li {
    direction: rtl;
}

html[dir="rtl"] .ecst-header-6 .ecst-logo-text,
body.rtl .ecst-header-6 .ecst-logo-text {
    direction: rtl;
}

/* ==========================================================================
   Content Area RTL
   ========================================================================== */

/*
 * RTL GRID FIX:
 * - Use direction: ltr on grid to prevent automatic column reversal
 * - Manually control layout with grid-template-columns and order
 * - This gives us precise control over the layout
 */

/* Base: Keep grid in LTR mode to prevent auto-reversal */
html[dir="rtl"] .ecst-content-sidebar,
body.rtl .ecst-content-sidebar {
    direction: ltr;
}

/* Content inside grid items should be RTL */
html[dir="rtl"] .ecst-content-sidebar > *,
body.rtl .ecst-content-sidebar > * {
    direction: rtl;
}

/* 
 * Sidebar Right (default) in RTL: Sidebar moves to LEFT
 * Grid: Sidebar | Content (1fr)
 */
html[dir="rtl"] .ecst-sidebar-right .ecst-content-sidebar,
body.rtl .ecst-sidebar-right .ecst-content-sidebar {
    grid-template-columns: var(--ecst-sidebar-width, 300px) 1fr;
}

html[dir="rtl"] .ecst-sidebar-right .ecst-content-area,
html[dir="rtl"] .ecst-sidebar-right .ecst-posts-area,
body.rtl .ecst-sidebar-right .ecst-content-area,
body.rtl .ecst-sidebar-right .ecst-posts-area {
    order: 2;
}

html[dir="rtl"] .ecst-sidebar-right .ecst-sidebar,
body.rtl .ecst-sidebar-right .ecst-sidebar {
    order: 1;
}

/* 
 * Sidebar Left in RTL: Sidebar moves to RIGHT
 * Grid: Content (1fr) | Sidebar
 */
html[dir="rtl"] .ecst-sidebar-left .ecst-content-sidebar,
body.rtl .ecst-sidebar-left .ecst-content-sidebar {
    grid-template-columns: 1fr var(--ecst-sidebar-width, 300px);
}

html[dir="rtl"] .ecst-sidebar-left .ecst-content-area,
html[dir="rtl"] .ecst-sidebar-left .ecst-posts-area,
body.rtl .ecst-sidebar-left .ecst-content-area,
body.rtl .ecst-sidebar-left .ecst-posts-area {
    order: 1;
}

html[dir="rtl"] .ecst-sidebar-left .ecst-sidebar,
body.rtl .ecst-sidebar-left .ecst-sidebar {
    order: 2;
    padding-left: var(--ecst-spacing-xl);
    padding-right: 0;
    border-left: 1px solid var(--ecst-border-color);
    border-right: none;
}

/* ==========================================================================
   Sidebar RTL
   ========================================================================== */

/* Default sidebar (right position in LTR, moves to left in RTL) */
html[dir="rtl"] .ecst-sidebar-right .ecst-sidebar,
body.rtl .ecst-sidebar-right .ecst-sidebar {
    padding-right: var(--ecst-spacing-xl);
    padding-left: 0;
    border-right: 1px solid var(--ecst-border-color);
    border-left: none;
}

/* General sidebar text alignment */
html[dir="rtl"] .ecst-sidebar,
body.rtl .ecst-sidebar {
    text-align: right;
}

/* No sidebar - Reset to single column */
html[dir="rtl"] .ecst-no-sidebar .ecst-content-sidebar,
body.rtl .ecst-no-sidebar .ecst-content-sidebar {
    grid-template-columns: 1fr;
}

html[dir="rtl"] .ecst-no-sidebar .ecst-posts-area,
body.rtl .ecst-no-sidebar .ecst-posts-area {
    order: unset;
}

html[dir="rtl"] .ecst-widget,
body.rtl .ecst-widget {
    text-align: right;
}

html[dir="rtl"] .ecst-widget ul,
body.rtl .ecst-widget ul {
    padding-right: 0;
}

/* ==========================================================================
   Posts RTL
   ========================================================================== */
html[dir="rtl"] .ecst-post,
body.rtl .ecst-post {
    text-align: right;
}

html[dir="rtl"] .ecst-post-meta,
body.rtl .ecst-post-meta {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

/* Related Posts RTL */
html[dir="rtl"] .ecst-related-posts,
body.rtl .ecst-related-posts {
    text-align: right;
}

html[dir="rtl"] .ecst-related-post-content,
body.rtl .ecst-related-post-content {
    text-align: right;
}

/* Grid Layout RTL */
html[dir="rtl"] .ecst-posts-grid,
html[dir="rtl"] .ecst-related-posts-grid,
body.rtl .ecst-posts-grid,
body.rtl .ecst-related-posts-grid {
    direction: rtl;
}

html[dir="rtl"] .ecst-posts-grid .ecst-entry-header,
html[dir="rtl"] .ecst-posts-grid .ecst-post-excerpt,
html[dir="rtl"] .ecst-posts-grid .ecst-entry-footer,
body.rtl .ecst-posts-grid .ecst-entry-header,
body.rtl .ecst-posts-grid .ecst-post-excerpt,
body.rtl .ecst-posts-grid .ecst-entry-footer {
    text-align: right;
}

/* List Compact Layout RTL */
html[dir="rtl"] .ecst-list-compact .ecst-post,
body.rtl .ecst-list-compact .ecst-post {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-list-compact .ecst-post-content,
body.rtl .ecst-list-compact .ecst-post-content {
    text-align: right;
}

/* List Alternating Layout RTL */
html[dir="rtl"] .ecst-list-alt .ecst-post,
body.rtl .ecst-list-alt .ecst-post {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-list-alt .ecst-post:nth-child(even),
body.rtl .ecst-list-alt .ecst-post:nth-child(even) {
    flex-direction: row;
}

html[dir="rtl"] .ecst-list-alt .ecst-post-content,
body.rtl .ecst-list-alt .ecst-post-content {
    text-align: right;
}

@media (max-width: 768px) {
    html[dir="rtl"] .ecst-list-compact .ecst-post,
    html[dir="rtl"] .ecst-list-alt .ecst-post,
    html[dir="rtl"] .ecst-list-alt .ecst-post:nth-child(even),
    body.rtl .ecst-list-compact .ecst-post,
    body.rtl .ecst-list-alt .ecst-post,
    body.rtl .ecst-list-alt .ecst-post:nth-child(even) {
        flex-direction: column;
    }
}

/* ==========================================================================
   Social Share RTL
   ========================================================================== */
html[dir="rtl"] .ecst-social-share,
body.rtl .ecst-social-share {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-share-buttons,
body.rtl .ecst-share-buttons {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-social-share-floating,
body.rtl .ecst-social-share-floating {
    left: auto;
    right: 1rem;
    flex-direction: column;
}

/* ==========================================================================
   Dark Mode Toggle RTL
   ========================================================================== */
html[dir="rtl"] .ecst-dark-mode-toggle,
body.rtl .ecst-dark-mode-toggle {
    margin-left: 0;
    margin-right: var(--ecst-spacing-sm);
}

/* ==========================================================================
   Breaking News Ticker RTL
   ========================================================================== */
html[dir="rtl"] .ecst-breaking-news,
body.rtl .ecst-breaking-news {
    direction: rtl;
}

html[dir="rtl"] .ecst-ticker-wrapper,
body.rtl .ecst-ticker-wrapper {
    flex-direction: row;
}

html[dir="rtl"] .ecst-ticker-label,
body.rtl .ecst-ticker-label {
    flex-direction: row-reverse;
    order: 3;
}

html[dir="rtl"] .ecst-ticker-content,
body.rtl .ecst-ticker-content {
    direction: rtl;
    order: 2;
}

html[dir="rtl"] .ecst-ticker-list,
body.rtl .ecst-ticker-list {
    flex-direction: row;
    animation-name: ecst-ticker-scroll-rtl;
}

@keyframes ecst-ticker-scroll-rtl {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); }
}

html[dir="rtl"] .ecst-ticker-item,
body.rtl .ecst-ticker-item {
    direction: rtl;
    text-align: right;
    flex-direction: row-reverse;
}

/* RTL Separator - keep same direction */
html[dir="rtl"] .ecst-ticker-separator,
body.rtl .ecst-ticker-separator {
    margin: 0 1rem;
}

html[dir="rtl"] .ecst-ticker-nav,
body.rtl .ecst-ticker-nav {
    display: flex !important;
    visibility: visible !important;
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.5rem;
    flex-shrink: 0;
    order: 1;
}

html[dir="rtl"] .ecst-ticker-prev,
html[dir="rtl"] .ecst-ticker-next,
body.rtl .ecst-ticker-prev,
body.rtl .ecst-ticker-next {
    display: flex !important;
    visibility: visible !important;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    background: var(--ecst-white, #ffffff);
    border: 1px solid var(--ecst-border-color, #e0e0e0);
    border-radius: var(--ecst-border-radius, 4px);
    cursor: pointer;
    color: var(--ecst-dark-color, #333333);
}

html[dir="rtl"] .ecst-ticker-prev:hover,
html[dir="rtl"] .ecst-ticker-next:hover,
body.rtl .ecst-ticker-prev:hover,
body.rtl .ecst-ticker-next:hover {
    background: var(--ecst-primary-color);
    color: var(--ecst-white, #ffffff);
    border-color: var(--ecst-primary-color);
}

html[dir="rtl"] .ecst-ticker-prev svg,
html[dir="rtl"] .ecst-ticker-next svg,
body.rtl .ecst-ticker-prev svg,
body.rtl .ecst-ticker-next svg {
    display: block !important;
    width: 16px;
    height: 16px;
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    html[dir="rtl"] .ecst-ticker-nav,
    body.rtl .ecst-ticker-nav {
        display: none !important;
    }
}

/* ==========================================================================
   Custom Widgets RTL
   ========================================================================== */
html[dir="rtl"] .ecst-recent-post-item,
html[dir="rtl"] .ecst-popular-post-item,
body.rtl .ecst-recent-post-item,
body.rtl .ecst-popular-post-item {
    flex-direction: row-reverse;
    text-align: right;
}

html[dir="rtl"] .ecst-social-icons-widget,
body.rtl .ecst-social-icons-widget {
    flex-direction: row-reverse;
}

/* Reading Progress Bar RTL */
html[dir="rtl"] .ecst-reading-progress-bar,
body.rtl .ecst-reading-progress-bar {
    right: 0;
    left: auto;
}

/* Table of Contents RTL */
html[dir="rtl"] .ecst-toc-h3,
body.rtl .ecst-toc-h3 {
    padding-left: 0;
    padding-right: var(--ecst-spacing-md);
}

html[dir="rtl"] .ecst-toc-h4,
body.rtl .ecst-toc-h4 {
    padding-left: 0;
    padding-right: var(--ecst-spacing-xl);
}

/* Cookie Notice RTL */
html[dir="rtl"] .ecst-cookie-bottom-left,
body.rtl .ecst-cookie-bottom-left {
    left: auto;
    right: var(--ecst-spacing-lg);
}

html[dir="rtl"] .ecst-cookie-bottom-right,
body.rtl .ecst-cookie-bottom-right {
    right: auto;
    left: var(--ecst-spacing-lg);
}

/* Accessibility Controls RTL */
html[dir="rtl"] .ecst-accessibility-controls,
body.rtl .ecst-accessibility-controls {
    right: auto;
    left: var(--ecst-spacing-md);
}

/* Back to Top RTL - Swap positions */
html[dir="rtl"] .ecst-back-to-top.ecst-back-to-top-right,
body.rtl .ecst-back-to-top.ecst-back-to-top-right {
    right: auto;
    left: 30px;
}

html[dir="rtl"] .ecst-back-to-top.ecst-back-to-top-left,
body.rtl .ecst-back-to-top.ecst-back-to-top-left {
    left: auto;
    right: 30px;
}

/* Author Box RTL */
html[dir="rtl"] .ecst-author-view-all svg,
body.rtl .ecst-author-view-all svg {
    transform: rotate(180deg);
}

html[dir="rtl"] .ecst-post-meta span,
body.rtl .ecst-post-meta span {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-post-tags,
body.rtl .ecst-post-tags {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

html[dir="rtl"] .ecst-read-more,
body.rtl .ecst-read-more {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-read-more svg,
body.rtl .ecst-read-more svg {
    transform: rotate(180deg);
}

html[dir="rtl"] .ecst-category-badge,
body.rtl .ecst-category-badge {
    margin-left: var(--ecst-spacing-sm);
    margin-right: 0;
}

/* ==========================================================================
   Single Post RTL
   ========================================================================== */
html[dir="rtl"] .ecst-single-post .ecst-entry-header,
html[dir="rtl"] .ecst-single-post .ecst-entry-content,
body.rtl .ecst-single-post .ecst-entry-header,
body.rtl .ecst-single-post .ecst-entry-content {
    text-align: right;
}

/* RTL Image Alignments */
html[dir="rtl"] .ecst-entry-content .alignleft,
body.rtl .ecst-entry-content .alignleft {
    float: right;
    margin: 0 0 var(--ecst-spacing-md) var(--ecst-spacing-lg);
}

html[dir="rtl"] .ecst-entry-content .alignright,
body.rtl .ecst-entry-content .alignright {
    float: left;
    margin: 0 var(--ecst-spacing-lg) var(--ecst-spacing-md) 0;
}

html[dir="rtl"] .ecst-entry-content .wp-caption-text,
html[dir="rtl"] .ecst-entry-content figcaption,
body.rtl .ecst-entry-content .wp-caption-text,
body.rtl .ecst-entry-content figcaption {
    text-align: center;
}

html[dir="rtl"] .ecst-author-bio,
body.rtl .ecst-author-bio {
    flex-direction: row-reverse;
    text-align: right;
}

html[dir="rtl"] .ecst-author-avatar,
body.rtl .ecst-author-avatar {
    margin-left: var(--ecst-spacing-lg);
    margin-right: 0;
}

/* Post Navigation RTL */
html[dir="rtl"] .ecst-nav-previous,
body.rtl .ecst-nav-previous {
    flex-direction: row-reverse;
    text-align: right;
}

html[dir="rtl"] .ecst-nav-next,
body.rtl .ecst-nav-next {
    flex-direction: row;
    text-align: left;
}

html[dir="rtl"] .ecst-nav-label svg,
body.rtl .ecst-nav-label svg {
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    html[dir="rtl"] .ecst-nav-next,
    body.rtl .ecst-nav-next {
        flex-direction: row-reverse;
        text-align: right;
    }
}

/* ==========================================================================
   Comments RTL
   ========================================================================== */
html[dir="rtl"] .ecst-comments-area,
body.rtl .ecst-comments-area {
    text-align: right;
}

html[dir="rtl"] .ecst-comment-body,
body.rtl .ecst-comment-body {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-comment-avatar,
body.rtl .ecst-comment-avatar {
    margin-left: var(--ecst-spacing-md);
    margin-right: 0;
}

html[dir="rtl"] .ecst-comment-content,
body.rtl .ecst-comment-content {
    text-align: right;
}

html[dir="rtl"] .ecst-comment-meta,
body.rtl .ecst-comment-meta {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

html[dir="rtl"] .ecst-comment-list,
body.rtl .ecst-comment-list {
    padding-right: 0;
}

html[dir="rtl"] .ecst-comment-list .children,
body.rtl .ecst-comment-list .children {
    padding-right: var(--ecst-spacing-xl);
    padding-left: 0;
    border-right: 2px solid var(--ecst-border-color);
    border-left: none;
}

html[dir="rtl"] .ecst-comment-form input,
html[dir="rtl"] .ecst-comment-form textarea,
body.rtl .ecst-comment-form input,
body.rtl .ecst-comment-form textarea {
    text-align: right;
}

/* ==========================================================================
   Pagination RTL
   ========================================================================== */
html[dir="rtl"] .ecst-pagination,
body.rtl .ecst-pagination {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-pagination .prev svg,
html[dir="rtl"] .ecst-pagination .next svg,
body.rtl .ecst-pagination .prev svg,
body.rtl .ecst-pagination .next svg {
    transform: rotate(180deg);
}

/* ==========================================================================
   Breadcrumbs RTL
   ========================================================================== */
html[dir="rtl"] .ecst-breadcrumbs,
body.rtl .ecst-breadcrumbs {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

html[dir="rtl"] .ecst-breadcrumbs .separator,
body.rtl .ecst-breadcrumbs .separator {
    transform: rotate(180deg);
}

/* ==========================================================================
   Footer RTL
   ========================================================================== */
html[dir="rtl"] .ecst-site-footer,
body.rtl .ecst-site-footer {
    text-align: right;
}

html[dir="rtl"] .ecst-footer-widgets .ecst-container,
body.rtl .ecst-footer-widgets .ecst-container {
    direction: rtl;
}

html[dir="rtl"] .ecst-footer-widget,
body.rtl .ecst-footer-widget {
    text-align: right;
}

html[dir="rtl"] .ecst-footer-widget ul,
body.rtl .ecst-footer-widget ul {
    padding-right: 0;
}

/* Footer Bottom RTL */
html[dir="rtl"] .ecst-footer-bottom,
body.rtl .ecst-footer-bottom {
    direction: ltr;
}

html[dir="rtl"] .ecst-footer-bottom .ecst-container,
body.rtl .ecst-footer-bottom .ecst-container {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-copyright,
body.rtl .ecst-copyright {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .ecst-footer-menu,
body.rtl .ecst-footer-menu {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-footer-menu li,
body.rtl .ecst-footer-menu li {
    direction: rtl;
}

html[dir="rtl"] .ecst-footer-social,
body.rtl .ecst-footer-social {
    flex-direction: row-reverse;
}

/* ==========================================================================
   Footer Layout 2 RTL
   ========================================================================== */
html[dir="rtl"] .ecst-footer-2 .ecst-footer-widgets .ecst-container,
body.rtl .ecst-footer-2 .ecst-footer-widgets .ecst-container {
    grid-template-columns: 1fr 1fr 2fr;
}

html[dir="rtl"] .ecst-footer-2 .ecst-footer-about,
body.rtl .ecst-footer-2 .ecst-footer-about {
    padding-left: var(--ecst-spacing-xl);
    padding-right: 0;
    grid-column: 3;
}

html[dir="rtl"] .ecst-footer-2 .ecst-footer-logo,
body.rtl .ecst-footer-2 .ecst-footer-logo {
    text-align: right;
}

/* ==========================================================================
   Footer Layout 3 RTL
   ========================================================================== */
html[dir="rtl"] .ecst-footer-3,
body.rtl .ecst-footer-3 {
    direction: ltr;
}

html[dir="rtl"] .ecst-footer-3 .ecst-footer-inner,
body.rtl .ecst-footer-3 .ecst-footer-inner {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-footer-3 .ecst-copyright,
body.rtl .ecst-footer-3 .ecst-copyright {
    direction: rtl;
}

/* ==========================================================================
   Footer Layout 4 RTL
   ========================================================================== */
html[dir="rtl"] .ecst-footer-4 .ecst-newsletter-form,
body.rtl .ecst-footer-4 .ecst-newsletter-form {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecst-footer-4 .ecst-newsletter-form input[type="email"],
body.rtl .ecst-footer-4 .ecst-newsletter-form input[type="email"] {
    text-align: right;
    direction: rtl;
    border-radius: 0 var(--ecst-border-radius) var(--ecst-border-radius) 0;
}

html[dir="rtl"] .ecst-footer-4 .ecst-newsletter-form button,
body.rtl .ecst-footer-4 .ecst-newsletter-form button {
    border-radius: var(--ecst-border-radius) 0 0 var(--ecst-border-radius);
}

/* ==========================================================================
   Forms RTL
   ========================================================================== */
html[dir="rtl"] input[type="text"],
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"],
html[dir="rtl"] input[type="password"],
html[dir="rtl"] input[type="search"],
html[dir="rtl"] input[type="number"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] textarea,
html[dir="rtl"] select,
body.rtl input[type="text"],
body.rtl input[type="email"],
body.rtl input[type="url"],
body.rtl input[type="password"],
body.rtl input[type="search"],
body.rtl input[type="number"],
body.rtl input[type="tel"],
body.rtl textarea,
body.rtl select {
    text-align: right;
}

html[dir="rtl"] input[type="checkbox"],
html[dir="rtl"] input[type="radio"],
body.rtl input[type="checkbox"],
body.rtl input[type="radio"] {
    margin-left: 8px;
    margin-right: 0;
}

/* ==========================================================================
   Back to Top RTL
   ========================================================================== */
html[dir="rtl"] .ecst-back-to-top.ecst-back-to-top-right,
body.rtl .ecst-back-to-top.ecst-back-to-top-right {
    right: auto;
    left: 30px;
}

html[dir="rtl"] .ecst-back-to-top.ecst-back-to-top-left,
body.rtl .ecst-back-to-top.ecst-back-to-top-left {
    left: auto;
    right: 30px;
}

/* ==========================================================================
   Social Links RTL
   ========================================================================== */
html[dir="rtl"] .ecst-social-links,
body.rtl .ecst-social-links {
    flex-direction: row-reverse;
}

/* ==========================================================================
   Easy Custom Skin Plugin RTL
   ========================================================================== */
html[dir="rtl"] .ecsf-posts-wrapper,
html[dir="rtl"] .ecsf-shortcode-wrapper,
body.rtl .ecsf-posts-wrapper,
body.rtl .ecsf-shortcode-wrapper {
    direction: rtl;
}

html[dir="rtl"] .ecsf-post-item,
body.rtl .ecsf-post-item {
    text-align: right;
}

html[dir="rtl"] .ecsf-post-meta,
body.rtl .ecsf-post-meta {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

html[dir="rtl"] .ecsf-read-more,
body.rtl .ecsf-read-more {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ecsf-read-more svg,
body.rtl .ecsf-read-more svg {
    transform: rotate(180deg);
}

html[dir="rtl"] .ecsf-pagination,
body.rtl .ecsf-pagination {
    flex-direction: row-reverse;
}

/* ==========================================================================
   Accessibility RTL
   ========================================================================== */
html[dir="rtl"] .screen-reader-text:focus,
body.rtl .screen-reader-text:focus {
    left: auto;
    right: 5px;
}

html[dir="rtl"] .skip-link,
body.rtl .skip-link {
    left: auto;
    right: 50%;
    transform: translateX(50%);
}

html[dir="rtl"] .skip-link:focus,
body.rtl .skip-link:focus {
    right: 50%;
}

/* ==========================================================================
   Responsive RTL - Tablet (max-width: 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
    /* Reset grid to single column on tablet */
    html[dir="rtl"] .ecst-content-sidebar,
    body.rtl .ecst-content-sidebar {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
    }
    
    /* Content area always first */
    html[dir="rtl"] .ecst-posts-area,
    html[dir="rtl"] .ecst-content-area,
    html[dir="rtl"] .ecst-sidebar-right .ecst-posts-area,
    html[dir="rtl"] .ecst-sidebar-right .ecst-content-area,
    html[dir="rtl"] .ecst-sidebar-left .ecst-posts-area,
    html[dir="rtl"] .ecst-sidebar-left .ecst-content-area,
    body.rtl .ecst-posts-area,
    body.rtl .ecst-content-area,
    body.rtl .ecst-sidebar-right .ecst-posts-area,
    body.rtl .ecst-sidebar-right .ecst-content-area,
    body.rtl .ecst-sidebar-left .ecst-posts-area,
    body.rtl .ecst-sidebar-left .ecst-content-area {
        order: 1 !important;
        width: 100% !important;
    }
    
    /* Sidebar always second */
    html[dir="rtl"] .ecst-sidebar,
    html[dir="rtl"] .ecst-sidebar-right .ecst-sidebar,
    html[dir="rtl"] .ecst-sidebar-left .ecst-sidebar,
    body.rtl .ecst-sidebar,
    body.rtl .ecst-sidebar-right .ecst-sidebar,
    body.rtl .ecst-sidebar-left .ecst-sidebar {
        order: 2 !important;
        width: 100% !important;
        padding-right: 0 !important;
        padding-left: 0 !important;
        border-right: none !important;
        border-left: none !important;
        border-top: 1px solid var(--ecst-border-color);
        padding-top: var(--ecst-spacing-xl);
        margin-top: var(--ecst-spacing-xl);
    }
    
    /* Post meta - wrap properly on tablet */
    html[dir="rtl"] .ecst-post-meta,
    body.rtl .ecst-post-meta {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    
    /* List layouts - stack on tablet */
    html[dir="rtl"] .ecst-list-compact .ecst-post,
    html[dir="rtl"] .ecst-list-alt .ecst-post,
    html[dir="rtl"] .ecst-list-alt .ecst-post:nth-child(even),
    body.rtl .ecst-list-compact .ecst-post,
    body.rtl .ecst-list-alt .ecst-post,
    body.rtl .ecst-list-alt .ecst-post:nth-child(even) {
        flex-direction: column !important;
    }
    
    html[dir="rtl"] .ecst-list-compact .ecst-post-thumbnail,
    html[dir="rtl"] .ecst-list-alt .ecst-post-thumbnail,
    body.rtl .ecst-list-compact .ecst-post-thumbnail,
    body.rtl .ecst-list-alt .ecst-post-thumbnail {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        margin-bottom: var(--ecst-spacing-md) !important;
    }
    
    html[dir="rtl"] .ecst-list-compact .ecst-post-content,
    html[dir="rtl"] .ecst-list-alt .ecst-post-content,
    body.rtl .ecst-list-compact .ecst-post-content,
    body.rtl .ecst-list-alt .ecst-post-content {
        width: 100% !important;
        text-align: right !important;
    }
    
    /* Post navigation - side by side with RTL order */
    html[dir="rtl"] .ecst-nav-links,
    body.rtl .ecst-nav-links {
        display: flex;
        flex-direction: row-reverse;
    }
    
    html[dir="rtl"] .ecst-nav-previous,
    body.rtl .ecst-nav-previous {
        flex-direction: row-reverse;
        text-align: right;
    }
    
    html[dir="rtl"] .ecst-nav-next,
    body.rtl .ecst-nav-next {
        flex-direction: row;
        text-align: left;
    }
    
    /* Footer adjustments */
    html[dir="rtl"] .ecst-footer-2 .ecst-footer-about,
    body.rtl .ecst-footer-2 .ecst-footer-about {
        padding-left: 0;
        grid-column: span 2;
    }
    
    /* Related posts grid - 2 columns on tablet */
    html[dir="rtl"] .ecst-related-posts-grid,
    body.rtl .ecst-related-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================================================
   Responsive RTL - Mobile (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
    /* Topbar stacked */
    html[dir="rtl"] .ecst-topbar .ecst-container,
    body.rtl .ecst-topbar .ecst-container {
        flex-direction: column;
    }
    
    html[dir="rtl"] .ecst-topbar-left,
    html[dir="rtl"] .ecst-topbar-right,
    body.rtl .ecst-topbar-left,
    body.rtl .ecst-topbar-right {
        width: 100%;
        justify-content: center;
        flex-direction: row-reverse;
    }
    
    /* Header stacked */
    html[dir="rtl"] .ecst-header-main .ecst-container,
    body.rtl .ecst-header-main .ecst-container {
        flex-direction: column;
    }
    
    /* Mobile Menu - Vertical, RTL text */
    html[dir="rtl"] .ecst-primary-menu,
    body.rtl .ecst-primary-menu {
        flex-direction: column;
        direction: rtl;
    }
    
    html[dir="rtl"] .ecst-primary-menu > li > a,
    body.rtl .ecst-primary-menu > li > a {
        justify-content: flex-start;
        text-align: right;
    }
    
    html[dir="rtl"] .ecst-primary-menu .sub-menu,
    body.rtl .ecst-primary-menu .sub-menu {
        position: static;
        right: auto;
        padding-right: var(--ecst-spacing-lg);
        padding-left: 0;
    }
    
    /* Content-sidebar ensure proper stacking */
    html[dir="rtl"] .ecst-content-sidebar,
    body.rtl .ecst-content-sidebar {
        display: flex !important;
        flex-direction: column !important;
    }
    
    html[dir="rtl"] .ecst-posts-area,
    html[dir="rtl"] .ecst-content-area,
    body.rtl .ecst-posts-area,
    body.rtl .ecst-content-area {
        order: 1 !important;
        width: 100% !important;
    }
    
    html[dir="rtl"] .ecst-sidebar,
    body.rtl .ecst-sidebar {
        order: 2 !important;
        width: 100% !important;
    }
    
    /* Post meta - centered on mobile */
    html[dir="rtl"] .ecst-post-meta,
    body.rtl .ecst-post-meta {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    /* Single post header - centered on mobile */
    html[dir="rtl"] .ecst-single-post .ecst-entry-header,
    body.rtl .ecst-single-post .ecst-entry-header {
        text-align: center;
    }
    
    html[dir="rtl"] .ecst-single-post .ecst-category-badge,
    body.rtl .ecst-single-post .ecst-category-badge {
        display: inline-block;
        margin: 0 auto var(--ecst-spacing-sm) auto;
    }
    
    /* Post navigation - stacked on mobile */
    html[dir="rtl"] .ecst-post-navigation,
    html[dir="rtl"] .ecst-nav-links,
    body.rtl .ecst-post-navigation,
    body.rtl .ecst-nav-links {
        display: flex;
        flex-direction: column;
        gap: var(--ecst-spacing-md);
    }
    
    html[dir="rtl"] .ecst-nav-previous,
    html[dir="rtl"] .ecst-nav-next,
    body.rtl .ecst-nav-previous,
    body.rtl .ecst-nav-next {
        width: 100%;
        flex-direction: row-reverse !important;
        text-align: right !important;
    }
    
    /* Author bio - stacked and centered */
    html[dir="rtl"] .ecst-author-bio,
    html[dir="rtl"] .ecst-author-box,
    body.rtl .ecst-author-bio,
    body.rtl .ecst-author-box {
        flex-direction: column;
        text-align: center;
    }
    
    html[dir="rtl"] .ecst-author-avatar,
    body.rtl .ecst-author-avatar {
        margin-left: 0;
        margin-right: 0;
        margin-bottom: var(--ecst-spacing-md);
    }
    
    html[dir="rtl"] .ecst-author-info,
    body.rtl .ecst-author-info {
        text-align: center;
    }
    
    html[dir="rtl"] .ecst-author-social,
    body.rtl .ecst-author-social {
        justify-content: center;
    }
    
    /* Comments - stacked */
    html[dir="rtl"] .ecst-comment-body,
    body.rtl .ecst-comment-body {
        flex-direction: column;
    }
    
    html[dir="rtl"] .ecst-comment-avatar,
    body.rtl .ecst-comment-avatar {
        margin-left: 0;
        margin-right: 0;
        margin-bottom: var(--ecst-spacing-sm);
    }
    
    html[dir="rtl"] .ecst-comment-content,
    body.rtl .ecst-comment-content {
        text-align: right;
    }
    
    /* Related posts - single column */
    html[dir="rtl"] .ecst-related-posts-grid,
    body.rtl .ecst-related-posts-grid {
        grid-template-columns: 1fr;
    }
    
    html[dir="rtl"] .ecst-related-post-content,
    body.rtl .ecst-related-post-content {
        text-align: right;
    }
    
    /* Footer stacked */
    html[dir="rtl"] .ecst-footer-widgets .ecst-container,
    body.rtl .ecst-footer-widgets .ecst-container {
        grid-template-columns: 1fr;
    }
    
    html[dir="rtl"] .ecst-footer-bottom .ecst-container,
    body.rtl .ecst-footer-bottom .ecst-container {
        flex-direction: column;
        text-align: center;
    }
    
    html[dir="rtl"] .ecst-footer-menu,
    body.rtl .ecst-footer-menu {
        justify-content: center;
    }
    
    html[dir="rtl"] .ecst-footer-social,
    body.rtl .ecst-footer-social {
        justify-content: center;
    }
    
    html[dir="rtl"] .ecst-footer-2 .ecst-footer-widgets .ecst-container,
    body.rtl .ecst-footer-2 .ecst-footer-widgets .ecst-container {
        grid-template-columns: 1fr;
    }
    
    html[dir="rtl"] .ecst-footer-2 .ecst-footer-about,
    body.rtl .ecst-footer-2 .ecst-footer-about {
        grid-column: auto;
    }
    
    html[dir="rtl"] .ecst-footer-3 .ecst-footer-inner,
    body.rtl .ecst-footer-3 .ecst-footer-inner {
        flex-direction: column;
        text-align: center;
    }
    
    /* Newsletter form stacked */
    html[dir="rtl"] .ecst-footer-4 .ecst-newsletter-form,
    body.rtl .ecst-footer-4 .ecst-newsletter-form {
        flex-direction: column;
    }
    
    html[dir="rtl"] .ecst-footer-4 .ecst-newsletter-form input[type="email"],
    html[dir="rtl"] .ecst-footer-4 .ecst-newsletter-form button,
    body.rtl .ecst-footer-4 .ecst-newsletter-form input[type="email"],
    body.rtl .ecst-footer-4 .ecst-newsletter-form button {
        border-radius: var(--ecst-border-radius);
    }
    
    /* Back to top - swap positions */
    html[dir="rtl"] .ecst-back-to-top.ecst-back-to-top-right,
    body.rtl .ecst-back-to-top.ecst-back-to-top-right {
        left: 20px;
        right: auto;
    }
    
    html[dir="rtl"] .ecst-back-to-top.ecst-back-to-top-left,
    body.rtl .ecst-back-to-top.ecst-back-to-top-left {
        right: 20px;
        left: auto;
    }
    
    /* Social share - centered */
    html[dir="rtl"] .ecst-social-share,
    body.rtl .ecst-social-share {
        justify-content: center;
        flex-direction: column;
        align-items: center;
    }
    
    html[dir="rtl"] .ecst-share-buttons,
    body.rtl .ecst-share-buttons {
        justify-content: center;
    }
    
    /* Tags - centered */
    html[dir="rtl"] .ecst-post-tags,
    body.rtl .ecst-post-tags {
        justify-content: center;
        text-align: center;
    }
    
    html[dir="rtl"] .ecst-post-tags-list,
    body.rtl .ecst-post-tags-list {
        justify-content: center;
    }
    
    /* Breadcrumbs - centered */
    html[dir="rtl"] .ecst-breadcrumbs,
    body.rtl .ecst-breadcrumbs {
        justify-content: center;
        text-align: center;
    }
    
    /* Entry footer - centered */
    html[dir="rtl"] .ecst-entry-footer,
    body.rtl .ecst-entry-footer {
        text-align: center;
    }
    
    /* List layouts - stacked */
    html[dir="rtl"] .ecst-list-compact .ecst-post,
    html[dir="rtl"] .ecst-list-alt .ecst-post,
    html[dir="rtl"] .ecst-list-alt .ecst-post:nth-child(even),
    body.rtl .ecst-list-compact .ecst-post,
    body.rtl .ecst-list-alt .ecst-post,
    body.rtl .ecst-list-alt .ecst-post:nth-child(even) {
        flex-direction: column !important;
    }
    
    html[dir="rtl"] .ecst-list-compact .ecst-post-thumbnail,
    html[dir="rtl"] .ecst-list-alt .ecst-post-thumbnail,
    body.rtl .ecst-list-compact .ecst-post-thumbnail,
    body.rtl .ecst-list-alt .ecst-post-thumbnail {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    html[dir="rtl"] .ecst-list-compact .ecst-post-content,
    html[dir="rtl"] .ecst-list-alt .ecst-post-content,
    body.rtl .ecst-list-compact .ecst-post-content,
    body.rtl .ecst-list-alt .ecst-post-content {
        width: 100% !important;
        text-align: right;
    }
}

/* ==========================================================================
   Admin Bar RTL
   ========================================================================== */
html[dir="rtl"] .admin-bar .ecst-header-sticky,
body.rtl.admin-bar .ecst-header-sticky {
    top: 32px;
}

@media (max-width: 782px) {
    html[dir="rtl"] .admin-bar .ecst-header-sticky,
    body.rtl.admin-bar .ecst-header-sticky {
        top: 46px;
    }
}

/* ==========================================================================
   Print RTL
   ========================================================================== */
@media print {
    html[dir="rtl"],
    body.rtl {
        direction: rtl;
        text-align: right;
    }
}
