/* RTL Support для арабської мови та інших мов, що читаються справа наліво */

/* Основні стилі для RTL мов */
body.rtl-language,
html[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

/* Header та навігація */
body.rtl-language header,
html[dir="rtl"] header {
    direction: rtl;
}

body.rtl-language nav ul,
html[dir="rtl"] nav ul {
    flex-direction: row-reverse;
}

body.rtl-language .logo,
html[dir="rtl"] .logo {
    order: 2;
}

body.rtl-language .controls,
html[dir="rtl"] .controls {
    order: 1;
}

body.rtl-language .auth-buttons,
html[dir="rtl"] .auth-buttons {
    order: 0;
}

/* Кнопки та елементи керування */
body.rtl-language .change-bg-button,
html[dir="rtl"] .change-bg-button {
    margin-left: 0;
    margin-right: 10px;
}

body.rtl-language .theme-switcher,
html[dir="rtr"] .theme-switcher {
    margin-left: 0;
    margin-right: 20px;
}

/* Форми та поля вводу */
body.rtl-language input,
body.rtl-language textarea,
body.rtl-language select,
html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select {
    text-align: right;
    direction: rtl;
}

body.rtl-language .form-group label,
html[dir="rtl"] .form-group label {
    text-align: right;
}

/* Кнопки */
body.rtl-language .btn,
html[dir="rtl"] .btn {
    text-align: center;
}

/* Списки */
body.rtl-language ul,
body.rtl-language ol,
html[dir="rtl"] ul,
html[dir="rtl"] ol {
    padding-right: 20px;
    padding-left: 0;
}

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

/* Таблиці */
body.rtl-language table,
html[dir="rtl"] table {
    direction: rtl;
}

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

/* Модальні вікна */
body.rtl-language .modal-content,
html[dir="rtl"] .modal-content {
    direction: rtl;
    text-align: right;
}

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

body.rtl-language .modal-close,
html[dir="rtl"] .modal-close {
    right: auto;
    left: 15px;
}

/* Dropdown меню */
body.rtl-language .dropdown-menu,
html[dir="rtl"] .dropdown-menu {
    right: auto;
    left: 0;
    text-align: right;
}

/* Footer */
body.rtl-language footer,
html[dir="rtl"] footer {
    direction: rtl;
}

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

/* Футер .site-footer: у styles.css задано text-align:left та margin-left:auto — для RTL потрібне дзеркало */
body.rtl-language footer.site-footer .footer-bottom,
html[dir="rtl"] footer.site-footer .footer-bottom {
    align-items: flex-end;
}

body.rtl-language footer.site-footer .footer-bottom p,
html[dir="rtl"] footer.site-footer .footer-bottom p {
    text-align: right;
}

body.rtl-language footer.site-footer .footer-contacts,
html[dir="rtl"] footer.site-footer .footer-contacts {
    margin-left: 0;
    margin-right: auto;
}

@media (min-width: 769px) {
    body.rtl-language .site-footer .footer-links,
    html[dir="rtl"] .site-footer .footer-links {
        margin-left: 0;
        margin-right: auto;
    }
}

/* Логотип-бренд лишається латиницею: окремий LTR у блоці .logo */
body.rtl-language header .logo .logo-text,
html[dir="rtl"] header .logo .logo-text {
    unicode-bidi: isolate;
}

/* Іконки та стрілки */
body.rtl-language .fa-arrow-right,
html[dir="rtl"] .fa-arrow-right {
    transform: scaleX(-1);
}

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

/* Спеціальні стилі для арабської мови */
body.rtl-language[lang="ar"] {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Виправлення для flexbox елементів */
body.rtl-language .flex-container,
html[dir="rtl"] .flex-container {
    flex-direction: row-reverse;
}

/* Виправлення для grid елементів */
body.rtl-language .grid-container,
html[dir="rtl"] .grid-container {
    direction: rtl;
}

/* Виправлення для float елементів */
body.rtl-language .float-left,
html[dir="rtl"] .float-left {
    float: right !important;
}

body.rtl-language .float-right,
html[dir="rtl"] .float-right {
    float: left !important;
}

/* Виправлення для margin та padding */
body.rtl-language .ml-auto,
html[dir="rtl"] .ml-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
}

body.rtl-language .mr-auto,
html[dir="rtl"] .mr-auto {
    margin-right: 0 !important;
    margin-left: auto !important;
}

/* Виправлення для позиціонування */
body.rtl-language .position-absolute,
html[dir="rtl"] .position-absolute {
    direction: rtl;
}

/* Виправлення для анімацій */
body.rtl-language .slide-in-right,
html[dir="rtl"] .slide-in-right {
    animation: slideInLeft 0.3s ease-out;
}

body.rtl-language .slide-in-left,
html[dir="rtl"] .slide-in-left {
    animation: slideInRight 0.3s ease-out;
}

/* Адаптивні стилі для мобільних пристроїв */
@media (max-width: 768px) {
    body.rtl-language .mobile-controls,
    html[dir="rtl"] .mobile-controls {
        order: 0;
    }
    
    body.rtl-language .logo,
    html[dir="rtl"] .logo {
        order: 1;
    }
    
    body.rtl-language .auth-buttons,
    html[dir="rtl"] .auth-buttons {
        order: 2;
    }
}

/* Виправлення для спеціальних елементів KuBeyond */
body.rtl-language .hero-content,
html[dir="rtl"] .hero-content {
    text-align: right;
}

body.rtl-language .special-offer,
html[dir="rtl"] .special-offer {
    direction: rtl;
}

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

body.rtl-language .language-switcher,
html[dir="rtl"] .language-switcher {
    left: 20px;
    right: auto;
}

body.rtl-language .language-flags,
html[dir="rtl"] .language-flags {
    left: 0;
    right: auto;
}

/* Виправлення для фільтрів */
body.rtl-language .filter-section,
html[dir="rtl"] .filter-section {
    direction: rtl;
}

/* Виправлення для карток вакансій та спеціалістів */
body.rtl-language .vacancy-item,
body.rtl-language .specialist-card,
html[dir="rtl"] .vacancy-item,
html[dir="rtl"] .specialist-card {
    direction: rtl;
    text-align: right;
}

/* Виправлення для пагінації */
body.rtl-language .pagination,
html[dir="rtl"] .pagination {
    direction: rtl;
}

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

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