/* Booking widget — pixel copy of the Cal.com dark month_view embed.
   Tokens lifted from the live widget (see SPEC.md). */

.ct-book-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg: #0f0f0f;
  --bg-muted: #171717;
  --bg-subtle: #262626;
  --bg-emphasis: #404040;
  --border: #4d4d4d;
  --border-subtle: #262626;
  --text: #d4d4d4;
  --text-emphasis: #fafafa;
  --text-subtle: #a3a3a3;
  --brand: #fafafa;
  --brand-text: #000000;
}

/* shield the widget from host-site element styles (h1, p, button fonts) */
.ct-book-overlay h1, .ct-book-overlay h2, .ct-book-overlay h3,
.ct-book-overlay p, .ct-book-overlay span, .ct-book-overlay div,
.ct-book-overlay button, .ct-book-overlay input, .ct-book-overlay textarea,
.ct-book-overlay a, .ct-book-overlay label, .ct-book-overlay dl,
.ct-book-overlay dt, .ct-book-overlay dd {
  font-family: inherit;
  letter-spacing: normal;
  text-transform: none;
  line-height: 1.4;
}

/* step transition */
@keyframes ctbFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.ct-book-fade { animation: ctbFade 0.18s ease; }

/* skeleton shimmer while loading */
@keyframes ctbShimmer {
  0%   { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}
.ct-book-skeleton {
  border-color: var(--border-subtle) !important;
  height: 36px;
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-subtle) 50%, var(--bg-muted) 75%);
  background-size: 400px 100%;
  animation: ctbShimmer 1.2s linear infinite;
  pointer-events: none;
}

/* timezone dropdown styled like cal.com's inline selector */
.ct-book-tzrow { min-width: 0; }
.ct-book-tzsel {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  max-width: 190px;
  cursor: pointer;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}
.ct-book-tzsel:hover { color: var(--text-emphasis); }
.ct-book-tzsel option { background: var(--bg-muted); color: var(--text-emphasis); }

/* reschedule extras */
.ct-book-current {
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-emphasis);
  margin-bottom: 16px;
}
.ct-book-current span {
  display: block;
  color: var(--text-subtle);
  font-size: 12px;
  margin-bottom: 2px;
}
.ct-book-resch-note { font-size: 14px; color: var(--text); margin: 4px 0 16px; }

/* add-guests link button */
.ct-book-guests-btn {
  background: none;
  border: none;
  color: var(--text-emphasis);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  padding: 0;
  margin: 2px 0 16px;
  cursor: pointer;
  text-align: left;
}
.ct-book-guests-btn:hover { color: #fff; text-decoration: underline; }

/* add-to-calendar icon row (success step) */
.ct-book-addcal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
  font-size: 14px;
  color: var(--text);
}
.ct-book-cal-ic {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-emphasis);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}
.ct-book-cal-ic:hover { border-color: var(--text-emphasis); }

.ct-book-close {
  position: absolute;
  top: 16px;
  right: 24px;
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 8px;
}

.ct-book-card {
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text);
  display: flex;
  max-width: 1040px;
  width: 100%;
  height: 490px;
  max-height: 90vh;
}

/* ---------- left column: event info ---------- */
.ct-book-info {
  width: 280px;
  min-width: 280px;
  padding: 24px;
  border-right: 1px solid var(--border-subtle);
  box-sizing: border-box;
}
.ct-book-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-bottom: 8px;
}
.ct-book-host {
  color: var(--text-subtle);
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 4px;
}
.ct-book-title {
  color: var(--text-emphasis);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 12px;
}
.ct-book-desc {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 20px;
}
.ct-book-desc p { margin: 0 0 14px; }
.ct-book-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 12px;
}
.ct-book-meta svg { width: 16px; height: 16px; flex: none; opacity: 0.85; }
.ct-book-selected-when {
  display: flex;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-emphasis);
  margin-bottom: 12px;
  line-height: 1.35;
}

/* ---------- center column: calendar ---------- */
.ct-book-cal {
  flex: 1;
  padding: 24px;
  box-sizing: border-box;
  min-width: 380px;
  overflow-y: auto;
}
.ct-book-info { overflow-y: auto; }
.ct-book-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.ct-book-cal-month {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-emphasis);
}
.ct-book-cal-month span { color: var(--text-subtle); font-weight: 500; }
.ct-book-cal-nav { display: flex; gap: 4px; }
.ct-book-cal-nav button {
  background: none;
  border: none;
  color: var(--text-subtle);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}
.ct-book-cal-nav button:hover:not(:disabled) { background: var(--bg-subtle); color: var(--text-emphasis); }
.ct-book-cal-nav button:disabled { opacity: 0.35; cursor: default; }

.ct-book-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.ct-book-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
  padding: 6px 0 10px;
}
.ct-book-day {
  position: relative;
  aspect-ratio: 1;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-subtle);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ct-book-day.avail {
  background: var(--bg-subtle);
  color: var(--text-emphasis);
  font-weight: 700;
  cursor: pointer;
}
.ct-book-day.avail:hover { background: var(--bg-emphasis); }
.ct-book-day.sel {
  background: var(--brand);
  color: var(--brand-text);
}
.ct-book-day.today::after {
  content: "";
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.ct-book-day .ct-book-mtag {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-emphasis);
  color: var(--text);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-radius: 4px;
  padding: 1px 4px;
}

/* ---------- right column: slots ---------- */
.ct-book-slots {
  width: 260px;
  min-width: 260px;
  padding: 24px 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
.ct-book-slots-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.ct-book-slots-day {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-emphasis);
}
.ct-book-slots-day span { color: var(--text-subtle); font-weight: 500; font-size: 14px; }
.ct-book-fmt {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 2px;
}
.ct-book-fmt button {
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-subtle);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  padding: 3px 8px;
  cursor: pointer;
}
.ct-book-fmt button.on {
  background: var(--bg-emphasis);
  color: var(--text-emphasis);
  border: 1px solid var(--border);
}
.ct-book-slot-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}
.ct-book-slot {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 10px;
  color: var(--text-emphasis);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  padding: 9px 0;
  text-align: center;
  cursor: pointer;
  flex: none;
}
.ct-book-slot:hover { border-color: var(--text-emphasis); }

/* ---------- form step ---------- */
.ct-book-form {
  flex: 1;
  padding: 24px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
.ct-book-form label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-emphasis);
  margin: 0 0 6px;
  display: block;
}
.ct-book-form input,
.ct-book-form textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-emphasis);
  font-size: 14px;
  font-family: inherit;
  padding: 6px 10px;
  margin-bottom: 16px;
}
.ct-book-form input { height: 32px; }
.ct-book-form textarea { min-height: 64px; resize: vertical; }
.ct-book-form ::placeholder { color: var(--text-subtle); }
.ct-book-legal {
  font-size: 12px;
  color: var(--text-subtle);
  margin: 4px 0 20px;
}
.ct-book-actions {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
}
.ct-book-back {
  background: none;
  border: none;
  color: var(--text-emphasis);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.ct-book-confirm {
  background: var(--brand);
  color: var(--brand-text);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  padding: 8px 10px;
  cursor: pointer;
}
.ct-book-confirm:disabled { opacity: 0.6; cursor: default; }
.ct-book-error {
  color: #f87171;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ---------- success step ---------- */
.ct-book-success {
  flex: 1;
  padding: 40px 32px;
  box-sizing: border-box;
  text-align: center;
}
.ct-book-check {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: #34d399;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}
.ct-book-success h3 {
  color: var(--text-emphasis);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
}
.ct-book-success .sub { color: var(--text-subtle); font-size: 14px; margin: 0 0 28px; }
.ct-book-facts {
  text-align: left;
  border-top: 1px solid var(--border-subtle);
  padding-top: 20px;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px 12px;
  font-size: 14px;
}
.ct-book-facts dt { color: var(--text-emphasis); font-weight: 500; }
.ct-book-facts dd { margin: 0; color: var(--text); line-height: 1.45; }

/* ---------- loading ---------- */
.ct-book-loading {
  padding: 60px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 14px;
  width: 100%;
}

/* ---------- mobile ---------- */
@media (max-width: 820px) {
  .ct-book-overlay { padding: 0; align-items: stretch; }
  .ct-book-card {
    flex-direction: column;
    height: auto;
    max-height: none;
    border-radius: 0;
    border: none;
  }
  .ct-book-info, .ct-book-cal { overflow-y: visible; }
  .ct-book-info,
  .ct-book-cal,
  .ct-book-slots {
    width: auto;
    min-width: 0;
    border-right: none;
  }
  .ct-book-info { border-bottom: 1px solid var(--border-subtle); }
  .ct-book-slot-list { overflow: visible; }
}
