/**
 * Book demo — small pill left of the assistant FAB + .project-modal content.
 */

.book-demo-fab {
  position: fixed;
  /* Centered on the 48px assistant FAB */
  bottom: calc(var(--space-3) + 4px);
  right: calc(var(--space-3) + 48px + var(--space-2));
  z-index: 1100; /* under modals (1200) */
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-4) 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-family-base);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition-fast), opacity var(--transition-fast), border-color var(--transition-fast);
}

.book-demo-fab svg {
  color: var(--color-primary);
  flex-shrink: 0;
}

.book-demo-fab:hover,
.book-demo-fab:focus-visible {
  border-color: var(--color-primary);
}

.book-demo-fab:active {
  transform: scale(0.97);
}

.book-demo-fab:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Out of the way while the chat is open or the assistant is hidden for a modal */
body:has(#assistant-widget-root.assistant-widget--open) .book-demo-fab,
html[data-assistant-open="true"] .book-demo-fab {
  opacity: 0;
  pointer-events: none;
}

/* The assistant FAB sits at z 12100, above modals; keep it off our dialog */
body:has(#book-demo-modal:not([hidden])) #assistant-widget-root {
  display: none !important;
}

@media (max-width: 767px) {
  .book-demo-fab {
    bottom: calc(var(--space-3) + 4px + env(safe-area-inset-bottom, 0px));
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .book-demo-fab__label {
    display: none;
  }
}

@media print {
  .book-demo-fab {
    display: none;
  }
}

/* Modal laid out like a booking page: info | month calendar | times */
.book-demo-modal__dialog {
  width: min(800px, calc(100vw - var(--space-8)));
  max-width: 100%;
}

.book-demo-modal__body {
  display: grid;
  grid-template-columns: minmax(0, 250px) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  padding: 0;
}

.book-demo-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-4);
  border-right: 1px solid var(--color-border);
}

.book-demo-host__avatar {
  position: relative;
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-1);
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
  color: var(--color-primary);
  font-weight: 600;
}

.book-demo-host__avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-demo-info__host {
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
}

.book-demo-info__headline {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
}

.book-demo-facts {
  list-style: none;
  margin: var(--space-2) 0 var(--space-3);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.book-demo-facts li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.book-demo-facts li svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.book-demo-facts li[data-role="when"] {
  color: var(--color-primary);
}

/* Nested well: contrast from fill, no hairline */
.book-demo-topics {
  align-self: stretch;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--color-grouped-nested);
}

.book-demo-topics__title {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
}

.book-demo-topics ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.book-demo-topics li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  line-height: 1.35;
  color: var(--color-text);
}

.book-demo-topics__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-primary);
}

.book-demo-step {
  padding: var(--space-4);
  min-height: 420px;
}

.book-demo-step[hidden] {
  display: none;
}

.book-demo-step__title {
  margin: 0 0 var(--space-4);
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--color-text);
}

.book-demo-step--pick {
  display: grid;
  /* Calendar and times sit side by side at their own width, no stretched gap */
  grid-template-columns: max-content max-content;
  justify-content: start;
  gap: var(--space-6);
}

/* Month calendar */
.book-demo-cal__nav {
  /* Same width as the 7 x 40px grid so the month sits centred over the days */
  width: calc(7 * 40px + 6 * var(--space-1));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

.book-demo-cal__month {
  min-width: 130px;
  text-align: center;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
}

.book-demo-cal__nav .icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.book-demo-cal__grid {
  display: grid;
  /* Fixed cells keep the day circles close together instead of spreading to the column width */
  grid-template-columns: repeat(7, 40px);
  justify-content: start;
  gap: var(--space-1);
  justify-items: center;
}

.book-demo-cal__weekday {
  padding-bottom: var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
}

.book-demo-cal__day {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-tertiary);
  font-family: var(--font-family-base);
  font-size: var(--font-size-sm);
  cursor: default;
}

.book-demo-cal__day.is-open {
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.book-demo-cal__day.is-open:hover {
  background: color-mix(in srgb, var(--color-primary) 18%, var(--color-surface));
}

.book-demo-cal__day.is-selected,
.book-demo-cal__day.is-selected:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

.book-demo-cal__day:focus-visible,
.book-demo-slot:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.book-demo-cal__status:empty {
  display: none;
}

.book-demo-cal__status {
  margin: var(--space-3) 0 0;
  text-align: center;
}

.book-demo-cal__tz {
  margin: var(--space-4) 0 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

/* Times of the picked day */
.book-demo-slots {
  width: 156px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.book-demo-slots[hidden] {
  display: none;
}

.book-demo-slots__day {
  margin: calc(var(--space-4) + var(--space-4)) 0 var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
}

.book-demo-slots__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 360px;
  overflow-y: auto;
  overflow-x: clip;
  padding-right: 2px;
}

.book-demo-slot {
  width: 100%;
  min-height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
  color: var(--color-primary);
  font-family: var(--font-family-base);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.book-demo-slot:hover {
  background: color-mix(in srgb, var(--color-primary) 18%, var(--color-surface));
}

.book-demo-slot-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.book-demo-slot.is-selected {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-text-secondary);
  color: var(--color-text-inverse);
  cursor: default;
}

.book-demo-slot__next {
  min-height: 40px;
  padding-inline: var(--space-2);
}

/* Details + done */
.book-demo-step[data-step="details"] {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 460px;
}

.book-demo-step[data-step="details"] .book-demo-step__title {
  margin-bottom: 0;
}

.book-demo-step .form-group {
  margin: 0;
}

.book-demo-step textarea.form-input {
  resize: vertical;
  min-height: 96px;
}

.book-demo-error {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-danger);
}

.book-demo-error[hidden] {
  display: none;
}

.book-demo-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-2);
}

.book-demo-done .book-demo-step__title {
  margin: 0;
}

.book-demo-done .setting-info {
  max-width: 360px;
  margin: 0 0 var(--space-2);
  text-align: center;
}

.book-demo-done__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-2);
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-positive) 14%, var(--color-surface));
  color: var(--color-positive);
}

.book-demo-booked__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.book-demo-booked__actions[hidden] {
  display: none;
}

.book-demo-booked__actions .setting-info {
  margin: 0;
}

.book-demo-booked__row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.book-demo-link {
  padding: var(--space-1) var(--space-2);
  border: none;
  background: none;
  color: var(--color-text-secondary);
  font-family: var(--font-family-base);
  font-size: var(--font-size-sm);
  text-decoration: underline;
  cursor: pointer;
}

.book-demo-link:hover {
  color: var(--color-danger);
}

.book-demo-done__icon--neutral {
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
  color: var(--color-primary);
}

.book-demo-done .btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

@media (max-width: 767px) {
  .book-demo-modal__dialog {
    width: 100%;
  }

  .book-demo-modal__body {
    grid-template-columns: minmax(0, 1fr);
  }

  .book-demo-info {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-2) var(--space-5) var(--space-4);
  }

  .book-demo-host__avatar {
    width: 56px;
    height: 56px;
  }

  .book-demo-topics {
    display: none;
  }

  .book-demo-step {
    min-height: 0;
    padding: var(--space-4) var(--space-5);
  }

  .book-demo-step--pick {
    grid-template-columns: minmax(0, 1fr);
  }

  .book-demo-cal__day {
    width: 40px;
    height: 40px;
  }

  .book-demo-slots {
    width: 100%;
  }

  .book-demo-slots__day {
    margin-top: 0;
  }

  .book-demo-slots__list {
    max-height: none;
  }
}

/* Guest mode (byggvekst.no/app): the site has no shared .project-modal shell, so
   the same chrome is drawn here from the design tokens. */
.book-demo-modal--guest {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  font-family: var(--font-family-base);
}

.book-demo-modal--guest[hidden] {
  display: none;
}

.book-demo-modal--guest .project-modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 28, 30, 0.55);
}

.book-demo-modal--guest .project-modal__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - var(--space-8));
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  overflow: hidden;
}

.book-demo-modal--guest .project-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--modal-header-padding-top, 12px) var(--modal-header-padding-x, 20px) var(--modal-header-padding-bottom, 8px);
  border-bottom: 1px solid var(--color-border);
}

.book-demo-modal--guest .project-modal__header h2 {
  margin: 0;
  font-size: var(--font-size-md);
  font-weight: 600;
}

.book-demo-modal--guest .project-modal__body {
  overflow-y: auto;
  overflow-x: clip;
}

.book-demo-modal--guest .project-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border);
}

.book-demo-modal--guest .project-modal__footer[hidden] {
  display: none;
}

.book-demo-modal--guest .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.book-demo-modal--guest .icon-btn:hover {
  background: var(--color-grouped-nested);
}

.book-demo-modal--guest .form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.book-demo-modal--guest .form-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
}

.book-demo-modal--guest .setting-info {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

@media (max-width: 767px) {
  .book-demo-modal--guest {
    align-items: flex-end;
    padding: 0;
  }

  .book-demo-modal--guest .project-modal__dialog {
    width: 100%;
    max-height: calc(100dvh * 0.9);
    border-radius: var(--radius-sheet, 16px) var(--radius-sheet, 16px) 0 0;
    border-bottom: none;
  }

  .book-demo-modal--guest .project-modal__footer {
    flex-direction: column-reverse;
  }

  .book-demo-modal--guest .project-modal__footer .btn {
    width: 100%;
  }
}
