/* ============================================================
   نظام التصميم الأساسي — UrFit
   الهوية: سجل تدريب احترافي، مو تطبيق استهلاكي لامع
   ============================================================ */

/* الخط يُحمّل من Google Fonts عند توفر إنترنت، مع fallback فوري لخطوط
   النظام العربية (ممتازة أصلاً على iOS/Android) عند عدم التوفر — هذا
   يضمن التطبيق يشتغل ويبان جيد offline بالكامل من أول فتحة */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;900&family=IBM+Plex+Mono:wght@500;600;700&display=swap');

:root {
  /* --- الألوان --- */
  --bg-base: #16181C;
  --bg-card: #1E2126;
  --bg-card-raised: #262A31;
  --border-subtle: #2E3238;
  --border-dashed: #3A3F47;

  --text-primary: #EDEEF0;
  --text-secondary: #9BA1AB;
  --text-tertiary: #676D77;

  --accent: #C4F542;
  --accent-dim: #8FB332;
  --accent-bg: rgba(196, 245, 66, 0.08);

  --danger: #E85D4E;
  --warning: #E8A84E;

  /* --- الخطوط ---
     ترتيب متعمد: Tajawal أولاً (إن حمّل)، ثم أفضل خطوط النظام العربية
     على كل منصة (SF Arabic على iOS، Noto/Roboto على Android)، ثم عام */
  --font-body: 'Tajawal', -apple-system, 'SF Arabic', 'Segoe UI', system-ui, 'Noto Sans Arabic', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', 'Cascadia Code', monospace;

  /* --- مسافات --- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  direction: rtl;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* خلفية بملمس دقيق جداً — شبكة هندسية خافتة توحي بورقة تخطيط */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border-subtle) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 90px; /* مساحة لشريط التنقل السفلي */
}

/* --- الطباعة --- */
h1, h2, h3 {
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.numeral {
  font-family: var(--font-mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* --- أزرار --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #14170F;
}
.btn-primary:active { opacity: 0.88; }

.btn-secondary {
  background: var(--bg-card-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-block { width: 100%; }

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* --- بطاقات --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

/* خط تقطيع (perforation) — العنصر المميز بالتصميم */
.perforated {
  position: relative;
  border-top: 1px dashed var(--border-dashed);
}
.perforated::before,
.perforated::after {
  content: '';
  position: absolute;
  top: -6px;
  width: 12px;
  height: 12px;
  background: var(--bg-base);
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
}
.perforated::before { right: -6px; }
.perforated::after { left: -6px; }

/* --- شارات (Badges) --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.badge-accent { background: var(--accent-bg); color: var(--accent); }
.badge-muted { background: var(--bg-card-raised); color: var(--text-secondary); }

/* --- شاشة عامة --- */
.screen {
  padding: var(--space-5) var(--space-4);
  animation: fadeIn 0.25s ease;
}

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

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

/* --- التمرير --- */
.scroll-x {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.scroll-x::-webkit-scrollbar { display: none; }

/* --- فوكس لوحة المفاتيح --- */
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
