/* ============================================================
   EVERXP RTL — Overrides for dir="rtl" (Hebrew)
   Applied automatically when window.XP_LANG === 'he'
   ============================================================ */

/* ── Typography defaults ── */
[dir="rtl"] :root {
  --font-display: 'Heebo', sans-serif;
  --font-body: 'Heebo', sans-serif;
}

[dir="rtl"] body {
  font-family: 'Heebo', sans-serif;
  text-align: right;
}

[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3,
[dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6,
[dir="rtl"] p, [dir="rtl"] a, [dir="rtl"] span,
[dir="rtl"] button, [dir="rtl"] li, [dir="rtl"] td, [dir="rtl"] th {
  font-family: 'Heebo', sans-serif;
}

[dir="rtl"] .label-overline {
  text-align: right;
}

[dir="rtl"] .xp-section-sub {
  text-align: right;
  margin-left: 0;
  margin-right: 0;
}

/* ── Navbar ── */
[dir="rtl"] .navbar-nav {
  margin-right: 0;
}

/* Push CTA buttons to the left (end side in RTL) */
[dir="rtl"] .xp-navbar .ms-auto {
  margin-left: 0 !important;
  margin-right: auto !important;
}

[dir="rtl"] .xp-lib-header__sub,
[dir="rtl"] .xp-lib-header__title {
  text-align: right;
}

[dir="rtl"] .xp-lib-item__body {
  text-align: right;
}

[dir="rtl"] .dropdown-menu {
  text-align: right;
}

/* ── Hero ── */
[dir="rtl"] .xp-hero__left {
  text-align: right;
}

/* Typewriter words: anchor to right instead of left */
[dir="rtl"] .xp-tw-word {
  left: auto;
  right: 0;
  text-align: right;
}

[dir="rtl"] .xp-hero__ctas {
  justify-content: flex-start;
}

[dir="rtl"] .xp-hero__proof {
  text-align: right;
}

[dir="rtl"] .xp-hero__proof .fa-check-circle {
  margin-left: 4px;
  margin-right: 0;
}

/* Campaign mockup labels */
[dir="rtl"] .xp-campaign-live {
  flex-direction: row-reverse;
}

[dir="rtl"] .xp-variant-bar {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

/* ── How It Works ── */
[dir="rtl"] .xp-layer-diagram {
  direction: rtl;
}

[dir="rtl"] .xp-arrow-dot {
  animation-name: dot-flow-rtl;
}

@keyframes dot-flow-rtl {
  0%, 100% { opacity: 0.2; transform: translateX(0); }
  50%       { opacity: 1;   transform: translateX(-6px); }
}

[dir="rtl"] .xp-arrow-head {
  transform: scaleX(-1);
  animation-name: arrow-pulse-rtl;
}

@keyframes arrow-pulse-rtl {
  0%, 100% { opacity: 0.5; transform: scaleX(-1) translateX(0); }
  50%       { opacity: 1;   transform: scaleX(-1) translateX(4px); }
}

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

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

/* ── Combinations section ── */
[dir="rtl"] .xp-api-demo__footer {
  flex-direction: row-reverse;
}

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

[dir="rtl"] .xp-api-demo__title {
  text-align: center;
}

/* ── Personalization section ── */
/* dir="rtl" already flips flex row order — no row-reverse needed */
[dir="rtl"] .xp-visit-card {
  text-align: right;
}

[dir="rtl"] .xp-visit-card:hover {
  transform: translateX(4px);
}

[dir="rtl"] .xp-visit-body,
[dir="rtl"] .xp-visit-label,
[dir="rtl"] .xp-visit-headline {
  text-align: right;
}

[dir="rtl"] .xp-stat-callout {
  border-left: none;
  border-right: 3px solid var(--xp-gold);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  text-align: right;
}

/* ── Analytics ── */
[dir="rtl"] .xp-chart-header {
  flex-direction: row-reverse;
}

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

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

[dir="rtl"] .xp-metrics-row {
  direction: rtl;
}

[dir="rtl"] .xp-promoted-notice {
  text-align: right;
}

[dir="rtl"] .xp-promoted-notice i {
  margin-right: 0;
  margin-left: var(--space-2);
}

/* ── Proof band ── */
[dir="rtl"] .xp-proof-stat {
  text-align: center;
}

/* ── Integrations showcase ── */
[dir="rtl"] .xp-int-row {
  direction: rtl;
}

[dir="rtl"] .xp-int-row__label strong,
[dir="rtl"] .xp-int-row__label small {
  text-align: right;
}

[dir="rtl"] .xp-int-row__logos {
  justify-content: flex-start;
}

[dir="rtl"] .xp-int-showcase__footer {
  text-align: center;
}

/* ── Footer ── */
[dir="rtl"] .xp-footer__top {
  flex-direction: row-reverse;
}

[dir="rtl"] .xp-footer__brand {
  align-items: flex-end; /* right-align logo + tagline in RTL */
}

[dir="rtl"] .xp-footer__brand img {
  width: auto; /* prevent flex stretch */
}

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

[dir="rtl"] .xp-footer__links ul {
  text-align: right;
}

[dir="rtl"] .xp-footer__col-title {
  text-align: right;
}

/* ── Language toggle ── */
.xp-lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 100px;
  padding: .25rem .5rem;
}

.xp-lang-toggle__label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
  padding: 0 .25rem;
  white-space: nowrap;
}

.xp-lang-btn {
  background: transparent;
  border: none;
  border-radius: 100px;
  padding: .2rem .55rem;
  font-size: .72rem;
  font-weight: 700;
  color: rgba(255,255,255,.45);
  cursor: pointer;
  transition: background .15s, color .15s;
  line-height: 1.5;
}

.xp-lang-btn:hover {
  color: var(--xp-white);
  background: rgba(255,255,255,.1);
}

.xp-lang-btn--active {
  background: var(--xp-gold) !important;
  color: var(--xp-navy-dark) !important;
}

/* Place toggle in footer bottom row */
.xp-footer__bottom .xp-lang-toggle {
  flex-shrink: 0;
}

/* ── Pricing page RTL ── */
[dir="rtl"] .xp-plan-features li {
  flex-direction: row-reverse;
  text-align: right;
}

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

[dir="rtl"] .xp-page-hero__trust {
  justify-content: flex-end;
}

[dir="rtl"] .accordion-button {
  text-align: right;
}

[dir="rtl"] .accordion-button::after {
  margin-left: 0;
  margin-right: auto;
}

/* ── General section header RTL ── */
[dir="rtl"] .text-center .xp-section-sub {
  text-align: center;
  margin: 0 auto;
}

[dir="rtl"] .text-center .label-overline,
[dir="rtl"] .text-center .xp-section-title {
  text-align: center;
}

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

@media (max-width: 991px) {
  [dir="rtl"] .xp-layer-diagram {
    direction: ltr;
  }

  [dir="rtl"] .xp-arrow-head {
    transform: scaleX(1) rotate(90deg);
  }
}

/* Collapsed nav + single-column hero */
@media (max-width: 1199px) {
  /* Centre the typewriter words (override desktop right-anchor) */
  [dir="rtl"] .xp-tw-word {
    left: 0;
    right: 0;
    width: 100%;
    text-align: center;
  }

  /* Centre CTAs (override desktop flex-start) */
  [dir="rtl"] .xp-hero__ctas {
    justify-content: center;
  }

  /* Centre proof items */
  [dir="rtl"] .xp-hero__proof {
    justify-content: center;
    text-align: center;
  }

  /* Nav ms-auto: on collapsed mobile nav, reset RTL margin override
     so buttons fill their row normally */
  [dir="rtl"] .xp-navbar .ms-auto {
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

/* Small tablet / large phone */
@media (max-width: 767px) {
  /* Footer top: stack vertically, align brand to the right in RTL */
  [dir="rtl"] .xp-footer__top {
    flex-direction: column;
    align-items: flex-end;
  }

  [dir="rtl"] .xp-footer__brand {
    align-items: flex-end;
  }

  /* Pricing hero: centre on mobile */
  [dir="rtl"] .xp-page-hero {
    text-align: center;
  }

  [dir="rtl"] .xp-page-hero__trust {
    justify-content: center;
  }

  /* Step cards text: centre on mobile (they're centred in LTR too) */
  [dir="rtl"] .xp-step__title,
  [dir="rtl"] .xp-step__desc {
    text-align: center;
  }
}

/* Phone */
@media (max-width: 575px) {
  /* Proof items: stack and centre in RTL */
  [dir="rtl"] .xp-hero__proof {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  /* Footer bottom: stack vertically, items to the right */
  [dir="rtl"] .xp-footer__bottom {
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-3);
  }
}
