/* ============================================================
   PCPI Calendar – Frontend Widget
   Layout: left info panel + right calendar/slots/form
   Design reference: TidyCal-style two-column booking widget
   ============================================================ */

:root {
  --pcpi-accent:        #1a56db;   /* overridden per-booking-type via inline style */
  --pcpi-accent-light:  #ebf5ff;
  --pcpi-accent-hover:  #1e429f;
  --pcpi-text:          #111928;
  --pcpi-muted:         #6b7280;
  --pcpi-border:        #e5e7eb;
  --pcpi-bg:            #ffffff;
  --pcpi-surface:       #f9fafb;
  --pcpi-radius:        8px;
  --pcpi-shadow:        0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --pcpi-font:          -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---- Outer wrapper ---- */
.pcpi-booking-widget {
  font-family: var(--pcpi-font);
  font-size: 15px;
  color: var(--pcpi-text);
  line-height: 1.5;
  max-width: 860px;
  margin: 0 auto;
  background: var(--pcpi-bg);
  border: 1px solid var(--pcpi-border);
  border-radius: var(--pcpi-radius);
  box-shadow: var(--pcpi-shadow);
  overflow: hidden;
}

/* ---- Two-column inner layout ---- */
.pcpi-widget-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 540px;
}

/* ---- LEFT PANEL ---- */
.pcpi-panel-left {
  border-right: 1px solid var(--pcpi-border);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--pcpi-bg);
}

.pcpi-host-logo {
  max-height: 48px;
  max-width: 160px;
  object-fit: contain;
  margin-bottom: 16px;
  display: block;
}

.pcpi-bt-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--pcpi-text);
  margin: 0 0 12px;
  line-height: 1.3;
}

.pcpi-bt-meta {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}

.pcpi-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--pcpi-muted);
}

.pcpi-meta-row svg,
.pcpi-meta-icon {
  flex-shrink: 0;
  opacity: .7;
}

.pcpi-bt-desc {
  font-size: 13px;
  color: var(--pcpi-muted);
  line-height: 1.55;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--pcpi-border);
}

.pcpi-bt-desc p {
  margin: 0 0 12px;
}

.pcpi-bt-desc p:last-child {
  margin-bottom: 0;
}

/* Divider */
.pcpi-divider {
  height: 1px;
  background: var(--pcpi-border);
  margin: 16px 0;
}

/* Approval badge */
.pcpi-approval-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #c2410c;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 8px;
  margin-bottom: 14px;
}

/* Timezone selector — now rendered under the calendar grid (see
   calendarSlotHtml() in frontend.js) rather than pinned to the bottom of
   the left panel, so it no longer needs margin-top:auto to push itself
   down a flex column; it just follows the grid in normal flow. */
.pcpi-tz-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--pcpi-muted);
  margin-top: 14px;
}

.pcpi-tz-icon {
  flex-shrink: 0;
  line-height: 1;
}

.pcpi-tz-row label {
  flex-shrink: 0;
  font-weight: 500;
  white-space: nowrap;
}

.pcpi-tz-row select {
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid var(--pcpi-border);
  border-radius: 4px;
  background: var(--pcpi-bg);
  color: var(--pcpi-text);
  flex: 1;
  min-width: 0;
}

/* ---- RIGHT PANEL ---- */
.pcpi-panel-right {
  padding: 28px 28px 28px;
  display: flex;
  flex-direction: column;
  min-height: 540px;
}

/* ---- CALENDAR ---- */
.pcpi-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.pcpi-month-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--pcpi-text);
}

.pcpi-cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: none;
  border: 1px solid var(--pcpi-border);
  cursor: pointer;
  font-size: 1rem;
  color: var(--pcpi-muted);
  transition: background .12s, color .12s;
}

.pcpi-cal-nav:hover {
  background: var(--pcpi-surface);
  color: var(--pcpi-text);
}

.pcpi-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.pcpi-cal-dow {
  font-size: 11px;
  font-weight: 600;
  color: var(--pcpi-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 4px 0 8px;
}

.pcpi-cal-day {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: none;
  background: none;
  border-radius: 50%;
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, color .12s;
  position: relative;
  color: var(--pcpi-text);
}

.pcpi-cal-day:not(:disabled):not(.pcpi-day-unavail):hover {
  background: var(--pcpi-accent);
  color: #fff;
}

.pcpi-cal-day.pcpi-day-avail {
  font-weight: 600;
  color: var(--pcpi-text);
}

.pcpi-cal-day.pcpi-day-today {
  border: 2px solid var(--pcpi-accent);
  color: var(--pcpi-accent);
  font-weight: 700;
}

.pcpi-cal-day.pcpi-day-selected {
  background: var(--pcpi-accent) !important;
  color: #fff !important;
  font-weight: 700;
}

.pcpi-cal-day.pcpi-day-unavail,
.pcpi-cal-day:disabled {
  color: #d1d5db;
  cursor: default;
}

/* ---- SLOT COLUMN ---- */
.pcpi-slot-column-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--pcpi-text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--pcpi-border);
}

.pcpi-slots-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 400px;
  padding-right: 4px;
}

.pcpi-slot-btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: 1.5px solid var(--pcpi-border);
  border-radius: 6px;
  background: var(--pcpi-bg);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
  color: var(--pcpi-text);
}

.pcpi-slot-btn:hover {
  border-color: var(--pcpi-accent);
  color: var(--pcpi-accent);
  background: var(--pcpi-accent-light);
}

.pcpi-slot-btn.pcpi-slot-selected {
  background: var(--pcpi-accent);
  border-color: var(--pcpi-accent);
  color: #fff;
}

.pcpi-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--pcpi-accent-light);
  color: var(--pcpi-accent);
  vertical-align: middle;
}

.pcpi-slot-btn.pcpi-slot-selected .pcpi-pill {
  background: rgba(255,255,255,.25);
  color: #fff;
}

/* ---- TWO-PANE: calendar left + slots right ---- */
.pcpi-cal-slots-layout {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 24px;
  flex: 1;
}

/* ---- BOOKING FORM ---- */
.pcpi-form-wrap {
  flex: 1;
}

.pcpi-form-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--pcpi-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 16px;
}
.pcpi-form-back:hover { color: var(--pcpi-text); }

.pcpi-form-selected-slot {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--pcpi-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pcpi-booking-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Honeypot field (see frontend.js and pcpi_booking_looks_like_spam() in
   functions.php) — hidden via off-screen absolute positioning rather than
   display:none or visibility:hidden. Both of those are common enough
   honeypot techniques that some bots specifically check computed style
   and skip filling in fields hidden that way; an off-screen position is
   harder for a bot to distinguish from a normal field without actually
   rendering the page. */
.pcpi-hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.pcpi-field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pcpi-field-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--pcpi-text);
}

.pcpi-field-group input,
.pcpi-field-group textarea,
.pcpi-field-group select {
  border: 1.5px solid var(--pcpi-border);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: var(--pcpi-font);
  color: var(--pcpi-text);
  background: var(--pcpi-bg);
  width: 100%;
  box-sizing: border-box;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}

.pcpi-field-group input:focus,
.pcpi-field-group textarea:focus,
.pcpi-field-group select:focus {
  border-color: var(--pcpi-accent);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

.pcpi-field-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Submit button */
.pcpi-submit-btn {
  width: 100%;
  padding: 12px 20px;
  background: var(--pcpi-accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--pcpi-font);
  cursor: pointer;
  transition: background .12s, opacity .12s;
  margin-top: 4px;
}

.pcpi-submit-btn:hover:not(:disabled) {
  background: var(--pcpi-accent-hover);
}

.pcpi-submit-btn:disabled {
  opacity: .65;
  cursor: default;
}

/* ---- CONFIRMATION ---- */
.pcpi-confirmation {
  text-align: center;
  padding: 48px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Not justify-content: center — this box's height comes from
     matching the left panel's height (CSS Grid row stretch), which
     grows with the booking type's description length. Centering
     vertically here means a long description pushes "Booking
     Confirmed!" arbitrarily far down instead of keeping it near the
     top where a guest actually looks first. */
  justify-content: flex-start;
}

.pcpi-confirm-icon {
  width: 64px;
  height: 64px;
  background: #d1fae5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 20px;
}

.pcpi-confirm-icon.pcpi-pending { background: #fef3c7; }

.pcpi-confirmation h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 8px;
}

.pcpi-confirmation p {
  color: var(--pcpi-muted);
  font-size: 14px;
  margin: 0 0 8px;
  max-width: 360px;
}

.pcpi-confirm-time {
  color: var(--pcpi-text);
  font-size: 16px;
  margin: 4px 0 12px;
}

.pcpi-confirm-detail-box {
  background: var(--pcpi-surface);
  border: 1px solid var(--pcpi-border);
  border-radius: 8px;
  padding: 14px 20px;
  margin: 16px 0;
  text-align: left;
  width: 100%;
  max-width: 360px;
  font-size: 13px;
}

.pcpi-confirm-detail-row {
  display: flex;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--pcpi-border);
}
.pcpi-confirm-detail-row:last-child { border-bottom: none; }
.pcpi-confirm-label { color: var(--pcpi-muted); width: 80px; flex-shrink: 0; }
.pcpi-confirm-value { font-weight: 500; }

.pcpi-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.pcpi-confirm-calendar {
  margin: 12px 0 8px;
  text-align: center;
}
.pcpi-confirm-calendar-title {
  display: block;
  font-size: 12px;
  color: var(--pcpi-muted);
  margin-bottom: 8px;
}
.pcpi-confirm-calendar-icons {
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
}
.pcpi-confirm-calendar-icons a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--pcpi-muted);
  text-decoration: none;
}
.pcpi-confirm-calendar-icons a svg {
  width: 34px;
  height: 34px;
  transition: transform 0.12s ease;
}
.pcpi-confirm-calendar-icons a:hover {
  color: var(--pcpi-text);
}
.pcpi-confirm-calendar-icons a:hover svg {
  transform: scale(1.1);
}

.pcpi-confirm-link {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  color: var(--pcpi-accent);
  text-decoration: none;
  cursor: pointer;
  background: var(--pcpi-bg);
  border: 2px solid var(--pcpi-accent);
  border-radius: var(--pcpi-radius);
  padding: 10px 24px;
}
.pcpi-confirm-link:hover {
  color: var(--pcpi-accent);
  background: var(--pcpi-accent-light);
  border-color: var(--pcpi-accent);
}

/* ---- LOADING ---- */
.pcpi-loading-area {
  display: flex;
  align-items: center;
  /* Not justify-content: center — same reasoning as .pcpi-confirmation
     and .pcpi-select-date-prompt above: this sits in the same column
     that stretches to match the left panel's height, so centering
     vertically would show the spinner far down the page during a long
     description rather than near the calendar it's replacing. */
  justify-content: flex-start;
  padding: 40px;
  color: var(--pcpi-muted);
  gap: 10px;
  flex: 1;
}

.pcpi-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--pcpi-border);
  border-top-color: var(--pcpi-accent);
  border-radius: 50%;
  animation: pcpi-spin .65s linear infinite;
  flex-shrink: 0;
}

@keyframes pcpi-spin { to { transform: rotate(360deg); } }

/* ---- NO SLOTS ---- */
.pcpi-no-slots-msg {
  color: var(--pcpi-muted);
  font-size: 13px;
  padding: 16px 0;
  text-align: center;
}

/* ---- ALERTS ---- */
.pcpi-alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}
.pcpi-alert-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.pcpi-alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* ---- ARCHIVE / BOOKING TYPE LIST PAGE ---- */
.pcpi-archive-page {
  max-width: 760px;
  margin: 40px auto;
  padding: 0 16px;
  box-sizing: border-box;
}

.pcpi-archive-wrap {
  max-width: 760px;
  margin: 0 auto;
  font-family: var(--pcpi-font);
}

.pcpi-archive-header {
  text-align: center;
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--pcpi-border);
}

.pcpi-archive-logo {
  max-height: 56px;
  margin: 0 auto 12px;
  display: block;
}

.pcpi-archive-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
}

.pcpi-bt-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pcpi-bt-list-card {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--pcpi-border);
  border-radius: var(--pcpi-radius);
  background: var(--pcpi-bg);
  text-decoration: none;
  color: var(--pcpi-text);
  overflow: hidden;
  transition: box-shadow .12s;
}

.pcpi-bt-list-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
  text-decoration: none;
  color: var(--pcpi-text);
}

.pcpi-bt-list-accent {
  width: 5px;
  align-self: stretch;
  flex-shrink: 0;
}

.pcpi-bt-list-body {
  flex: 1;
  padding: 16px 20px;
}

.pcpi-bt-list-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 6px;
}

.pcpi-bt-list-meta {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--pcpi-muted);
  flex-wrap: wrap;
}

.pcpi-bt-list-cta {
  padding: 0 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--pcpi-accent);
  flex-shrink: 0;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 680px) {
  .pcpi-widget-layout {
    grid-template-columns: 1fr;
  }

  .pcpi-panel-left {
    border-right: none;
    border-bottom: 1px solid var(--pcpi-border);
    padding: 20px;
  }

  .pcpi-panel-right {
    padding: 20px;
  }

  .pcpi-cal-slots-layout {
    grid-template-columns: 1fr;
  }

  .pcpi-slots-list {
    max-height: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .pcpi-field-row-2 {
    grid-template-columns: 1fr;
  }
}

/* ---- Select-a-date prompt (shown before any date is clicked) ---- */
.pcpi-select-date-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Not justify-content: center — same reasoning as .pcpi-confirmation
     above: this column's height stretches to match the left panel's
     height, which grows with the description length, so centering
     vertically pushes this hint arbitrarily far down a long page
     instead of keeping it visible near the calendar above it. */
  justify-content: flex-start;
  min-height: 200px;
  color: var(--pcpi-muted);
  text-align: center;
  padding: 48px 20px 20px;
}

.pcpi-select-date-prompt span {
  font-size: 28px;
  margin-bottom: 10px;
  display: block;
  opacity: .4;
}

.pcpi-select-date-prompt p {
  font-size: 13px;
  margin: 0;
  line-height: 1.5;
}

/* ------------------------------------------------------------------ *
 *  Guest Reschedule page (standalone, not embedded in a shortcode)
 * ------------------------------------------------------------------ */
.pcpi-page-wrap {
  max-width: 720px;
  margin: 40px auto;
  padding: 0 20px;
}

.pcpi-notice-box {
  padding: 16px 20px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.6;
}

.pcpi-notice-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.pcpi-reschedule-page {
  --pcpi-accent: #1a56db;
  border: 1px solid var(--pcpi-border, #e5e7eb);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

/* Shared frame for standalone confirmation pages (cancel) that don't
   need the PCPIReschedule JS module to initialize on them. */
.pcpi-status-page {
  --pcpi-accent: #1a56db;
  border: 1px solid var(--pcpi-border, #e5e7eb);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.pcpi-resched-page-header {
  padding: 28px 28px 20px;
  border-bottom: 1px solid #f0f0f1;
  text-align: center;
}

.pcpi-resched-logo {
  max-height: 40px;
  margin-bottom: 14px;
}

.pcpi-resched-page-header h1 {
  font-size: 20px;
  margin: 0 0 8px;
}

.pcpi-resched-current {
  font-size: 14px;
  color: var(--pcpi-muted, #6b7280);
  margin: 0;
}

.pcpi-resched-page-body {
  padding: 24px;
}

.pcpi-resched-new-time-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--pcpi-accent-light, #f0f6ff);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 14px;
}

.pcpi-form-back-resched {
  background: none;
  border: none;
  color: var(--pcpi-accent);
  cursor: pointer;
  font-size: 13px;
  text-decoration: underline;
  padding: 0;
  flex-shrink: 0;
}

.pcpi-resched-answers-form h3 {
  font-size: 14px;
  margin: 0 0 12px;
}
