* { font-family: 'Tajawal', 'Cairo', system-ui, -apple-system, sans-serif; }

html { scroll-behavior: smooth; }

body { direction: rtl; }

/* Gradient backgrounds */
.gradient-primary {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #0f766e 100%);
}
.gradient-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}
.gradient-gold {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Numbers should always be LTR for readability */
.num, input[type="number"], .amount {
  direction: ltr;
  unicode-bidi: embed;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.num-cell {
  text-align: left;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}

/* Table styles */
.fin-table { width: 100%; border-collapse: collapse; }
.fin-table th, .fin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  text-align: right;
}
.fin-table th {
  background: #f1f5f9;
  font-weight: 700;
  color: #334155;
}
.fin-table tr.total-row {
  background: #fef3c7;
  font-weight: 800;
}
.fin-table tr.section-header td {
  background: #e0e7ff;
  font-weight: 800;
  color: #1e3a8a;
}
.fin-table tr.subtotal td {
  background: #f1f5f9;
  font-weight: 700;
  border-top: 2px solid #64748b;
}
.fin-table tr.grand-total td {
  background: #1e3a8a;
  color: white;
  font-weight: 900;
  font-size: 1.05em;
  border-top: 3px double #fbbf24;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-debit { background: #dbeafe; color: #1e40af; }
.badge-credit { background: #fee2e2; color: #991b1b; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #854d0e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* Cards */
.lesson-card {
  transition: all 0.3s ease;
  border: 1px solid #e2e8f0;
}
.lesson-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -15px rgba(30, 58, 138, 0.25);
  border-color: #3b82f6;
}

/* Navigation */
.nav-link {
  position: relative;
  transition: color 0.2s;
}
.nav-link:hover { color: #fbbf24; }
.nav-link.active { color: #fbbf24; }
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 0;
  width: 100%;
  height: 3px;
  background: #fbbf24;
  border-radius: 2px;
}

/* Tabs */
.tab-btn {
  padding: 10px 20px;
  border-bottom: 3px solid transparent;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.tab-btn:hover { color: #1e40af; }
.tab-btn.active {
  color: #1e40af;
  border-color: #1e40af;
  background: #eff6ff;
}

/* Journal entry rows */
.je-debit { background: #eff6ff; }
.je-credit { background: #fef2f2; }

/* Input styling */
.input-field {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  transition: all 0.15s;
  background: white;
}
.input-field:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Quiz */
.quiz-option {
  display: block;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 8px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: white;
  cursor: pointer;
  text-align: right;
  transition: all 0.15s;
  font-weight: 500;
}
.quiz-option:hover { border-color: #3b82f6; background: #eff6ff; }
.quiz-option.selected { border-color: #3b82f6; background: #dbeafe; }
.quiz-option.correct { border-color: #16a34a; background: #dcfce7; color: #14532d; }
.quiz-option.wrong { border-color: #dc2626; background: #fee2e2; color: #7f1d1d; }

/* Ratio card */
.ratio-card {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: white;
  transition: all 0.2s;
}
.ratio-card:hover { border-color: #3b82f6; box-shadow: 0 8px 20px -10px rgba(30, 58, 138, 0.2); }
.ratio-value { font-size: 1.8rem; font-weight: 900; }
.ratio-value.good { color: #16a34a; }
.ratio-value.neutral { color: #2563eb; }
.ratio-value.warning { color: #d97706; }
.ratio-value.bad { color: #dc2626; }

/* Balance check */
.balance-ok { color: #16a34a; font-weight: 800; }
.balance-fail { color: #dc2626; font-weight: 800; }

/* Print */
@media print {
  .no-print { display: none !important; }
  body { background: white; }
}

/* Hero pattern */
.hero-pattern {
  background-image:
    radial-gradient(circle at 10% 20%, rgba(251, 191, 36, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(20, 184, 166, 0.12) 0%, transparent 50%);
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* Section transitions */
.page-section { display: none; animation: fadeIn 0.3s ease; }
.page-section.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Chart container */
.chart-container { position: relative; height: 320px; }

/* Step indicator */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-weight: 600;
  font-size: 0.9rem;
}
.step.active { background: #1e3a8a; color: white; }
.step.done { background: #16a34a; color: white; }

/* Info box */
.info-box {
  border-right: 4px solid #3b82f6;
  background: #eff6ff;
  padding: 14px 18px;
  border-radius: 8px;
  margin: 12px 0;
}
.warn-box {
  border-right: 4px solid #f59e0b;
  background: #fffbeb;
  padding: 14px 18px;
  border-radius: 8px;
  margin: 12px 0;
}
.success-box {
  border-right: 4px solid #16a34a;
  background: #f0fdf4;
  padding: 14px 18px;
  border-radius: 8px;
  margin: 12px 0;
}
.danger-box {
  border-right: 4px solid #dc2626;
  background: #fef2f2;
  padding: 14px 18px;
  border-radius: 8px;
  margin: 12px 0;
}

/* Formula styling */
.formula {
  background: #0f172a;
  color: #fbbf24;
  padding: 12px 18px;
  border-radius: 10px;
  font-family: 'Courier New', monospace;
  direction: ltr;
  text-align: center;
  font-weight: 700;
  margin: 12px 0;
  display: inline-block;
  min-width: 60%;
}
