/* FutureGate Admin — i18n & RTL polish */

/* ── Language switcher (sits inside .workspace-actions) ── */
.lang-switcher {
  position: relative;
  display: inline-flex;
}

.lang-toggle {
  gap: 6px;
  padding: 0 12px;
  min-width: 56px;
  width: auto;
}

.lang-toggle .lang-current {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: currentColor;
}

.lang-toggle [data-lucide] {
  width: 16px;
  height: 16px;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--c-surface, #fff);
  border: 1px solid var(--c-border, #e2e8f0);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  padding: 6px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lang-menu[hidden] {
  display: none;
}

[dir="rtl"] .lang-menu {
  right: auto;
  left: 0;
}

.lang-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  font: inherit;
  color: var(--c-text, #0f172a);
  text-align: start;
  width: 100%;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.lang-menu-item:hover,
.lang-menu-item:focus-visible {
  background: var(--c-surface-soft, rgba(99, 102, 241, 0.08));
  outline: none;
}

.lang-menu-item.is-active {
  background: var(--c-primary-soft, rgba(99, 102, 241, 0.14));
  color: var(--c-primary, #4f46e5);
}

.lang-menu-code {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 12px;
}

.lang-menu-name {
  font-size: 13px;
  color: var(--c-text-faint, #64748b);
}

.lang-menu-item.is-active .lang-menu-name {
  color: inherit;
}

/* ── RTL polish for the existing layout ── */
[dir="rtl"] body {
  direction: rtl;
}

/* Use Arabic-friendly font stack with fallback to existing fonts. */
[dir="rtl"] body,
[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] button,
[dir="rtl"] select {
  font-family: 'Noto Sans Arabic', 'Segoe UI', 'Tajawal', 'Cairo', 'Manrope', system-ui, -apple-system, sans-serif;
}

/* Sidebar mirroring */
[dir="rtl"] .sidebar {
  border-right: none;
  border-left: 1px solid var(--c-border, #e2e8f0);
}

[dir="rtl"] .nav-item,
[dir="rtl"] .admin-info,
[dir="rtl"] .sidebar-brand {
  flex-direction: row;
}

[dir="rtl"] .nav-badge,
[dir="rtl"] .toolbar-pill-badge {
  right: auto;
  left: 6px;
}

/* Numbers stay LTR even inside RTL containers (helps stat values, counts). */
[dir="rtl"] .stat-card .value,
[dir="rtl"] .control-card-count,
[dir="rtl"] .nav-badge,
[dir="rtl"] .toolbar-pill-badge,
[dir="rtl"] .top-rank,
[dir="rtl"] .top-count,
[dir="rtl"] time,
[dir="rtl"] .activity-time {
  direction: ltr;
  unicode-bidi: isolate;
}

/* Forms: align placeholders and inputs naturally. */
[dir="rtl"] input,
[dir="rtl"] textarea {
  text-align: right;
}

[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="url"],
[dir="rtl"] input[type="tel"] {
  direction: ltr;
  text-align: left;
}

/* Modal close button — keep iconography flipped consistently. */
[dir="rtl"] .modal-header {
  flex-direction: row-reverse;
}

/* Login chrome */
[dir="rtl"] .login-card,
[dir="rtl"] .login-shell {
  text-align: right;
}

/* Buttons that include lucide icons + label keep gap regardless of direction. */
[dir="rtl"] .btn,
[dir="rtl"] .btn-sm {
  flex-direction: row;
}

/* Tabs / chip filter rows */
[dir="rtl"] .tabs,
[dir="rtl"] .chip-row,
[dir="rtl"] .filter-row {
  flex-direction: row-reverse;
}
