/* Right-to-left overrides (Arabic, Kurdish). Loaded after bootstrap.rtl.min.css. */
@font-face {
    font-family: 'Rabar';
    src: url('../assets/fonts/font/rabar.woff2') format('woff2'),
         url('../assets/fonts/font/rabar.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

html[dir="rtl"] body,
html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] button,
html[dir="rtl"] select {
    font-family: 'Rabar', 'Segoe UI', Tahoma, Arial, sans-serif !important;
    text-align: right;
}

html[dir="rtl"] .navbar-brand,
html[dir="rtl"] .main_logo {
    margin-left: auto;
    margin-right: 0;
}


/* Keep English-only content readable inside RTL pages */
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"],
html[dir="rtl"] input[type="password"] {
    direction: ltr;
    text-align: right;
}

/* Chat bubbles on the AI page */
html[dir="rtl"] .chats-lists li { direction: rtl; }

/* Headings and other elements that the theme pins to Heebo with !important */
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3,
html[dir="rtl"] h4, html[dir="rtl"] h5, html[dir="rtl"] h6,
html[dir="rtl"] blockquote, html[dir="rtl"] p, html[dir="rtl"] a,
html[dir="rtl"] span:not([class*="fa"]):not([class*="feather"]):not([class*="uil"]),
html[dir="rtl"] label, html[dir="rtl"] li, html[dir="rtl"] div,
html[dir="rtl"] .search-form-control, html[dir="rtl"] .chat-msg-item {
    font-family: 'Rabar', 'Segoe UI', Tahoma, Arial, sans-serif !important;
}

/* Mixed-language text (English questions / messages inside RTL pages):
   each line takes the direction of its first strong character */
html[dir="rtl"] .user-recipient-name,
html[dir="rtl"] .chat-msg-item,
html[dir="rtl"] .write-post,
html[dir="rtl"] textarea,
html[dir="rtl"] .search-form-control {
    unicode-bidi: plaintext;
}

/* AI page hover nudge points the other way */
html[dir="rtl"] .question-item:hover {
    transform: translateX(-5px);
}

/* Navbar: keep long labels (e.g. the AI Assistant link) on one line */
html[dir="rtl"] .navbar-nav .nav-link,
html[dir="rtl"] .navbar-nav .dropdown-item {
    white-space: nowrap;
}
@media (min-width: 992px) {
    html[dir="rtl"] .navbar-expand-lg .navbar-nav .nav-link {
        padding-left: .75rem !important;
        padding-right: .75rem !important;
    }
}

/* Posts: text must wrap inside the card and never get clipped */
html[dir="rtl"] .post-meta,
html[dir="rtl"] .feed-shared-dt-1,
html[dir="rtl"] .feed-shared-dt-1 .post {
    overflow: visible;
    max-width: 100%;
}
html[dir="rtl"] .feed-shared-dt-1 .post p {
    white-space: normal !important;
    overflow-wrap: anywhere;
}
html[dir="rtl"] .btn-more p {
    display: inline;
    margin: 0;
}


/* Buttons keep their label centered (the global rule above right-aligns text) */
html[dir="rtl"] button,
html[dir="rtl"] .main-btn,
html[dir="rtl"] .post-link-btn,
html[dir="rtl"] .view-btn {
    text-align: center;
}

/* Location icon inside the job search input */
html[dir="rtl"] .inwrap::after {
    left: 8px;
    right: auto;
    text-align: center;
}
html[dir="rtl"] .inwrap .form_input_1 {
    padding-left: 48px;
}

/* Latin names / places / dates inside RTL pages: keep punctuation and "..." at the
   correct end by letting each element pick its own direction */
html[dir="rtl"] .state-name,
html[dir="rtl"] .cmpny-dt,
html[dir="rtl"] .time-dt,
html[dir="rtl"] .job-heading,
html[dir="rtl"] .browse-member-name,
html[dir="rtl"] .browse-member-headline,
html[dir="rtl"] .user-recipient-name {
    unicode-bidi: plaintext;
}

/* Mid-size screens: keep the search box clear of the profile picture */
@media (min-width: 992px) and (max-width: 1399px) {
    html[dir="rtl"] .search-form-header {
        width: 170px;
        margin-left: 0;
        margin-right: 10px;
    }
}

/* Settings sidebar: the expand arrow points toward the text in right-to-left */
html[dir="rtl"] .setting-list a[data-bs-toggle=collapse]:after,
html[dir="rtl"] .setting-list > li.active > a[data-bs-toggle=collapse]:after {
    content: '\f104';
}
html[dir="rtl"] .setting-list a[data-bs-toggle=collapse][aria-expanded=true]:after,
html[dir="rtl"] .setting-list > li.active > a[data-bs-toggle=collapse][aria-expanded=true]:after {
    transform: rotate(-90deg);
}

/* Date picker: while hidden it is parked at left:-100000px, which in a right-to-left page
   creates a huge horizontal scroll area. Park it inside the page instead. */
html[dir="rtl"] .datepicker:not(.active) {
    left: 0 !important;
    top: 0 !important;
    visibility: hidden;
}

/* Form fields: URLs, e-mails and Latin text keep their natural direction (no "/https://" flips) */
html[dir="rtl"] .form_input_1,
html[dir="rtl"] .form_textarea_1 {
    unicode-bidi: plaintext;
}

/* Profile header / post meta: Latin usernames and "City Country" keep their natural order */
html[dir="rtl"] .item-username,
html[dir="rtl"] .item-user-title {
    unicode-bidi: plaintext;
}
html[dir="rtl"] .state-name {
    margin-left: 5px;
    margin-right: 5px;
}

/* Posts follow the language they are written in: English posts start on the left,
   Kurdish/Arabic posts on the right (each paragraph is detected from its first letters) */
html[dir="rtl"] .feed-shared-dt-1 .post p,
html[dir="rtl"] .feed-shared-dt-1 .post p.font,
html[dir="rtl"] .post p,
html[dir="rtl"] .post .font,
html[dir="rtl"] .jobtxt47 p,
html[dir="rtl"] .evarticledes p {
    unicode-bidi: plaintext;
    text-align: start !important;
}

/* Ads and other user-written text blocks follow their own language too */
html[dir="rtl"] .feed-shared-dt-1 > p,
html[dir="rtl"] .feed-shared-dt-1 .ads-job-price-rang,
html[dir="rtl"] .feed-shared-author-dt .job-heading {
    unicode-bidi: plaintext;
    text-align: start !important;
}
html[dir="rtl"] .feed-shared-dt-1 .ads-job-price-rang { display: block; }

/* Posts: each post follows the direction of its own text (dir="auto"), so Kurdish/Arabic posts align right and English posts align left on any page language */
.post p[dir="auto"],
.post p.font[dir="auto"] {
    text-align: start !important;
    unicode-bidi: plaintext;
}

/* Two-line preview for post text (see initPostClamp in js/custom.js) */
.post-clamp {
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* SweetAlert popups in right-to-left languages */
html[dir="rtl"] .swal-modal,
html[dir="rtl"] .swal-modal * { font-family: 'Rabar', 'Segoe UI', Tahoma, Arial, sans-serif !important; }
html[dir="rtl"] .swal-modal { direction: rtl; }
html[dir="rtl"] .swal-title { direction: rtl; text-align: center !important; }
html[dir="rtl"] .swal-text { direction: rtl; text-align: start !important; padding-inline: 8px; line-height: 1.9; unicode-bidi: plaintext; white-space: pre-line; }
html[dir="rtl"] .swal-footer { text-align: center !important; direction: rtl; }
html[dir="rtl"] .swal-button-container { margin: 5px 6px; }
