/* Shared date and time picker (assets/scripts/datetime-picker.js).
 * Colours are the site palette from tailwind.config.js: primary (blue), accent (amber), neutral.
 * Light theme by default; dark theme under html.dark, as the rest of the site. Fonts are inherited.
 */

.dtp {
  position: relative;
}

.dtp-input {
  cursor: pointer;
}

.dtp-pop {
  position: absolute;
  left: 0;
  top: calc(100% + 0.5rem);
  z-index: 40;
  width: 100%;
  max-width: 22rem;
  padding: 1rem;
  border-radius: 1rem;
  background: #ffffff;
  color: #313135;
  border: 2px solid #8fbce6;
  box-shadow: 0 20px 40px -12px rgba(18, 38, 61, 0.35);
  font-size: 0.9375rem;
  line-height: 1.25;
}

.dark .dtp-pop {
  background: #313135;
  color: #ffffff;
  border-color: #3d7bbe;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.6);
}

.dtp-pop button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 0.5rem;
  cursor: pointer;
}

.dtp-pop button:focus-visible {
  outline: 2px solid #f2b040;
  outline-offset: 1px;
}

.dtp-pop button:disabled {
  cursor: default;
  opacity: 0.35;
}

.dtp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.dtp-title {
  font-weight: 700;
}

.dtp-nav {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.5rem;
  line-height: 1;
}

.dtp-nav:not(:disabled):hover {
  background: #dcebf9;
}

.dark .dtp-nav:not(:disabled):hover {
  background: #26568b;
}

.dtp-dow,
.dtp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.125rem;
  text-align: center;
}

.dtp-dow span {
  font-size: 0.75rem;
  font-weight: 700;
  color: #76767f;
  padding: 0.25rem 0;
}

.dark .dtp-dow span {
  color: #bbbbbf;
}

.dtp-day {
  height: 2.25rem;
  border-radius: 9999px;
}

.dtp-day:not(:disabled):hover {
  background: #dcebf9;
}

.dark .dtp-day:not(:disabled):hover {
  background: #26568b;
}

.dtp-day.is-today {
  box-shadow: inset 0 0 0 2px #f2b040;
}

.dtp-day.is-selected,
.dtp-time.is-selected {
  background: #2f68a8;
  color: #ffffff;
  font-weight: 700;
}

.dtp-day.is-selected:hover,
.dtp-time.is-selected:hover {
  background: #26568b;
}

.dtp-label {
  margin: 0.75rem 0 0.375rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #76767f;
}

.dark .dtp-label {
  color: #bbbbbf;
}

.dtp-times {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.375rem;
  max-height: 10.5rem;
  overflow-y: auto;
  padding: 2px;
}

.dtp-time {
  padding: 0.5rem 0.25rem;
  background: #efeff0;
  font-variant-numeric: tabular-nums;
}

.dark .dtp-time {
  background: #45454a;
}

.dtp-time:not(:disabled):not(.is-selected):hover {
  background: #dcebf9;
}

.dark .dtp-time:not(:disabled):not(.is-selected):hover {
  background: #26568b;
}

.dtp-time-any {
  grid-column: 1 / -1;
}

.dtp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
}

.dtp-link {
  padding: 0.5rem 0.75rem;
  color: #2f68a8;
  font-weight: 600;
}

.dark .dtp-link {
  color: #8fbce6;
}

.dtp-link[hidden] {
  display: none;
}

.dtp-done {
  margin-left: auto;
  padding: 0.5rem 1.25rem;
  background: #2f68a8;
  color: #ffffff;
  font-weight: 700;
}

.dtp-done:hover {
  background: #26568b;
}

@media (max-width: 420px) {
  .dtp-pop {
    max-width: none;
  }

  .dtp-times {
    grid-template-columns: repeat(3, 1fr);
  }
}
