* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #1a1a1a;
}

#app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
}

#topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.5rem 1rem;
  background: #14355c;
  color: white;
  z-index: 1000;
}

#topbar h1 {
  font-size: 1.1rem;
  margin: 0;
  white-space: nowrap;
}

#search-box {
  position: relative;
  flex: 1;
  max-width: 420px;
}

#search {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  border: none;
}

#search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  color: #1a1a1a;
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

#search-results:empty {
  display: none;
}

#search-results li {
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
}

#search-results li:hover {
  background: #eef3fa;
}

.search-result-code {
  color: #888;
  font-size: 0.8em;
}

#auth-area {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

#auth-area a, #auth-area button {
  color: white;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.4);
  padding: 0.35rem 0.7rem;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.85rem;
}

#map {
  width: 100%;
  height: 100%;
}

#panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100%);
  height: 100%;
  background: white;
  box-shadow: -2px 0 12px rgba(0,0,0,0.25);
  overflow-y: auto;
  z-index: 1100;
  padding: 1rem;
}

#panel-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  font-size: 1.4rem;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
}

.stop-marker span {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-sizing: border-box;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

#panel-content h2 {
  margin: 0.5rem 2rem 0.25rem 0;
  font-size: 1.2rem;
}

#panel-content .path {
  color: #555;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

#panel-content dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  font-size: 0.9rem;
}

#panel-content dt { font-weight: 600; }
#panel-content dt { color: #333; }

#panel-content section {
  margin-top: 1.25rem;
  border-top: 1px solid #e2e2e2;
  padding-top: 0.75rem;
}

#panel-content section h3 {
  font-size: 0.95rem;
  margin: 0 0 0.5rem 0;
}

#panel-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

#panel-content table td, #panel-content table th {
  border-bottom: 1px solid #eee;
  padding: 0.3rem 0.2rem;
  text-align: left;
  vertical-align: top;
}

#panel-content form.inline-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

#panel-content label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #333;
}

#panel-content input, #panel-content select {
  padding: 0.3rem;
  font-size: 0.85rem;
  border: 1px solid #ccc;
  border-radius: 3px;
}

#panel-content button, .dialog-actions button {
  padding: 0.35rem 0.7rem;
  border-radius: 4px;
  border: 1px solid #14355c;
  background: #14355c;
  color: white;
  cursor: pointer;
  font-size: 0.85rem;
  align-self: flex-start;
}

#panel-content button.secondary {
  background: white;
  color: #14355c;
}

#panel-content button.danger {
  background: #a3252c;
  border-color: #a3252c;
}

/* [hidden] uit het user-agent-stylesheet verliest anders van onze eigen "display"-regel hieronder
   (auteurs-CSS wint altijd van user-agent-CSS, ongeacht specificiteit) — zonder deze regel blijft
   een element met het hidden-attribuut toch zichtbaar zodra we er zelf "display" op zetten. */
#toolbar[hidden],
#dialog-overlay[hidden] {
  display: none;
}

#toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 1rem;
  background: #f2f2f2;
  border-top: 1px solid #ddd;
}

#toolbar button {
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  border: 1px solid #14355c;
  background: white;
  color: #14355c;
  cursor: pointer;
}

#toolbar button.active {
  background: #14355c;
  color: white;
}

#merge-status {
  font-size: 0.85rem;
  color: #333;
}

#dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

#dialog-box {
  background: white;
  border-radius: 6px;
  padding: 1.25rem;
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

#dialog-box h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.dialog-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  justify-content: flex-end;
}

.error-text {
  color: #a3252c;
  font-size: 0.85rem;
}

.hint-text {
  color: #555;
  font-size: 0.8rem;
}

#report-search {
  width: 100%;
  padding: 0.4rem 0.6rem;
  margin: 0.5rem 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

#report-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 4px;
}

.report-item {
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}

.report-item:last-child {
  border-bottom: none;
}

.report-item:hover {
  background: #eef3fa;
}

#report-load-more {
  margin-top: 0.5rem;
}
