/* ==========================================================================
   RTL — Arabic Layout Overrides
   Loaded only when get_locale() === 'ar'
   All rules use !important sparingly — only where Astra or LTR styles need
   an explicit override.
   ========================================================================== */

/* ── Base direction & Arabic font ──────────────────────────────────────────── */

html[dir="rtl"],
body {
  direction: rtl;
  font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif !important;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */

.narimane-header__inner {
  flex-direction: row-reverse;
}

.narimane-header__right {
  flex-direction: row-reverse;
}

.narimane-nav__list {
  flex-direction: row-reverse;
}

/* Language switcher direction */
.narimane-lang-switcher {
  direction: ltr; /* always LTR so EN/AR order stays readable */
}

/* Mobile nav */
.narimane-mobile-nav__list {
  text-align: right;
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */

.narimane-footer__grid {
  direction: rtl;
}

.narimane-footer__social {
  flex-direction: row-reverse;
}

.narimane-footer__contact li {
  flex-direction: row-reverse;
  gap: 0.5rem;
}

.narimane-footer__bottom p {
  text-align: center;
}

/* ── Shared layout helpers ──────────────────────────────────────────────────── */

.container {
  direction: rtl;
}

.section-label,
.badge {
  direction: rtl;
  text-align: right;
}

.section-heading {
  text-align: right;
}

.section-heading h2,
.section-heading p {
  text-align: right;
}

/* ── HOME — Hero ─────────────────────────────────────────────────────────────── */

.hero-grid {
  direction: rtl;
}

.hero-content {
  text-align: right;
}

.hero-badge-pill {
  flex-direction: row-reverse;
  text-align: right;
}

.hero-actions {
  flex-direction: row-reverse;
}

.hero-guarantee {
  flex-direction: row-reverse;
}

.hero-trust-indicators {
  flex-direction: row-reverse;
}

.trust-item {
  flex-direction: row-reverse;
}

/* Flip the visual column order so image is on the LEFT in RTL */
.hero-grid {
  direction: rtl;
}

.hero-visual {
  order: -1;
}

/* Glass cards — mirror position */
.glass-card-1 {
  left: auto;
  right: -1.5rem;
}

.glass-card-2 {
  right: auto;
  left: -1.5rem;
}

/* ── HOME — Pain Points ───────────────────────────────────────────────────────── */

.home-pain__heading {
  text-align: right;
}

.pain-card {
  text-align: right;
}

.pain-card__tag {
  text-align: right;
}

/* ── HOME — Solution (two courses) + course card utilities ───────────────────── */

.home-solution__heading {
  text-align: right;
}

.home-solution__title {
  align-items: flex-end;
}

.home-solution__portrait-caption {
  text-align: right;
}

.home-courses__heading {
  text-align: right;
}

.home-courses__intro {
  text-align: right;
}

.home-courses__grid {
  direction: rtl;
}

.home-courses__card {
  text-align: right;
}

.home-courses__list li {
  flex-direction: row-reverse;
  text-align: right;
}

.home-courses__btn {
  align-self: flex-end;
}

.home-courses__btn .btn-arrow {
  transform: scaleX(-1);
}

.home-courses__btn:hover .btn-arrow {
  transform: scaleX(-1) translateX(5px);
}

/* ── HOME — Steps ────────────────────────────────────────────────────────────── */

.home-steps__heading {
  text-align: right;
}

.step-card {
  flex-direction: row-reverse;
  text-align: right;
}

.step-card__content {
  text-align: right;
}

.home-steps__cta {
  text-align: right;
}

/* ── HOME — FAQ ──────────────────────────────────────────────────────────────── */

.home-faq__layout {
  direction: rtl;
}

.home-faq__left {
  text-align: right;
}

.faq-question {
  flex-direction: row-reverse;
  text-align: right;
}

.faq-question__icon {
  margin-right: 0;
  margin-left: auto;
  transform: scaleX(-1); /* mirror chevron */
}

.faq-answer p {
  text-align: right;
}

/* ── HOME — Testimonials carousel & spotlight ───────────────────────────────── */

/* Keep slide math LTR; card copy stays RTL so quotes render in the viewport. */
html[dir="rtl"] .testimonials-carousel__stage,
html[dir="rtl"] .testimonials-carousel__viewport,
html[dir="rtl"] .testimonials-carousel__track {
  direction: ltr;
}

html[dir="rtl"] .testimonial-card--carousel {
  direction: rtl;
}

.testimonials-carousel__heading {
  text-align: right;
}

.testimonial-card--carousel {
  text-align: right;
}

.testimonial-card__header {
  flex-direction: row-reverse;
}

.testimonial-card__author {
  flex-direction: row-reverse;
}

.testimonial-card__quote-icon {
  right: auto;
  left: var(--space-4);
}

.testimonial-card__text {
  padding-right: 0;
  padding-left: var(--space-1);
}

.testimonial-spotlight__inner {
  text-align: right;
}

/* ── ABOUT — Hero ────────────────────────────────────────────────────────────── */

.about-hero__layout {
  flex-direction: row-reverse;
}

.about-hero__content {
  text-align: right;
}

.about-hero__content-glass {
  text-align: right;
}

.about-hero__label {
  flex-direction: row-reverse;
}

.about-hero__social-row {
  flex-direction: row-reverse;
}

.about-hero__social {
  flex-direction: row-reverse;
}

/* Badge positions — mirror horizontally */
.hero-badge-1 {
  left: auto;
  right: -1rem;
}

.hero-badge-2 {
  right: auto;
  left: -1rem;
}

/* ── ABOUT — Intro ───────────────────────────────────────────────────────────── */

.about-intro__grid {
  direction: rtl;
}

.about-intro__pullquote,
.about-intro__text {
  text-align: right;
}

/* ── ABOUT — Timeline ────────────────────────────────────────────────────────── */

.about-timeline__item--left {
  flex-direction: row-reverse;
}

.about-timeline__item--right {
  flex-direction: row;
}

.about-timeline__card {
  text-align: right;
}

/* ── ABOUT — Philosophy ──────────────────────────────────────────────────────── */

.about-philosophy__inner {
  text-align: right;
}

.about-philosophy__pillars {
  direction: rtl;
}

.about-philosophy__pillar {
  text-align: right;
}

/* ── ABOUT — Credentials ─────────────────────────────────────────────────────── */

.about-credentials__card {
  text-align: right;
}

/* ── ABOUT — Stats ───────────────────────────────────────────────────────────── */

.about-stats__item {
  text-align: right;
}

/* ── COURSES — Hero ──────────────────────────────────────────────────────────── */

.courses-hero-elite__grid {
  direction: rtl;
}

.courses-hero-elite__content {
  text-align: right;
}

.courses-hero-elite__features {
  text-align: right;
}

.courses-hero-elite__features li {
  flex-direction: row-reverse;
}

.courses-hero-elite__actions {
  flex-direction: row-reverse;
}

.courses-hero-elite__avatars {
  flex-direction: row-reverse;
}

.courses-hero-elite__course-card:nth-child(2) {
  transform: rotate(1deg) translateX(-20px);
}

.courses-hero-elite__course-card:nth-child(3) {
  transform: rotate(-1deg) translateX(-40px);
}

.courses-hero-elite__course-card:nth-child(4) {
  transform: rotate(1.5deg) translateX(-50px);
}

.courses-hero-elite__course-card:hover,
.courses-hero-elite__course-card:focus-visible {
  transform: translateY(-4px) rotate(0deg);
}

/* ── COURSES — Pricing ───────────────────────────────────────────────────────── */

.courses-pricing__header {
  text-align: center;
}

.courses-pricing__features li {
  flex-direction: row-reverse;
  text-align: right;
}

.pack-picker__header {
  text-align: right;
}

.pack-picker__back {
  flex-direction: row-reverse;
}

.pack-picker__card-body {
  text-align: right;
}

.pack-picker__bar-inner {
  flex-direction: row-reverse;
}

@media (max-width: 640px) {
  .pack-picker__bar-inner {
    flex-direction: column;
  }
}

/* ── COURSES — Catalog ───────────────────────────────────────────────────────── */

.courses-catalog__heading {
  text-align: right;
}

/* ── COURSES — Features ──────────────────────────────────────────────────────── */

.courses-feature-card {
  text-align: right;
}

/* ── COURSES — Path ──────────────────────────────────────────────────────────── */

.courses-path__step {
  flex-direction: row-reverse;
  text-align: right;
}

.courses-path__step-content {
  text-align: right;
}

/* ── CONTACT — Hero ──────────────────────────────────────────────────────────── */

.contact-hero__content {
  text-align: right;
}

.contact-hero__eyebrow {
  flex-direction: row-reverse;
}

.contact-hero__channels {
  flex-direction: row-reverse;
}

.contact-hero__channel {
  flex-direction: row-reverse;
}

/* ── CONTACT — Form Section ──────────────────────────────────────────────────── */

.contact-main__grid {
  direction: rtl;
}

.contact-main__info-inner {
  text-align: right;
}

.contact-main__info-label {
  flex-direction: row-reverse;
}

.contact-main__channels {
  text-align: right;
}

.contact-main__channel {
  flex-direction: row-reverse;
}

.contact-main__promise {
  flex-direction: row-reverse;
  text-align: right;
}

.contact-main__social {
  flex-direction: row-reverse;
}

.contact-main__form-card {
  text-align: right;
}

.contact-form__label {
  text-align: right;
  display: block;
}

.contact-form__input,
.contact-form__select,
.contact-form__textarea {
  text-align: right;
  direction: rtl;
}

.contact-form__submit {
  flex-direction: row-reverse;
}

/* ── Buttons — flip arrow direction ─────────────────────────────────────────── */

.btn-modern-primary .btn-arrow {
  transform: scaleX(-1);
}

/* ── Tutor auth / register page ─────────────────────────────────────────────── */

body.narimane-tutor-auth-page .reg-form-body input[type="text"],
body.narimane-tutor-auth-page .reg-form-body input[type="email"],
body.narimane-tutor-auth-page .reg-form-body input[type="password"],
body.narimane-tutor-auth-page .reg-form-body input[type="date"],
body.narimane-tutor-auth-page .reg-form-body select {
  text-align: right;
  direction: rtl;
}

/* Card text stays centered in RTL */
body.narimane-tutor-auth-page .reg-headline,
body.narimane-tutor-auth-page .reg-tagline,
body.narimane-tutor-auth-page .reg-switch,
body.narimane-tutor-auth-page .reg-trust {
  text-align: center;
}

/* Form labels align to the reading direction */
body.narimane-tutor-auth-page .reg-form-body label {
  text-align: right;
  display: block;
}

/* Field icons sit on inline-start — flip background position in RTL */
body.narimane-tutor-auth-page .reg-form-body input[type="text"],
body.narimane-tutor-auth-page .reg-form-body input[type="password"],
body.narimane-tutor-auth-page .reg-form-body input[type="date"] {
  background-position: right 1rem 50% !important;
}

body.narimane-tutor-auth-page .reg-form-body select[name="narimane_student_sexe"] {
  background-position: right 1rem 50%, left 1rem 50% !important;
}

/* Dense registration layout — match LTR icon inset */
body.narimane-tutor-auth-page .reg-card:has(#tutor-registration-form) .reg-form-body input[type="text"],
body.narimane-tutor-auth-page .reg-card:has(#tutor-registration-form) .reg-form-body input[type="password"],
body.narimane-tutor-auth-page .reg-card:has(#tutor-registration-form) .reg-form-body input[type="date"] {
  background-position: right 0.65rem 50% !important;
}

body.narimane-tutor-auth-page .reg-card:has(#tutor-registration-form) .reg-form-body select[name="narimane_student_sexe"] {
  background-position: right 0.65rem 50%, left 0.65rem 50% !important;
}

/* ── Responsive RTL ─────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .about-intro__pullquote,
  .about-intro__text {
    text-align: center;
  }

  .courses-hero-elite__content {
    text-align: center;
  }

  .courses-hero-elite__features {
    text-align: right;
  }

  .courses-hero-elite__actions,
  .courses-hero-elite__avatars {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .hero-visual {
    order: unset;
  }

  .about-hero__layout {
    flex-direction: column;
  }

  .about-hero__content,
  .about-hero__content-glass {
    text-align: center;
  }

  .about-intro__grid,
  .courses-hero-elite__grid,
  .contact-main__grid {
    flex-direction: column;
  }
}

/* ==========================================================================
   Tutor LMS — LTR “islands” (default English-style plugin layout)
   Theme-built sections (heroes, asides, headers) stay RTL; Tutor UI does not.
   ========================================================================== */

html[dir="rtl"] #tutor-page-wrap,
html[dir="rtl"] .tutor-site-wrap.site,
html[dir="rtl"] .tutor-wrap,
html[dir="rtl"] .tutor-wrap-parent,
html[dir="rtl"] .course-archive-results,
html[dir="rtl"] .tutor-course-single-content-wrapper,
html[dir="rtl"] .tutor-course-single-sidebar-wrapper,
html[dir="rtl"] #tutor-single-entry-content,
html[dir="rtl"] .tutor-pagination,
html[dir="rtl"] .tutor-instructors,
html[dir="rtl"] .tutor-modal {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: start;
  font-family: var(--font-body), system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

/* Commerce / auth shells — only the column that renders Tutor shortcodes */
html[dir="rtl"] .narimane-checkout-form-shell,
html[dir="rtl"] .narimane-cart-form-shell,
html[dir="rtl"] body.narimane-tutor-auth-page .reg-lang-switcher {
  justify-content: flex-start;
}

html[dir="rtl"] body.narimane-tutor-auth-page .reg-split-left__inner,
html[dir="rtl"] body.narimane-tutor-auth-page .reg-form-header,
html[dir="rtl"] body.narimane-tutor-auth-page .reg-form-footer {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] body.narimane-tutor-auth-page .reg-form-body {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: start;
  font-family: var(--font-body), system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

/*
 * All-Tutor main areas (no hybrid marketing + catalog in the same #primary).
 * Do NOT use body.narimane-tutor-archive — archive uses our hero + sections.
 */
html[dir="rtl"] body.narimane-tutor-single #primary,
html[dir="rtl"] body.narimane-tutor-dashboard #primary,
html[dir="rtl"] body.narimane-tutor-login #primary,
html[dir="rtl"] body.narimane-tutor-register #primary,
html[dir="rtl"] body.single-lesson #primary,
html[dir="rtl"] body.single-tutor_quiz #primary,
html[dir="rtl"] body.single-tutor_assignments #primary {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: start;
  font-family: var(--font-body), system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

/* Countdown teaser — timer digits stay LTR; centered hero-adjacent layout */
html[dir="rtl"] .courses-countdown__header,
html[dir="rtl"] .courses-countdown__inner {
  text-align: center;
}

html[dir="rtl"] .courses-countdown__timer {
  direction: ltr;
}

/* Global promo strip — message RTL, timer digits LTR */
html[dir="rtl"] .narimane-global-promo__message {
  text-align: start;
}

html[dir="rtl"] .narimane-global-promo__timer-digits {
  direction: ltr;
  unicode-bidi: isolate;
}

html[dir="rtl"] .narimane-global-promo__bar {
  direction: ltr;
}

/* Flagship — flip scroll-reveal directions for RTL */
html[dir="rtl"] .courses-flagship .reveal--left {
  transform: translateX(40px);
}

html[dir="rtl"] .courses-flagship .reveal--left.revealed {
  transform: translateX(0);
}

html[dir="rtl"] .courses-flagship__was {
  transform: translateX(8px);
}

html[dir="rtl"] .courses-flagship__price-block.revealed .courses-flagship__was {
  transform: translateX(0);
}

html[dir="rtl"] .courses-flagship.is-live .courses-flagship__cta.revealed svg {
  animation-direction: reverse;
}

/* ── About Timeline ─────────────────────────────────────────────────────────── */
.about-timeline__item--left {
  padding-right: 0 !important;
  padding-left: var(--space-8);
  text-align: right;
  justify-content: flex-start;
}

.about-timeline__item--right {
  margin-left: 0 !important;
  margin-right: 50%;
  padding-left: 0 !important;
  padding-right: var(--space-8);
  text-align: right;
}

.about-timeline__item--left .about-timeline__dot {
  right: auto !important;
  left: -22px;
}

.about-timeline__item--right .about-timeline__dot {
  left: auto !important;
  right: -22px;
}
