/**
 * Feminism Magazine - RTL Styles (Task 278)
 *
 * Right-to-Left layout support for Arabic, Hebrew, and other RTL languages
 *
 * @version 1.0.0
 */

/* ========================================
   RTL DIRECTION
   ======================================== */

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

/* ========================================
   LAYOUT FLIPS
   ======================================== */

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

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

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

/* Grid layouts */
[dir="rtl"] .grid,
.rtl .grid,
[dir="rtl"] .posts-grid,
.rtl .posts-grid {
    direction: rtl;
}

[dir="rtl"] .grid > *,
.rtl .grid > * {
    direction: ltr;
}

/* Flex layouts */
[dir="rtl"] .flex-row,
.rtl .flex-row {
    flex-direction: row-reverse;
}

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

/* ========================================
   TEXT ALIGNMENT
   ======================================== */

[dir="rtl"] .text-left,
.rtl .text-left {
    text-align: right;
}

[dir="rtl"] .text-right,
.rtl .text-right {
    text-align: left;
}

[dir="rtl"] .text-center,
.rtl .text-center {
    text-align: center;
}

/* ========================================
   SPACING ADJUSTMENTS
   ======================================== */

[dir="rtl"] .mr-auto,
.rtl .mr-auto {
    margin-right: 0;
    margin-left: auto;
}

[dir="rtl"] .ml-auto,
.rtl .ml-auto {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .pl-1, [dir="rtl"] .pl-2, [dir="rtl"] .pl-3, [dir="rtl"] .pl-4,
.rtl .pl-1, .rtl .pl-2, .rtl .pl-3, .rtl .pl-4 {
    padding-left: 0;
}

[dir="rtl"] .pr-1, [dir="rtl"] .pr-2, [dir="rtl"] .pr-3, [dir="rtl"] .pr-4,
.rtl .pr-1, .rtl .pr-2, .rtl .pr-3, .rtl .pr-4 {
    padding-right: 0;
}

/* ========================================
   BORDERS
   ======================================== */

[dir="rtl"] .border-l,
.rtl .border-l {
    border-left: none;
    border-right-width: 1px;
    border-right-style: solid;
}

[dir="rtl"] .border-r,
.rtl .border-r {
    border-right: none;
    border-left-width: 1px;
    border-left-style: solid;
}

/* ========================================
   ICONS & ARROWS
   ======================================== */

[dir="rtl"] .icon-arrow-right,
.rtl .icon-arrow-right {
    transform: scaleX(-1);
}

[dir="rtl"] .icon-arrow-left,
.rtl .icon-arrow-left {
    transform: scaleX(-1);
}

[dir="rtl"] .chevron-right,
.rtl .chevron-right {
    transform: rotate(180deg);
}

/* Dropdown arrows */
[dir="rtl"] .has-dropdown::after,
.rtl .has-dropdown::after {
    margin-left: 0;
    margin-right: 0.5rem;
}

/* ========================================
   NAVIGATION
   ======================================== */

[dir="rtl"] .nav-link,
.rtl .nav-link {
    flex-direction: row-reverse;
}

[dir="rtl"] .mobile-nav-link,
.rtl .mobile-nav-link {
    text-align: right;
}

/* ========================================
   CARDS & POSTS
   ======================================== */

[dir="rtl"] .post-card,
.rtl .post-card {
    text-align: right;
}

[dir="rtl"] .post-card__meta,
.rtl .post-card__meta {
    flex-direction: row-reverse;
}

[dir="rtl"] .category-badge,
.rtl .category-badge {
    right: auto;
    left: 1rem;
}

/* ========================================
   SIDEBAR
   ======================================== */

[dir="rtl"] .sidebar,
.rtl .sidebar {
    border-left: none;
    border-right: 1px solid var(--color-border);
}

[dir="rtl"] .trending-item,
.rtl .trending-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .trending-number,
.rtl .trending-number {
    margin-right: 0;
    margin-left: var(--space-sm);
}

[dir="rtl"] .sidebar-item,
.rtl .sidebar-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .sidebar-item-image,
.rtl .sidebar-item-image {
    margin-right: 0;
    margin-left: var(--space-sm);
}

/* ========================================
   FORMS
   ======================================== */

[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select,
.rtl input,
.rtl textarea,
.rtl select {
    text-align: right;
}

[dir="rtl"] .input-group,
.rtl .input-group {
    flex-direction: row-reverse;
}

[dir="rtl"] .input-group .btn,
.rtl .input-group .btn {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

[dir="rtl"] .input-group input,
.rtl .input-group input {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ========================================
   BUTTONS
   ======================================== */

[dir="rtl"] .btn svg,
[dir="rtl"] button svg,
.rtl .btn svg,
.rtl button svg {
    margin-right: 0;
    margin-left: 0.5rem;
}

[dir="rtl"] .btn--icon svg,
.rtl .btn--icon svg {
    margin: 0;
}

/* ========================================
   BREADCRUMBS
   ======================================== */

[dir="rtl"] .breadcrumb,
.rtl .breadcrumb {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

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

/* ========================================
   PAGINATION
   ======================================== */

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

[dir="rtl"] .pagination .prev,
.rtl .pagination .prev {
    order: 1;
}

[dir="rtl"] .pagination .next,
.rtl .pagination .next {
    order: -1;
}

/* ========================================
   ARTICLE CONTENT
   ======================================== */

[dir="rtl"] .entry-content,
.rtl .entry-content {
    text-align: right;
}

[dir="rtl"] .entry-content ul,
[dir="rtl"] .entry-content ol,
.rtl .entry-content ul,
.rtl .entry-content ol {
    padding-left: 0;
    padding-right: 1.5rem;
}

[dir="rtl"] .entry-content blockquote,
.rtl .entry-content blockquote {
    border-left: none;
    border-right: 4px solid var(--color-primary);
    padding-left: 0;
    padding-right: 1.5rem;
}

[dir="rtl"] .entry-content blockquote cite,
.rtl .entry-content blockquote cite {
    text-align: left;
}

/* Pullquotes */
[dir="rtl"] .pullquote,
.rtl .pullquote {
    float: left;
    margin-right: 0;
    margin-left: 2rem;
}

[dir="rtl"] .pullquote--right,
.rtl .pullquote--right {
    float: right;
    margin-left: 0;
    margin-right: 2rem;
}

/* ========================================
   TABLES
   ======================================== */

[dir="rtl"] table,
.rtl table {
    text-align: right;
}

[dir="rtl"] th,
[dir="rtl"] td,
.rtl th,
.rtl td {
    text-align: right;
}

/* ========================================
   COMMENTS
   ======================================== */

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

[dir="rtl"] .comment-avatar,
.rtl .comment-avatar {
    margin-right: 0;
    margin-left: 1rem;
    float: right;
}

[dir="rtl"] .comment-body,
.rtl .comment-body {
    margin-left: 0;
    margin-right: 4rem;
}

[dir="rtl"] .comment-reply,
.rtl .comment-reply {
    right: auto;
    left: 0;
}

/* Comment nesting */
[dir="rtl"] .children,
.rtl .children {
    padding-left: 0;
    padding-right: 2rem;
    border-left: none;
    border-right: 2px solid var(--color-border);
}

/* ========================================
   SEARCH
   ======================================== */

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

[dir="rtl"] .search-submit,
.rtl .search-submit {
    right: auto;
    left: 0;
}

[dir="rtl"] .search-input,
.rtl .search-input {
    padding-right: var(--space-md);
    padding-left: 3rem;
}

/* ========================================
   HERO SECTION
   ======================================== */

[dir="rtl"] .hero,
.rtl .hero {
    text-align: right;
}

[dir="rtl"] .hero__content,
.rtl .hero__content {
    align-items: flex-start;
}

[dir="rtl"] .hero__meta,
.rtl .hero__meta {
    flex-direction: row-reverse;
}

/* ========================================
   SHARE BUTTONS
   ======================================== */

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

/* ========================================
   NOTIFICATIONS & ALERTS
   ======================================== */

[dir="rtl"] .alert,
.rtl .alert {
    padding-left: var(--space-md);
    padding-right: 3rem;
}

[dir="rtl"] .alert::before,
.rtl .alert::before {
    left: auto;
    right: 1rem;
}

[dir="rtl"] .alert__close,
.rtl .alert__close {
    right: auto;
    left: 0.5rem;
}

/* ========================================
   MODALS
   ======================================== */

[dir="rtl"] .modal,
.rtl .modal {
    text-align: right;
}

[dir="rtl"] .modal__close,
.rtl .modal__close {
    right: auto;
    left: 1rem;
}

/* ========================================
   OFFCANVAS / MOBILE MENU
   ======================================== */

[dir="rtl"] .mobile-menu,
.rtl .mobile-menu {
    left: auto;
    right: -100%;
}

[dir="rtl"] .mobile-menu.is-open,
.rtl .mobile-menu.is-open {
    right: 0;
    left: auto;
}

/* ========================================
   READING PROGRESS
   ======================================== */

[dir="rtl"] .reading-progress-bar,
.rtl .reading-progress-bar {
    left: auto;
    right: 0;
}

/* ========================================
   LANGUAGE SWITCHER
   ======================================== */

[dir="rtl"] .fem-language-switcher__dropdown,
.rtl .fem-language-switcher__dropdown {
    left: auto;
    right: 0;
}

/* ========================================
   ARABIC/HEBREW SPECIFIC
   ======================================== */

/* Arabic-specific font adjustments */
html[lang="ar"] body,
html[lang="ar"] .entry-content,
html[lang="ar"] .post-card {
    font-feature-settings: "calt" 1;
    line-height: 1.8;
}

/* Hebrew-specific adjustments */
html[lang="he"] body,
html[lang="he"] .entry-content {
    font-feature-settings: "calt" 1;
}

/* Cursive connections for Arabic */
.arabic-text {
    font-family: 'Noto Sans Arabic', 'Droid Arabic Naskh', 'Arial', sans-serif;
    line-height: 1.8;
}

.hebrew-text {
    font-family: 'Noto Sans Hebrew', 'Arial Hebrew', sans-serif;
}

/* ========================================
   DATE & NUMBER FORMATTING
   ======================================== */

[dir="rtl"] time,
.rtl time {
    direction: ltr;
    display: inline-block;
}

[dir="rtl"] .post-date,
.rtl .post-date {
    direction: ltr;
}

/* Phone numbers */
[dir="rtl"] .phone-number,
.rtl .phone-number,
[dir="rtl"] a[href^="tel:"],
.rtl a[href^="tel:"] {
    direction: ltr;
    display: inline-block;
    unicode-bidi: embed;
}

/* Email addresses */
[dir="rtl"] a[href^="mailto:"],
.rtl a[href^="mailto:"] {
    direction: ltr;
    display: inline-block;
    unicode-bidi: embed;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    [dir="rtl"] body,
    .rtl body {
        text-align: right;
    }
}

/* ========================================
   RESPONSIVE RTL
   ======================================== */

@media (max-width: 768px) {
    [dir="rtl"] .sidebar,
    .rtl .sidebar {
        border-right: none;
        border-top: 1px solid var(--color-border);
    }

    [dir="rtl"] .pullquote,
    [dir="rtl"] .pullquote--right,
    .rtl .pullquote,
    .rtl .pullquote--right {
        float: none;
        margin: 2rem 0;
        width: 100%;
    }
}

/* ========================================
   ANIMATION FIXES FOR RTL
   ======================================== */

[dir="rtl"] .slide-in-left,
.rtl .slide-in-left {
    animation-name: slideInRight;
}

[dir="rtl"] .slide-in-right,
.rtl .slide-in-right {
    animation-name: slideInLeft;
}

@keyframes slideInLeft {
    from {
        transform: translate3d(-100%, 0, 0);
        visibility: visible;
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideInRight {
    from {
        transform: translate3d(100%, 0, 0);
        visibility: visible;
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

/* ========================================
   SCROLL DIRECTION
   ======================================== */

[dir="rtl"] .custom-scrollbar,
.rtl .custom-scrollbar {
    direction: rtl;
}

/* Hide scrollbar buttons for RTL consistency */
[dir="rtl"] ::-webkit-scrollbar-button,
.rtl ::-webkit-scrollbar-button {
    display: none;
}

/* ========================================
   TOOLTIPS
   ======================================== */

[dir="rtl"] [data-tooltip]::after,
.rtl [data-tooltip]::after {
    left: auto;
    right: 50%;
    transform: translateX(50%);
}

[dir="rtl"] [data-tooltip-position="right"]::after,
.rtl [data-tooltip-position="right"]::after {
    left: 100%;
    right: auto;
    transform: translateY(-50%);
}

[dir="rtl"] [data-tooltip-position="left"]::after,
.rtl [data-tooltip-position="left"]::after {
    right: 100%;
    left: auto;
    transform: translateY(-50%);
}

/* ========================================
   COMPLIANCE BANNER RTL
   ======================================== */

[dir="rtl"] .fem-cookie-banner__container,
.rtl .fem-cookie-banner__container {
    flex-direction: row-reverse;
}

[dir="rtl"] .fem-cookie-banner__content,
.rtl .fem-cookie-banner__content {
    text-align: right;
}

[dir="rtl"] .fem-cookie-category__header,
.rtl .fem-cookie-category__header {
    flex-direction: row-reverse;
}

[dir="rtl"] .fem-cookie-category p,
.rtl .fem-cookie-category p {
    margin-left: 0;
    margin-right: 2rem;
}

/* ========================================
   MISC UTILITIES
   ======================================== */

[dir="rtl"] .float-left,
.rtl .float-left {
    float: right;
}

[dir="rtl"] .float-right,
.rtl .float-right {
    float: left;
}

[dir="rtl"] .clear-left,
.rtl .clear-left {
    clear: right;
}

[dir="rtl"] .clear-right,
.rtl .clear-right {
    clear: left;
}

/* Transform origin fixes */
[dir="rtl"] .transform-origin-left,
.rtl .transform-origin-left {
    transform-origin: right center;
}

[dir="rtl"] .transform-origin-right,
.rtl .transform-origin-right {
    transform-origin: left center;
}