/* Ensure name is on the right and email on the left in RTL comment form */
.rtl .comment-form-row {
    display: flex;
    flex-direction: row-reverse;
    gap: 20px;
}
/* ================================================================
   RTL Styles for Farsi and Pashto - Updated
   ================================================================ */

/* Global RTL Setup */
body {
    direction: rtl;
    text-align: right;
}

/* --- THE FIX: Header Containers (Sidebar & Sections) --- */
.sidebar-header,
.section-header,
.widget-header,
.d-flex.justify-content-between.align-items-center {
    display: flex !important;
    flex-direction: row !important; /* In RTL, 'row' starts from the Right */
    justify-content: space-between !important; /* Forces items to opposite ends */
    width: 100% !important; 
    align-items: center !important;
}

.mb-3{
    margin-bottom: 0px !important;
}

/* Ensure the comment form container is RTL */
.comment-form-wrapper {
    direction: rtl;
    text-align: right;
}

/* Align placeholders to the right */
.comment-form-wrapper input::placeholder,
.comment-form-wrapper textarea::placeholder {
    text-align: right;
}

/* Align comment form title to the right in RTL */
.rtl .comment-form-title {
    text-align: right;
    direction: rtl;
}

/* Indent nested comments from the right in RTL */
.rtl .comments-list .depth-2 {
    margin-right: 40px;
    margin-left: 0;
}

/* Style the checkbox area */
.comment-form-cookies-consent {
    display: flex;
    align-items: center;
    gap: 10px;
    direction: rtl;
}

.comment-form-cookies-consent input {
    margin: 0 0 0 10px; /* Space to the left of checkbox in RTL */
}

/* Specific fix for the text inside headers */
.sidebar-header h3,
.section-header h3,
.section-header h2,
.widget-title {
    margin: 0 !important;
    text-align: right !important;
    direction: rtl !important; /* Override LTR direction */
}

/* Ensure the 'See More' link is pushed to the left */
.sidebar-more,
.section-header a,
.widget-more {
    margin-right: auto !important; /* Pushes element to the left in RTL */
    margin-left: 0 !important;
    text-align: left !important;
    white-space: nowrap; /* Prevents text from breaking */
    direction: rtl !important; /* Override LTR direction */
    flex-direction: row-reverse !important; /* Icon on left, text on right */
}

/* Fix icon spacing in widget-more for RTL */
.widget-more i {
    margin-right: 5px !important;
    margin-left: 0 !important;
}

/* --- Sidebar Post List (Image on Right, Text on Left) --- */
.sidebar-post {
    display: flex !important;
    flex-direction: row !important;
    gap: 12px;
}

.sidebar-post-thumbnail {
    order: 1; /* Keep image on the right */
}

.sidebar-post-content {
    order: 2; /* Keep text on the left */
    text-align: right !important;
}

/* --- Two-Column Notes Section (Image on Right, Text on Left) --- */
.column-post-item {
    display: grid !important;
    grid-template-columns: 1fr 2fr !important; /* Reverse: image first, content second */
    direction: ltr !important; /* Force LTR grid flow */
}

.column-post-item .column-post-image {
    order: 1; /* Image on the right */
}

.column-post-item .column-post-content {
    order: 2; /* Content on the left */
    text-align: right !important;
    direction: rtl !important; /* Keep text RTL */
}

.column-post-content h3,
.column-post-title {
    text-align: right !important;
}

.column-post-excerpt {
    text-align: right !important;
}

.column-post-meta {
    display: flex !important;
    flex-direction: row-reverse !important;
    justify-content: flex-end !important;
    gap: 15px;
}

.column-post-category-overlay {
    left: auto !important;
    right: 10px !important;
}

/* --- Global Utilities --- */

/* Icons rotation: Point the chevron left for RTL */
.fa-chevron-right,
.fa-chevron-left,
.fa-arrow-right,
.fa-arrow-left {
    display: inline-block;
    transform: scaleX(-1) !important;
}

/* Reverse Floats */
.float-left { float: right !important; }
.float-right { float: left !important; }

/* Text alignment */
.text-left { text-align: right !important; }
.text-right { text-align: left !important; }

/* Lists */
ul, ol {
    padding-right: 20px;
    padding-left: 0;
}

/* Slider Controls Logic */
.hero-slider-prev,
.category-slider-prev {
    right: 20px !important;
    left: auto !important;
}

.hero-slider-next,
.category-slider-next {
    left: 20px !important;
    right: auto !important;
}

/* Grid & Row Overrides */
/* Note: We use 'row' because 'direction: rtl' on the body 
   automatically handles the column swapping. */
.row {
    display: flex;
    flex-direction: row !important;
}

/* Search form */
.search-box {
    display: flex;
    flex-direction: row !important;
}

.search-box input {
    border-radius: 20px !important;
    text-align: right !important;
}

.search-box button {
    border-radius: 20px !important;
    right: 150px !important;
}

/* Mobile search form - center it */
@media (max-width: 992px) {
    .search-box {
        margin: 0 auto !important;
        justify-content: center !important;
    }
    
    .search-box input {
        text-align: center !important;
    }
}

.single-post-category-badge{
    right: 40px !important;
    left: auto !important;
}

.single-post-social-overlay{
    left: 20px !important;
    right: auto !important;
    bottom: 20px !important;
}

/* ========================================
   Keep Header/Top Bar in LTR Layout
   ======================================== */
/* Force top-bar and its children to use LTR direction */
.top-bar,
.top-bar .container-header {
    direction: ltr !important;
}

/* Keep header logo on the left */
.header-logo {
    order: 1 !important;
}

/* Keep top-right-elements on the right */
.top-right-elements {
    order: 2 !important;
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* Keep social icons in LTR order */
.social-icons {
    display: flex !important;
    flex-direction: row !important;
    gap: 15px;
    align-items: center;
}

/* Keep utility icons in LTR order */
.utility-icons {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px;
}
 /* This triggers only when the language is RTL (Farsi/Pashto) */
.rtl .category-breadcrumb {
    display: flex;
    flex-direction: row-reverse; /* Flips the order of Home and Title */
    justify-content: flex-start;
    direction: rtl;
}

.rtl .category-breadcrumb .separator {
    margin: 0 10px;
    transform: scaleX(-1); /* Flips the slash if needed */
}

.rtl .category-header {
    text-align: right;
}

/* Ensure the grid and meta info also flip */
.rtl .category-post-item {
    direction: rtl;
    text-align: right;
}

.rtl .category-post-meta span {
    margin-left: 15px;
    margin-right: 0;
}

.rtl .category-post-meta i {
    margin-left: 5px;
    margin-right: 0;
}
/* Mirror the Category Header and Breadcrumb */
.rtl .category-header {
    text-align: right; /* Aligns the text to the right */
    direction: rtl;    /* Ensures punctuation/slashes sit correctly */
}

.rtl .category-breadcrumb {
    display: flex;
    justify-content: flex-start; /* Keeps items at the start of the right side */
    flex-direction: row;        /* Keeps the word order consistent */
}

/* Add spacing for the separator in RTL */
.rtl .category-breadcrumb .separator {
    margin: 0 10px;
}

/* Mirror the Main Content Grid */
.rtl .category-post-item {
    direction: rtl;
    text-align: right;
}

/* If you are using Bootstrap, ensure the row is mirrored */
.rtl .row {
    flex-direction: row-reverse;
}