/* Zhongwen Pro - RTL (Right-to-Left) Stylesheet
 * 支持阿拉伯语、波斯语、希伯来语、乌尔都语
 * 包含多语言文本溢出保护 */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}
/* === RTL Multi-language Text Overflow Protection === */
[dir="rtl"] .btn, [dir="rtl"] .badge, [dir="rtl"] .nav-link,
[dir="rtl"] .dropdown-item, [dir="rtl"] .card-title, [dir="rtl"] .card-text,
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6,
[dir="rtl"] p, [dir="rtl"] span, [dir="rtl"] label, [dir="rtl"] th, [dir="rtl"] td,
[dir="rtl"] li, [dir="rtl"] a, [dir="rtl"] small {
    word-break: break-word;
    overflow-wrap: break-word;
}
[dir="rtl"] .text-truncate-ml {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
[dir="rtl"] .d-flex, [dir="rtl"] .btn-group, [dir="rtl"] .navbar-nav {
    flex-wrap: wrap;
}
/* RTL - Navbar layout fixes */
[dir="rtl"] .navbar > .container,
[dir="rtl"] .navbar > .container-fluid {
    flex-direction: row-reverse;
}
[dir="rtl"] .navbar-brand {
    margin-right: 0;
    margin-left: 1rem;
}
[dir="rtl"] .navbar-toggler {
    margin-right: auto;
    margin-left: 0;
}
[dir="rtl"] .navbar-collapse {
    flex-grow: 1;
}
[dir="rtl"] .navbar-nav {
    padding-right: 0;
    margin-right: 0;
}
[dir="rtl"] .navbar-nav .nav-link {
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}
[dir="rtl"] .navbar-nav .dropdown-menu {
    text-align: right;
    right: 0;
    left: auto;
}
[dir="rtl"] .navbar .d-flex.align-items-center {
    flex-direction: row-reverse;
}
[dir="rtl"] .navbar .d-flex.align-items-center .btn-sm {
    white-space: nowrap;
}
/* RTL - Auth buttons */
[dir="rtl"] .navbar .btn-sm {
    white-space: nowrap;
    flex-shrink: 0;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* RTL - User menu button */
[dir="rtl"] .user-menu-btn {
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* RTL - Language switcher */
[dir="rtl"] .lang-switcher .lang-btn {
    max-width: 140px; overflow: hidden; text-overflow: ellipsis;
}
[dir="rtl"] .lang-switcher .lang-name {
    max-width: 60px; overflow: hidden; text-overflow: ellipsis;
}
[dir="rtl"] .lang-list .dropdown-item {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* RTL - Mobile bottom nav */
[dir="rtl"] .mobile-bottom-nav .bottom-nav-item span {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* RTL - Pricing cards */
[dir="rtl"] .pricing-plans .card h5 {
    word-break: break-word; overflow-wrap: break-word;
}
[dir="rtl"] .pricing-plans .card .badge {
    white-space: nowrap; max-width: 180px;
    overflow: hidden; text-overflow: ellipsis;
}
/* RTL - Forms */
[dir="rtl"] .form-label { word-break: break-word; overflow-wrap: break-word; }
[dir="rtl"] .navbar-nav { padding-right: 0; }
[dir="rtl"] .navbar-nav .nav-link { margin-left: 0; margin-right: 0.5rem; }
[dir="rtl"] .me-auto { margin-left: auto !important; margin-right: 0 !important; }
[dir="rtl"] .ms-auto { margin-right: auto !important; margin-left: 0 !important; }
[dir="rtl"] .me-0 { margin-right: 0 !important; margin-left: 0 !important; }
[dir="rtl"] .ms-0 { margin-left: 0 !important; margin-right: 0 !important; }
[dir="rtl"] .me-1, [dir="rtl"] .me-2, [dir="rtl"] .me-3 { margin-left: 0.25rem !important; margin-right: 0 !important; }
[dir="rtl"] .ms-1, [dir="rtl"] .ms-2, [dir="rtl"] .ms-3 { margin-right: 0.25rem !important; margin-left: 0 !important; }
[dir="rtl"] .dropdown-menu { text-align: right; }
[dir="rtl"] .dropdown-menu-end { left: 0; right: auto; }
[dir="rtl"] .input-group > .form-control { border-radius: 0 8px 8px 0; }
[dir="rtl"] .input-group > .input-group-text:first-child { border-radius: 8px 0 0 8px; }
[dir="rtl"] .input-group > .input-group-text:last-child { border-radius: 8px 0 0 8px; }
[dir="rtl"] .form-check { padding-left: 0; padding-right: 1.5em; }
[dir="rtl"] .form-check-input { float: right; margin-left: 0; margin-right: -1.5em; }
[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before { content: "‹"; float: right; padding: 0 0.5rem; }
[dir="rtl"] .breadcrumb-item + .breadcrumb-item { padding-left: 0; padding-right: 0.5rem; }
[dir="rtl"] .list-group { padding-right: 0; }
[dir="rtl"] .pagination { padding-right: 0; }
[dir="rtl"] .course-badges { right: auto; left: 8px; }
[dir="rtl"] .stretched-link::after { right: 0; }
[dir="rtl"] .admin-sidebar { left: auto; right: 0; border-left: 1px solid rgba(255,255,255,0.1); border-right: none; }
[dir="rtl"] .admin-sidebar .nav-link { border-left: none; border-right: 3px solid transparent; }
[dir="rtl"] .admin-sidebar .nav-link:hover,
[dir="rtl"] .admin-sidebar .nav-link.active { border-left-color: transparent; border-right-color: var(--zw-red); }
[dir="rtl"] .admin-main { margin-right: 250px; margin-left: 0; }
[dir="rtl"] .btn-group > .btn:first-child { border-radius: 0 8px 8px 0; }
[dir="rtl"] .btn-group > .btn:last-child { border-radius: 8px 0 0 8px; }
[dir="rtl"] .modal-header .btn-close { margin: -0.5rem auto -0.5rem -0.5rem; }
[dir="rtl"] .float-start { float: right !important; }
[dir="rtl"] .float-end { float: left !important; }
[dir="rtl"] .text-start { text-align: right !important; }
[dir="rtl"] .text-end { text-align: left !important; }
/* RTL - Input group fixes */
[dir="rtl"] .input-group {
    flex-direction: row-reverse;
}
[dir="rtl"] .input-group > .form-control {
    border-radius: 0 0.375rem 0.375rem 0;
}
[dir="rtl"] .input-group > .input-group-text:first-child {
    border-radius: 0 0.375rem 0.375rem 0;
}
[dir="rtl"] .input-group > .btn:last-child {
    border-radius: 0.375rem 0 0 0.375rem;
}
[dir="rtl"] .input-group .form-control.border-start-0 {
    border-left-width: 1px !important;
    border-right-width: 0 !important;
}
[dir="rtl"] .input-group .input-group-text.border-end-0 {
    border-right-width: 1px !important;
    border-left-width: 0 !important;
}

/* RTL - User menu dropdown */
[dir="rtl"] .dropdown-menu-end {
    right: auto !important;
    left: 0 !important;
    text-align: right;
}
[dir="rtl"] .dropdown-toggle::after {
    margin-right: 0.255em;
    margin-left: 0;
}

/* RTL - Mobile bottom nav */
[dir="rtl"] .mobile-bottom-nav {
    direction: rtl;
}
[dir="rtl"] .mobile-bottom-nav .bottom-nav-item {
    direction: rtl;
}

/* RTL - Cookie consent */
[dir="rtl"] .cookie-consent .container {
    flex-direction: row-reverse;
}

@media (max-width: 991.98px) {
    [dir="rtl"] .admin-sidebar { right: -100%; left: auto; }
    [dir="rtl"] .admin-sidebar.show { right: 0; left: auto; }
    [dir="rtl"] .admin-main { margin-right: 0; }
    [dir="rtl"] .navbar-collapse .navbar-nav {
        text-align: right;
    }
    [dir="rtl"] .navbar-collapse .d-flex.align-items-center {
        flex-direction: row-reverse;
        justify-content: flex-end;
    }
}
