/* Basic Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0b0f14;
  --panel: #12181f;
  --border: #232c37;
  --text-primary: #eef2f6;
  --text-secondary: #8b98a9;
  --text-muted: #5b6673;
  --low-bg: #0f2a1c;
  --low-text: #3ddc84;
  --low-border: #1c4a30;
  --med-bg: #332108;
  --med-text: #f5a623;
  --med-border: #5c3d0e;
  --high-bg: #341313;
  --high-text: #ff5c5c;
  --high-border: #5c1f1f;
}

html {
  height: 100%;
}

/* Body & General */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  padding: 18px 28px 20px;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Top bar: title + live status summary */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.title-block h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.title-block .sub {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 14px;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--low-text);
  box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(61, 220, 132, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); }
}

.summary {
  display: flex;
  gap: 28px;
}
.summary-item {
  text-align: right;
}
.summary-item .num {
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
}
.summary-item .lbl {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 4px;
}
.num.low { color: var(--low-text); }
.num.med { color: var(--med-text); }
.num.high { color: var(--high-text); }

/* Segment cards, 3 per row */
.grid {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s;
}
.card.high {
  border-color: var(--high-border);
  background: linear-gradient(180deg, var(--panel) 0%, rgba(52, 19, 19, 0.35) 100%);
}
.card.med {
  border-color: var(--med-border);
}

.route {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dir-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.badge.low { background: var(--low-bg); color: var(--low-text); }
.badge.med { background: var(--med-bg); color: var(--med-text); }
.badge.high { background: var(--high-bg); color: var(--high-text); }
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.delay {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.delay strong {
  color: var(--text-primary);
  font-weight: 600;
}
.card.high .delay strong { color: var(--high-text); }
.card.med .delay strong { color: var(--med-text); }

/* Live map panel: takes whatever vertical space is left */
.map-panel {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.map-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}
.map-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.legend {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--text-secondary);
}
.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend i {
  width: 14px;
  height: 4px;
  border-radius: 2px;
  display: inline-block;
}
.legend .l-low i { background: var(--low-text); }
.legend .l-med i { background: var(--med-text); }
.legend .l-high i { background: var(--high-text); }

#map {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  background: #0e1319;
}

/* Modal styling (if used) */
.modal {
  display: none; /* hidden by default */
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  z-index: 1000;
}
