/* =========================================================
   Auto Scrap — Auth UI
   Mobile-first · Blue + White · RTL / LTR
   Files live under /xtras
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  --primary: #0d47a1;
  --primary-dark: #0a3d8f;
  --primary-mid: #1565c0;
  --primary-light: #42a5f5;
  --primary-soft: #e3f2fd;
  --primary-gradient: linear-gradient(135deg, #1976d2 0%, #0d47a1 55%, #0a3d8f 100%);
  --bg-gradient: linear-gradient(165deg, #e3f0fc 0%, #f4f8ff 42%, #ffffff 100%);
  --white: #ffffff;
  --text: #0d2137;
  --text-muted: #5a6b85;
  --border: #c8d7ee;
  --danger: #d32f2f;
  --success: #2e7d32;
  --success-bg: #e8f5e9;
  --shadow: 0 16px 48px rgba(13, 71, 161, 0.14);
  --shadow-sm: 0 4px 14px rgba(13, 71, 161, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --transition: 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  --font-ar: "Cairo", "Segoe UI", Tahoma, sans-serif;
  --font-en: "Inter", "Segoe UI", system-ui, sans-serif;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100%;
  margin: 0;
  font-family: var(--font-ar);
  color: var(--text);
  background: var(--bg-gradient);
  background-attachment: fixed;
  line-height: 1.6;
}

html[dir="ltr"] body {
  font-family: var(--font-en);
}

/* Soft background orbs */
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

body::before {
  width: 300px;
  height: 300px;
  top: -90px;
  inset-inline-end: -110px;
  background: radial-gradient(circle, rgba(66, 165, 245, 0.32) 0%, transparent 70%);
}

body::after {
  width: 240px;
  height: 240px;
  bottom: -70px;
  inset-inline-start: -90px;
  background: radial-gradient(circle, rgba(13, 71, 161, 0.16) 0%, transparent 70%);
}

/* ---------- Layout ---------- */
.auth-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(200, 215, 238, 0.75);
  padding: 1.15rem 1.35rem 1.15rem;
  overflow: hidden;
}

/* ---------- Language switcher (INSIDE card, top) ---------- */
.lang-toggle-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.65rem;
}

.lang-toggle {
  background: #f3f7fd;
  border-radius: 999px;
  padding: 3px;
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-lang {
  border: none !important;
  border-radius: 999px !important;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.32rem 0.85rem;
  color: var(--text-muted);
  background: transparent;
  transition: background var(--transition), color var(--transition), box-shadow 0.2s;
  line-height: 1.3;
}

.btn-lang.active {
  background: var(--primary-gradient) !important;
  color: var(--white) !important;
  box-shadow: 0 2px 8px rgba(13, 71, 161, 0.28);
}

.btn-lang:not(.active):hover {
  color: var(--primary);
  background: var(--primary-soft);
}

/* ---------- Logo / brand ---------- */
.logo-section {
  text-align: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.25rem;
}

.logo-icon {
  display: inline-flex;
  margin-bottom: 0.65rem;
  filter: drop-shadow(0 8px 18px rgba(13, 71, 161, 0.28));
  animation: logoFloat 4.5s ease-in-out infinite;
}

.logo-img {
  width: 100px;
  height: 100px;
  display: block;
  object-fit: contain;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.app-name {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0 0 0.1rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.app-tagline {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
  font-weight: 500;
}

/* ---------- Screens + transitions ---------- */
.auth-screen {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--transition), transform var(--transition);
}

.auth-screen.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.auth-screen.leaving {
  display: block;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.screen-title {
  font-size: 1.28rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 0.3rem;
  text-align: center;
}

.screen-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0 0 1.25rem;
}

.phone-ltr {
  direction: ltr;
  unicode-bidi: isolate;
}

/* ---------- Forms ---------- */
.form-label {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.form-control,
.form-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.72rem 0.9rem;
  font-size: 1rem;
  color: var(--text);
  background-color: #fafcff;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.16);
  background-color: var(--white);
  color: var(--text);
}

.form-control:disabled,
.form-control[readonly] {
  background-color: #eef3fb;
  color: var(--text-muted);
  opacity: 1;
  cursor: not-allowed;
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--danger);
}

.form-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.invalid-feedback {
  font-size: 0.8rem;
  color: var(--danger);
}

/* Phone: code + number (always LTR) */
.phone-input-group {
  display: flex;
  gap: 0.5rem;
  direction: ltr;
}

.country-code {
  flex: 0 0 92px;
  padding-inline: 0.4rem;
  text-align: center;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--border);
  cursor: pointer;
}

.phone-number {
  flex: 1;
  min-width: 0;
  letter-spacing: 0.04em;
}

/* ---------- Buttons ---------- */
.btn-auth {
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  font-weight: 800;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}

.btn-primary.btn-auth {
  background: var(--primary-gradient);
  box-shadow: 0 8px 20px rgba(13, 71, 161, 0.35);
}

.btn-primary.btn-auth:hover:not(:disabled) {
  background: linear-gradient(135deg, #1e88e5 0%, #0d47a1 100%);
  box-shadow: 0 10px 24px rgba(13, 71, 161, 0.42);
  transform: translateY(-1px);
}

.btn-primary.btn-auth:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary.btn-auth:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.btn-outline-secondary.btn-auth {
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  background: var(--white);
}

.btn-outline-secondary.btn-auth:hover {
  background: #f5f8fc;
  border-color: var(--primary-light);
  color: var(--primary);
}

.btn-auth.loading .btn-text {
  opacity: 0.7;
}

.btn-auth.loading .btn-spinner {
  display: inline-block !important;
}

/* ---------- OTP boxes ---------- */
.otp-inputs {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.4rem 0 0.2rem;
}

.otp-digit {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 800;
  padding: 0;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: #fafcff;
  color: var(--primary);
  caret-color: var(--primary);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.otp-digit:focus {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.18);
  background: var(--white);
  outline: none;
}

.otp-digit.filled {
  border-color: var(--primary-mid);
  background: var(--primary-soft);
}

.otp-digit.is-invalid {
  border-color: var(--danger);
  background: #fff5f5;
}

/* ---------- Resend ---------- */
.resend-wrap {
  min-height: 3.4rem;
}

.btn-resend {
  font-weight: 700;
  color: var(--primary-mid);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
}

.btn-resend:disabled {
  color: var(--text-muted);
  opacity: 0.6;
  pointer-events: none;
}

.btn-resend:not(:disabled):hover {
  color: var(--primary);
  text-decoration: underline;
}

.resend-timer {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

.resend-timer strong {
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* ---------- Back ---------- */
.btn-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafcff;
  color: var(--primary);
  margin-bottom: 0.65rem;
  transition: background 0.2s, border-color 0.2s;
}

.btn-back:hover {
  background: var(--primary-soft);
  border-color: var(--primary-light);
}

/* Flip chevron in LTR */
html[dir="ltr"] .btn-back i {
  transform: scaleX(-1);
}

/* ---------- Unregistered CTA ---------- */
.unregistered-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

/* ---------- Alerts ---------- */
.alert-auth {
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  animation: fadeSlideIn 0.4s ease;
}

.alert-success.alert-auth {
  background: var(--success-bg);
  color: var(--success);
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Badge / helpers ---------- */
.bg-primary-subtle {
  background-color: var(--primary-soft) !important;
}

.text-primary {
  color: var(--primary-mid) !important;
}

/* ---------- Footer ---------- */
.auth-footer {
  margin-top: 1.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid #eef2f8;
  text-align: center;
}

.auth-footer p {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 360px) {
  .otp-digit {
    width: 40px;
    height: 48px;
    font-size: 1.2rem;
  }

  .logo-img {
    width: 88px;
    height: 88px;
  }

  .auth-card {
    padding: 1rem 1rem 1rem;
  }
}

@media (min-width: 480px) {
  .auth-card {
    padding: 1.35rem 1.75rem 1.35rem;
  }

  .logo-img {
    width: 112px;
    height: 112px;
  }

  .otp-digit {
    width: 50px;
    height: 56px;
    font-size: 1.45rem;
  }

  .otp-inputs {
    gap: 0.5rem;
  }
}

@media (min-width: 768px) {
  .auth-card {
    max-width: 440px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
   Dashboard (index2.php) — true mobile-app shell
   Header + Main + Bottom Nav all inside .app-phone
   max-width 390–428px, centered on desktop
   ========================================================= */

body.app-dashboard {
  --header-h: 58px;
  --bottom-nav-h: 74px;
  --phone-w: 428px; /* iPhone 14/15/16 Pro Max */
  --gray-50: #f0f3f8;
  --gray-100: #e8edf5;
  --gray-200: #dce3ee;
  --phone-bg: #f7f9fc;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  /* Outside phone: soft gray (desktop chrome) */
  background: linear-gradient(165deg, #d9e4f2 0%, #e8eef6 40%, #f0f3f8 100%);
  background-attachment: fixed;
  font-family: var(--font-ar);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

body.app-dashboard::before,
body.app-dashboard::after {
  display: none;
}

/* ---------- Header: INSIDE phone container ---------- */
.app-header {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  z-index: 30;
  height: var(--header-h);
  background: linear-gradient(135deg, #0a3d8f 0%, #0d47a1 45%, #1565c0 100%);
  color: #fff;
  box-shadow: 0 3px 14px rgba(13, 71, 161, 0.28);
}

.app-header-inner {
  width: 100%;
  max-width: none;
  height: 100%;
  padding: 0 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  box-sizing: border-box;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.header-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  background: #fff;
  padding: 2px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.header-app-name {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.header-garage-code {
  font-size: 0.72rem;
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-garage-code strong {
  font-weight: 800;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.header-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  padding: 0;
  transition: background 0.2s;
}

.header-icon-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.notif-badge {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff5252;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 1.5px solid #0d47a1;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  padding: 2px 4px 2px 2px;
  border-radius: 999px;
  transition: background 0.2s;
}

.header-user:hover {
  background: rgba(255, 255, 255, 0.1);
}

.header-user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
}

.header-user-name {
  font-size: 0.78rem;
  font-weight: 700;
}

.header-user-role {
  font-size: 0.65rem;
  opacity: 0.85;
}

@media (max-width: 380px) {
  .header-user-meta {
    display: none;
  }
}

.header-avatar-link {
  display: inline-flex;
  flex-shrink: 0;
  border-radius: 50%;
  line-height: 0;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.header-avatar-link:hover {
  transform: scale(1.06);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.header-avatar-link:active {
  transform: scale(0.98);
}

.header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: #e3f2fd;
  display: block;
}

/* ---------- Phone shell: Header + Main + Nav ---------- */
.app-phone {
  width: 100%;
  max-width: var(--phone-w);
  min-width: 0;
  /* Full viewport height on mobile = real app */
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background: var(--phone-bg);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(13, 71, 161, 0.08), 0 16px 48px rgba(15, 40, 80, 0.12);
}

/* Real device ≤ 428: edge-to-edge, no frame shadow */
@media (max-width: 428px) {
  .app-phone {
    max-width: 100%;
    box-shadow: none;
    border-radius: 0;
  }
}

/* Desktop: phone frame centered */
@media (min-width: 480px) {
  body.app-dashboard {
    padding: 1rem 0;
    min-height: 100dvh;
  }

  .app-phone {
    height: min(920px, calc(100dvh - 2rem));
    border-radius: 28px;
    overflow: hidden;
  }

  .app-header {
    border-radius: 28px 28px 0 0;
  }
}

/* ---------- Scrollable main (between header & nav) ---------- */
.app-main {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.9rem 0.85rem 1rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  min-height: 0;
}

/* Welcome */
.welcome-block {
  margin-bottom: 1rem;
}

.welcome-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 1rem 1rem;
  border-radius: 16px;
  background: linear-gradient(135deg, #0d47a1 0%, #1976d2 55%, #42a5f5 140%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(13, 71, 161, 0.28);
  overflow: hidden;
  position: relative;
}

.welcome-card::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  top: -36px;
  inset-inline-end: -28px;
  pointer-events: none;
}

.welcome-hi {
  font-size: 0.82rem;
  opacity: 0.92;
  font-weight: 600;
}

.welcome-title {
  font-size: 0.98rem;
  font-weight: 800;
  margin: 0 0 0.2rem;
  line-height: 1.35;
}

.welcome-sub {
  font-size: 0.74rem;
  opacity: 0.88;
}

.text-highlight {
  color: #bbdefb;
  font-weight: 800;
}

.welcome-visual {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* Sections */
.section-block {
  margin-bottom: 1.2rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
  gap: 0.5rem;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.section-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--gray-100);
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
}

.section-link {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary-mid);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.section-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Stats — always 2×2 inside phone */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.stat-card {
  background: var(--white);
  border-radius: 14px;
  padding: 0.8rem 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  border: 1px solid var(--gray-200);
  box-shadow: 0 3px 12px rgba(15, 40, 80, 0.05);
  transition: transform 0.2s, box-shadow 0.2s;
  min-height: 84px;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(13, 71, 161, 0.1);
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.stat-blue .stat-icon { background: #e3f2fd; color: #1565c0; }
.stat-cyan .stat-icon { background: #e0f7fa; color: #00838f; }
.stat-navy .stat-icon { background: #e8eaf6; color: #283593; }
.stat-sky .stat-icon { background: #e1f5fe; color: #0277bd; }

.stat-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.12rem;
}

.stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.25;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-value-sm {
  font-size: 0.8rem;
  line-height: 1.3;
}

/* Parts — 2 columns inside phone */
.parts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.part-card {
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
  box-shadow: 0 3px 12px rgba(15, 40, 80, 0.05);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.part-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(13, 71, 161, 0.12);
}

.part-thumb {
  position: relative;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  color: rgba(255, 255, 255, 0.95);
}

.part-thumb-1 { background: linear-gradient(145deg, #1565c0, #42a5f5); }
.part-thumb-2 { background: linear-gradient(145deg, #0d47a1, #5c6bc0); }
.part-thumb-3 { background: linear-gradient(145deg, #0277bd, #4fc3f7); }
.part-thumb-4 { background: linear-gradient(145deg, #1a237e, #3949ab); }

.part-badge {
  position: absolute;
  top: 7px;
  inset-inline-start: 7px;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #2e7d32;
}

.part-info {
  padding: 0.6rem 0.65rem 0.7rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.15rem;
}

.part-name {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.part-meta {
  font-size: 0.66rem;
  color: var(--text-muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.part-footer {
  margin-top: auto;
  padding-top: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
}

.part-price {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
}

.part-price small {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
}

.btn-part-view {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s, color 0.2s;
}

.btn-part-view:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Activity */
.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--white);
  border-radius: 14px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 3px 12px rgba(15, 40, 80, 0.05);
  overflow: hidden;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.8rem 0.85rem;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.15s;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item:hover {
  background: #f8fafc;
}

.activity-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.activity-icon.sold { background: #e8f5e9; color: #2e7d32; }
.activity-icon.added { background: #e3f2fd; color: #1565c0; }
.activity-icon.inquiry { background: #fff3e0; color: #ef6c00; }
.activity-icon.price { background: #f3e5f5; color: #7b1fa2; }

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 600;
  line-height: 1.35;
}

.activity-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.08rem !important;
}

.activity-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 600;
  flex-shrink: 0;
  padding-top: 0.12rem;
}

/* ---------- Bottom nav (inside phone, L→R fixed order) ----------
   1 حسابي | 2 بحث | 3 إضافة(+) center | 4 قطعي | 5 الرئيسية
   ---------------------------------------------------------------- */
.bottom-nav {
  position: relative;
  flex-shrink: 0;
  z-index: 20;
  height: var(--bottom-nav-h);
  background: #fff;
  border-top: 1px solid var(--gray-200);
  box-shadow: 0 -4px 20px rgba(15, 40, 80, 0.08);
  direction: ltr; /* lock visual left→right order */
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 0.2rem 8px;
  box-sizing: border-box;
  max-width: none;
  width: 100%;
  margin: 0;
  transform: none;
}

.bottom-nav-item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.14rem;
  min-height: 52px;
  padding-bottom: 2px;
  text-decoration: none;
  color: #8a97ab;
  font-size: 0.62rem;
  font-weight: 700;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-ar);
}

.bottom-nav-item i {
  font-size: 1.22rem;
  line-height: 1;
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item:hover {
  color: var(--primary-mid);
}

/* Center FAB — larger raised blue circle */
.bottom-nav-add {
  position: relative;
  flex: 1.15 1 0;
  justify-content: flex-end;
  z-index: 3;
}

.nav-add-btn {
  width: 58px;
  height: 58px;
  margin-top: -30px;
  margin-bottom: 2px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2196f3 0%, #1565c0 50%, #0d47a1 100%);
  color: #fff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.65rem;
  box-shadow:
    0 8px 22px rgba(13, 71, 161, 0.48),
    0 2px 6px rgba(13, 71, 161, 0.25),
    0 0 0 5px #ffffff,
    0 0 0 7px rgba(21, 101, 192, 0.12);
  border: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.nav-add-label {
  color: var(--primary);
  font-weight: 800;
  font-size: 0.62rem;
}

.bottom-nav-add:hover .nav-add-btn,
.bottom-nav-add:active .nav-add-btn {
  transform: scale(1.08);
  box-shadow:
    0 10px 26px rgba(13, 71, 161, 0.55),
    0 0 0 5px #fff,
    0 0 0 7px rgba(21, 101, 192, 0.16);
}

.bottom-nav-add:hover {
  color: var(--primary);
}

/* Toast constrained to phone width */
.app-toast-wrap {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1080;
  width: min(var(--phone-w), calc(100% - 1.5rem));
  max-width: var(--phone-w);
  padding: 0 0.75rem;
  pointer-events: none;
}

.app-toast-wrap .toast {
  pointer-events: auto;
  width: 100%;
}

/* AJAX content loader inside #app-main */
.app-content-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 2rem 1rem;
  text-align: center;
}

/* Header logo button → categories */
.header-logo-btn {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  border-radius: 10px;
  cursor: pointer;
  line-height: 0;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.header-logo-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.28);
}

.header-logo-btn:active {
  transform: scale(0.97);
}

.header-logo-btn .header-logo {
  display: block;
  pointer-events: none;
}

/* =========================================================
   Categories Tree — Accordion + lazy children
   ========================================================= */
.categories-page {
  padding-bottom: 0.5rem;
}

.cat-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.cat-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cat-page-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cat-page-title i {
  color: var(--primary-mid);
}

.cat-page-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Lang toggle inside categories */
.cat-lang-toggle {
  background: #f3f7fd;
  border-radius: 999px;
  padding: 2px;
  border: 1px solid var(--border);
}

.btn-lang-cat {
  border: none !important;
  border-radius: 999px !important;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.7rem;
  color: var(--text-muted);
  background: transparent;
}

.btn-lang-cat.active {
  background: var(--primary-gradient) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(13, 71, 161, 0.28);
}

.cat-btn-add {
  border-radius: 10px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--primary-gradient);
  border: none;
  box-shadow: 0 4px 12px rgba(13, 71, 161, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.cat-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: #eef4fc;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  line-height: 1.4;
}

.cat-tree-wrap {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  box-shadow: 0 3px 12px rgba(15, 40, 80, 0.05);
  overflow: hidden;
  min-height: 160px;
}

.cat-list {
  padding: 0.25rem 0;
}

.cat-item {
  border-bottom: 1px solid #eef2f8;
}

.cat-item:last-child {
  border-bottom: none;
}

.cat-item.is-inactive .cat-name {
  opacity: 0.55;
  text-decoration: line-through;
}

.cat-item.is-open > .cat-row {
  background: #f0f6ff;
}

.cat-item.is-open > .cat-row .cat-chevron {
  transform: rotate(-90deg);
}

.cat-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.55rem;
  min-height: 56px;
  transition: background 0.15s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cat-row:hover {
  background: #f5f9ff;
}

.cat-item-child > .cat-row {
  cursor: default;
  padding-inline-start: 0.85rem;
  background: #fafcff;
  min-height: 50px;
}

.cat-item-child > .cat-row:hover {
  background: #f3f8ff;
}

.cat-expand-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.cat-expand-btn:hover {
  background: #bbdefb;
}

.cat-chevron {
  font-size: 0.95rem;
  transition: transform 0.2s ease;
  display: inline-block;
}

/* RTL: closed chevron points left; open rotates */
html[dir="ltr"] .cat-item.is-open > .cat-row .cat-chevron {
  transform: rotate(90deg);
}

html[dir="ltr"] .cat-chevron {
  transform: none;
}

.cat-expand-spacer {
  width: 32px;
  flex-shrink: 0;
}

.cat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #eef4fc;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid #e3ebf5;
}

.cat-item-child .cat-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.cat-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cat-icon-preview-wrap {
  min-width: 42px;
  justify-content: center;
  padding: 0.25rem 0.5rem;
}

.cat-icon-preview-wrap .cat-icon-img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.cat-labels {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.cat-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
  min-width: 0;
}

.cat-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* L1 group number: ١- ٢- … (prominent) */
.cat-group-num {
  flex-shrink: 0;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.cat-item-child .cat-name {
  font-size: 0.82rem;
  font-weight: 600;
}

.cat-item-child .cat-name-text {
  font-weight: 600;
}

.cat-actions {
  display: flex;
  gap: 0.1rem;
  flex-shrink: 0;
}

.btn-cat-act {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.btn-cat-act:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn-cat-act.text-danger:hover {
  background: #ffebee;
  color: #c62828;
}

/* Lazy children panel */
.cat-children-panel {
  background: #f7faff;
  border-top: 1px solid #e8eef6;
  padding: 0.15rem 0 0.35rem;
}

.cat-children-list {
  padding-inline-start: 0.35rem;
  border-inline-start: 3px solid #c5d8f0;
  margin-inline-start: 1.35rem;
  margin-inline-end: 0.35rem;
}

.cat-children-list .cat-item {
  border-bottom-color: #e8eef6;
}

.cat-children-empty,
.cat-children-loading {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.75rem;
}

.cat-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

.cat-empty i {
  font-size: 2.2rem;
  color: var(--primary-light);
  display: block;
  margin-bottom: 0.5rem;
}

.cat-empty p {
  font-size: 0.9rem;
  margin-bottom: 0.85rem;
}

.cat-modal-content {
  border-radius: 16px;
  border: none;
  box-shadow: 0 16px 40px rgba(13, 71, 161, 0.18);
}

.cat-modal-content .modal-header {
  border-bottom-color: #eef2f8;
  padding: 0.85rem 1rem;
}

.cat-modal-content .modal-title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
}

.cat-modal-content .form-label {
  font-weight: 700;
  font-size: 0.82rem;
}

.app-dashboard .modal {
  --bs-modal-width: min(400px, 94vw);
}
