/* Removable Elevation-Aware Battery & Grade Profile Strip — static/elevation/elevation.css */

.elevation-strip {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  z-index: 1020;
  background: rgba(20, 24, 30, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color, #2c3540);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  color: var(--text-main, #f0f3f6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: height 0.18s ease, transform 0.18s ease;
}

.elevation-strip[hidden] {
  display: none !important;
}

/* Header bar */
.elevation-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  min-height: 36px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(26, 30, 36, 0.85);
}

.elevation-strip.is-collapsed .elevation-strip-header {
  border-bottom: none;
  cursor: pointer;
}

.elevation-strip.is-collapsed .elevation-strip-body {
  display: none !important;
}

.elevation-title-group {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.elevation-title-icon {
  color: var(--tesla-red, #e82127);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
}

.elevation-title-text {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
  white-space: nowrap;
}

.elevation-source-pill {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 180, 216, 0.14);
  color: #7dd3fc;
  border: 1px solid rgba(0, 180, 216, 0.35);
  white-space: nowrap;
}

.elevation-source-pill.is-fallback {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.35);
}

/* Energy Delta Badges */
.elevation-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.elevation-badges::-webkit-scrollbar {
  display: none;
}

.elev-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.elev-badge-climb {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.32);
}

.elev-badge-regen {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.elev-badge-net {
  background: rgba(255, 255, 255, 0.07);
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.14);
}

.elev-badge-net.is-penalty {
  background: rgba(232, 33, 39, 0.16);
  color: #fca5a5;
  border-color: rgba(232, 33, 39, 0.38);
}

.elev-badge-net.is-saving {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
}

.elev-badge-sep {
  opacity: 0.6;
}

/* Header Controls */
.elevation-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.elev-vehicle-select {
  background: var(--bg-tertiary, #232931);
  border: 1px solid var(--border-color, #2c3540);
  color: var(--text-main, #f0f3f6);
  border-radius: 6px;
  height: 26px;
  padding: 0 6px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
}

.elev-vehicle-select:focus {
  outline: none;
  border-color: #38bdf8;
}

.elev-unit-btn,
.elev-collapse-btn {
  background: var(--bg-tertiary, #232931);
  border: 1px solid var(--border-color, #2c3540);
  color: var(--text-main, #f0f3f6);
  border-radius: 6px;
  height: 26px;
  min-width: 28px;
  padding: 0 7px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.elev-unit-btn:hover,
.elev-collapse-btn:hover {
  background: var(--tesla-red, #e82127);
  border-color: var(--tesla-red, #e82127);
  color: #fff;
}

/* Strip Body & Scrub Readout */
.elevation-strip-body {
  display: flex;
  flex-direction: column;
  padding: 4px 10px 6px;
  gap: 3px;
}

.elevation-scrub-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.69rem;
  color: var(--text-muted, #8c9ba8);
  flex-wrap: nowrap;
  overflow: hidden;
}

.elev-scrub-stat {
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
}

.elev-scrub-stat.is-uphill {
  color: #fbbf24;
}

.elev-scrub-stat.is-downhill {
  color: #34d399;
}

.elev-scrub-leg {
  color: var(--text-muted, #8c9ba8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: auto;
}

/* SVG Chart Container */
.elevation-chart-wrap {
  width: 100%;
  height: 92px;
  position: relative;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.elevation-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.elev-grid-line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.elev-axis-label {
  fill: #8c9ba8;
  font-size: 9px;
  font-weight: 600;
}

.elev-pin-label {
  fill: #ffffff;
  font-size: 8.5px;
  font-weight: 800;
  paint-order: stroke;
  stroke: rgba(18, 20, 24, 0.9);
  stroke-width: 2.5px;
}

.elev-stop-pin {
  cursor: pointer;
}

/* Map Hover Tooltip */
.elevation-map-tooltip {
  background: rgba(20, 24, 30, 0.95) !important;
  color: #f8fafc !important;
  border: 1px solid #38bdf8 !important;
  border-radius: 6px !important;
  padding: 3px 7px !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45) !important;
}

/* Lift desktop map legend, drone airspace legend, and weather radar pill above the elevation strip when active */
body.elevation-strip-visible:not(.car-shell):not(.ui-mobile) .map-legend,
body.elevation-strip-visible:not(.car-shell):not(.ui-mobile) .airspace-map-legend {
  bottom: 184px;
  transition: bottom 0.18s ease;
}

body.elevation-strip-visible.elevation-strip-collapsed:not(.car-shell):not(.ui-mobile) .map-legend,
body.elevation-strip-visible.elevation-strip-collapsed:not(.car-shell):not(.ui-mobile) .airspace-map-legend {
  bottom: 62px;
}

body.elevation-strip-visible:not(.car-shell):not(.ui-mobile) .weather-radar-pill {
  bottom: 184px;
  transition: bottom 0.18s ease;
}

body.elevation-strip-visible.elevation-strip-collapsed:not(.car-shell):not(.ui-mobile) .weather-radar-pill {
  bottom: 62px;
}

/* --------------------------------------------------------------------------
   Tesla Car-Shell Adaptation (bottom sheet at --car-sheet-h)
   -------------------------------------------------------------------------- */
body.car-shell .elevation-strip {
  left: 10px;
  right: 10px;
  bottom: calc(var(--car-sheet-h, 72px) + 8px);
  z-index: 1050;
}

body.car-shell[data-sheet="plan"] .elevation-strip,
body.car-shell[data-sheet="itinerary"] .elevation-strip,
body.car-shell.car-chrome-hidden .elevation-strip {
  display: none !important;
}

body.car-shell .elevation-chart-wrap {
  height: 76px;
}

body.car-shell .elev-unit-btn,
body.car-shell .elev-collapse-btn {
  min-height: 32px;
  min-width: 34px;
}

body.car-shell .elev-vehicle-select {
  height: 32px;
}

body.car-shell.elevation-strip-visible .weather-radar-pill,
body.car-shell.elevation-strip-visible .airspace-map-legend {
  bottom: calc(var(--car-sheet-h, 72px) + 162px);
}

body.car-shell.elevation-strip-visible.elevation-strip-collapsed .weather-radar-pill,
body.car-shell.elevation-strip-visible.elevation-strip-collapsed .airspace-map-legend {
  bottom: calc(var(--car-sheet-h, 72px) + 54px);
}

/* --------------------------------------------------------------------------
   Mobile Shell Adaptation (/mobile or ?ui=mobile)
   -------------------------------------------------------------------------- */
body.ui-mobile .elevation-strip {
  left: calc(8px + var(--safe-left, 0px));
  right: calc(8px + var(--safe-right, 0px));
  bottom: calc(var(--mobile-plan-h, 48px) + var(--mobile-fab-gap, 12px) + var(--mobile-chrome-bottom, 0px) + 8px);
  z-index: 1050;
}

body.ui-mobile.sheet-open .elevation-strip {
  display: none !important;
}

body.ui-mobile .elevation-chart-wrap {
  height: 72px;
}

body.ui-mobile .elevation-source-pill,
body.ui-mobile .elev-scrub-leg,
body.ui-mobile .elev-vehicle-select {
  display: none;
}

body.ui-mobile.elevation-strip-visible .weather-radar-pill,
body.ui-mobile.elevation-strip-visible .map-legend,
body.ui-mobile.elevation-strip-visible .airspace-map-legend {
  bottom: calc(var(--mobile-plan-h, 48px) + var(--mobile-fab-gap, 12px) + var(--mobile-chrome-bottom, 0px) + 154px);
}

body.ui-mobile.elevation-strip-visible.elevation-strip-collapsed .weather-radar-pill,
body.ui-mobile.elevation-strip-visible.elevation-strip-collapsed .map-legend,
body.ui-mobile.elevation-strip-visible.elevation-strip-collapsed .airspace-map-legend {
  bottom: calc(var(--mobile-plan-h, 48px) + var(--mobile-fab-gap, 12px) + var(--mobile-chrome-bottom, 0px) + 52px);
}

@media (max-width: 640px) {
  .elevation-source-pill,
  .elev-scrub-leg,
  .elev-vehicle-select {
    display: none;
  }
  .elevation-strip-header {
    padding: 5px 8px;
  }
  .elev-badge {
    font-size: 0.64rem;
    padding: 2px 5px;
  }
}
