/*
 * This page links the real streamwyse.de/static/css/main.css directly (see
 * templates/index.html <head>), so :root tokens, body defaults, .container,
 * .site-header/.main-nav/.nav-flyout, .detail-section, and .btn/.btn-primary
 * all come from there — nothing is redefined here. This file only adds what
 * main.css has no equivalent for: the interactive form controls, map
 * picker, charts, and results list.
 *
 * Important consequence: main.css's default body background is the dark
 * brand teal (--color-bg) with white text (--color-text) — the same as the
 * rest of the marketing site, not a light page. .showcase-card below
 * reproduces the same "light card floating on the dark page" pattern the
 * site itself uses for its own forms (.auth-card, .dashboard-card,
 * .contact-card in main.css) — Showcase gets its own class only because our
 * card is wider and holds richer content than those.
 */

* {
  box-sizing: border-box;
}

/* Not part of the site's token set — a semantic error color for form/
   status feedback, chosen to not clash with the orange primary. */
:root {
  --color-error: #b3261e;
}

.showcase-card {
  background: #ffffff;
  border: 1px solid var(--color-border-on-light);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  color: var(--color-text-on-light);
  margin-bottom: var(--space-6);
}

.lead {
  color: var(--color-text-light);
}

.cta-box {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border-on-light);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  margin: var(--space-6) 0;
  text-align: center;
}

.cta-box h2 {
  margin-bottom: var(--space-2);
}

.cta-box p {
  max-width: 60ch;
  margin: 0 auto var(--space-4);
  color: var(--color-text-light-on-light);
}

fieldset {
  border: 1px solid var(--color-border-on-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  padding: var(--space-4);
}

legend {
  font-weight: 600;
  padding: 0 0.4rem;
}

.city-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-2);
}

.city-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.coordinate-list {
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.coordinate-list:empty {
  margin-bottom: 0;
}

.coordinate-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border-on-light);
  border-radius: 999px;
  padding: 0.3rem 0.5rem 0.3rem 0.8rem;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.coordinate-chip button {
  border: none;
  background: transparent;
  color: var(--color-error);
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
  padding: 0.1rem 0.3rem;
}

.hint {
  color: var(--color-text-light-on-light);
  font-size: 0.85rem;
  margin: var(--space-2) 0 0;
}

.field-error {
  color: var(--color-error);
  font-size: 0.85rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--color-primary);
}

#duration-output {
  font-weight: 600;
}

/* .btn/.btn-primary come from the real site's main.css. It's built for
   <a> links though, so button-specific resets and a disabled state (which
   the marketing site never needs) are added here. */
button.btn {
  border: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Real .btn-secondary is styled for the dark hero (transparent + white
   text/border) — invisible on our white .showcase-card, so it's overridden
   here rather than reused as-is. */
.btn-secondary {
  background: var(--color-bg-alt);
  color: var(--color-text-on-light);
  border: 1px solid var(--color-border-on-light);
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.form-message {
  min-height: 1.4em;
}

.form-message.error {
  color: var(--color-error);
}

.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.result-item {
  border: 1px solid var(--color-border-on-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  overflow: hidden;
}

.result-summary {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  background: var(--color-bg-alt);
}

.result-summary .latency {
  font-variant-numeric: tabular-nums;
  color: var(--color-text-light-on-light);
  white-space: nowrap;
}

.result-item.error .result-summary {
  color: var(--color-error);
}

/* Brief flash when a map marker jumps the visitor to this row. */
@keyframes result-highlight-flash {
  0% { background: rgba(253, 97, 0, 0.35); }
  100% { background: var(--color-bg-alt); }
}

.result-item.highlight .result-summary {
  animation: result-highlight-flash 1.6s ease-out;
}

.result-detail {
  display: none;
  padding: 0.75rem 0.9rem;
  border-top: 1px solid var(--color-border-on-light);
}

.result-item.expanded .result-detail {
  display: block;
}

.result-detail pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8rem;
  max-height: 320px;
  overflow: auto;
  background: var(--color-bg-alt);
  padding: var(--space-2);
  border-radius: var(--radius-md);
}

/* Results grouped by location */

.results-groups {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.location-group {
  border: 1px solid var(--color-border-on-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.location-group summary {
  cursor: pointer;
  list-style: none;
  padding: 0.7rem 0.9rem;
  background: var(--color-bg-alt);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
}

.location-group summary::-webkit-details-marker {
  display: none;
}

.location-group summary .location-stats {
  font-weight: 400;
  color: var(--color-text-light-on-light);
  font-size: 0.85rem;
  white-space: nowrap;
}

.location-group .results-list {
  padding: var(--space-2);
}

#response-map {
  height: 340px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-on-light);
  margin-bottom: var(--space-3);
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem var(--space-4);
  margin-bottom: var(--space-6);
  font-size: 0.85rem;
}

.map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.map-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Map picker modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(29, 36, 48, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
}

.modal-overlay[hidden] {
  display: none;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: min(560px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border-on-light);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-light-on-light);
}

#picker-map {
  height: 280px;
  cursor: crosshair;
}

.picker-body {
  padding: var(--space-4) var(--space-6);
  overflow-y: auto;
}

.picker-radius-label {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-3);
}

.radius-readout {
  font-weight: 600;
  color: var(--color-primary);
}

.coord-box {
  border: 1px solid var(--color-border-on-light);
  border-radius: var(--radius-md);
  background: var(--color-bg-alt);
  padding: 0.6rem 0.8rem;
  font-variant-numeric: tabular-nums;
}

.coord-empty {
  color: var(--color-text-light-on-light);
}

.manual-entry {
  margin-top: var(--space-3);
}

.manual-entry label {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-light-on-light);
  margin-bottom: 0.25rem;
}

.manual-entry .row input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border-on-light);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
}

.manual-entry button {
  margin-top: 0.6rem;
  width: 100%;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--color-border-on-light);
}
