/* ═══════════════════════════════════════════════════════
   hafil.css — النظام اللوني والتنسيق الموحد لحافل
   hafilmaintenanceworkshops.online
   ═══════════════════════════════════════════════════════ */

/* ── إعادة الضبط ── */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ── المتغيرات العامة ── */
:root {
  --blue:       #1a3f6f;
  --blue-dark:  #0f2540;
  --blue-light: #1a5276;
  --gold:       #c9a227;
  --gold-dark:  #8a6d10;
  --light:      #f1f5f9;
  --white:      #fff;
  --text:       #1e293b;
  --muted:      #64748b;
  --border:     #e2e8f0;
  --red:        #dc2626;
  --red-dark:   #991b1b;
  --green:      #15803d;
  --green-dark: #166534;
  --danger:     #dc2626;
  --success:    #16a34a;

  /* ── تأثيرات العمق ── */
  --shadow-sm:  0 2px 0 var(--border), 0 3px 6px rgba(0,0,0,.07);
  --shadow-md:  0 4px 0 var(--border), 0 6px 12px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 0 #d1d9e6,       0 12px 24px rgba(0,0,0,.15);
  --shadow-btn-blue: 0 4px 0 var(--blue-dark), 0 5px 10px rgba(26,63,111,.4);
  --shadow-btn-gold: 0 4px 0 var(--gold-dark), 0 5px 10px rgba(201,162,39,.4);
  --shadow-btn-red:  0 4px 0 var(--red-dark),  0 5px 10px rgba(220,38,38,.4);
  --shadow-btn-green:0 4px 0 var(--green-dark),0 5px 10px rgba(21,128,61,.4);
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
}

/* ── الجسم ── */
body {
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  background: var(--light);
  color: var(--text);
  min-height: 100vh;
}

/* ══════════════════════════════════════════════════════
   TOPBAR — شريط العنوان العلوي
   ══════════════════════════════════════════════════════ */
.topbar {
  background: linear-gradient(160deg, var(--blue-light), var(--blue-dark));
  height: 50px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
  box-shadow: 0 3px 0 #0a1628, 0 5px 14px rgba(0,0,0,.35);
  position: sticky;
  top: 0;
  z-index: 100;
}
.top-logo {
  height: 30px;
  filter: brightness(0) invert(1);
  object-fit: contain;
  flex-shrink: 0;
}
.top-title {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex: 1;
}
.top-title small {
  display: block;
  font-size: 10px;
  color: #93c5fd;
  font-weight: 400;
}
.top-btn {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.1);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all .15s;
  box-shadow: 0 2px 0 rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.1);
}
.top-btn:hover { background: rgba(255,255,255,.22); transform: translateY(-1px); }
.top-btn:active { transform: translateY(1px); box-shadow: none; }
.top-btn.gold  {
  border-color: var(--gold);
  background: rgba(201,162,39,.25);
  color: #fcd34d;
  box-shadow: 0 2px 0 rgba(138,109,16,.4), inset 0 1px 0 rgba(255,255,255,.1);
}

/* ══════════════════════════════════════════════════════
   BUTTONS — الأزرار
   ══════════════════════════════════════════════════════ */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  font-weight: 700;
  transition: all .12s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn:active { transform: translateY(2px); }

.btn-primary {
  background: linear-gradient(160deg, var(--blue-light), var(--blue));
  color: #fff;
  box-shadow: var(--shadow-btn-blue);
}
.btn-primary:hover  { background: linear-gradient(160deg, #1e5f8a, #1a4f8a); transform: translateY(-1px); }
.btn-primary:active { box-shadow: none; }

.btn-success {
  background: linear-gradient(160deg, #16a34a, var(--green));
  color: #fff;
  box-shadow: var(--shadow-btn-green);
}
.btn-success:hover  { transform: translateY(-1px); }
.btn-success:active { box-shadow: none; }

.btn-gold {
  background: linear-gradient(160deg, #d4a820, var(--gold));
  color: #fff;
  box-shadow: var(--shadow-btn-gold);
}
.btn-gold:hover     { transform: translateY(-1px); }
.btn-gold:active    { box-shadow: none; }

.btn-danger {
  background: linear-gradient(160deg, #ef4444, var(--red));
  color: #fff;
  box-shadow: var(--shadow-btn-red);
}
.btn-danger:hover   { transform: translateY(-1px); }
.btn-danger:active  { box-shadow: none; }

.btn-light {
  background: linear-gradient(160deg, #fff, var(--light));
  color: var(--muted);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-light:hover    { background: var(--light); transform: translateY(-1px); }
.btn-light:active   { box-shadow: none; }

.btn-outline {
  background: #fff;
  color: var(--blue);
  border: 1.5px solid var(--blue);
  box-shadow: var(--shadow-sm);
}

/* ══════════════════════════════════════════════════════
   STATS CARDS — بطاقات الإحصائيات
   ══════════════════════════════════════════════════════ */
.stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.stat, .stat-card {
  background: linear-gradient(160deg, #fff, #f0f4f8);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  flex: 1;
  min-width: 120px;
  border: 1px solid #d1dce8;
  border-top: 3px solid var(--blue);
  border-bottom: 5px solid #b8c8d8;
  text-align: center;
  transition: all .15s;
}
.stat:hover, .stat-card:hover {
  transform: translateY(-2px);
  border-bottom-color: #9aafc4;
}
.stat-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--blue);
}
.stat-lbl {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

/* ══════════════════════════════════════════════════════
   FILTERS — شريط الفلاتر
   ══════════════════════════════════════════════════════ */
.filters {
  background: linear-gradient(160deg, #fff, #f0f4f8);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  border-bottom: 5px solid #b8c8d8;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  border: 1px solid #d1dce8;
}
.fg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}
.fg label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.fg select, .fg input, .fg textarea {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: #f8fafc;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  transition: all .15s;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.06);
}
.fg select:focus, .fg input:focus, .fg textarea:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--white);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.04), 0 0 0 3px rgba(26,63,111,.1);
}

/* ══════════════════════════════════════════════════════
   TABLE — الجدول
   ══════════════════════════════════════════════════════ */
.table-wrap {
  background: var(--white);
  border-radius: var(--radius-md);
  border-bottom: 5px solid #b8c8d8;
  overflow: visible;
  border: 1px solid #d1dce8;
}
.table-head {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(160deg, #fff, #f8fafc);
}
.table-head h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
th {
  background: linear-gradient(160deg, #f8fafc, #f1f5f9);
  padding: 10px 12px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
tr:hover td { background: #f8fafc; }

/* ══════════════════════════════════════════════════════
   BADGES — الشارات
   ══════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.badge-blue   { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.badge-green  { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.badge-red    { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.badge-gold   { background: #fef9ee; color: #92400e; border: 1px solid #fcd34d; }
.badge-gray   { background: #f1f5f9; color: var(--muted); border: 1px solid var(--border); }
.badge-purple { background: #ede9fe; color: #4c1d95; border: 1px solid #c4b5fd; }

/* ══════════════════════════════════════════════════════
   AVATAR — صورة المستخدم
   ══════════════════════════════════════════════════════ */
.avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.2);
}
.av-mgr { background: linear-gradient(160deg, #16a34a, #166534); }
.av-tec { background: linear-gradient(160deg, #2563eb, #1d4ed8); }
.av-adm { background: linear-gradient(160deg, #b45309, #92400e); }
.av-con { background: linear-gradient(160deg, #be185d, #831843); }
.av-drv { background: linear-gradient(160deg, #059669, #065f46); }
.av-sup { background: linear-gradient(160deg, #7c3aed, #4c1d95); }

/* Role pills */
.rp-mgr { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.rp-tec { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.rp-adm { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.rp-con { background: #fce7f3; color: #831843; border: 1px solid #f9a8d4; }
.rp-drv { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.rp-sup { background: #ede9fe; color: #4c1d95; border: 1px solid #c4b5fd; }

/* ══════════════════════════════════════════════════════
   TABS — التبويبات
   ══════════════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.tab {
  padding: 8px 20px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: linear-gradient(160deg, #fff, #f8fafc);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  color: var(--muted);
  text-decoration: none;
  transition: all .15s;
  box-shadow: var(--shadow-sm);
}
.tab.active {
  border-color: var(--blue);
  background: linear-gradient(160deg, var(--blue-light), var(--blue));
  color: #fff;
  box-shadow: var(--shadow-btn-blue);
}
.tab:hover:not(.active) { transform: translateY(-1px); }

/* ══════════════════════════════════════════════════════
   PAGINATION — ترقيم الصفحات
   ══════════════════════════════════════════════════════ */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 14px;
  flex-wrap: wrap;
}
.pag-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: linear-gradient(160deg, #fff, #f8fafc);
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: all .15s;
  box-shadow: var(--shadow-sm);
}
.pag-btn.active {
  background: linear-gradient(160deg, var(--blue-light), var(--blue));
  color: #fff;
  border-color: var(--blue);
  box-shadow: var(--shadow-btn-blue);
}
.pag-btn:hover:not(.active) { background: var(--light); transform: translateY(-1px); }

/* ══════════════════════════════════════════════════════
   MODAL — النوافذ المنبثقة
   ══════════════════════════════════════════════════════ */
.modal-bg, .modal-overlay, .overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,32,68,.65);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  padding: 16px;
}
.modal-bg.open, .modal-overlay.open, .overlay.open { display: flex; }
.modal {
  background: linear-gradient(160deg, #fff, #f0f4f8);
  border-radius: var(--radius-lg);
  padding: 22px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 0 #b8c8d8, 0 20px 60px rgba(0,0,0,.30);
  border: 1px solid #d1dce8;
}
.modal h2, .modal h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--light);
}
.mfooter {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1.5px solid var(--light);
}
.mbtn {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: linear-gradient(160deg, #fff, #f8fafc);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all .12s;
  box-shadow: var(--shadow-sm);
}
.mbtn:hover   { background: var(--light); transform: translateY(-1px); }
.mbtn:active  { transform: translateY(1px); box-shadow: none; }
.mbtn.ok {
  border-color: var(--blue);
  color: #fff;
  background: linear-gradient(160deg, var(--blue-light), var(--blue));
  box-shadow: var(--shadow-btn-blue);
}
.mbtn.ok:hover  { transform: translateY(-1px); }
.mbtn.ok:active { transform: translateY(2px); box-shadow: none; }
.mbtn.danger {
  border-color: var(--red);
  color: #fff;
  background: linear-gradient(160deg, #ef4444, var(--red));
  box-shadow: var(--shadow-btn-red);
}

/* ══════════════════════════════════════════════════════
   ALERT — التنبيهات
   ══════════════════════════════════════════════════════ */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 14px;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}
.alert.err { background: #fef2f2; border: 1px solid #fca5a5; color: var(--danger); border-right: 4px solid var(--danger); }
.alert.ok  { background: #f0fdf4; border: 1px solid #86efac; color: var(--success); border-right: 4px solid var(--success); }

/* ══════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════ */
.empty {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}
.empty-icon { font-size: 40px; margin-bottom: 8px; }

/* ══════════════════════════════════════════════════════
   PAGE WRAPPER
   ══════════════════════════════════════════════════════ */
.page {
  max-width: 1300px;
  margin: 0 auto;
  padding: 16px;
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .topbar {
    height: auto;
    min-height: 46px;
    padding: 4px 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .topbar::-webkit-scrollbar { display: none; }
  .top-logo  { height: 22px; }
  .top-btn   { font-size: 10px; padding: 3px 9px; flex-shrink: 0; }
  .filters   { flex-direction: column; }
  .fg        { min-width: 100%; }
  table      { display: block; overflow-x: auto; }
  .modal     { width: 96vw !important; max-width: 96vw !important; padding: 12px !important; }
  .mfooter   { flex-wrap: wrap; }
  .mfooter .mbtn { flex: 1; min-width: 80px; }
}

@media (max-width: 480px) {
  .top-title { display: none; }
  .stat-val  { font-size: 16px; }
}

/* ══════════════════════════════════════════════════════
   SMALL ACTION BUTTONS — أزرار الإجراءات الصغيرة
   ══════════════════════════════════════════════════════ */
.btn-icon {
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all .12s;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.btn-icon:active { transform: translateY(1px); }

/* أزرق — تعديل / إضافة */
.btn-icon-blue {
  background: #eff6ff;
  color: #2563eb;
  border-color: rgba(59,130,246,.3);
  box-shadow: 0 1px 0 rgba(59,130,246,.2);
}
.btn-icon-blue:hover { background: #dbeafe; border-color: #93c5fd; }

/* أحمر — حذف */
.btn-icon-red {
  background: #fef2f2;
  color: #dc2626;
  border-color: rgba(239,68,68,.3);
  box-shadow: 0 1px 0 rgba(220,38,38,.2);
}
.btn-icon-red:hover { background: #fee2e2; border-color: #fca5a5; }

/* أخضر — إضافة موظف */
.btn-icon-green {
  background: #f0fdf4;
  color: #16a34a;
  border-color: rgba(34,197,94,.3);
  box-shadow: 0 1px 0 rgba(21,128,61,.2);
}
.btn-icon-green:hover { background: #dcfce7; border-color: #86efac; }

/* رمادي — إجراء عام */
.btn-icon-gray {
  background: #f8fafc;
  color: var(--muted);
  border-color: #cbd5e1;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.btn-icon-gray:hover { background: #f1f5f9; border-color: #94a3b8; }

/* زر السجل — أحمر شفاف في التوبار */
.top-btn-danger {
  border-color: rgba(252,165,165,.5) !important;
  background: rgba(220,38,38,.15) !important;
  color: #fca5a5 !important;
}
.top-btn-danger:hover { background: rgba(220,38,38,.25) !important; }

/* زر toggle السايدبار */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.1);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: all .15s;
  box-shadow: 0 2px 0 rgba(0,0,0,.2);
}
.sidebar-toggle:hover { background: rgba(255,255,255,.2); transform: translateY(-1px); }
.sidebar-toggle:active { transform: translateY(1px); box-shadow: none; }