/* ═══════════════════════════════════════════════════════════════════════════
   CAREER STUDIO — RTL (Right-to-Left) Layout Engine
   Supports: Arabic (ar), Hebrew (he), Urdu (ur), Farsi (fa),
             Pashto (ps), Kurdish (ku), Uyghur (ug), Sindhi (sd)

   Uses CSS Logical Properties throughout — the correct, layout-agnostic way.
   Only [dir="rtl"] overrides are defined here for exceptions.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── BASE RTL DIRECTION ─────────────────────────────────────────────────── */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

/* ─── TYPOGRAPHY: RTL fonts use Cairo/Noto Arabic ────────────────────────── */
[dir="rtl"] body,
[dir="rtl"] .card,
[dir="rtl"] .fg label,
[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select {
  font-family: 'Noto Sans Arabic', 'Cairo', 'Noto Sans Hebrew', var(--fd);
  letter-spacing: 0; /* Arabic/Hebrew don't use letter-spacing */
}
[dir="rtl"] .fm,
[dir="rtl"] code,
[dir="rtl"] pre,
[dir="rtl"] .lp-json {
  font-family: 'JetBrains Mono', monospace;
  direction: ltr; /* code stays LTR inside RTL pages */
  text-align: left;
  unicode-bidi: embed;
}

/* ─── LAYOUT: SIDEBAR ────────────────────────────────────────────────────── */
[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
  border-left: none;
  border-right: 1px solid var(--bd0);
}
[dir="rtl"] .main-area {
  margin-left: 0;
  margin-right: var(--sidebar-width, 260px);
}
@media (max-width: 768px) {
  [dir="rtl"] .sidebar { right: -100%; left: auto; }
  [dir="rtl"] .sidebar.open { right: 0; left: auto; }
  [dir="rtl"] .main-area { margin-right: 0; }
}

/* ─── HEADER ─────────────────────────────────────────────────────────────── */
[dir="rtl"] .hdr-inner {
  flex-direction: row-reverse;
}
[dir="rtl"] .brand {
  flex-direction: row-reverse;
}
[dir="rtl"] .hdr-actions {
  flex-direction: row-reverse;
}

/* ─── NAV SIDEBAR ITEMS ──────────────────────────────────────────────────── */
[dir="rtl"] .ntab {
  flex-direction: row-reverse;
  text-align: right;
}
[dir="rtl"] .ntab .ni {
  margin-right: 0;
  margin-left: 10px;
}
[dir="rtl"] .sb-group-header {
  flex-direction: row-reverse;
}
[dir="rtl"] .sb-gh-arrow {
  margin-right: 0;
  margin-left: 0;
  transform: scaleX(-1); /* flip chevron direction */
}
[dir="rtl"] .sb-hot {
  margin-right: 4px;
  margin-left: 0;
}

/* ─── CARDS ──────────────────────────────────────────────────────────────── */
[dir="rtl"] .card {
  text-align: right;
}
[dir="rtl"] .ch {
  flex-direction: row-reverse;
}
[dir="rtl"] .ci {
  margin-right: 0;
  margin-left: 9px;
}
[dir="rtl"] .bdg {
  margin-right: 4px;
  margin-left: 0;
}

/* ─── FORM FIELDS ────────────────────────────────────────────────────────── */
[dir="rtl"] .fg {
  text-align: right;
}
[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select {
  direction: rtl;
  text-align: right;
}
/* Allow auto-direction for user typing (detects LTR/RTL automatically) */
[dir="rtl"] input[type="text"],
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="search"],
[dir="rtl"] textarea {
  direction: auto;
  unicode-bidi: plaintext;
}

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
[dir="rtl"] .btn-p::before,
[dir="rtl"] .btn-gold::before,
[dir="rtl"] .btn-danger::before {
  transform: translateX(100%); /* shimmer runs right-to-left */
}
[dir="rtl"] .btn-p:hover::before { transform: translateX(-130%); }

/* ─── GRID LAYOUTS ───────────────────────────────────────────────────────── */
[dir="rtl"] .g2,
[dir="rtl"] .g3,
[dir="rtl"] .g4 {
  direction: rtl;
}

/* ─── ICONS THAT IMPLY DIRECTION (arrows, chevrons, progress) ────────────── */
[dir="rtl"] .arrow-icon,
[dir="rtl"] .progress-indicator,
[dir="rtl"] .nav-arrow,
[dir="rtl"] .sb-gh-arrow { transform: scaleX(-1); }

/* ─── PROGRESS BARS: should fill right-to-left ──────────────────────────── */
[dir="rtl"] .lp-bar-fill {
  float: right;
  border-radius: var(--rpill);
}
[dir="rtl"] .lp-bar {
  direction: rtl;
}

/* ─── TIMELINE: mirrors for RTL ──────────────────────────────────────────── */
[dir="rtl"] .lp-timeline-rail {
  direction: rtl;
  overflow-x: auto;
}
[dir="rtl"] .lp-timeline-node {
  border-left: none;
  border-right: 3px solid var(--aurora-gold);
}
[dir="rtl"] .lp-tl-year { text-align: right; }

/* ─── OFFICE CALENDAR: mirrors for RTL ─────────────────────────────────── */
[dir="rtl"] .oc-week-header,
[dir="rtl"] .oc-grid {
  direction: rtl;
}
[dir="rtl"] .oc-time-label {
  border-right: none;
  border-left: 1px solid var(--bd0);
  text-align: left;
}
[dir="rtl"] .oc-event {
  border-left: none;
  border-right: 3px solid;
}
[dir="rtl"] .oc-event.roi-high   { border-right-color: var(--aurora-green); border-left: none; }
[dir="rtl"] .oc-event.roi-medium { border-right-color: var(--aurora-gold);  border-left: none; }
[dir="rtl"] .oc-event.roi-low    { border-right-color: var(--aurora-red);   border-left: none; }
[dir="rtl"] .oc-event.roi-drain  { border-right-color: var(--aurora-violet);border-left: none; }

/* ─── STREAMING CURSOR: left side for RTL text ──────────────────────────── */
[dir="rtl"] .stream-cursor {
  float: right;
  margin-right: 0;
  margin-left: 2px;
}

/* ─── CHAT BUBBLES ───────────────────────────────────────────────────────── */
[dir="rtl"] .lp-chat-msg { text-align: right; }
[dir="rtl"] .lp-chat-user b,
[dir="rtl"] .lp-chat-ai b { text-align: right; }

/* ─── TOAST NOTIFICATIONS ────────────────────────────────────────────────── */
[dir="rtl"] .toast-container {
  right: auto;
  left: 20px;
}

/* ─── MODAL ──────────────────────────────────────────────────────────────── */
[dir="rtl"] .modal-content {
  text-align: right;
}
[dir="rtl"] .modal-close {
  left: 16px;
  right: auto;
}

/* ─── LANGUAGE PICKER MODAL (RTL-aware) ─────────────────────────────────── */
[dir="rtl"] .lang-modal-search input { direction: rtl; text-align: right; }
[dir="rtl"] .lang-option { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .lang-flag { margin-right: 0; margin-left: 10px; }

/* ─── IDENTITY CARDS ─────────────────────────────────────────────────────── */
[dir="rtl"] .lp-archetype-card,
[dir="rtl"] .lp-shadow-card {
  text-align: right;
}
[dir="rtl"] .lp-evo-stage {
  border-left: none;
  border-right: 3px solid var(--aurora-violet);
  padding-left: 0;
  padding-right: 18px;
}

/* ─── MEETING CARDS ──────────────────────────────────────────────────────── */
[dir="rtl"] .oc-meeting-card {
  border-left: none;
  border-right: 3px solid;
}
[dir="rtl"] .oc-meeting-card.high   { border-right-color: var(--aurora-green); }
[dir="rtl"] .oc-meeting-card.neutral{ border-right-color: var(--aurora-gold); }
[dir="rtl"] .oc-meeting-card.drain  { border-right-color: var(--aurora-red); }
[dir="rtl"] .oc-meeting-card:hover  { transform: translateX(-3px); } /* mirror hover slide */

/* ─── SCORE RING: stays centered ──────────────────────────────────────────── */
[dir="rtl"] .lp-score-ring { margin: 0 auto 18px; }

/* ─── SIDEBAR LANGUAGE LABEL ─────────────────────────────────────────────── */
[dir="rtl"] #sbLangLabel { text-align: right; }

/* ─── NUMBERS stay LTR always (digits don't flip) ─────────────────────────── */
[dir="rtl"] .lp-score-num,
[dir="rtl"] .oc-week-score-num,
[dir="rtl"] .lp-sal-10yr,
[dir="rtl"] .lp-sal-peak {
  direction: ltr;
  unicode-bidi: embed;
}

/* ─── SCROLLBAR mirrors for RTL ──────────────────────────────────────────── */
[dir="rtl"] .spanel { overflow-y: scroll; scrollbar-gutter: stable; }
