/* ===========================================================
   هوية ساتكو فوق قالب Modern Admin
   اللون الأساسي مستخرج من الشعار: #DE9420
   =========================================================== */

:root {
  --satco-primary: #de9420;
  --satco-primary-dark: #b9770f;
  --satco-primary-light: #f3b44a;
  --satco-primary-soft: #fdf3e3;
  --satco-ink: #1b2431;
}

body {
  font-family: 'Cairo', sans-serif;
  background-color: #f4f6f9;
}

/* ---------- الشريط العلوي ---------- */
/* الشعار شفاف على خلفية داكنة — بدون أي مربع خلفه */
.header-navbar.navbar-brand-center .navbar-header,
.header-navbar .navbar-header {
  background: transparent !important;
  box-shadow: none !important;
}

.header-navbar .navbar-brand {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 !important;
  height: 100%;
}

.header-navbar .navbar-brand .brand-logo {
  height: 42px !important;
  width: auto !important;
  max-width: none !important;
  max-height: 42px !important;
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  position: static !important;
  object-fit: contain;
}

/* القالب يعطي navbar-header عرضًا ثابتًا يقصّ الشعار */
.header-navbar.navbar-brand-center .navbar-header {
  width: auto !important;
  min-width: 260px;
}

/* اسم النظام تحت الشعار (مخفي على الشاشات الصغيرة) */
.header-navbar .brand-text {
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.3px;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1;
  text-align: center;
}

@media (max-width: 767px) {
  .header-navbar .brand-text {
    display: none;
  }
}

/* ---------- القائمة الجانبية ---------- */
.main-menu.menu-dark {
  background: var(--satco-ink);
}

.main-menu.menu-dark .navigation > li.active > a {
  background: linear-gradient(270deg, var(--satco-primary), var(--satco-primary-dark));
  box-shadow: 0 0 10px 1px rgba(222, 148, 32, 0.5);
  border-radius: 6px;
  color: #fff;
}

.main-menu.menu-dark .navigation > li > a:hover {
  color: var(--satco-primary-light);
}

.main-menu.menu-dark .navigation li.has-sub.open > a {
  color: var(--satco-primary-light);
}

/* أيقونات القائمة بعرض ثابت — القالب يتركها بعرضها الطبيعي فيختلف مكان
   بداية النص من عنصر لآخر حسب رمز كل أيقونة */
.main-menu .navigation > li > a > i {
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.main-menu .navigation > li > a {
  display: flex;
  align-items: center;
}

.main-menu .navigation > li > a > span.menu-title {
  flex: 1 1 auto;
}

/* ---------- الأزرار والألوان ---------- */
.btn-satco,
.bg-satco {
  background-color: var(--satco-primary) !important;
  border-color: var(--satco-primary) !important;
  color: #fff !important;
}

.btn-satco:hover {
  background-color: var(--satco-primary-dark) !important;
  border-color: var(--satco-primary-dark) !important;
}

.btn-outline-satco {
  color: var(--satco-primary-dark) !important;
  border: 1px solid var(--satco-primary) !important;
  background: transparent;
}

.btn-outline-satco:hover {
  background-color: var(--satco-primary) !important;
  color: #fff !important;
}

.text-satco {
  color: var(--satco-primary-dark) !important;
}

.bg-satco-soft {
  background-color: var(--satco-primary-soft) !important;
}

.bg-satco-gradient {
  background: linear-gradient(118deg, var(--satco-primary-light), var(--satco-primary-dark)) !important;
  color: #fff !important;
}

/* ---------- البطاقات ---------- */
.card {
  border-radius: 14px;
  border: 1px solid #e6eaf0;
  box-shadow: 0 2px 14px rgba(27, 36, 49, 0.05);
}

.card-header {
  border-radius: 14px 14px 0 0;
}

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-card h3 {
  font-weight: 800;
  margin-bottom: 0;
}

/* ---------- حاويات الرسوم البيانية ---------- */
/* Chart.js 2.7 مع maintainAspectRatio:false يحتاج حاوية بارتفاع محدد */
.chart-box {
  position: relative;
  width: 100%;
}

.chart-box canvas {
  max-width: 100%;
}

/* ---------- الجداول ---------- */
.table thead th {
  background: #f7f9fc;
  border-bottom: 1px solid #e6eaf0;
  font-weight: 700;
  color: #6b7789;
  font-size: 0.85rem;
  white-space: nowrap;
}

.table td {
  vertical-align: middle;
  font-size: 0.9rem;
}

/* الجداول داخل .table-responsive — منع كسر الأسماء والصالات على أكثر من سطر */
.table th,
.table td {
  white-space: nowrap;
  padding-right: 0.65rem !important;
  padding-left: 0.65rem !important;
}

/* هامش مريح لأول وآخر عمود حتى لا يلتصق المحتوى بحافة البطاقة */
.table th:first-child,
.table td:first-child {
  padding-right: 1.1rem !important;
}

.table th:last-child,
.table td:last-child {
  padding-left: 1.1rem !important;
}

/* استثناء للأعمدة النصية الطويلة مثل ملاحظات التقييم */
.table td.td-wrap {
  white-space: normal;
  min-width: 220px;
}

/* ---------- لوحة السيارة السعودية ---------- */
.plate {
  display: inline-flex;
  align-items: stretch;
  white-space: nowrap;
  border: 2px solid var(--satco-ink);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  font-weight: 800;
  line-height: 1;
  direction: ltr;
}

.plate span {
  padding: 5px 9px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  color: var(--satco-ink);
  letter-spacing: 1px;
  font-size: 14px;
}

.plate .plate-letters {
  border-right: 2px solid var(--satco-ink);
  border-left: 2px solid var(--satco-ink);
}

.plate .plate-ksa {
  background: var(--satco-ink);
  color: #fff;
  font-size: 9px;
  letter-spacing: 0.5px;
}

/* نسخة مصغّرة داخل الجداول حتى لا تتمدد الأعمدة */
.table .plate span {
  padding: 3px 7px;
  font-size: 12.5px;
  letter-spacing: 0.5px;
}

.table .plate .plate-ksa {
  font-size: 8px;
  padding: 3px 5px;
}

/* ---------- شارات الحالات ---------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-entered   { background: #e9f1fc; color: #3b7dd8; }
.status-inspect   { background: #fdf3e3; color: #b9770f; }
.status-rejected  { background: #fbeaea; color: #d64545; }
.status-ready     { background: #e6f5ed; color: #1e9e63; }
.status-heading   { background: #fdf3e3; color: #de9420; }
.status-at-hall   { background: #e9f1fc; color: #3b7dd8; }
.status-customer  { background: #e6f5ed; color: #1e9e63; }
.status-returning { background: #eef1f5; color: #6b7789; }
.status-active    { background: #e6f5ed; color: #1e9e63; }
.status-inactive  { background: #eef1f5; color: #6b7789; }
.status-maint     { background: #fdf3e3; color: #b9770f; }

/* ---------- الخط الزمني للرحلة ---------- */
/* تخطيط flex بدل التموضع المطلق — أضمن في RTL */
.trip-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.trip-timeline li {
  display: flex;
  align-items: stretch;
  gap: 14px;
}

/* العمود الذي يحمل النقطة والخط الواصل */
.trip-timeline .track {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 26px;
}

.trip-timeline .dot {
  width: 26px;
  height: 26px;
  min-height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff !important;
}

.trip-timeline .dot i {
  color: #fff;
}

.trip-timeline .line {
  flex: 1 1 auto;
  width: 2px;
  background: #e6eaf0;
  margin: 4px 0;
  min-height: 18px;
}

.trip-timeline .step-body {
  flex: 1 1 auto;
  padding-bottom: 22px;
}

.trip-timeline li:last-child .step-body {
  padding-bottom: 0;
}

.trip-timeline .time {
  font-size: 0.78rem;
  color: #9aa4b2;
  white-space: nowrap;
}

/* ---------- أيقونة السائق في الجداول ---------- */
.user-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: var(--satco-primary-soft);
  color: var(--satco-primary-dark);
  font-size: 16px;
  vertical-align: middle;
}

/* ---------- النجوم ---------- */
.stars i {
  color: #e6eaf0;
  font-size: 15px;
}

.table .stars i {
  font-size: 13px;
}

.stars i.filled {
  color: var(--satco-primary);
}

/* ===========================================================
   صفحة تقييمات العملاء
   =========================================================== */

/* ---------- ملخص التقييم العام ---------- */
.rating-hero {
  text-align: center;
  padding: 10px 0 6px;
  border-bottom: 1px solid #eef1f5;
}

.rating-score {
  font-size: 54px;
  font-weight: 800;
  line-height: 1;
  color: var(--satco-primary-dark);
  margin-bottom: 6px;
}

.stars-lg i {
  font-size: 20px;
}

/* أشرطة توزيع النجوم */
.rating-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}

.rating-bar-label {
  flex: 0 0 34px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #6b7789;
  white-space: nowrap;
}

.rating-bar-label i {
  color: var(--satco-primary);
  font-size: 12px;
}

.rating-bar {
  flex: 1 1 auto;
  height: 8px;
  border-radius: 100px;
  background: #eef1f5;
  overflow: hidden;
  display: block;
}

.rating-bar-fill {
  display: block;
  height: 100%;
  border-radius: 100px;
  background: var(--satco-primary);
}

.rating-bar-fill.low {
  background: #d64545;
}

.rating-bar-count {
  flex: 0 0 30px;
  text-align: left;
  font-size: 0.8rem;
  color: #9aa4b2;
}

/* ---------- صفوف "بانتظار إرسال رابط" ---------- */
.pending-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.pending-info {
  min-width: 0;
}

.pending-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.dot-sep {
  color: #cfd6e0;
  margin: 0 3px;
}

/* تأكيد لحظي بعد نسخ الرابط */
.btn.is-copied,
.btn.is-copied:hover {
  background-color: #1e9e63 !important;
  border-color: #1e9e63 !important;
  color: #fff !important;
}

/* شريحة رقم الرحلة */
.trip-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 8px;
  background: var(--satco-primary-soft);
  color: var(--satco-primary-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.trip-chip-link:hover {
  background: var(--satco-primary);
  color: #fff;
}

/* ---------- بطاقة التقييم ---------- */
.review-card {
  border: 1px solid #e6eaf0;
  border-radius: 14px;
  padding: 16px;
  height: 100%;
  background: #fff;
  transition: box-shadow 0.15s ease;
}

.review-card:hover {
  box-shadow: 0 4px 18px rgba(27, 36, 49, 0.08);
}

.review-card.is-low {
  border-color: rgba(214, 69, 69, 0.35);
  background: #fffafa;
}

.review-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.review-scores {
  display: flex;
  align-items: center;
  background: #f7f9fc;
  border-radius: 10px;
  padding: 10px 14px;
}

.review-card.is-low .review-scores {
  background: #fdf0f0;
}

.score-item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.score-divider {
  width: 1px;
  align-self: stretch;
  background: #e0e6ee;
  margin: 0 12px;
}

.review-note {
  margin: 12px 0 0;
  font-size: 0.88rem;
  line-height: 1.7;
  color: #4a5768;
}

.review-note i {
  color: var(--satco-primary);
  opacity: 0.55;
  margin-left: 4px;
}

.review-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #e6eaf0;
}

/* ---------- شرائح الفلترة ---------- */
.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chips .chip {
  padding: 5px 14px;
  border-radius: 100px;
  border: 1px solid #e6eaf0;
  font-size: 0.8rem;
  font-weight: 700;
  color: #6b7789;
  background: #fff;
}

.filter-chips .chip:hover {
  border-color: var(--satco-primary);
  color: var(--satco-primary-dark);
}

.filter-chips .chip.active {
  background: var(--satco-primary);
  border-color: var(--satco-primary);
  color: #fff;
}

.filter-chips .chip-danger.active,
.filter-chips .chip-danger:hover {
  background: #d64545;
  border-color: #d64545;
  color: #fff;
}

/* ---------- شرائح المعاينة ---------- */
.design-note {
  background: var(--satco-primary-soft);
  border: 1px dashed var(--satco-primary);
  color: var(--satco-primary-dark);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
}
/* ---------- خرائط مناطق الإيواء ---------- */
.zone-map {
  height: 560px;
  border-radius: 12px;
  border: 1px solid #e6eaf0;
  overflow: hidden;
  z-index: 0;
}

.zone-map--short {
  height: 300px;
}

/* Leaflet يفترض اتجاه LTR في مواضع أدواته وشريط المصدر. */
.leaflet-container {
  direction: ltr;
  font-family: 'Cairo', sans-serif;
}

.leaflet-container .leaflet-draw-toolbar a,
.leaflet-container .leaflet-control-layers-toggle {
  background-color: #fff;
}

/* مؤشر التقاط في وضع اختبار موقع السائق. */
.zone-map.is-testing {
  cursor: crosshair;
}

.zone-map.is-testing .leaflet-container {
  cursor: crosshair;
}

.zone-hint {
  background: #f7f9fc;
  border: 1px solid #e6eaf0;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: #6b7789;
  line-height: 1.9;
}

.zone-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed #e6eaf0;
  font-size: 0.85rem;
}

.zone-stat:last-of-type {
  border-bottom: 0;
}

.zone-stat span {
  color: #6b7789;
}

.zone-stat b {
  color: var(--satco-ink);
}

.zone-ltr {
  direction: ltr;
  unicode-bidi: embed;
  text-align: left;
}

.zone-test-result {
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.8;
}

.zone-test-result--ok {
  background: #e9f7ef;
  border: 1px solid #33b06a;
  color: #1d7a45;
}

.zone-test-result--tolerance {
  background: var(--satco-primary-soft);
  border: 1px solid var(--satco-primary);
  color: var(--satco-primary-dark);
}

.zone-test-result--bad {
  background: #fdecec;
  border: 1px solid #d64545;
  color: #a52d2d;
}

.zone-test-result--warn {
  background: #f7f9fc;
  border: 1px solid #e6eaf0;
  color: #6b7789;
}

.btn.active.btn-outline-satco {
  background: var(--satco-primary);
  color: #fff;
}
