/* الويب الموحد — زيتي + أصفر + أبيض — عربي RTL — متجاوب */
:root {
  --olive: #4a5d23;
  --olive-dark: #3a4a1b;
  --olive-light: #6b8235;
  --yellow: #e8b923;
  --yellow-dark: #c99e10;
  --white: #ffffff;
  --bg: #f5f6f1;
  --text: #2c3320;
  --muted: #7a8070;
  --border: #e2e5d8;
  --danger: #b23a3a;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(74, 93, 35, 0.10);
}

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

html, body {
  min-height: 100%;
  font-family: 'Segoe UI', Tahoma, 'Noto Kufi Arabic', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
}

a { color: var(--olive); }

/* ---------- الدخول ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--olive-dark) 0%, var(--olive) 60%, var(--olive-light) 100%);
  padding: 20px;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
  border-top: 6px solid var(--yellow);
}

.login-logo { text-align: center; margin-bottom: 28px; }

.login-logo .icon {
  width: 64px; height: 64px;
  margin: 0 auto 12px;
  background: var(--olive);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--yellow);
  font-size: 30px;
}

.login-logo h1 { font-size: 20px; color: var(--olive-dark); }
.login-logo p { font-size: 14px; color: var(--muted); margin-top: 4px; }

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  direction: rtl;
  background: var(--bg);
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--olive-light);
  background: var(--white);
}

.btn {
  width: 100%;
  padding: 13px;
  background: var(--olive);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.btn:hover { background: var(--olive-dark); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.error-msg {
  background: #fbeaea;
  color: var(--danger);
  border: 1px solid #f0c8c8;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
  text-align: center;
}

.error-msg.show { display: block; }

/* عنصر مخفي يبقى مخفياً حتى لو أُعطي display في قاعدة أخرى */
[hidden] { display: none !important; }

/* ---------- التخطيط العام ---------- */
.topbar {
  background: var(--olive-dark);
  color: var(--white);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar .brand { font-size: 18px; font-weight: 700; color: var(--yellow); }
.topbar .user { font-size: 14px; opacity: 0.9; display: flex; align-items: center; gap: 12px; }

.btn-logout {
  background: rgba(255,255,255,0.12);
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  padding: 7px 16px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

.btn-logout:hover { background: rgba(255,255,255,0.22); }

.container { max-width: 1100px; margin: 0 auto; padding: 26px 20px; }

.page-title { font-size: 24px; color: var(--olive-dark); margin-bottom: 6px; }
.page-sub { color: var(--muted); font-size: 14.5px; margin-bottom: 24px; }

/* ---------- بطاقات البيانات ---------- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.info-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border-right: 5px solid var(--yellow);
}

.info-card .label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.info-card .value { font-size: 18px; font-weight: 700; color: var(--olive-dark); }

/* ---------- الجداول ---------- */
.table-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; font-size: 14.5px; }

thead th {
  background: var(--olive);
  color: var(--white);
  padding: 14px 16px;
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); }
tbody tr:hover { background: #fafbf6; }
.loading { text-align: center; color: var(--muted); padding: 30px !important; }

/* ---------- الشارات ---------- */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-draft { background: #ececec; color: #555; }
.badge-submitted_to_gov { background: #fdf3d3; color: var(--yellow-dark); }
.badge-sent_to_axis { background: #eef3e0; color: var(--olive-dark); }
.badge-archived { background: var(--olive-dark); color: var(--yellow); }
.badge-monthly { background: var(--olive); color: var(--white); }
.badge-semi_monthly { background: var(--yellow); color: var(--olive-dark); }
.badge-excellent { background: #dff0d0; color: #2f6b1f; }
.badge-good { background: #eef3e0; color: var(--olive-dark); }
.badge-average { background: #fdf3d3; color: var(--yellow-dark); }
.badge-acceptable { background: #fde8c8; color: #a05a00; }
.badge-rejected { background: #fbeaea; color: var(--danger); }

.btn-mini {
  padding: 6px 14px;
  border: 1.5px solid var(--olive-light);
  background: var(--white);
  color: var(--olive-dark);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-mini:hover { background: var(--olive); color: var(--white); }

.btn-block {
  display: block;
  width: 100%;
  padding: 13px;
  background: var(--olive);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.btn-block:hover { background: var(--olive-dark); }
.btn-block.yellow { background: var(--yellow); color: var(--olive-dark); }
.btn-block.yellow:hover { background: var(--yellow-dark); }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.choice-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 24px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  border-bottom: 6px solid var(--yellow);
  transition: transform 0.15s;
  display: block;
}

.choice-card:hover { transform: translateY(-5px); }
.choice-card .big-icon { font-size: 46px; margin-bottom: 14px; }
.choice-card h3 { font-size: 20px; color: var(--olive-dark); margin-bottom: 8px; }
.choice-card p { font-size: 14px; color: var(--muted); }

/* ---------- أشرطة وضع التجربة والقفل ---------- */
.trial-bar, .lock-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}

.trial-bar { background: #fff8e1; border: 1px solid #e8c766; color: #7a5c00; }
.trial-bar .tb-icon { font-size: 20px; }
.trial-bar .tb-text { flex: 1; min-width: 200px; }
.trial-bar .btn-mini { margin-top: 4px; }

.lock-notice { background: #fdecec; border: 1px solid #f0b3b3; color: #8a1f1f; }

/* ---------- قائمة تقاريري (صفحة القائد) ---------- */
.myreports-list { display: flex; flex-direction: column; gap: 10px; }

.myreport-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
}

.myreport-card:hover { border-color: var(--olive); }
.myreport-card .mr-icon { font-size: 22px; }
.myreport-card .mr-main { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.myreport-card .mr-main strong { font-size: 15px; color: var(--olive-dark); }
.myreport-card .mr-main small { color: var(--muted); font-size: 12.5px; }
.myreport-card .mr-open { color: var(--olive-dark); font-weight: 700; font-size: 13px; }

/* ---------- الاستمارة ---------- */
.form-section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.form-section h3 {
  font-size: 17px;
  color: var(--olive-dark);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--yellow);
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
  position: sticky;
  bottom: 0;
}

.form-actions .btn-block { flex: 1; min-width: 200px; }

textarea.answer {
  min-height: 110px;
  resize: vertical;
}

.save-note {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 10px;
  min-height: 20px;
}

/* ---------- التقييم ---------- */
.rating-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.rating-option {
  flex: 1;
  min-width: 130px;
}

.rating-option input { display: none; }

.rating-option label {
  display: block;
  text-align: center;
  padding: 14px 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  background: var(--bg);
  transition: all 0.15s;
}

.rating-option input:checked + label {
  background: var(--olive);
  color: var(--white);
  border-color: var(--olive);
}

.status-history { list-style: none; }

.status-history li {
  padding: 12px 16px;
  border-right: 3px solid var(--yellow);
  margin-right: 8px;
  margin-bottom: 10px;
  background: var(--bg);
  border-radius: 0 8px 8px 0;
  font-size: 14px;
}

.status-history .when { color: var(--muted); font-size: 12.5px; display: block; margin-top: 4px; }

/* ---------- الهاتف ---------- */
@media (max-width: 700px) {
  .container { padding: 16px 12px; }
  .page-title { font-size: 20px; }
  .topbar { padding: 14px 16px; }
  .form-actions { flex-direction: column; }
  .form-actions .btn-block { min-width: 0; }
  .rating-option { min-width: calc(50% - 5px); }
  table { font-size: 13.5px; }
  thead th, tbody td { padding: 10px 10px; }
  /* الكيبورد على الهاتف: حجم 16px يمنع تقريب iOS تلقائياً + مساحة لمس مريحة */
  .field input, .field select, .field textarea, #districtInput {
    font-size: 16px;
    min-height: 42px;
    padding: 10px 12px;
  }
  .trial-bar .btn-mini { width: 100%; text-align: center; }
}
