/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
  background: #f4f6f8;
  color: #17202a;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: #f4f6f8;
}

button,
pre {
  font: inherit;
}

.app-shell {
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.route-debug {
  display: flex;
  height: 100vh;
  min-height: 100vh;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  padding: 16px;
}

.route-debug__header,
.route-debug__pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.route-debug__header {
  flex: 0 0 auto;
}

.route-debug__header h1,
.route-debug__pane-header h2 {
  margin: 0;
  color: #101820;
  font-weight: 700;
  line-height: 1.1;
}

.route-debug__header h1 {
  font-size: 1.45rem;
}

.route-debug__pane-header h2 {
  font-size: 0.95rem;
}

.route-debug__endpoint {
  margin: 0 0 5px;
  color: #526170;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
}

.route-debug__refresh {
  min-width: 92px;
  min-height: 38px;
  border: 1px solid #1d4f91;
  border-radius: 8px;
  background: #1d4f91;
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
}

.route-debug__refresh:disabled {
  cursor: wait;
  opacity: 0.62;
}

.route-debug__workspace {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.85fr);
  gap: 16px;
  overflow: hidden;
  min-height: 0;
}

.route-debug__map-pane,
.route-debug__inspector-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #d6dde5;
  border-radius: 8px;
  background: #ffffff;
}

.route-debug__pane-header {
  flex: 0 0 auto;
  border-bottom: 1px solid #d6dde5;
  padding: 12px 14px;
}

.route-debug__summary,
.route-debug__status {
  min-width: 116px;
  border: 1px solid #d6dde5;
  border-radius: 999px;
  padding: 4px 10px;
  color: #334155;
  background: #f8fafc;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.route-debug__pane-actions,
.route-debug__map-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.route-debug__pane-actions {
  margin-left: auto;
}

.route-debug__map-toolbar {
  gap: 4px;
}

.route-debug__map-control {
  display: grid;
  min-width: 30px;
  height: 28px;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2937;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
}

.route-debug__map-control:hover {
  border-color: #1d4f91;
  color: #1d4f91;
}

.route-debug__map-control--fit {
  padding: 0 10px;
}

.route-debug-map {
  position: relative;
  flex: 1 1 auto;
  min-height: 540px;
  overflow: hidden;
  background: #d7e1dc;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.route-debug-map--panning {
  cursor: grabbing;
}

.route-debug-map__pan-layer {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  transition: transform 90ms ease-out;
  will-change: transform;
}

.route-debug-map--panning .route-debug-map__pan-layer {
  transition: none;
}

.route-debug-map__tiles,
.route-debug-map__overlay {
  position: absolute;
  inset: 0;
}

.route-debug-map__tiles {
  z-index: 0;
}

.route-debug-map__tiles img {
  position: absolute;
  width: 256px;
  height: 256px;
  max-width: none;
  user-select: none;
}

.route-debug-map__overlay {
  pointer-events: none;
}

.route-debug-map__overlay--attempts {
  z-index: 1;
}

.route-debug-map__overlay--vertices {
  z-index: 2;
}

.route-debug-map__overlay--final {
  z-index: 3;
}

.route-debug-map__overlay--highlight {
  z-index: 4;
}

.route-debug-map__cost-labels {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.route-debug-map__cost-label {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 74px;
  transform: translate(-50%, calc(-100% - 7px));
  border: 1px solid rgb(214 95 0 / 38%);
  border-radius: 4px;
  padding: 1px 4px;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 1px 4px rgb(15 23 42 / 18%);
  color: #9a3412;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.route-debug-map__cost-label--start {
  border-color: rgb(25 135 84 / 36%);
  color: #166534;
}

.route-debug-map__cost-label-value {
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-debug-map__cost-label-controls {
  flex: 0 0 auto;
  font-size: 0.62rem;
  letter-spacing: 0;
}

.route-debug-map__attempt {
  fill: none;
  stroke: #265fbc;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}

.route-debug-map__highlight {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
  vector-effect: non-scaling-stroke;
}

.route-debug-map__highlight--selected {
  stroke: #d65f00;
}

.route-debug-map__final-route {
  fill: none;
  stroke: #198754;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 8;
  vector-effect: non-scaling-stroke;
}

.route-debug-map__vertex-dot {
  fill: #1d4f91;
  opacity: 0.78;
  stroke: #ffffff;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.route-debug-map__vertex-dot--final {
  fill: #198754;
  opacity: 0.95;
}

.route-debug-map__vertex-dot--uninvolved {
  opacity: 0.4;
}

.route-debug-map__vertex-dot--selected {
  fill: #d65f00;
  opacity: 1;
  stroke-width: 3;
}

.route-debug-map__marker {
  position: absolute;
  transform: translate(-50%, -50%);
}

.route-debug-map__marker {
  display: grid;
  z-index: 5;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgb(15 23 42 / 28%);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
}

.route-debug-map__marker--s {
  background: #198754;
}

.route-debug-map__marker--e {
  background: #b42318;
}

.route-debug-map__attribution {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 4;
  border-radius: 4px;
  padding: 3px 6px;
  background: rgb(255 255 255 / 88%);
  color: #1f2937;
  font-size: 0.72rem;
  text-decoration: none;
}

.route-debug-map__message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #526170;
  font-weight: 700;
}

.route-debug__inspector {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  background: #ffffff;
}

.route-debug__inspector-section {
  border-bottom: 1px solid #e2e8f0;
  padding: 14px 0;
}

.route-debug__inspector-section:first-child {
  padding-top: 0;
}

.route-debug__inspector-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.route-debug__inspector-section h3 {
  margin: 0 0 10px;
  color: #101820;
  font-size: 0.88rem;
  line-height: 1.2;
}

.route-debug__metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.route-debug__metric {
  min-width: 0;
  border: 1px solid #dce3ea;
  border-radius: 7px;
  padding: 8px;
  background: #f8fafc;
}

.route-debug__metric span,
.route-debug__definition-list dt,
.route-debug__selection-heading p,
.route-debug__muted {
  color: #64748b;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.25;
}

.route-debug__metric strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: #17202a;
  font-size: 0.96rem;
  line-height: 1.15;
}

.route-debug__selection-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.route-debug__selection-heading p,
.route-debug__selection-heading h3 {
  margin: 0;
}

.route-debug__selection-heading p {
  text-transform: uppercase;
}

.route-debug__selection-heading span {
  flex: 0 0 auto;
  border: 1px solid #f0c38f;
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.route-debug__definition-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin: 0;
}

.route-debug__definition-list div {
  display: grid;
  grid-template-columns: minmax(96px, 0.42fr) minmax(0, 1fr);
  gap: 10px;
}

.route-debug__definition-list dt,
.route-debug__definition-list dd {
  margin: 0;
}

.route-debug__definition-list dd {
  min-width: 0;
  color: #17202a;
  font-size: 0.8rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.route-debug__table-wrap {
  overflow: auto;
}

.route-debug__cost-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.75rem;
  line-height: 1.35;
}

.route-debug__cost-table th,
.route-debug__cost-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 7px 6px;
  text-align: left;
  vertical-align: top;
}

.route-debug__cost-table th {
  color: #475569;
  font-size: 0.7rem;
  font-weight: 800;
}

.route-debug__cost-table td:nth-child(1),
.route-debug__cost-table td:nth-child(3),
.route-debug__cost-table td:nth-child(4) {
  white-space: nowrap;
}

.route-debug__cost-table strong,
.route-debug__cost-table span {
  display: block;
}

.route-debug__cost-table span {
  margin-top: 2px;
  color: #64748b;
}

.route-debug__cost-row--blocked {
  background: #fff1f2;
}

.route-debug__empty {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
  color: #475569;
}

.route-debug__empty h3,
.route-debug__empty p,
.route-debug__muted {
  margin: 0;
}

.route-debug__empty p {
  margin-top: 6px;
  font-size: 0.82rem;
  line-height: 1.4;
}

.route-debug__empty--error {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #9f1239;
}

@media (max-width: 960px) {
  body,
  .app-shell,
  .route-debug {
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .route-debug__workspace {
    grid-template-columns: 1fr;
  }

  .route-debug-map {
    height: 70svh;
    min-height: 70svh;
  }

  .route-debug__inspector-pane {
    min-height: 420px;
  }
}

@media (max-width: 640px) {
  .route-debug {
    padding: 10px;
  }

  .route-debug__header,
  .route-debug__pane-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .route-debug__pane-actions,
  .route-debug__map-toolbar {
    width: 100%;
  }

  .route-debug__pane-actions {
    flex-wrap: wrap;
    margin-left: 0;
  }

  .route-debug__map-control--fit {
    flex: 1;
  }

  .route-debug__refresh,
  .route-debug__summary,
  .route-debug__status {
    width: 100%;
  }
}
