/* منصة التشخيص الفلاحي - واجهة موبايل أولاً */
:root {
  --green: #1a7a32;
  --green-dark: #145c26;
  --green-light: #e8f5e9;
  --green-mid: #2d8a3e;
  --bg: #f4f6f4;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --radius: 16px;
  --shadow: 0 8px 30px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Segoe UI', Tahoma, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  direction: rtl;
}

a { color: var(--green); text-decoration: none; font-weight: 600; }

/* ===== شريط علوي ===== */
.app-header {
  background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
  color: #fff;
  padding: 16px 18px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-header .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  max-width: 520px;
  margin: 0 auto;
}
.app-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
}
.app-header .sub {
  font-size: 0.8rem;
  opacity: 0.9;
  margin-top: 2px;
}
.app-header .nav a {
  color: #fff;
  font-size: 0.85rem;
  opacity: 0.95;
  margin-right: 8px;
}

/* ===== حاوية ===== */
.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 14px 40px;
}

/* ===== بطاقة ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 18px;
  margin-bottom: 16px;
}

/* ===== أزرار ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--green);
  color: #fff;
}
.btn-primary:hover { background: var(--green-dark); }
.btn-outline {
  background: #fff;
  color: var(--green);
  border: 1.5px solid var(--green);
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--border);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.btn-row .btn { flex: 1; }

/* ===== حقول ===== */
.label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 6px;
  color: #333;
}
.input, .select {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  background: #fafafa;
  margin-bottom: 14px;
  transition: border-color 0.15s;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--green);
  background: #fff;
}

/* ===== تبويبات المصادقة ===== */
.auth-tabs {
  display: flex;
  background: #eef2ee;
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 20px;
}
.auth-tabs a, .auth-tabs span {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.auth-tabs .active {
  background: var(--green-dark);
  color: #fff;
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 0.92rem;
}
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-info { background: #fff7ed; color: #9a3412; }
.alert-ok { background: var(--green-light); color: var(--green-dark); }

/* ===== شريط التقدم ===== */
.progress-wrap {
  margin-bottom: 18px;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.progress-bar {
  height: 8px;
  background: #e5ebe5;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-mid));
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* ===== خطوة السؤال ===== */
.step { display: none; }
.step.active { display: block; }

.q-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  margin-left: 8px;
}
.q-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
}

/* خيارات راديو كبيرة للمس */
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  margin-bottom: 10px;
  background: #fafcfa;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.opt:active { transform: scale(0.99); }
.opt:hover { border-color: var(--green-mid); background: var(--green-light); }
.opt.selected {
  border-color: var(--green);
  background: var(--green-light);
  box-shadow: 0 0 0 1px var(--green);
}
.opt input {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
  flex-shrink: 0;
}
.opt span { font-size: 1rem; flex: 1; }

.branch {
  margin: 8px 0 12px 0;
  padding: 12px;
  background: #f3f8f3;
  border-radius: 12px;
  border-right: 3px solid var(--green);
  display: none;
}
.branch.show { display: block; }
.branch-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 10px;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: -6px;
  margin-bottom: 12px;
}

/* ===== تقرير ===== */
.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  justify-content: space-between;
  align-items: center;
}
.chip {
  display: inline-block;
  background: var(--green-light);
  color: var(--green-dark);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ===== حسابي ===== */
.table-card { overflow-x: auto; }
table.simple {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.simple th, table.simple td {
  padding: 10px 8px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
table.simple th {
  background: var(--green-light);
  color: var(--green-dark);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
}

.footer-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 16px;
}

@media (min-width: 600px) {
  .wrap { padding-top: 24px; }
  .card { padding: 28px 24px; }
}
