/* demo.css — Harbor Bluff Deliveries dispatch demo */

:root {
  --navy: #1b2a4a;
  --cream: #f5f0e6;
  --orange: #e0703a;
  --ink: #24303f;
  --border: #d8cfba;
}

* {
  box-sizing: border-box;
}

html, body {
  max-width: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--cream);
}

a {
  color: var(--navy);
}

button {
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:focus-visible,
.driver-item:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.demo-header {
  background: var(--navy);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
}

.demo-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.demo-header h1 {
  font-size: 1.15rem;
  margin: 0;
}

.badge {
  background: var(--orange);
  color: #fff;
  font-size: 0.7rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
}

.back-link {
  color: var(--cream);
  font-size: 0.85rem;
  text-decoration: underline;
  white-space: nowrap;
}

.demo-subtitle {
  margin: 10px 16px;
  font-size: 0.9rem;
  color: var(--ink);
}

.demo-notice {
  margin: 0 16px 10px;
  padding: 8px 12px;
  background: #fff3e0;
  border: 1px solid var(--orange);
  border-radius: 6px;
  font-size: 0.85rem;
}

.demo-main {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto auto;
  grid-template-areas:
    "drivers map"
    "detail  map";
  gap: 12px;
  padding: 0 16px 16px;
}

.drivers-panel { grid-area: drivers; }
.map-panel { grid-area: map; }
.detail-panel { grid-area: detail; }

.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.status-counts {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.count-chip {
  flex: 1;
  text-align: center;
  background: var(--cream);
  border-radius: 6px;
  padding: 6px 4px;
}

.count-value {
  display: block;
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--navy);
}

.count-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.driver-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.driver-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--cream);
  border: 2px solid transparent;
  border-radius: 6px;
  text-align: left;
}

.driver-item[aria-pressed="true"] {
  border-color: var(--orange);
  background: #fff;
}

.driver-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.driver-name {
  flex: 1;
  font-weight: 600;
}

.driver-status-tag {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-available.driver-status-tag {
  background: #e2f0e6;
  color: #2f7a4a;
}

.status-delivering.driver-status-tag {
  background: #fde6d6;
  color: #9b390c;
}

.map-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.map-toolbar button {
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
}

#town-map {
  width: 100%;
  height: auto;
  max-height: 60vh;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: block;
}

.route-line {
  fill: none;
  stroke-width: 2;
  stroke-dasharray: 4 4;
}

.route-alex { stroke: #2f7a6b; }
.route-sam { stroke: #c1440e; }
.route-jordan { stroke: #5b4b8a; }

.street-label {
  font-size: 9px;
  fill: #6b6350;
}

.map-caption {
  font-size: 8px;
  fill: #6b6350;
  font-style: italic;
}

.marker-label {
  font-size: 9px;
  fill: var(--ink);
  text-anchor: middle;
}

.depot-marker {
  stroke: #fff;
  stroke-width: 1;
}

.position-marker {
  stroke: #fff;
  stroke-width: 2;
  transition: cx 0.3s ease, cy 0.3s ease;
}

.position-marker.status-available {
  opacity: 0.55;
}

.position-marker.status-delivering {
  opacity: 1;
}

.position-marker.selected {
  stroke: var(--orange);
  stroke-width: 3;
}

.detail-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.driver-detail h3 {
  margin: 0 0 6px;
  color: var(--navy);
}

.driver-detail p {
  margin: 4px 0;
  font-size: 0.9rem;
}

.detail-empty {
  color: #6b6350;
  font-style: italic;
}

.detail-eta {
  font-style: italic;
  color: #6b6350;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-actions button {
  flex: 1;
  min-width: 120px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 12px;
  font-weight: 600;
}

.detail-actions button:disabled {
  background: #d8cfba;
  color: #6b6350;
}

.demo-footer {
  padding: 12px 16px 20px;
  font-size: 0.8rem;
  color: #6b6350;
}

@media (max-width: 720px) {
  .demo-main {
    grid-template-columns: 1fr;
    grid-template-areas:
      "drivers"
      "map"
      "detail";
  }
}

@media (max-width: 420px) {
  .demo-header h1 {
    font-size: 1rem;
  }

  .demo-subtitle,
  .demo-notice {
    margin-left: 10px;
    margin-right: 10px;
  }

  .demo-main {
    padding: 0 10px 16px;
  }

  .detail-actions button {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) { .position-marker { transition: none; } }
