@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #2563eb;
  --primary-dark: #1741a6;
  --primary-light: #60a5fa;
  --primary-soft: #eff6ff;
  --navy: #0f2a4a;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --bg: #f4f7fc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 42, 74, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 42, 74, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 42, 74, 0.14);
  --gradient-panel: linear-gradient(160deg, #eaf2ff 0%, #cfe2fb 45%, #9dc4f5 100%);
  /* لون ثانوي واحد فقط (ذهبي متّزن) - يُستخدم بحساب: مؤشرات التبويب النشط وخط الهيدر الجانبي، بلا مساس بالهوية الزرقاء الأساسية */
  --gold: #a97416;
  --gold-soft: #f3e2c2;
  --shadow-rich: 0 14px 34px rgba(15, 42, 74, 0.16), 0 3px 10px rgba(169, 116, 22, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Cairo', Tahoma, 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15.5px;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

.container-wide {
  max-width: 1520px;
  margin: 0 auto;
  padding: 16px;
}

.card.app-nav {
  background: var(--gradient-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(15, 42, 74, 0.06);
  margin-bottom: 20px;
  padding: 18px 22px;
}

/* عمق أوضح + خط جانبي (ذهبي↔أزرق) يميّز لوحة التنقّل الرئيسية عن باقي البطاقات */
.card.app-nav.app-nav-rich {
  box-shadow: var(--shadow-rich);
  border-color: var(--gold-soft);
  position: relative;
}

.card.app-nav.app-nav-rich::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-start-start-radius: var(--radius);
  border-end-start-radius: var(--radius);
  background: linear-gradient(180deg, var(--gold), var(--primary));
}

.app-nav-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.app-nav-identity p {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(15, 42, 74, 0.65);
}

.app-nav-identity h1 {
  margin: 0 0 2px;
  font-size: 22px;
  color: var(--navy);
}

.app-nav-identity .muted {
  color: rgba(15, 42, 74, 0.65);
}

.app-nav-top .btn.secondary {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(15, 42, 74, 0.12);
  color: var(--navy);
}

.app-nav-announcement {
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.6;
  word-break: break-word;
}

.app-nav-announcement-global {
  background: rgba(15, 42, 74, 0.08);
  color: var(--navy);
  border: 1px solid rgba(15, 42, 74, 0.14);
}

.app-nav-announcement-committee {
  background: var(--gold-soft);
  color: #7a5410;
  border: 1px solid rgba(169, 116, 22, 0.25);
  margin-top: 8px;
}

.app-impersonation-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 18px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1.5px solid #f59e0b;
  color: #92400e;
  font-size: 13.5px;
  font-weight: 600;
}

.app-impersonation-bar .btn.secondary {
  width: auto;
  padding: 6px 16px;
  font-size: 13px;
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}

.app-impersonation-bar .btn.secondary:hover {
  background: #d97706;
  border-color: #d97706;
}

.app-maintenance-bar {
  margin-bottom: 14px;
  text-align: center;
}

.app-maintenance-bar button {
  border: 1.5px solid var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 10px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.app-nav-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 16px;
  border-top: 1px solid rgba(15, 42, 74, 0.14);
  padding-top: 14px;
}

.app-nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  color: rgba(15, 42, 74, 0.75);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.35);
  transition: background 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
  position: relative;
}

.app-nav-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.app-nav-tab:hover {
  background: rgba(255, 255, 255, 0.75);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.app-nav-tab.active {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 42, 74, 0.28);
}

.app-nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 50%;
  transform: translateX(50%);
  width: 20px;
  height: 3px;
  border-radius: 3px;
  background: var(--gold);
}

.app-nav-divider {
  width: 1px;
  align-self: stretch;
  margin: 4px 8px;
  background: rgba(15, 42, 74, 0.16);
}

/* قوائم منسدلة مجمّعة (تُستخدم فقط لما تكون navItems مصنّفة بـgroup - حالياً السوبر أدمن فقط) */
.app-nav-tabs-grouped {
  align-items: flex-start;
}

.app-nav-group {
  position: relative;
}

.app-nav-group-summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  color: rgba(15, 42, 74, 0.75);
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
  list-style: none;
  user-select: none;
  position: relative;
}

.app-nav-group-summary svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.app-nav-group-summary::-webkit-details-marker {
  display: none;
}

.app-nav-group-summary::after {
  content: '▾';
  font-size: 11px;
  transition: transform 0.15s;
}

.app-nav-group[open] > .app-nav-group-summary::after {
  transform: rotate(180deg);
}

.app-nav-group-summary:hover {
  background: rgba(255, 255, 255, 0.75);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.app-nav-group-summary.active {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 42, 74, 0.28);
}

.app-nav-group-summary.active::before {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 50%;
  transform: translateX(50%);
  width: 20px;
  height: 3px;
  border-radius: 3px;
  background: var(--gold);
}

.app-nav-group-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-start: 0;
  z-index: 20;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-rich);
  border: 1px solid rgba(15, 42, 74, 0.08);
}

.app-nav-group-link {
  display: block;
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(15, 42, 74, 0.82);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.app-nav-group-link:hover {
  background: rgba(15, 42, 74, 0.06);
}

.app-nav-group-link.active {
  background: var(--navy);
  color: #fff;
}

.page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

@media (min-width: 900px) {
  .page-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(15, 42, 74, 0.04);
  margin-bottom: 16px;
}

/* جدول إداري موحّد (اللجان/الخدمات/أسباب الإغلاق/الحسابات) - صفوف متدرجة الألوان وقابلة للتعديل المباشر */
.admin-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 720px;
}

.admin-table thead th {
  background: #dbe6f7;
  color: var(--navy);
  text-align: right;
  padding: 13px 14px;
  font-size: 13.5px;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid #c3d6ef;
}

.admin-table thead th:first-child {
  border-top-right-radius: var(--radius);
}

.admin-table thead th:last-child {
  border-top-left-radius: var(--radius);
}

.admin-table tbody tr {
  background: var(--card-bg);
  transition: background 0.12s;
}

.admin-table tbody tr:nth-child(even) {
  background: #f6f9fe;
}

.admin-table tbody tr.row-disabled {
  opacity: 0.6;
}

.admin-table tbody tr:hover {
  background: #dbeafe;
}

/* صفوف قابلة للنقر (مثلاً: انتقال من جداول التقارير لصفحة تتبّع التذاكر) - التظليل عند المرور فوقها موجود مسبقاً أعلاه لكل صفوف الجدول */
.admin-table tbody tr.row-clickable {
  cursor: pointer;
}

.admin-table td {
  padding: 11px 14px;
  border: 1px solid var(--border);
  vertical-align: middle;
  font-size: 14px;
}

.admin-table td input[type='text'],
.admin-table td input[type='number'],
.admin-table td select {
  padding: 7px 9px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  background: #fff;
  width: 100%;
  min-width: 90px;
}

.admin-table .row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-table .row-actions button {
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  color: #fff;
}

.btn-save { background: var(--primary); }
.btn-reset { background: var(--warning); }
.btn-toggle { background: #6b7280; }
.btn-toggle.is-active { background: var(--warning); }
.btn-delete { background: var(--danger); }

.pill-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
}
.pill-badge.on { background: var(--success-soft); color: var(--success); }
.pill-badge.off { background: var(--danger-soft); color: var(--danger); }

h1 {
  font-size: 23px;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--navy);
}

h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--navy);
}

p {
  margin: 0 0 8px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

/* منع تكبير iOS التلقائي للحقول (يتطلب خط 16px فأكثر) */
input,
select,
textarea,
button {
  font-size: 16px;
  font-family: inherit;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* حقول التاريخ/الوقت الأصلية للمتصفح تعرض أجزاءها (يوم/شهر/سنة) بترتيب مشوَّش وغير مقروء تحت اتجاه الصفحة
   العام RTL (dir="rtl") - فرض LTR على الحقل نفسه فقط يصلح ترتيب الأجزاء الداخلية بلا أي أثر على باقي الصفحة */
input[type='date'],
input[type='time'],
input[type='datetime-local'] {
  direction: ltr;
  text-align: right;
}

.service-option {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.service-option input {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
}

.service-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.btn {
  display: block;
  width: 100%;
  padding: 15px;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  min-height: 48px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
}

.btn:hover {
  background: var(--primary-dark);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.34);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn.secondary {
  background: #eef2f6;
  color: var(--navy);
  box-shadow: none;
}

.btn.secondary:hover {
  background: #e2e8f0;
}

.error-box {
  background: var(--danger-soft);
  color: #991b1b;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 600;
}

.success-box {
  background: var(--success-soft);
  color: #166534;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 600;
}

.result {
  text-align: center;
}

.ticket-number {
  font-size: 64px;
  font-weight: 800;
  color: var(--primary);
  margin: 8px 0;
}

.status-text {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 16px;
}

.result.status-in_progress .status-text {
  color: var(--success);
}

.result.status-missed .status-text,
.result.status-cancelled .status-text {
  color: var(--danger);
}

.result.status-completed .status-text {
  color: var(--success);
}

.result.status-referred .status-text {
  color: var(--warning);
}

.wait-details {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}

.wait-details .num {
  font-size: 30px;
  font-weight: 800;
  color: var(--navy);
}

.wait-details .lbl {
  font-size: 13px;
  color: var(--muted);
}

.badge {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

/* شارة/بطاقة ترحيبية دائرية الحواف، بنفس روح شارة "مرحباً بكم" بالمرجع */
.pill {
  display: inline-block;
  background: #f1f5f9;
  color: var(--navy);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

/* مربّع أيقونة ناعم، يُستخدم قبل عناوين البطاقات */
.icon-chip {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* ============ تخطيط الشاشات الرئيسية المقسومة (دخول / بوابة) ============ */
.split-shell {
  min-height: 100vh;
  display: flex;
}

.split-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background: #fff;
}

.split-brand-side {
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 48px;
  background: var(--gradient-panel);
  color: var(--navy);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.split-brand-side::before,
.split-brand-side::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

.split-brand-side::before {
  width: 260px;
  height: 260px;
  top: -80px;
  inset-inline-end: -80px;
}

.split-brand-side::after {
  width: 180px;
  height: 180px;
  bottom: -60px;
  inset-inline-start: -60px;
  background: rgba(255, 255, 255, 0.25);
}

.split-brand-side > * {
  position: relative;
  z-index: 1;
}

.split-brand-wordmark {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.split-brand-tagline {
  font-size: 15px;
  color: rgba(15, 42, 74, 0.75);
  max-width: 320px;
}

.split-brand-card {
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius);
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}

@media (min-width: 820px) {
  .split-brand-side {
    display: flex;
  }
  .split-form-side {
    max-width: 50%;
  }
}

@media (min-width: 640px) {
  .container {
    max-width: 520px;
  }
}
