/* ================================================================
   ملف التنسيق العام (style.css) — تستخدمه كل الصفحات
   هوية بصرية احترافية: أزرق أساسي #3379BD + خلفية فاتحة أنيقة
   ================================================================ */

/* ---------- المتغيرات الأساسية (الألوان والقياسات) ----------
   أي تغيير بلون الهوية يكفي تسويه هنا فقط، وينعكس بكل الموقع */
:root {
  --primary: #3379BD;         /* اللون الأساسي (الأزرق) */
  --primary-dark: #275f94;    /* درجة أغمق — تدرجات وحالة hover */
  --primary-light: #eaf2fa;   /* درجة فاتحة جدًا — خلفيات وشارات */
  --primary-lighter: #f4f8fc; /* أفتح درجة — خلفية عامة للصفحة */

  --surface: #ffffff;         /* خلفية البطاقات */
  --background: #f4f7fb;      /* خلفية الصفحة */
  --border: #e2e8f0;          /* لون الحدود الخفيفة */

  --text: #1e293b;            /* النص الأساسي */
  --text-muted: #64748b;      /* نص ثانوي */

  --success: #16a34a;
  --success-bg: #dcfce7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warning-bg: #fef3c7;
  --warning-text: #92400e;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(30, 41, 59, 0.06);
  --shadow-md: 0 6px 20px rgba(51, 121, 189, 0.12);
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }

body {
  margin: 0;
  font-family: "Tajawal", "Tahoma", "Segoe UI", sans-serif;
  background: var(--background);
  color: var(--text);
  direction: rtl;
  line-height: 1.6;
  overflow-x: hidden; /* يمنع أي عنصر (نص طويل بلا مسافات مثلاً) من تكبير عرض الصفحة والتسبب بانزياح النوافذ المنبثقة */
  overflow-wrap: break-word; /* يجبر أي نص طويل متواصل بدون مسافات على الالتفاف بدل ما يفيض خارج حدوده */
  word-break: break-word;
}

/* ---------- الشريط العلوي (header) في كل الصفحات ---------- */
header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 18px 28px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
}
header h1 { font-size: 19px; font-weight: 700; margin: 0; letter-spacing: 0.2px; }
header .user-info { font-size: 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* شاشات صغيرة جدًا: نخلي العنوان والأزرار كل وحدة بسطر مستقل بعرض كامل */
@media (max-width: 420px) {
  header { justify-content: center; text-align: center; }
  header h1 { width: 100%; text-align: center; }
  header .user-info { width: 100%; justify-content: center; }
}

/* ---------- الأزرار العامة ---------- */
button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  background: var(--primary);
  color: #fff;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
button:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(51, 121, 189, 0.25); }
button:active { transform: translateY(1px); }

button.secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
button.secondary:hover { background: rgba(255, 255, 255, 0.25); box-shadow: none; }

/* أزرار ثانوية داخل البطاقات والنوافذ المنبثقة (خلفية فاتحة، مو بالشريط العلوي) */
.main button.secondary,
.modal-box button.secondary {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid var(--border);
}
.main button.secondary:hover,
.modal-box button.secondary:hover { background: #ddeaf6; }

/* ---------- شعار صفحة تسجيل الدخول ---------- */
.login-logo {
  text-align: center;
  margin-top: 40px;
  padding: 0 24px; /* هامش جانبي يمنع الصورة تلمس حواف الشاشة */
}
.login-logo img {
  display: inline-block;
  width: 100%;
  max-width: 200px; /* الحد الأقصى الفعلي لعرض الشعار، بغض النظر عن حجم الشاشة */
  height: auto;
  mix-blend-mode: multiply; /* يخفي خلفية الصورة البيضاء ويدمجها بخلفية الصفحة */
}

/* ---------- صندوق صفحة تسجيل الدخول (login.html) ---------- */
.container { max-width: 440px; margin: 20px auto 70px; padding: 24px; }
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.card h2 { margin-top: 0; font-size: 20px; font-weight: 700; color: var(--primary-dark); }

/* حقول الإدخال (البريد، كلمة المرور، اسم القسم...) */
.field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.field input {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px; /* لازم 16px فأكثر — أقل من كذا يخلي آيفون يكبّر الصفحة تلقائيًا عند فتح لوحة المفاتيح */
  font-family: inherit;
  background: #fbfcfe;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(51, 121, 189, 0.15);
}

/* رسائل الخطأ والنجاح */
.error { color: var(--danger); font-size: 13px; min-height: 18px; }
.success { color: var(--success); font-size: 13px; min-height: 18px; }

/* زر نصي بسيط */
.link-btn {
  background: none;
  color: var(--primary);
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
}

.center { text-align: center; }

/* ---------- محتوى الصفحة الرئيسية بعد الشريط العلوي ---------- */
.main { padding: 28px 24px; max-width: 1000px; margin: 0 auto; }
.main h2 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 4px; }

/* شارة نوع الحساب (زائر / مشرف) */
.badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.badge.admin { background: #fde68a; color: #78350f; }

/* ================================================================
   قسم إدارة الأقسام (Categories) — يُستخدم في admin.html و index.html
   ================================================================ */

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.category-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 12px;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.category-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.category-visual {
  width: 100%;
  height: 100px;
  background: var(--primary-lighter);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.category-visual img { width: 100%; height: 100%; object-fit: contain; padding: 10px; box-sizing: border-box; }
.category-visual .icon-text { font-size: 42px; }

.category-name { margin-top: 10px; font-size: 14px; font-weight: 700; text-align: center; padding: 0 8px; }

.category-actions { display: flex; gap: 8px; margin-top: 10px; }
.category-actions button { padding: 5px 14px; font-size: 12px; }

/* زر "إضافة قسم جديد" بشكل مربع منقط */
.add-category-card {
  border: 2px dashed #b9cfe6;
  border-radius: var(--radius);
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  background: var(--primary-lighter);
  transition: background 0.12s ease, border-color 0.12s ease;
}
.add-category-card:hover { background: var(--primary-light); border-color: var(--primary); }

/* ---------- النافذة المنبثقة (Modal) لإضافة/تعديل قسم ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}
.modal-box h3 { margin-top: 0; font-size: 18px; font-weight: 700; color: var(--primary-dark); }

/* أزرار اختيار نوع الصورة (ما زالت موجودة بالـ CSS احتياطًا لو استُخدمت لاحقًا) */
.image-type-toggle { display: flex; gap: 8px; margin-bottom: 14px; }
.image-type-toggle button { flex: 1; background: var(--primary-light); color: var(--primary-dark); }
.image-type-toggle button.active { background: var(--primary); color: #fff; }

.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions button { flex: 1; }

/* ================================================================
   قسم القوائم والبنود — يُستخدم في lists.html
   ================================================================ */

/* مسار العودة (قسم كذا > القوائم) أعلى الصفحة */
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.breadcrumb button { background: none; padding: 0; color: var(--primary); font-weight: 600; }

/* ---------- شريط التبويبات (القوائم) ----------
   overflow-x: auto يمنح السحب باللمس (سوايب) يمين/يسار على الجوال تلقائيًا
   بدون أي كود جافاسكربت إضافي، وبنفس الوقت التبويبات قابلة للضغط المباشر */
.lists-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 4px 2px 12px;
  margin-top: 16px;
  border-bottom: 1px solid var(--border);
}
.lists-tabs::-webkit-scrollbar { height: 4px; }
.lists-tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.list-tab {
  flex: 0 0 auto;
  scroll-snap-align: start;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  background: var(--primary-lighter);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid var(--border);
  transition: background 0.12s ease, color 0.12s ease;
}
.list-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.list-tab.add-list-tab {
  background: transparent;
  color: var(--primary);
  border: 2px dashed #b9cfe6;
}

/* ---------- عنوان القائمة النشطة + أزرار تعديل/حذفها ---------- */
.list-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}
.list-panel-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
.list-panel-header .actions { display: flex; gap: 8px; }
.list-panel-header .actions button { padding: 5px 14px; font-size: 12px; }

/* ---------- صفوف البنود ---------- */
.items-list { display: flex; flex-direction: column; gap: 10px; }

.item-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  gap: 8px;
  transition: box-shadow 0.12s ease, border-color 0.12s ease, background 0.4s ease;
}
.item-row:hover { box-shadow: var(--shadow-sm); border-color: var(--primary); }
.item-row .item-name {
  font-weight: 600;
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.item-row button { padding: 5px 14px; font-size: 12px; }

/* بند موقوف حسب التوجيه — رمادي ومشطوب، يبقى ظاهر بالقائمة لكن بشكل مختلف */
.item-row.item-suspended { background: #f1f3f5; }
.item-row.item-suspended .item-name {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* زر "إضافة بند جديد" أسفل القائمة */
.add-item-btn {
  border: 2px dashed #b9cfe6;
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-lighter);
  cursor: pointer;
}
.add-item-btn:hover { background: var(--primary-light); }

.empty-hint { color: var(--text-muted); font-size: 14px; padding: 20px 0; text-align: center; }

/* ================================================================
   قسم الحالات وصورها — يُستخدم في cases.html
   ================================================================ */

/* بطاقة الحالة بشبكة الحالات (نفس فكرة مربع القسم) */
.case-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.case-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.case-card .case-thumb {
  width: 100%;
  height: 110px;
  background: var(--primary-lighter);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.case-card .case-thumb img { width: 100%; height: 100%; object-fit: cover; }
.case-card .case-thumb .icon-text { font-size: 40px; }
.case-card .case-title { padding: 10px 12px; font-weight: 700; font-size: 14px; text-align: center; }

/* صف مربعات صور الحالة داخل نافذة التعديل — حتى 3 مربعات جنب بعض */
.case-images-row { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }

.case-image-slot {
  width: 84px; height: 84px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  background: var(--primary-lighter);
  border: 1px solid var(--border);
}
.case-image-slot img { width: 100%; height: 100%; object-fit: cover; }

.case-image-remove {
  position: absolute; top: 4px; left: 4px;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  border-radius: 50%;
  width: 22px; height: 22px;
  font-size: 13px;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
  padding: 0;
}
.case-image-remove:hover { background: rgba(220, 38, 38, 0.85); }

.add-image-slot {
  width: 84px; height: 84px;
  border: 2px dashed #b9cfe6;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  font-size: 26px;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
}
.add-image-slot:hover { background: var(--primary-light); }

.field textarea {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: inherit;
  background: #fbfcfe;
  resize: none; /* يمنع تمديد الحقل يدويًا خارج حدوده */
  max-height: 240px;
  overflow-y: auto; /* النص الطويل يتمرر داخل الحقل نفسه بدل ما يفيض خارجه */
}
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(51, 121, 189, 0.15);
}

/* ================================================================
   الشريط السفلي (Bottom Nav) — يظهر بصفحات المفتش
   ================================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0; right: 0; left: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.06);
  z-index: 40;
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 9px 0 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  position: relative;
}
.bottom-nav a .nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 26px;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}
.bottom-nav a.active { color: var(--primary); font-weight: 700; }
.bottom-nav a.active .nav-icon { background: var(--primary-light); color: var(--primary); }

/* نقطة حمراء صغيرة فوق أيقونة "تعاميم" لما فيه تعميم جديد ما قُرئ */
.bottom-nav a .nav-dot {
  position: absolute;
  top: 2px; left: calc(50% + 6px);
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--surface);
}

/* مساحة سفلية تمنع تغطية آخر عنصر بالصفحة بالشريط الثابت */
.bottom-nav-spacer { height: 76px; }

/* ================================================================
   قسم التعاميم
   ================================================================ */
.circular-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: box-shadow 0.12s ease;
}
.circular-card:hover { box-shadow: var(--shadow-sm); }

.circular-card .circular-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.circular-card .circular-title { font-size: 15px; font-weight: 700; }
.circular-card.unread .circular-title { font-weight: 800; }

/* نقطة التنبيه بجانب عنوان التعميم غير المقروء */
.circular-unread-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
}

.circular-card .circular-date { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

.circular-card .circular-content {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
}
/* الوضع المطوي: سطرين بس ثم نقاط */
.circular-card .circular-content.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.circular-card .circular-more { font-size: 12px; color: var(--primary); font-weight: 700; margin-top: 4px; }

/* ================================================================
   قسم الأدوات المساعدة (نفس فكرة شبكة الأقسام)
   ================================================================ */
.tool-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  padding-bottom: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.tool-card .tool-visual {
  width: 100%; height: 90px;
  background: var(--primary-lighter);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.tool-card .tool-visual img { width: 100%; height: 100%; object-fit: contain; padding: 10px; box-sizing: border-box; }
.tool-card .tool-visual .icon-text { font-size: 36px; }
.tool-card .tool-name { margin-top: 8px; font-size: 13px; font-weight: 700; text-align: center; padding: 0 6px; }

/* عمود يجمع مفتاح "وضع المفتش" وشارة الدور تحته مباشرة، بدل سطر عرضي منفصل */
.toggle-badge-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.ios-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.ios-toggle input[type="checkbox"] {
  /* نخفي مربع الاختيار الافتراضي، ونبني شكل المفتاح بالكامل بـ toggle-slider تحت */
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.ios-toggle .toggle-slider {
  position: relative;
  width: 42px;
  height: 24px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.ios-toggle .toggle-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px; /* بوضع الإيقاف بواجهة RTL، المقبض يبدأ من اليمين */
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s ease;
}

.ios-toggle input:checked + .toggle-slider {
  background: #34c759; /* نفس لون التفعيل بالآيفون */
}
.ios-toggle input:checked + .toggle-slider::before {
  transform: translateX(-18px); /* المقبض ينزلق لليسار عند التفعيل */
}

/* ================================================================
   القائمة الجانبية (☰) — تظهر بكل الصفحات (المشرف والمفتش)
   ================================================================ */
.hamburger-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.side-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 60;
}

/* تنزلق من اليمين، وتاخذ جزء بسيط من الشاشة بس (مو الشاشة كاملة) */
.side-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 72%;
  max-width: 280px;
  background: var(--surface);
  z-index: 61;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.side-drawer.open { transform: translateX(0); }

.close-drawer-btn {
  align-self: flex-start;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 16px;
  padding: 4px;
}

.side-drawer a,
.side-drawer button.drawer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 10px;
  text-align: right;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.side-drawer .drawer-icon { display: inline-flex; flex-shrink: 0; color: var(--primary); }
.side-drawer a:hover,
.side-drawer button.drawer-link:hover { background: var(--primary-lighter); }
.side-drawer button.drawer-link.logout-link { color: #b91c1c; }
.side-drawer button.drawer-link.logout-link .drawer-icon { color: #b91c1c; }

/* ================================================================
   صفحة "حول مساعد المفتش"
   ================================================================ */
.about-content {
  max-width: 480px;
  margin: 40px auto;
  padding: 0 24px;
  text-align: center;
}
.about-content p { font-size: 15px; line-height: 1.9; color: var(--text); }
.about-rights { margin-top: 40px; font-size: 13px; color: var(--text-muted); line-height: 1.8; }

/* زر رجوع بشكل سهم بس (بدون خلفية زر عادية) — حديث ومختصر */
.icon-back-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.icon-back-btn:hover { background: none; box-shadow: none; opacity: 0.75; }

/* ================================================================
   أنواع المنشآت (حلاق، مغسلة...)
   ================================================================ */

/* صف أدوات القسم بلوحة المشرف (زر الأنواع + مفتاح عرض جميع البنود) */
.category-tools {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 4px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.category-tools .tools-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* نسخة المفتاح بخلفية فاتحة (النسخة الأصلية مصممة للشريط الأزرق) */
.ios-toggle.on-light { color: var(--text); font-size: 14px; }
.ios-toggle.on-light .toggle-slider { background: #cbd5e1; }
.ios-toggle.on-light input:checked + .toggle-slider { background: #34c759; }

/* وسم نوع المنشأة بجانب البند */
.item-row .item-main { flex: 1; min-width: 0; }
.facility-badges { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.facility-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* صف نوع منشأة بنافذة إدارة الأنواع */
.type-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.type-row .type-name { font-weight: 600; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.type-row .type-actions { display: flex; gap: 6px; flex-shrink: 0; }
.type-row .type-actions button { padding: 5px 12px; font-size: 12px; }
.type-row .type-actions button.danger { background: var(--danger-bg); color: #b91c1c; }

/* اختيار المنشآت داخل نموذج البند */
.facility-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  font-size: 14px;
  cursor: pointer;
}
.facility-check input { width: 18px; height: 18px; }
.facility-picker-summary { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* صف اسم القسم + القائمة المنسدلة لنوع المنشأة بواجهة المفتش */
.category-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.category-heading-row h2 { margin: 0; }
.facility-select {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--primary-light);
  border: 1px solid #b9cfe6;
  border-radius: 999px;
  padding: 8px 14px;
  max-width: 100%;
}
.facility-select:focus { outline: none; box-shadow: 0 0 0 3px rgba(51, 121, 189, 0.15); }

/* ================================================================
   ترتيب البنود بلوحة المشرف: أسهم ▲▼ بكل بند
   ================================================================ */

.reorder-arrows { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.item-row .reorder-arrows button {
  width: 34px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.item-row .reorder-arrows button:disabled { opacity: 0.35; cursor: default; }

/* تظليل مؤقت للبند بعد نقله */
.item-row.just-moved { background: #e0efff; }

/* رسالة حالة حفظ الترتيب (تظهر عند الحفظ فقط) */
.reorder-status { margin-bottom: 8px; font-size: 13px; }

/* ================================================================
   اختيار المنشأة بقائمة منسدلة داخل نموذج البند
   ================================================================ */
.field select {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px; /* 16px فأكثر يمنع تكبير الصفحة تلقائيًا بالآيفون */
  font-family: inherit;
  background: #fbfcfe;
  color: var(--text);
}
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(51, 121, 189, 0.15);
}

.facility-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.facility-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
  font-size: 13px;
  font-weight: 600;
}
.facility-chip button {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  background: rgba(39, 95, 148, 0.15);
  color: var(--primary-dark);
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.facility-chip button:hover { background: rgba(39, 95, 148, 0.28); box-shadow: none; }

/* زر نسخ الملاحظة بصفحة المفتش */
.copy-note-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  flex-shrink: 0;
}

/* ================================================================
   نافذة تكبير الصورة (Lightbox) — صفحة المفتش
   ================================================================ */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 22, 0.92);
  z-index: 80;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lightbox-overlay img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); box-shadow: none; }

/* ================================================================
   شاشة الحساب المعطّل (تستبدل الصفحة بالكامل)
   ================================================================ */
.disabled-account-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  gap: 14px;
}
.disabled-account-screen h2 { margin: 0; color: #b91c1c; }
.disabled-account-screen p { color: var(--text-muted); font-size: 15px; line-height: 1.8; max-width: 360px; margin: 0; }

/* ================================================================
   صفحة إدارة المستخدمين (مالك النظام)
   ================================================================ */
.user-count-line { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }

.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.user-card.is-disabled { background: #f1f3f5; }

.user-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.user-email { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.user-email-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; overflow-wrap: anywhere; }
.user-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.role-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.role-badge.owner { background: #fde68a; color: #78350f; }
.role-badge.admin { background: var(--primary-light); color: var(--primary-dark); }
.role-badge.viewer { background: #f1f3f5; color: var(--text-muted); }
.role-badge.disabled { background: var(--danger-bg); color: #b91c1c; }

.user-created { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.user-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.user-card-actions button { padding: 6px 14px; font-size: 12px; }
.user-card-actions button.danger-text { color: #b91c1c; }
.user-self-note { font-size: 13px; color: var(--text-muted); font-style: normal; }

/* ================================================================
   صفحة "حسابي"
   ================================================================ */
.readonly-value {
  padding: 11px 14px;
  background: #f1f3f5;
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text-muted);
}

/* ================================================================
   أداة تسجيل الزيارات — شكل مخفي بلوحة المشرف
   ================================================================ */
.category-card.tool-hidden { opacity: 0.55; }
.tool-hidden-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
}
.tool-edit-btn { margin-top: 6px; padding: 5px 14px; font-size: 12px; }

/* ================================================================
   أداة تسجيل الزيارات
   ================================================================ */

/* تبويبات تسجيل زيارة / زياراتي / كل الزيارات */
.tabs-row {
  display: flex;
  gap: 8px;
  margin: 14px 0 18px;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  background: none;
  border: none;
  padding: 10px 4px;
  margin-left: 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.location-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }

.visit-filters-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.visit-filters-row select {
  flex: 1;
  min-width: 110px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fbfcfe;
}

/* تجميع الزيارات بالشهر */
.month-group { margin-bottom: 10px; }
.month-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--primary-light);
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  cursor: pointer;
}
.month-count { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.month-items { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

.visit-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
}
.visit-row-main { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.visit-row-name { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.visit-status-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.visit-row-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* نافذة تفاصيل الزيارة */
.visit-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.visit-detail-row span:first-child { color: var(--text-muted); flex-shrink: 0; }

/* شريط حالة التصدير (أداة الزيارات) */
.export-status {
  font-size: 13px;
  color: var(--text-muted);
  margin: 6px 0 10px;
}
.export-status.error { color: #b91c1c; }

/* ================================================================
   أداة تسجيل الزيارات — إضافات: الفترة الزمنية، اختيار الصورة، الموقع اليدوي
   ================================================================ */
.date-filter-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.date-filter-field input {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fbfcfe;
}

.photo-picker-buttons { display: flex; gap: 8px; }
.photo-picker-buttons button { flex: 1; padding: 9px; font-size: 13px; }
.photo-picker-name { display: block; font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.location-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.location-row .location-hint { margin-bottom: 0; }
