/* ============================================================
   MasterStock – RTL (Arabic) Stylesheet
   Include this AFTER style.css when dir="rtl"
   ============================================================ */

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

/* ── Sidebar RTL ────────────────────────────────────────────── */
[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
  box-shadow: -4px 0 24px rgba(26,44,91,.25);
}

[dir="rtl"] .main-content {
  margin-left: 0;
  margin-right: var(--sidebar-width);
}

[dir="rtl"] .sidebar-brand { flex-direction: row-reverse; }
[dir="rtl"] .sidebar-user  { flex-direction: row-reverse; }

[dir="rtl"] .nav-item a {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .nav-item a .nav-badge { margin-left: 0; margin-right: auto; }

[dir="rtl"] .sidebar-footer a { flex-direction: row-reverse; }

/* ── Topbar RTL ─────────────────────────────────────────────── */
[dir="rtl"] .topbar { flex-direction: row-reverse; }
[dir="rtl"] .topbar-left { text-align: right; }

/* ── Cards RTL ──────────────────────────────────────────────── */
[dir="rtl"] .card-header { flex-direction: row-reverse; }
[dir="rtl"] .stat-card { flex-direction: row-reverse; }

[dir="rtl"] .stat-card::before {
  left: auto;
  right: 0;
}

/* ── Table RTL ──────────────────────────────────────────────── */
[dir="rtl"] .table th,
[dir="rtl"] .table td { text-align: right; }

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

/* ── Form RTL ───────────────────────────────────────────────── */
[dir="rtl"] .input-wrap .input-icon {
  left: auto;
  right: 14px;
}

[dir="rtl"] .form-control {
  text-align: right;
}

[dir="rtl"] .auth-card .form-control {
  padding: 12px 42px 12px 16px;
}

[dir="rtl"] .panel-form .form-control {
  padding: 10px 14px;
}

/* ── Buttons RTL ────────────────────────────────────────────── */
[dir="rtl"] .btn { flex-direction: row-reverse; }
[dir="rtl"] .d-flex { flex-direction: row-reverse; }

/* Exceptions - don't reverse these */
[dir="rtl"] .actions.d-flex,
[dir="rtl"] .filter-bar.d-flex,
[dir="rtl"] .topbar-right.d-flex {
  flex-direction: row;
}

/* ── Page Header RTL ────────────────────────────────────────── */
[dir="rtl"] .page-header { flex-direction: row-reverse; }
[dir="rtl"] .breadcrumb  { flex-direction: row-reverse; }

/* ── Alert RTL ──────────────────────────────────────────────── */
[dir="rtl"] .alert { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .alert-success { border-left: none; border-right: 4px solid #22c55e; }
[dir="rtl"] .alert-danger  { border-left: none; border-right: 4px solid #ef4444; }
[dir="rtl"] .alert-warning { border-left: none; border-right: 4px solid #f59e0b; }
[dir="rtl"] .alert-info    { border-left: none; border-right: 4px solid #3b82f6; }

/* ── Badge RTL ──────────────────────────────────────────────── */
[dir="rtl"] .badge { flex-direction: row-reverse; }

/* ── Auth Card RTL ──────────────────────────────────────────── */
[dir="rtl"] .auth-card h2,
[dir="rtl"] .auth-card p.subtitle { text-align: right; }

/* ── Language Switcher ──────────────────────────────────────── */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  padding: 4px;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 26px;
  border-radius: 16px;
  font-size: .72rem;
  font-weight: 700;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  transition: all .2s ease;
  letter-spacing: .3px;
}

.lang-btn:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.lang-btn.active {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 2px 8px rgba(247,148,29,.4);
}

/* ── Arabic Font Override ───────────────────────────────────── */
[dir="rtl"] body,
[dir="rtl"] .btn,
[dir="rtl"] .form-control,
[dir="rtl"] .nav-item a {
  font-family: 'Inter', 'Segoe UI', Tahoma, Arial, sans-serif;
}

/* ── Progress bar RTL ───────────────────────────────────────── */
[dir="rtl"] .progress-bar {
  background: linear-gradient(270deg, var(--orange) 0%, var(--orange-light) 100%);
}

/* ── Sidebar mobile RTL ─────────────────────────────────────── */
@media (max-width: 768px) {
  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }
  [dir="rtl"] .sidebar.mobile-open {
    transform: translateX(0);
  }
  [dir="rtl"] .main-content {
    margin-right: 0;
  }
}
