/* Fleet management dashboard — premium SaaS design system */

.fleet-page {
  --fleet-bg: #f8fafc;
  --fleet-primary: #6d28d9;
  --fleet-primary-dark: #5b21b6;
  --fleet-primary-soft: rgba(109, 40, 217, 0.12);
  --fleet-card-shadow: 0 2px 10px -3px rgba(0, 0, 0, 0.07);
  --fleet-radius-xl: 1rem;

  background: var(--fleet-bg);
  min-height: calc(100vh - 80px);
  padding: 1.5rem 1.25rem 2.5rem;
  direction: rtl;
  font-family: 'Inter', 'Varela Round', sans-serif;
  color: var(--sa-text-body);
}

.fleet-page .sa-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0;
  min-height: unset;
  background: transparent;
}

.fleet-page .sa-header {
  background: var(--sa-surface);
  border-radius: var(--fleet-radius-xl);
  box-shadow: var(--fleet-card-shadow);
  border: 1px solid var(--sa-border);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.fleet-page .sa-header h2 {
  color: var(--sa-text-h);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.fleet-smart-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--fleet-primary-soft);
  color: var(--fleet-primary);
}

.fleet-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 991px) {
  .fleet-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 575px) {
  .fleet-kpi-grid { grid-template-columns: 1fr; }
}

.fleet-kpi-card {
  background: var(--sa-surface);
  border-radius: var(--fleet-radius-xl);
  box-shadow: var(--fleet-card-shadow);
  border: 1px solid var(--sa-border);
  padding: 1.25rem 1.35rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.fleet-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -6px rgba(109, 40, 217, 0.18);
}

.fleet-kpi-card.primary {
  background: linear-gradient(145deg, var(--fleet-primary) 0%, var(--fleet-primary-dark) 100%);
  border: none;
  color: #fff;
}

.fleet-kpi-card.primary .fleet-kpi-label,
.fleet-kpi-card.primary .fleet-kpi-sub {
  color: rgba(255, 255, 255, 0.82);
}

.fleet-kpi-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sa-text-sub);
  margin-bottom: 0.35rem;
}

.fleet-kpi-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--sa-text-h);
  letter-spacing: -0.03em;
}

.fleet-kpi-card.primary .fleet-kpi-value { color: #fff; }

.fleet-kpi-sub {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--sa-text-muted);
}

.fleet-chart-card {
  background: var(--sa-surface);
  border-radius: var(--fleet-radius-xl);
  box-shadow: var(--fleet-card-shadow);
  border: 1px solid var(--sa-border);
  padding: 1.25rem;
  height: 100%;
}

.fleet-chart-title {
  font-size: 0.9375rem;
  font-weight: 800;
  color: var(--sa-text-h);
  margin-bottom: 0.25rem;
}

.fleet-chart-sub {
  font-size: 0.75rem;
  color: var(--sa-text-muted);
  margin-bottom: 1rem;
}

.fleet-chart-host {
  position: relative;
  width: 100%;
}

.fleet-service-progress {
  min-width: 120px;
}

.fleet-service-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--sa-text-muted);
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.fleet-service-progress-track {
  height: 8px;
  border-radius: 999px;
  background: #eef2ff;
  overflow: hidden;
}

.fleet-service-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--fleet-primary), #a78bfa);
  transition: width 0.8s ease-in-out;
}

.fleet-service-progress-fill.due {
  background: linear-gradient(90deg, #dc2626, #f87171);
}

.fleet-health-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 28px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0 0.5rem;
}

.fleet-health-score.excellent { background: #d1fae5; color: #065f46; }
.fleet-health-score.good { background: #dbeafe; color: #1e40af; }
.fleet-health-score.fair { background: #fef3c7; color: #92400e; }
.fleet-health-score.poor { background: #fee2e2; color: #991b1b; }

.fleet-tco-chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--fleet-primary);
  background: var(--fleet-primary-soft);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

/* Primary KPI — solid purple (connect_9 style) */
.sa-card.sa-card-primary {
  background: linear-gradient(145deg, var(--fleet-primary) 0%, var(--fleet-primary-dark) 100%);
  border: none;
  color: #fff;
  box-shadow: 0 8px 24px rgba(109, 40, 217, 0.28);
}

.sa-card.sa-card-primary::before { display: none; }

.sa-card.sa-card-primary .sa-card-label,
.sa-card.sa-card-primary .sa-card-sub {
  color: rgba(255, 255, 255, 0.82);
}

.sa-card.sa-card-primary .sa-card-value {
  color: #fff;
  font-size: 2.25rem;
}

.sa-card.sa-card-primary .sa-card-icon {
  color: rgba(255, 255, 255, 0.95);
}

.fleet-status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.fleet-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--sa-surface);
  border: 1px solid var(--sa-border);
  box-shadow: var(--fleet-card-shadow);
}

.fleet-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.fleet-status-dot.danger { background: var(--sa-red); }
.fleet-status-dot.warn { background: var(--sa-amber); }
.fleet-status-dot.ok { background: var(--sa-green); }
.fleet-status-dot.primary { background: var(--fleet-primary); }

.fleet-alert-list {
  background: var(--sa-surface);
  border-radius: var(--fleet-radius-xl);
  border: 1px solid var(--sa-border);
  box-shadow: var(--fleet-card-shadow);
  overflow: hidden;
}

.fleet-alert-list-header {
  padding: 1rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--sa-text-h);
  border-bottom: 1px solid var(--sa-border);
}

.fleet-alert-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--sa-border);
  transition: background var(--sa-transition);
}

.fleet-alert-row:last-child { border-bottom: none; }

.fleet-alert-row:hover { background: var(--sa-surface-hover); }

.fleet-alert-row-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.95rem;
}

.fleet-alert-row-icon.danger { background: var(--sa-red-bg); color: var(--sa-red-text); }
.fleet-alert-row-icon.warn { background: var(--sa-amber-bg); color: var(--sa-amber-text); }

.fleet-alert-row-body { flex: 1; min-width: 0; }

.fleet-alert-row-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sa-text-h);
}

.fleet-alert-row-sub {
  font-size: 0.75rem;
  color: var(--sa-text-muted);
  margin-top: 2px;
}

.fleet-telemetry-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
  align-items: stretch;
}

@media (max-width: 991px) {
  .fleet-telemetry-layout {
    grid-template-columns: 1fr;
  }
}

.fleet-map-panel {
  background: var(--sa-surface);
  border-radius: var(--fleet-radius-xl);
  border: 1px solid var(--sa-border);
  box-shadow: var(--fleet-card-shadow);
  overflow: hidden;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.fleet-map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--sa-border);
  background: var(--fleet-bg);
}

.fleet-map-frame {
  flex: 1;
  min-height: 280px;
  background: linear-gradient(180deg, #e8eef5 0%, #dce4ec 100%);
  position: relative;
}

.fleet-map-frame iframe {
  width: 100%;
  height: 100%;
  min-height: 280px;
  border: 0;
}

.fleet-map-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 280px;
  color: var(--sa-text-sub);
  padding: 2rem;
  text-align: center;
}

.fleet-map-placeholder i {
  font-size: 2.5rem;
  color: var(--fleet-primary);
  opacity: 0.6;
  margin-bottom: 0.75rem;
}

.fleet-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.fleet-sidebar-card {
  background: var(--sa-surface);
  border-radius: var(--fleet-radius-xl);
  border: 1px solid var(--sa-border);
  box-shadow: var(--fleet-card-shadow);
  padding: 1.25rem;
}

.fleet-vehicle-title {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--sa-text-h);
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

.fleet-metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.fleet-metric-mini {
  background: var(--fleet-bg);
  border-radius: var(--sa-radius-sm);
  padding: 0.75rem;
  border: 1px solid var(--sa-border);
}

.fleet-metric-mini-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--sa-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fleet-metric-mini-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--sa-text-h);
  margin-top: 0.25rem;
}

.fleet-gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0 1rem;
}

.fleet-gauge {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.fleet-gauge-inner {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--sa-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px var(--sa-border);
}

.fleet-gauge-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--sa-text-h);
  line-height: 1;
}

.fleet-gauge-label {
  font-size: 0.6875rem;
  color: var(--sa-text-muted);
  margin-top: 2px;
}

.fleet-btn-full {
  width: 100%;
  justify-content: center;
  padding: 0.65rem 1rem;
  margin-top: 0.5rem;
}

.fleet-dtc-table .sa-table thead {
  background: var(--fleet-bg);
}

.fleet-dtc-table .sa-table thead th {
  color: var(--sa-text-sub);
  font-weight: 700;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fleet-dtc-code {
  font-family: ui-monospace, monospace;
  font-weight: 700;
  color: var(--fleet-primary);
}

.fleet-form-modal .sa-modal {
  text-align: right;
  max-width: 420px;
  padding: 1.75rem;
  border-radius: var(--fleet-radius-xl);
  box-shadow: var(--fleet-card-shadow);
}

.fleet-form-modal .form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sa-text-sub);
  margin-bottom: 0.35rem;
}

.fleet-form-modal .form-control {
  border-radius: var(--sa-radius-sm);
  border-color: var(--sa-border);
}

.fleet-form-modal .form-control:focus {
  border-color: var(--fleet-primary);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.15);
}

.btn-sa.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

.fleet-badge-wrap .badge {
  margin-left: 4px;
  margin-bottom: 4px;
}

.fleet-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--sa-surface);
  border-radius: var(--fleet-radius-xl);
  border: 1px dashed var(--sa-border);
  box-shadow: var(--fleet-card-shadow);
}

.fleet-empty-state i {
  font-size: 2.5rem;
  color: var(--sa-green);
  margin-bottom: 1rem;
}

.fleet-page .sa-table-wrap {
  border-radius: var(--fleet-radius-xl);
  box-shadow: var(--fleet-card-shadow);
  border: 1px solid var(--sa-border);
  overflow: hidden;
}

.fleet-analytics-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

@media (max-width: 767px) {
  .fleet-analytics-strip { grid-template-columns: 1fr; }
}

.fleet-analytics-metric {
  background: var(--fleet-bg);
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius-md);
  padding: 0.85rem 1rem;
}

.fleet-analytics-metric .label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--sa-text-muted);
  text-transform: uppercase;
}

.fleet-analytics-metric .value {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--sa-text-h);
  margin-top: 0.2rem;
}

.fleet-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.fleet-category-tab {
  border: 1px solid var(--sa-border);
  background: var(--sa-surface);
  color: var(--sa-text-body);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-size: 0.8125rem;
  font-weight: 700;
  box-shadow: var(--fleet-card-shadow);
  cursor: pointer;
  transition: all 0.18s ease;
}

.fleet-category-tab:hover,
.fleet-category-tab.active {
  background: var(--fleet-primary);
  border-color: var(--fleet-primary);
  color: #fff;
}
