/* The look of the admin pages. */
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1f2933;
  background: #f5f7fa;
  line-height: 1.45;
}

.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 10px 16px;
  background: #16324f;
  color: #ffffff;
}

.admin-header strong {
  margin-right: auto;
}

.admin-header a,
.link-button {
  border: 0;
  background: none;
  color: #ffffff;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.link-button {
  padding: 0;
}

.admin-header form {
  margin: 0;
}

main {
  box-sizing: border-box;
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  margin: 8px 0 16px;
  font-size: 1.4rem;
}

h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.card {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  background: #ffffff;
}

.narrow {
  max-width: 420px;
}

.sign-in {
  max-width: 380px;
  margin: 48px auto 16px;
  padding: 24px;
}

.sign-in h1 {
  margin-top: 0;
  margin-bottom: 4px;
}

.full-width {
  width: 100%;
  padding: 10px;
}

.flash {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 6px;
}

.flash.ok {
  background: #e3f6e8;
  color: #17602a;
}

.flash.error {
  background: #fdecea;
  color: #8a1c13;
}

.warning {
  padding: 10px 12px;
  border-radius: 6px;
  background: #fff4d6;
  color: #6b4e00;
}

.hint {
  color: #52606d;
  font-size: 0.9rem;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin: 0;
}

.stats dt {
  color: #52606d;
  font-size: 0.85rem;
}

.stats dd {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="file"],
select {
  box-sizing: border-box;
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: 1px solid #9aa5b1;
  border-radius: 6px;
  background: #ffffff;
  font: inherit;
  font-size: 16px;
}

input[type="color"] {
  width: 44px;
  height: 34px;
  padding: 2px;
  border: 1px solid #9aa5b1;
  border-radius: 6px;
  background: #ffffff;
}

button,
.button {
  display: inline-block;
  padding: 8px 14px;
  border: 0;
  border-radius: 6px;
  background: #16324f;
  color: #ffffff;
  font: inherit;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
}

button.danger {
  background: #b3261e;
}

button.plain,
.button.plain {
  border: 1px solid #16324f;
  background: #ffffff;
  color: #16324f;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 10px;
  margin-bottom: 10px;
}

.row form {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 10px;
  margin: 0;
}

.row form.compact {
  flex: 0 0 auto;
}

.row label {
  flex: 1 1 130px;
  margin: 0;
}

.row label.tick {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.layer-name {
  flex: 1 1 160px;
  font-weight: 600;
}

/* Wide tables scroll inside their card, so the page itself doesn't. */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  padding: 7px 8px;
  border-bottom: 1px solid #e4e7eb;
  text-align: left;
}

th {
  color: #52606d;
  font-weight: 600;
}

#preview-map {
  height: 420px;
  margin: 12px 0;
  border-radius: 8px;
}

/* Button styles below would otherwise make a hidden button show. */
[hidden] {
  display: none !important;
}

/* Overlap the map pictures slightly, so no thin gaps show between them. */
.leaflet-container img.leaflet-tile {
  width: 257px !important;
  height: 257px !important;
  mix-blend-mode: normal; /* Leaflet's blend would brighten the overlap */
}

/* The Alerts page. */
.alerts-page {
  max-width: 760px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.section-head h1 {
  margin: 0;
}

.alerts-list,
.reminders-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.alert,
.reminder {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
}

.alert.unread {
  border-left: 4px solid #d32f2f;
  background: #fdf6f6;
}

.alert-text {
  display: grid;
  flex: 1 1 260px;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.alert-meta {
  color: #52606d;
  font-size: 0.82rem;
}

.alert-actions {
  display: flex;
  gap: 6px;
}

.alert-actions button,
.reminder button {
  padding: 5px 10px;
  font-size: 0.85rem;
}

.reminder-form {
  margin-bottom: 14px;
}

.reminder-form .row label {
  flex: 1 1 180px;
}

input[type="datetime-local"],
input[type="time"],
textarea {
  box-sizing: border-box;
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: 1px solid #9aa5b1;
  border-radius: 6px;
  background: #ffffff;
  font: inherit;
  font-size: 16px;
}

.popup-setting {
  margin-bottom: 12px;
}

.admin-header .badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #d32f2f;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  text-decoration: none;
}

/* The station quiz. */
.quiz {
  max-width: 640px;
}

#quiz-map {
  height: 260px;
  margin-bottom: 12px;
  border-radius: 8px;
}

#quiz-map[hidden] {
  display: none;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quiz-options button {
  min-height: 48px;
}

.quiz-options button:disabled {
  cursor: default;
}

/* The ticks and crosses mean the colours aren't the only clue. */
.quiz-options button.right {
  border-color: #17602a;
  background: #e3f6e8;
  color: #17602a;
  font-weight: 700;
}

.quiz-options button.right::before {
  content: "✓ ";
}

.quiz-options button.wrong {
  border-color: #8a1c13;
  background: #fdecea;
  color: #8a1c13;
}

.quiz-options button.wrong::before {
  content: "✗ ";
}

.quiz-feedback {
  min-height: 1.4em;
  font-weight: 600;
}

.quiz-feedback.right {
  color: #17602a;
}

.quiz-feedback.wrong {
  color: #8a1c13;
}

/* On narrow screens: name on its own line, with its controls together below. */
@media (max-width: 700px) {
  .layer-name {
    flex: 1 1 100%;
  }

  .row {
    padding-bottom: 10px;
    border-bottom: 1px solid #e4e7eb;
  }

  .row form.compact {
    margin-left: auto;
  }

  .row form[method="get"],
  form.row {
    border: 0;
  }

  .sign-in {
    margin-top: 16px;
  }
}

/* ---------- Terms and Conditions ---------- */

.terms-summary {
  margin: 4px 0 10px;
  padding: 10px 12px;
  border-left: 4px solid #16324f;
  border-radius: 4px;
  background: #f0f4f8;
  font-size: 0.88rem;
}

.terms-summary p {
  margin: 4px 0 0;
}

label.agree-terms {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 14px;
}

label.agree-terms input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
}

.terms {
  max-width: 820px;
  margin: 16px auto;
}

.terms h1 {
  margin-top: 0;
}

.terms-text {
  line-height: 1.55;
}

.terms-text h2 {
  margin-top: 1.6em;
  font-size: 1.1rem;
}

.terms-text table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
}

.terms-text th,
.terms-text td {
  padding: 6px 10px;
  border: 1px solid #d9e2ec;
  text-align: left;
  vertical-align: top;
}

.terms-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #d9e2ec;
}

.notice {
  padding: 10px 12px;
  border-radius: 6px;
  background: #fff4d6;
}

textarea.terms-editor {
  min-height: 360px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.85rem;
}
