/*
 * VehicleInfoComponent (the vehicle-details popup opened from Fleet Status,
 * Find Nearest, Replay, Geofence, etc.) — restyled per two reference
 * screenshots the user supplied (a regular-vehicle card and an
 * ambulance/dispatch card), both showing: a status-icon row, a top tab bar
 * (Overview / Device / Trip / Activity), battery/odometer summary cards and
 * a location row with an "Open" link.
 *
 * Scoped to the existing classes this component already renders
 * (.vehicle-info, .card.rounded-vlg) plus the new vinfo-* classes added
 * alongside them — doesn't touch the vendor template's generic .card/.badge
 * rules other popups may share.
 */

/* top+bottom (instead of top+a guessed vh subtraction) lets the browser
   compute the available height itself, from whatever .vehicle-info's own
   containing block actually is — guaranteed to never run past the bottom
   of that box, on any device, with no guessed offset to get wrong. */
.vehicle-info {
  top: 65px;
  bottom: 16px;
  height: auto;
  width: 360px;
}

.vehicle-info .card.rounded-vlg {
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
}

.vehicle-info .vehicle-header {
  flex-shrink: 0;
}

.vehicle-info .card-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.vehicle-info .vinfo-bottom-bar {
  flex-shrink: 0;
}

/* Close (X) button: circular white badge instead of the vendor's plain
   transparent 20x20 click area. */
.vehicle-info .card .card-header-action {
  z-index: 4;
}

.vehicle-info .card .card-header-action a {
  width: 26px !important;
  height: 26px !important;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.6) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.vehicle-info .card .card-header-action a:hover {
  background-color: rgba(255, 255, 255, 0.85) !important;
}

.vehicle-info .card .card-header-action a i {
  position: static;
  color: #475569;
}

/* No vehicle photo: remove the solid colored band (red/amber/green/blue,
   from custom.css) behind the vehicle number + date/time header — status is
   already shown via the colored pill above, so on a plain white background
   this band was redundant and, for "Stopped", looked like an alarming red
   strip. Scoped to .vehicle-info-visibility (the no-image variant only). */
.vehicle-info .vehicle-info-visibility.vehicle-title-stopped,
.vehicle-info .vehicle-info-visibility.vehicle-title-idle,
.vehicle-info .vehicle-info-visibility.vehicle-title-moving,
.vehicle-info .vehicle-info-visibility.vehicle-title-noresponse {
  background-color: transparent;
}

.vehicle-info .vehicle-info-visibility .text-white,
.vehicle-info .vehicle-info-visibility .no-image-vehicle-datetime {
  color: #1f2430 !important;
}

/* Has a vehicle photo: the title bar now renders *inside* .vehicle-header
   (see renderTitleBar in VehicleInfoComponent.jsx), absolutely positioned
   over the photo rather than stacking below it. Restores a dark gradient
   scrim so the (still white, per custom.css) text/date stay readable over
   whatever photo is behind them. */
.vehicle-header h4 {
  position: absolute !important;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
  margin: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.25) 60%,
    rgba(0, 0, 0, 0) 100%
  ) !important;
}

/* ---- Speed gauge badge (floating, absolute, over the vehicle title bar) ---- */

.vehicle-info h4.vehicle-title,
.vehicle-info h4.vehicle-title-moving,
.vehicle-info h4.vehicle-title-stopped,
.vehicle-info h4.vehicle-title-idle,
.vehicle-info h4.vehicle-title-noresponse {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

/* Date/time stacked below the vehicle number instead of floating beside it
   (vendor .vehicle-datetime/.pull-left CSS assumed a side-by-side layout). */
.vehicle-info h4 .pull-left {
  float: none;
}

.vehicle-info h4 .vehicle-datetime,
.vehicle-info h4 .no-image-vehicle-datetime {
  width: auto;
  text-align: left;
  white-space: nowrap;
}

.vinfo-speed-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  line-height: 1;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  padding: 4px 8px 5px;
}

.vinfo-speed-badge__val {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.72rem;
  color: #1f2430;
  margin-top: -1px;
}

/* ---- Top status/transporter pills ---- */

.vinfo-top-pills {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 46px;
  z-index: 2;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.vinfo-top-pills::-webkit-scrollbar {
  display: none;
}

.vinfo-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e7e9f3;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #1f2430;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.vinfo-pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #94a3b8;
}

.vinfo-pill__dot--moving {
  background: #22c55e;
}

.vinfo-pill__dot--stopped {
  background: #ef4444;
}

.vinfo-pill__dot--idle {
  background: #f59e0b;
}

.vinfo-pill__dot--noresponse {
  background: #94a3b8;
}

/* Text color matches the exact status colors used in the grid's Status
   column (Moving/Stopped/Idle/Offline-NoResponse). */
.vinfo-pill--moving {
  color: #22c55e;
}

.vinfo-pill--stopped {
  color: #ef4444;
}

.vinfo-pill--idle {
  color: #f59e0b;
}

.vinfo-pill--noresponse {
  color: #64748b;
}

/* ---- Status icon row (GPS / Battery / AC / Fuel / Engine / Ignition / Door) ---- */

.vinfo-icon-row {
  flex-shrink: 0;
}

.vinfo-icon-row .row {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vinfo-icon-row .col-4 {
  flex: 0 0 calc(25% - 6px);
  max-width: calc(25% - 6px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: left;
  padding: 7px 6px;
  border: 1px solid #e7e9f3;
  border-radius: 8px;
  background: #ffffff;
}

.vinfo-icon-row .col-4 i,
.vinfo-icon-row .col-4 img {
  display: inline-block;
  margin: 0;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ---- Tab bar ---- */

.vinfo-tabs {
  flex-shrink: 0;
  display: flex;
  flex-wrap: nowrap;
  border-bottom: 1px solid #e7e9f3;
  padding: 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.vinfo-tabs::-webkit-scrollbar {
  display: none;
}

.vinfo-tab {
  flex: 0 0 auto;
  white-space: nowrap;
  border: none;
  background: transparent;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.vinfo-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.vinfo-tab:hover {
  color: var(--color-primary);
}

/* Tab content (Overview/Device/Trip/Activity) scrolls in its own box,
   independent of the fixed header (image/pills/icon-row/tabs) above it and
   the fixed bottom action bar below it. flex:1 (rather than a flat vh
   height) lets it fill whatever room .card.rounded-vlg's own
   device-driven max-height actually leaves for it — shrinks automatically
   on a short viewport, grows on a tall one. */
.vinfo-tab-content-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* ---- Overview tab ---- */

.vinfo-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 10px;
  padding: 8px 10px 8px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.vinfo-status-banner--moving {
  background: #ecfdf3;
  color: #15803d;
}

.vinfo-status-banner--stopped {
  background: #fef2f2;
  color: #b91c1c;
}

.vinfo-status-banner--idle {
  background: #fffbeb;
  color: #92400e;
}

.vinfo-status-banner--noresponse {
  background: #f1f5f9;
  color: #475569;
}

.vinfo-status-banner__track {
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
}

.vinfo-status-banner--moving .vinfo-status-banner__track {
  background: #15803d;
}

.vinfo-status-banner--stopped .vinfo-status-banner__track {
  background: #b91c1c;
}

.vinfo-status-banner--idle .vinfo-status-banner__track {
  background: #92400e;
}

.vinfo-stat-cards {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.vinfo-stat-card {
  flex: 1 1 0;
  background: #f8fafc;
  border: 1px solid #e7e9f3;
  border-radius: 10px;
  padding: 10px 12px;
}

.vinfo-stat-card__label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.vinfo-stat-card__value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1f2430;
}

.vinfo-stat-card__value small {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
}

.vinfo-location-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #e7e9f3;
  border-radius: 10px;
  padding: 10px 12px;
}

.vinfo-location-row__label {
  font-size: 0.66rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.vinfo-location-row__label i {
  color: #22c55e;
}

.vinfo-location-row__address {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1f2430;
}

.vinfo-location-row__open {
  flex-shrink: 0;
  color: var(--color-primary);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.vinfo-location-row__open:hover {
  text-decoration: underline;
}

/* Device/Trip tabs' content (#accordion) had no horizontal inset of its own
   — it relied on the old accordion-header/body padding, which is gone now
   that those headers were removed — so it sat flush against the card edges
   instead of matching the Overview tab's p-3 (1rem) inset. */
#accordion {
  padding: 16px;
}

/* ---- Vehicle/Ambulance details card (Overview tab, below the address) ---- */

.vehicle-info .vinfo-details-card {
  height: auto;
  max-height: 220px;
  border: 1px solid #e7e9f3;
  border-radius: 10px;
  margin-top: 10px;
}

.vehicle-info .vinfo-details-card.list-group .list-group-item {
  padding: 10px 14px;
  font-size: 0.78rem;
  line-height: 1.1;
  border-bottom: 1px solid #e7e9f3 !important;
}

.vehicle-info .vinfo-details-card .list-group-item:last-child {
  border-bottom: none !important;
}

.vinfo-details-card .vinfo-title {
  color: #64748b;
  font-weight: 600;
}

.vinfo-details-card .vinfo-text {
  color: #1f2430;
  font-weight: 700;
}

.vinfo-details-card .badge-status {
  background: transparent !important;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 700;
}

.vinfo-details-card .badge-status.badge-success-status {
  color: #16a34a;
}

.vinfo-details-card .badge-status.badge-danger-status {
  color: #ef4444;
}

/* ---- Bottom action bar (Track live + Configurations) ---- */

.vinfo-bottom-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #e7e9f3;
}

.vinfo-track-live-btn {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.vinfo-track-live-btn:hover {
  filter: brightness(0.95);
}

.vinfo-icon-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #e7e9f3;
  background: #ffffff;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.vinfo-icon-btn:hover {
  background: #f8fafc;
}

/* ---- Activity tab ---- */

.vinfo-activity__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: #ffffff;
  border: 1px solid #e7e9f3;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1f2430;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
}

.vinfo-activity__btn:hover {
  background: #f8fafc;
}
