/* ============================================================
   JTP Booking Plugin – Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@700;900&display=swap');

:root {
  --jtp-primary:     #376db5;
  --jtp-accent:      #d62528;
  --jtp-dark:        #0d0d0d;
  --jtp-light:       #f7f7f7;
  --jtp-font-family: 'Montserrat', sans-serif;
}

/* ── Trigger Button ─────────────────────────────────────────── */
.jtp-trigger {
  background-color: var(--jtp-primary);
  color: white;
  border: none;
  padding: 12px 24px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  border-radius: 8px;
  font-family: var(--jtp-font-family);
}
.jtp-trigger:hover { background-color: var(--jtp-accent); }

/* ── Floating button ────────────────────────────────────────── */
#floating-availability-button {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--jtp-accent);
  color: white;
  font-weight: 700;
  font-size: 16px;
  padding: 14px 20px;
  border-radius: 30px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  cursor: pointer;
  z-index: 10000;
  animation: jtp-bounce 1s infinite;
  display: none;
}
@media (max-width: 768px) {
  #floating-availability-button { display: none !important; }
}
@keyframes jtp-bounce {
  0%,100% { transform: translateY(-50%) translateY(0); }
  50%      { transform: translateY(-50%) translateY(-8px); }
}

/* ── Popup overlay ──────────────────────────────────────────── */
#booking-popup {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  padding: 10px;
  opacity: 0;
  transition: opacity .3s ease;
}
#booking-popup.show {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
}
#booking-popup.hide {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

body.modal-open           { overflow: hidden; }
body.modal-open #booking-popup { touch-action: auto; }

/* ── Popup box ──────────────────────────────────────────────── */
.booking-popup {
  background: #fff;
  max-width: 600px;
  width: 95%;
  max-height: 90vh;
  overflow: visible !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-radius: 10px;
  padding: 30px;
  position: relative;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  min-height: 400px;
  touch-action: auto !important;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  font-family: var(--jtp-font-family);
}
.booking-popup::-webkit-scrollbar { display: none; }

.booking-popup-inner-scroll {
  overflow-y: auto;
  max-height: 80vh;
  padding-right: 10px;
  box-sizing: border-box;
  flex-grow: 1;
}

/* ── Close button ───────────────────────────────────────────── */
.close-button {
  position: absolute;
  top: 8px; right: 8px;
  width: 32px; height: 32px;
  background-color: #0073e6;
  color: white;
  font-size: 22px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.close-button:hover { background-color: var(--jtp-accent); }

/* ── Typography ─────────────────────────────────────────────── */
.booking-popup h1,.booking-popup h2,.booking-popup h3,
.booking-popup h4,.booking-popup h5,.booking-popup h6 {
  font-family: var(--jtp-font-family);
  font-weight: 900;
}
.booking-popup label { font-weight: 700; display: block; margin-top: 10px; }

/* ── Heading ────────────────────────────────────────────────── */
.booking-heading {
  font-size: 1.75rem;
  text-align: center;
  margin-bottom: 20px;
  font-weight: 700;
  color: var(--jtp-primary);
}
.arrival-date {
  font-weight: bold;
  text-align: center;
  margin: 10px 0;
}

/* ── Buttons (general) ──────────────────────────────────────── */
.booking-popup button {
  background-color: var(--jtp-primary);
  color: white;
  border: none;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  border-radius: 8px;
  font-family: var(--jtp-font-family);
}
.booking-popup button:hover { background-color: var(--jtp-accent); }

.inline-nav-btn {
  background-color: var(--jtp-primary);
  color: white;
  border: none;
  font-size: 1rem;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
}
.inline-nav-btn:hover { background-color: var(--jtp-accent); }

/* ── Time slot selector ─────────────────────────────────────── */
.time-window-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.time-window-selector > button {
  background-color: var(--jtp-primary);
  color: white;
  padding: 12px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color .2s ease;
  width: 100%;
  box-sizing: border-box;
}
.time-window-selector > button:hover { background-color: var(--jtp-accent); }

/* ── Callout wrapper ────────────────────────────────────────── */
.callout-wrapper {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  position: relative;
}
.callout-wrapper button {
  flex: 1;
  min-width: 100%; max-width: 100%;
  background-color: var(--jtp-primary);
  color: white;
  padding: 12px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color .2s ease;
  box-sizing: border-box;
}
.callout-wrapper button:hover { background-color: var(--jtp-accent); }

/* ── Bounce callout ─────────────────────────────────────────── */
.bounce-callout {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translate(6px, calc(-50% - 2px));
  display: flex;
  align-items: center;
  font-size: .85rem;
  font-weight: bold;
  color: var(--jtp-accent);
  background-color: #fff;
  border: 2px solid var(--jtp-accent);
  border-radius: 6px;
  padding: 6px 12px;
  animation: jtp-bounceLeftRight 1.2s ease-in-out infinite;
  white-space: nowrap;
  line-height: 1.3;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
  z-index: 10;
  pointer-events: none;
}
@keyframes jtp-bounceLeftRight {
  0%,100% { transform: translate(6px, calc(-50% - 2px)) scale(1); }
  50%      { transform: translate(0px, calc(-50% - 2px)) scale(1.1); }
}
@keyframes jtp-bounceUpDown {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-8px) scale(1.05); }
}
@media (max-width: 480px) {
  .bounce-callout {
    position: static !important;
    flex-direction: column;
    align-items: center;
    animation: jtp-bounceUpDown 1.4s ease-in-out infinite;
    font-size: .95rem;
    padding: 8px 12px;
    margin-bottom: 8px;
    text-align: center;
    max-width: 100%; width: 100%;
    box-sizing: border-box;
  }
}

/* ── Blinking border ────────────────────────────────────────── */
@keyframes jtp-flashBorder {
  0%,100% { border: 3px solid #3a5a8a; }
  50%      { border: 3px solid transparent; }
}
.blinking-border { animation: jtp-flashBorder 1s infinite; }

/* ── Spinner ────────────────────────────────────────────────── */
.spinner { display: none; text-align: center; padding: 20px; }
.spinner img {
  width: 100px; height: 100px;
  animation: jtp-spinFade 1s linear infinite;
}
@keyframes jtp-spinFade {
  0%   { opacity: .5; transform: rotate(0deg); }
  50%  { opacity: 1; }
  100% { opacity: .5; transform: rotate(360deg); }
}

/* ── Form sections ──────────────────────────────────────────── */
.form-section         { display: none; }
.form-section.active  { display: block; }

.booking-popup input,
.booking-popup select,
.booking-popup textarea {
  width: 100%;
  padding: 10px;
  margin: 8px 0;
  box-sizing: border-box;
  font-size: 1rem;
  font-family: var(--jtp-font-family);
}

/* ── Checkbox rows ──────────────────────────────────────────── */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 8px 0;
  font-size: .95rem;
  line-height: 1.4;
}
.checkbox-row input[type="checkbox"] {
  margin-top: 2px;
  width: 18px; height: 18px;
  flex-shrink: 0;
}
.checkbox-row label { margin: 0; flex: 1; cursor: pointer; }
.checkbox-row:not(:last-child) { margin-bottom: 10px; }
.nowrap { white-space: nowrap; }

/* ── Radio groups ───────────────────────────────────────────── */
.radio-group        { margin: 10px 0 15px; border: none; padding: 0; }
.radio-group legend { font-weight: 700; margin-bottom: 8px; font-size: .95rem; }
.radio-option-row   { display: flex; gap: 30px; align-items: center; margin-top: 5px; }
.radio-option-row label {
  font-weight: normal;
  display: flex; align-items: center; gap: 6px;
  font-size: .95rem; cursor: pointer;
}
.homeowner-radio-group        { margin-top: 20px; border: none; padding: 0; }
.homeowner-radio-group legend { font-weight: 700; margin-bottom: 10px; }
.radio-options { display: flex; gap: 30px; align-items: center; padding-left: 2px; }

/* ── Submit / Back buttons ──────────────────────────────────── */
button#submit-booking,
button#back-button {
  background-color: var(--jtp-primary);
  color: white;
  padding: 12px 0;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  flex: 1;
  transition: background-color .2s ease;
}
button#submit-booking:hover,
button#back-button:hover { background-color: var(--jtp-accent); }

/* ── Error box ──────────────────────────────────────────────── */
.booking-error { color: #3a5a8a; margin-top: 10px; display: none; }
.hidden        { display: none !important; }
.hidden-field  { display: none !important; }

/* ── Confirmation message ───────────────────────────────────── */
.confirmation-message         { text-align: center; padding: 20px; }
.confirmation-message h2      { color: var(--jtp-accent); margin-bottom: 15px; }

/* ── Mobile overrides ───────────────────────────────────────── */
@media (max-width: 600px) {
  .booking-popup {
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }
  #booking-popup {
    align-items: flex-start !important;
    padding-top: 20px;
  }
  .booking-popup-inner-scroll {
    overflow-y: auto;
    max-height: 80vh;
    box-sizing: border-box;
    padding-right: 10px;
  }
  .radio-options      { flex-direction: column !important; align-items: flex-start !important; gap: 10px !important; }
  .bounce-callout {
    position: static !important;
    flex-direction: column;
    align-items: center;
    animation: jtp-bounceUpDown 1.4s ease-in-out infinite;
    font-size: .95rem;
    padding: 8px 12px;
    font-weight: bold;
    border-radius: 6px;
    background: #fff;
    color: var(--jtp-accent);
    border: 2px solid var(--jtp-accent);
    box-shadow: 0 2px 6px rgba(0,0,0,.1);
    margin-bottom: 12px;
    text-align: center;
    max-width: 100%; width: 100%;
    box-sizing: border-box;
  }
  #date-time-selection { overflow: visible !important; position: relative; }
  div[style*="margin-top: 20px"] { flex-direction: column !important; }
  div[style*="margin-top: 20px"] button { width: 100% !important; margin-bottom: 10px; }
  .booking-popup-inner-scroll { overflow-y: visible !important; }
  #date-time-selection { overflow: visible !important; }
}
