/* The admin page, on top of ../style.css for colours, fonts and buttons. */

.admin-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 1rem var(--inline);
  border-bottom: 2px solid var(--paper-deep);
}

.admin-home {
  font-family: var(--display);
  font-weight: 700;
  text-decoration: none;
}

.admin-who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.admin {
  display: grid;
  gap: 1.5rem;
  padding: 2rem var(--inline) 4rem;
}

.admin h1 {
  font-size: clamp(2rem, 6vw, 3rem);
}

.admin h2 {
  font-size: 1.5rem;
}

#admin-content {
  display: grid;
  gap: 1.5rem;
}

.admin-card {
  display: grid;
  gap: 1rem;
  min-width: 0;
  padding: clamp(1.25rem, 4vw, 1.75rem);
  border-radius: var(--radius);
  background: var(--paper-deep);
}

.admin-card > p,
.admin-card h2 {
  margin: 0;
}

.admin-card > .button {
  justify-self: start;
}

.admin-hint {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.admin-error {
  margin: 0;
  color: var(--error);
  font-weight: 600;
}

.admin-error:empty {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.admin input,
.admin select {
  min-width: 0;
  padding: 0.65rem 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 0.75rem;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

.admin input:focus-visible,
.admin select:focus-visible,
.admin .button:focus-visible,
.admin .text-button:focus-visible {
  outline: 3px solid var(--sea);
  outline-offset: 2px;
}

.bike-codes-title {
  margin: 1.5rem 0 0.25rem;
  font-size: 1rem;
}

.bike-codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 1rem;
}

.bike-code {
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  padding: 0.9rem;
  border: 2px solid var(--ink, currentColor);
  border-radius: 0.8rem;
  text-align: center;
  break-inside: avoid;
}

.bike-code img,
.bike-code svg {
  width: 100%;
  max-width: 9rem;
  height: auto;
  background: #fff;
  border-radius: 0.4rem;
}

.bike-code b {
  font-size: 0.95rem;
}

.bike-code span {
  font-size: 0.7rem;
  opacity: 0.7;
  overflow-wrap: anywhere;
}

/* Printing the page is how the codes get onto the bikes. */
@media print {
  .admin-header,
  .admin-card:not(.admin-card-bikes),
  .bike-form,
  .allow-list,
  .admin-hint,
  .bike-codes-title {
    display: none !important;
  }

  .bike-codes {
    grid-template-columns: repeat(2, 1fr);
  }
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.9rem;
}

.photo-card {
  display: grid;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
}

.photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0.6rem;
  background: rgba(0, 0, 0, 0.06);
}

.photo-card span {
  font-size: 0.78rem;
  line-height: 1.35;
  opacity: 0.75;
}

.photo-card b {
  font-size: 0.8rem;
  opacity: 1;
}

.booking-state-tag {
  font-weight: 700;
}

.booking-state-tag[data-state='riding'] {
  color: var(--available);
}

.booking-state-tag[data-state='lapsed'] {
  opacity: 0.6;
}

.log-where {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.bike-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 0.75rem;
}

.bike-form label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.bike-form input {
  padding: 0.5rem 0.6rem;
  border: 2px solid var(--ink);
  border-radius: 0.5rem;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.allow-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.allow-form input {
  flex: 1 1 16rem;
}

.allow-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.allow-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: var(--paper);
}

.allow-entry {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.allow-meta {
  flex: 1 1 12rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.log-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
}

.log-filters label {
  display: grid;
  flex: 1 1 10rem;
  gap: 0.25rem;
  font-size: 0.9rem;
  font-weight: 600;
}

/* The table scrolls sideways inside the card on narrow screens, not the page. */
.log-scroll {
  overflow-x: auto;
  border-radius: 0.75rem;
  background: var(--paper);
}

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

.log th,
.log td {
  padding: 0.55rem 0.8rem;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.log th {
  position: sticky;
  top: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font-weight: 600;
  border-bottom: 2px solid var(--paper-deep);
}

.log tbody tr + tr td {
  border-top: 1px solid var(--paper-deep);
}

.log-type {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--sea-light);
  color: var(--sea);
  font-weight: 700;
}

.log-type[data-tone='bad'] {
  background: #f6dcda;
  color: var(--error);
}

.log-type[data-tone='good'] {
  background: #d8efdf;
  color: #1d6b3c;
}

.log-from {
  color: var(--ink-soft);
}

.log .text-button {
  text-align: left;
  overflow-wrap: anywhere;
}

.log-session {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* On phones each event is a small card with labelled lines instead of a table row. */
@media (max-width: 40rem) {
  .log thead {
    display: none;
  }

  .log tr {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    gap: 0.3rem 0.75rem;
    padding: 0.8rem 1rem;
  }

  .log tbody tr + tr {
    border-top: 1px solid var(--paper-deep);
  }

  .log td,
  .log tbody tr + tr td {
    display: contents;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .log td::before {
    content: attr(data-label);
    color: var(--ink-soft);
    font-size: 0.85rem;
  }

  .log td:empty {
    display: none;
  }

  .log-type,
  .log .text-button {
    justify-self: start;
  }
}

#log-more {
  justify-self: start;
}
