/* Zeremoni demo runtime — WhatsApp float, tour, view toggle */
/* All three floats stacked at bottom-left. Order top→bottom: ? · toggle · WA.
   The right side stays clear so the panel content (filters, search, table)
   never collides with a float. */
#zeremoni-wa-float {
  position: fixed;
  left: 18px;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 14px;
  background: #25D366;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(37,211,102,0.42);
  z-index: 9995;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: zeremoniWaPulse 2.4s ease-in-out infinite;
  white-space: nowrap;
  max-width: calc(100vw - 36px);
}
#zeremoni-wa-float:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(37,211,102,0.55);
}
#zeremoni-wa-float svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }
@keyframes zeremoniWaPulse {
  0%, 100% { box-shadow: 0 10px 24px rgba(37,211,102,0.42), 0 0 0 0 rgba(37,211,102,0.5); }
  50%      { box-shadow: 0 10px 24px rgba(37,211,102,0.42), 0 0 0 12px rgba(37,211,102,0); }
}

#zeremoni-demo-toggle {
  position: fixed;
  left: 18px;
  bottom: 72px;
  padding: 10px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #0f172a;
  background: #fff;
  border: 1px solid rgba(15,23,42,0.10);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,0.14);
  z-index: 9994;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  max-width: calc(100vw - 36px);
}
#zeremoni-demo-toggle:hover { transform: translateY(-1px); box-shadow: 0 12px 22px rgba(0,0,0,0.18); }

#zeremoni-tour-help {
  position: fixed;
  left: 18px;
  bottom: 130px;
  padding: 10px 16px 10px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(135deg, #E8B4BC 0%, #B87280 100%);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(184, 114, 128, 0.42);
  z-index: 9993;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  max-width: calc(100vw - 36px);
}
#zeremoni-tour-help svg { width: 16px; height: 16px; flex-shrink: 0; }
#zeremoni-tour-help:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(184, 114, 128, 0.55); }

@media (max-width: 380px) {
  #zeremoni-wa-float, #zeremoni-demo-toggle, #zeremoni-tour-help { font-size: 12px; padding: 9px 14px; }
}

/* Envelope active — floating pills stay visible at all times (user prefers
   constant access to "Ver tour", "Ver Gestión", and "Contáctanos"). Only the
   tour overlay z-index needs bumping so the sentimental opening message reads
   on top of the envelope artwork. */
body.demo-envelope-active #zeremoni-tour-popover { z-index: 10001; }
body.demo-envelope-active #zeremoni-tour-spotlight { z-index: 10000; }

/* Envelope opening — between the seal click and the envelope-page removal the
   splash ("¡Bienvenidos!") owns the screen. The tour spotlight is still anchored
   to #seal-wrapper at this point (which is animating away), so its inverse-
   box-shadow dimmer ends up darkening the splash. Fade the overlay out for the
   duration of the open animation; Phase C removes this class and the next step
   paints fresh. */
body.demo-envelope-opening #zeremoni-tour-spotlight,
body.demo-envelope-opening #zeremoni-tour-popover {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.3s ease;
}

/* Reserve bottom space in the panel so the stacked floats (?, toggle, WA)
   never overlap the guest table when there are few rows. Without this,
   1-row panels show the last row pinned under the WhatsApp pill. */
#zeremoni-demo-panel-view { padding-bottom: 200px; }
@media (max-width: 640px) {
  #zeremoni-demo-panel-view { padding-bottom: 220px; }
}

/* Tour spotlight — inverse box-shadow dims everything outside the highlighted rect.
   No full-screen overlay element; the spotlight IS the dimmer. */
#zeremoni-tour-spotlight {
  position: fixed;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.62);
  pointer-events: none;
  z-index: 9998;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
}
#zeremoni-tour-popover {
  position: fixed;
  background: #fff;
  color: #1e293b;
  padding: 18px 20px 16px;
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  max-width: 340px;
  z-index: 9999;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.35);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
#zeremoni-tour-popover h4 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #0f172a;
}
#zeremoni-tour-popover p {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.55;
  color: #475569;
}
#zeremoni-tour-popover p a.zeremoni-tour-link {
  color: #B87280;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}
#zeremoni-tour-popover p a.zeremoni-tour-link:hover { color: #9B5F6D; }
.zeremoni-tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.zeremoni-tour-progress {
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}
.zeremoni-tour-btn {
  border: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s ease;
  text-decoration: none;
  display: inline-block;
}
.zeremoni-tour-btn.primary { background: #0f172a; color: #fff; }
.zeremoni-tour-btn.secondary { background: transparent; color: #64748b; }
.zeremoni-tour-btn:hover { opacity: 0.85; }
.zeremoni-tour-btn-group { display: flex; gap: 6px; align-items: center; }

/* Resume chooser + step picker (replay-from-pill flow) */
.zeremoni-tour-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: zeremoniTourFadeIn 0.18s ease;
}
@keyframes zeremoniTourFadeIn { from { opacity: 0; } to { opacity: 1; } }
.zeremoni-tour-modal-card {
  position: relative;
  background: #fff;
  color: #1e293b;
  border-radius: 16px;
  padding: 28px 24px 22px;
  max-width: 380px;
  width: 100%;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.42);
  text-align: center;
}
.zeremoni-tour-modal-card h4 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: 0.01em;
}
.zeremoni-tour-modal-card p {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.55;
  color: #475569;
}
.zeremoni-tour-modal-card p em { font-style: italic; color: #0f172a; }
.zeremoni-tour-modal-actions { display: grid; gap: 8px; }
.zeremoni-tour-modal-actions .zeremoni-tour-btn {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: 0;
  font-family: inherit;
  width: 100%;
  text-align: center;
  display: block;
}
.zeremoni-tour-modal-actions .zeremoni-tour-btn.primary {
  background: linear-gradient(135deg, #E8B4BC 0%, #B87280 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(184, 114, 128, 0.32);
}
.zeremoni-tour-modal-actions .zeremoni-tour-btn.secondary {
  background: #f1f5f9;
  color: #0f172a;
}
.zeremoni-tour-modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: transparent;
  border: 0;
  font-size: 22px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
}
.zeremoni-tour-modal-close:hover { color: #475569; background: #f1f5f9; }
.zeremoni-tour-picker-card { max-width: 440px; }
.zeremoni-tour-step-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 4px 6px 4px 2px;
  margin: 0 -4px;
}
.zeremoni-tour-step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: #f8fafc;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: #1e293b;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.zeremoni-tour-step-item:hover {
  background: #FBF0F2;
  border-color: #E8C5CB;
  transform: translateX(2px);
}
.zeremoni-tour-step-item.is-saved {
  background: #FBF0F2;
  border-color: #B87280;
  box-shadow: 0 0 0 1px #B87280 inset;
}
.zeremoni-tour-step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #B87280;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.zeremoni-tour-step-title { flex: 1; line-height: 1.35; font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  #zeremoni-tour-spotlight, #zeremoni-tour-popover { transition: none; }
  #zeremoni-wa-float { animation: none; }
  .zeremoni-tour-modal-backdrop { animation: none; }
  .zeremoni-tour-step-item { transition: none; }
}

/* Small viewports — tighten the popover so it leaves more room for the
   highlighted element. Combined with the JS anti-overlap shift in paintStep,
   this keeps modal dialogs (add guest, send WhatsApp) fully readable on
   phones without the popover sitting on top of the action buttons. */
@media (max-width: 480px) {
  #zeremoni-tour-popover {
    max-width: calc(100vw - 24px);
    padding: 14px 16px 12px;
  }
  #zeremoni-tour-popover h4 { font-size: 13px; margin-bottom: 4px; }
  #zeremoni-tour-popover p { font-size: 12px; line-height: 1.45; margin-bottom: 10px; }
  .zeremoni-tour-btn { padding: 6px 12px; font-size: 11px; }
  .zeremoni-tour-progress { font-size: 10px; }
}
