/*
 * The booking picker (components/booking.php), on the Contact page's "Book a call" tab and in the Bespoke plan
 * builder's booking step: the call's title, a week of days, the times that day, the visitor's details, and the notes
 * for a booking made, a time just taken, or booking being unavailable.
 *
 * The message form on the Contact page shares its fields, buttons and notices, so they're styled here together.
 * In the Bespoke builder (booking--plan) it sits in a narrow column; blocks/bespoke-builder's styles fit it there.
 */

/* Book a call: the title, the call's length, and "Live from our Teams calendar" */

.booking {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.booking__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.booking__title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.booking__title,
.contact-form__title {
  margin: 0;
  color: #0d3d39;
  font-family: inherit;
  font-size: 22px;
  font-weight: 700;
  text-transform: none;
}

.booking__meta {
  color: var(--text-muted);
  font-size: 14px;
}

.booking__live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--teal-light);
  color: var(--teal-darker);
  font-size: 13px;
}

.booking__loading,
.booking__noscript {
  margin: 0;
  color: var(--text-muted);
}

/* The days and times */

.booking__picker:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.booking__step {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.booking__step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.booking__label {
  font-size: 14px;
  font-weight: 600;
}

.booking__week-nav {
  display: flex;
  gap: 6px;
}

.booking__week {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: var(--teal-darker);
  cursor: pointer;
}

.booking__week:disabled {
  opacity: 0.4;
  cursor: default;
}

.booking__days {
  display: grid;
  grid-template-columns: repeat(var(--booking-days, 5), minmax(0, 1fr));
  gap: 8px;
}

.booking__day {
  min-height: 64px;
  padding: 10px 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.booking__day-name {
  display: block;
  font-size: 12px;
}

.booking__day-number {
  display: block;
  font-size: 22px;
  font-weight: 600;
}

.booking__day[aria-pressed="true"] {
  border-color: #0d3d39;
  background: #0d3d39;
  color: var(--white);
}

.booking__day:disabled {
  border-color: #e8ebe5;
  background: #e8ebe5;
  color: var(--text-muted);
  cursor: default;
}

.booking__times {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.booking__time {
  min-height: 44px;
  padding: 12px 8px;
  border: 1px solid var(--teal-dark);
  border-radius: 8px;
  background: var(--white);
  color: var(--teal-darker);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.booking__time[aria-pressed="true"] {
  border-color: var(--teal-darker);
  background: var(--teal-darker);
  color: var(--white);
  font-weight: 600;
}

.booking__time:disabled {
  border-color: #e8ebe5;
  background: #e8ebe5;
  color: var(--text-muted);
  text-decoration: line-through;
  cursor: default;
}

.booking__day:focus-visible,
.booking__time:focus-visible,
.booking__week:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

.booking__hint,
.booking__note {
  color: var(--text-muted);
  font-size: 13px;
}

/* The visitor's details, under a line once a time is chosen */

.booking__form:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 20px;
  border-top: 1px solid #e8ebe5;
}

.booking__form-title {
  color: #0d3d39;
  font-size: 15px;
  font-weight: 600;
}

/* Fields, shared by both forms: three to a row, as in the wireframe, and one to a row on phones */

.booking__fields,
.contact-form__fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/*
 * Book a call's five fields make two even rows: name, email and phone, then the company (two columns wide) and the
 * team size.
 */

.booking:not(.booking--plan) .booking__field--company {
  grid-column: span 2;
}

.booking__field,
.contact-form__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
}

.booking__field input,
.booking__field select,
.booking__field textarea,
.contact-form__field input,
.contact-form__field select,
.contact-form__field textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}

.booking__field textarea,
.contact-form__field textarea {
  resize: vertical;
}

.booking__field :is(input, select, textarea):focus,
.contact-form__field :is(input, select, textarea):focus {
  border-color: var(--teal-dark);
  outline: 3px solid rgba(21, 89, 82, 0.16);
  outline-offset: 1px;
}

/* The hidden spam fields: off screen, never shown to people */

.booking__trap,
.contact-form__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* The buttons */

.booking__confirm,
.contact-form__submit {
  align-self: flex-start;
  min-height: 48px;
  padding: 15px 24px;
  border: 0;
  border-radius: 8px;
  background: var(--teal-darker);
  color: var(--white);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.booking__confirm:hover,
.booking__confirm:focus-visible,
.contact-form__submit:hover,
.contact-form__submit:focus-visible {
  background: #0d3d39;
}

.booking__confirm:disabled,
.contact-form__submit:disabled {
  opacity: 0.7;
  cursor: progress;
}

/* Notes: booked, a time just taken, booking unavailable, and the message form's notices */

.booking__done:not([hidden]) {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  border-radius: 14px;
  background: #e7f5ed;
  color: #125d3a;
}

.booking__done svg {
  flex-shrink: 0;
}

.booking__done-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.booking__done-text span {
  color: var(--text);
  font-size: 14px;
}

.booking__error,
.contact-form__notice {
  margin: 0;
  padding: 14px 16px;
  border-radius: 8px;
  font-weight: 600;
}

.booking__error,
.contact-form__notice--error {
  border: 1px solid #d9a0a0;
  background: #fff0f0;
  color: #8a1e1e;
}

.booking__unavailable:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  border-radius: 14px;
  background: var(--teal-pale);
  color: var(--text);
}

/* Tablets and phones: four times to a row, and the fields one under another */

@media (max-width: 700px) {
  .booking__times {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .booking__fields,
  .contact-form__fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .booking:not(.booking--plan) .booking__field--company {
    grid-column: auto;
  }
}

/* Phones: the days stay in one row, a little tighter, with three times to a row */

@media (max-width: 480px) {
  .booking__days {
    gap: 6px;
  }

  .booking__day {
    min-height: 56px;
    padding: 8px 2px;
  }

  .booking__day-number {
    font-size: 19px;
  }

  .booking__times {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
