/* WhatsApp Widget Styling */

/* Theme tokens: the light values are the widget's own colours; the dark
   theme (end of this file) points them at the site's tokens. */
:root {
  --wa-surface: white;
  --wa-ink: #333;
  --wa-ink-2: #666;
  --wa-line: #e5e5e5;
  --wa-line-2: #eee;
  --wa-line-3: #f0f0f0;
  --wa-soft: #fafafa;
  --wa-hover: #e8f9ee;
  --wa-title: #128c7e;
}

.whatsapp-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.whatsapp-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: white;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  transition: all 0.3s ease;
  padding: 0;
}

.whatsapp-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.6);
}

.whatsapp-fab:active {
  transform: scale(0.95);
}

.whatsapp-fab svg {
  width: 28px;
  height: 28px;
}

.whatsapp-fab-pulse {
  animation: whatsapp-fab-pulse-anim 5s ease-in-out infinite;
}

.whatsapp-fab-pulse svg {
  animation: whatsapp-icon-pulse-anim 5s ease-in-out infinite;
}

@keyframes whatsapp-fab-pulse-anim {
  0%, 100% {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4), 0 0 0 0 rgba(255, 255, 255, 0);
    transform: scale(1);
  }
  50% {
    background: #050505;
    border-color: #050505;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.72), 0 0 0 8px rgba(0, 0, 0, 0.22);
    transform: scale(1.08);
  }
}

@keyframes whatsapp-icon-pulse-anim {
  0%, 100% {
    filter: drop-shadow(0 0 0 transparent);
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.95));
    transform: scale(1.2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-fab-pulse,
  .whatsapp-fab-pulse svg {
    animation: none;
  }
}

/* Attention effect for the standalone "Book on WhatsApp" link buttons
   (not the floating widget FAB). No scale/box-shadow — those visually
   overlapped neighboring buttons in the hero. The class is added (by
   whatsapp-widget.js) 15s after page load, turning the button black
   immediately; from there this loop fades it to green and back, each
   swap taking 7s (14s per full black-green-black cycle). If the button
   still hasn't been clicked 40s after that, the class is removed and
   whatsapp-btn-hint (below) appears instead — see BTN_ATTENTION_DELAY_MS /
   BTN_ATTENTION_TIMEOUT_MS in whatsapp-widget.js. */
.whatsapp-btn-attention {
  background: #050505;
  border-color: #050505;
  animation: whatsapp-btn-color-loop 14s ease-in-out infinite;
}

@keyframes whatsapp-btn-color-loop {
  0%, 100% {
    background: #050505;
    border-color: #050505;
  }
  50% {
    background: #25d366;
    border-color: #25d366;
  }
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-btn-attention {
    animation: none;
    background: #25d366;
    border-color: #25d366;
  }
}

/* Quiet reminder shown once the attention effect above gives up
   unclicked — so the button goes back to normal instead of flashing
   forever, but the visitor still has a plain-text pointer to it.
   flex-basis: 100% drops it onto its own line within the button row's
   flex-wrap container instead of squeezing beside the buttons. */
.whatsapp-btn-hint {
  flex-basis: 100%;
  margin-top: 2px;
  font-size: 0.85rem;
  /* Inherit the section's own text colour so the hint reads on both the
     dark photo heroes (white text) and light sections (dark text); a grey
     muted colour disappeared on the heroes. */
  color: inherit;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 500ms ease, transform 500ms ease;
}

.whatsapp-btn-hint.is-visible {
  opacity: 0.92;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-btn-hint {
    transition: none;
  }
}

/* Small speech-bubble nudge above the FAB ("Planning a trip?", "Psst…
   still here!"), with a tail on its bottom edge pointing down at the
   WhatsApp icon. --nudge-tail-right is the tail's center measured from the
   bubble's right edge, i.e. FAB center (widget right + half FAB width)
   minus the bubble's own right offset. */
.whatsapp-nudge {
  --nudge-tail-right: 30px;
  position: fixed;
  bottom: 96px;
  right: 20px;
  max-width: 220px;
  background: var(--wa-surface);
  border: 1px solid var(--line, #ddd);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--wa-ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
  z-index: 998;
  animation: whatsapp-nudge-in 0.3s ease;
}

.whatsapp-nudge::after {
  content: "";
  position: absolute;
  bottom: -8px;
  right: calc(var(--nudge-tail-right) - 7px);
  width: 14px;
  height: 14px;
  background: var(--wa-surface);
  border-right: 1px solid var(--line, #ddd);
  border-bottom: 1px solid var(--line, #ddd);
  transform: rotate(45deg);
}

.whatsapp-nudge[hidden] {
  display: none;
}

@keyframes whatsapp-nudge-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* A true slide-in side panel, not a floating card over the middle of the
   page — full viewport height, anchored to the right edge, paired with a
   dimming backdrop (below) so it reads as a sidebar drawer rather than a
   popup blocking whatever was behind it. */
.whatsapp-popup {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  width: min(400px, 100vw);
  background: var(--wa-surface);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  /* A slower, gentler ease-out so the panel reads as a deliberate slide. */
  transition: transform 1.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (min-width: 681px) {
  /* Page width eases in and out with the drawer's slide (same duration and
     curve), so the content gently makes room instead of snapping. */
  body {
    transition: padding-right 1.4s cubic-bezier(0.22, 0.61, 0.36, 1);
  }

  body.whatsapp-drawer-open {
    padding-right: min(400px, 32vw);
  }

  .whatsapp-popup {
    width: min(400px, 32vw);
  }
}

.whatsapp-popup.is-open {
  transform: translateX(0);
}

.whatsapp-popup[hidden] {
  display: none;
}

.whatsapp-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 1.4s cubic-bezier(0.22, 0.61, 0.36, 1);
  z-index: 998;
}

.whatsapp-backdrop.is-open {
  opacity: 1;
}

.whatsapp-backdrop[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-popup,
  .whatsapp-backdrop,
  body {
    transition: none !important;
  }
}

.whatsapp-popup-header {
  flex-shrink: 0;
  padding: 16px;
  border-bottom: 1px solid var(--wa-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: white;
}

.whatsapp-popup-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.whatsapp-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.whatsapp-close:hover {
  transform: rotate(90deg);
}

.whatsapp-popup-body {
  padding: 16px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.whatsapp-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.whatsapp-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.whatsapp-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--wa-ink);
}

.whatsapp-field input,
.whatsapp-field select,
.whatsapp-field textarea {
  padding: 10px 12px;
  border: 1px solid var(--line, #ccc);
  border-radius: var(--radius, 8px);
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.whatsapp-input-invalid {
  border-color: var(--clay, #e53935) !important;
}

.whatsapp-phone-row {
  display: flex;
  gap: 8px;
}

.whatsapp-phone-row select {
  flex: 0 0 auto;
  width: 110px;
  padding: 10px 4px;
  border: 1px solid var(--line, #ccc);
  border-radius: var(--radius, 8px);
  font-size: 16px;
  font-family: inherit;
  background: var(--wa-surface);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-phone-row input {
  flex: 1;
  min-width: 0;
}

.whatsapp-error {
  font-size: 12px;
  color: var(--clay, #e53935);
  margin-top: 2px;
}

.whatsapp-field input:focus,
.whatsapp-field select:focus,
.whatsapp-field textarea:focus {
  outline: none;
  border-color: #25d366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.whatsapp-field textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}

.whatsapp-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wa-title);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--wa-line-2);
}

.whatsapp-form > .whatsapp-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.whatsapp-counter-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.whatsapp-counter-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--wa-ink);
}

.whatsapp-counter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.whatsapp-counter-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 50%;
  border: 1px solid #25d366;
  background: var(--wa-surface);
  color: var(--wa-title);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
  padding: 0;
  touch-action: manipulation;
}

.whatsapp-counter-btn:hover {
  background: var(--wa-hover);
}

.whatsapp-counter-btn:active {
  background: #25d366;
  color: white;
}

.whatsapp-counter input {
  width: 34px;
  text-align: center;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--wa-ink);
  background: transparent;
  padding: 0;
  -moz-appearance: textfield;
}

.whatsapp-counter input::-webkit-outer-spin-button,
.whatsapp-counter input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.whatsapp-btn {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.whatsapp-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.whatsapp-btn:active {
  transform: translateY(0);
}

.whatsapp-footer {
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--wa-line-3);
  background: var(--wa-soft);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.04);
}

.whatsapp-response-time {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--wa-ink-2);
  text-align: center;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  .whatsapp-widget {
    bottom: 16px;
    right: 16px;
  }

  .whatsapp-fab {
    width: 56px;
    height: 56px;
  }

  .whatsapp-nudge {
    bottom: 88px;
    right: 16px;
    --nudge-tail-right: 28px;
  }

  .whatsapp-popup-header h3 {
    font-size: 15px;
  }
}

/* Ensure widget is not affected by page styles */
.whatsapp-widget * {
  box-sizing: border-box;
}

.whatsapp-widget button:focus,
.whatsapp-widget input:focus,
.whatsapp-widget select:focus,
.whatsapp-widget textarea:focus {
  outline: 2px solid #25d366;
  outline-offset: 2px;
}

/* Dark theme (data-theme set by the head snippet): the popup takes the site's tokens. */
:root[data-theme="dark"] {
  --wa-surface: var(--panel);
  --wa-ink: var(--ink);
  --wa-ink-2: var(--muted);
  --wa-line: var(--line);
  --wa-line-2: var(--line);
  --wa-line-3: var(--line);
  --wa-soft: var(--sky);
  --wa-hover: #1d3a2c;
  --wa-title: #5fd3a8;}
