/* ============================================
   PERFObuzz — components.css
   Buttons, Cards, Forms UI, reusable components
   ============================================ */

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  border-radius: var(--radius-full);
  padding: 0.5rem 1.125rem;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
  border: 1.5px solid transparent;
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: scale(0.98);
}

/* Primary — Indigo */
.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3);
}

/* Lime CTA */
.btn-lime {
  background: var(--cta);
  color: var(--cta-text);
  border-color: var(--cta);
}

.btn-lime:hover {
  background: var(--cta-hover);
  border-color: var(--cta-hover);
  box-shadow: 0 4px 20px rgba(190, 242, 100, 0.25);
}

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-outline:hover {
  background: var(--bg-surface);
  border-color: var(--accent);
  color: var(--accent);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* Sizes */
.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: var(--text-xs);
}

.btn-lg {
  padding: 0.55rem 1.25rem;
  font-size: var(--text-base);
}

/* Full width */
.btn-full {
  width: 100%;
}

/* With icon → circular contrast badge (design ref: pill + circular icon chip) */
.btn .icon {
  stroke: currentColor;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 5px;
  box-sizing: border-box;
  border-radius: var(--radius-full);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.btn-primary .icon {
  background: #ffffff;
  color: var(--accent);
}

.btn-lime .icon {
  background: var(--void-black);
  color: var(--cta);
}

.btn-outline .icon,
.btn-ghost .icon {
  background: rgba(250, 250, 250, 0.08);
  color: currentColor;
}

.btn-sm .icon {
  width: 24px;
  height: 24px;
  padding: 5px;
}

/* Compact hero CTA — uppercase, tighter, arrow badge nested near the edge */
.btn-hero {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.4rem 0.4rem 0.4rem 1.15rem;
  gap: 0.6rem;
}

/* Solid (filled) icons — e.g. the WhatsApp glyph, which is a filled path,
   not a line icon, so the default .icon (fill:none) would hide it */
.icon-solid {
  fill: currentColor;
  stroke: none;
}

/* Disabled */
.btn:disabled,
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================
   HONEYPOT (spam trap — visually removed, not display:none)
   ============================================ */
.hp-field {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   CLOUDFLARE TURNSTILE
   ============================================ */
.form-turnstile {
  margin-bottom: var(--space-4);
  min-height: 65px;
}

/* When there's no live widget yet (dev / before the key loads), don't reserve
   the 65px — collapse it so the CTA sits close to the last field. */
.form-turnstile:has(.cf-turnstile:empty) {
  min-height: 0;
  margin-bottom: 0;
}

/* ============================================
   FORM CONSENT (below submit CTA — no checkbox)
   ============================================ */
.form-consent {
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
}

.form-consent button {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: inherit;
}

.form-consent button:hover {
  color: var(--accent-hover);
}

/* Generic form-level error banner (network / verification failures) */
.form-banner-error {
  display: none;
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--persimmon-light);
  background: rgba(229, 91, 75, 0.08);
  border: 1px solid rgba(229, 91, 75, 0.3);
  border-radius: var(--radius-md);
}

.form-banner-error.is-visible {
  display: block;
}

/* ============================================
   LEGAL MODAL (Terms & Privacy) — native <dialog>
   ============================================ */
.legal-modal {
  width: min(520px, calc(100vw - 2 * var(--space-4)));
  max-height: min(78vh, 680px);
  margin: auto; /* centre in the viewport */
  padding: 0;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.legal-modal::backdrop {
  background: rgba(9, 9, 11, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.legal-modal-inner {
  display: flex;
  flex-direction: column;
  max-height: min(78vh, 680px);
}

.legal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
}

.legal-modal-title {
  font-size: var(--text-xl);
}

.legal-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  color: var(--accent);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.legal-modal-close:hover,
.legal-modal-close:focus-visible {
  background: var(--bg-surface-alt);
  border-color: var(--border-light);
}

.legal-modal-body {
  padding: var(--space-6);
  overflow-y: auto;
}

.legal-modal-body h3 {
  font-size: var(--text-lg);
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
}

.legal-modal-body h3:first-child {
  margin-top: 0;
}

.legal-modal-body p,
.legal-modal-body li {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  max-width: none;
}

.legal-modal-body ul {
  list-style: disc;
  padding-left: var(--space-4);
  margin-bottom: var(--space-3);
}

.legal-modal-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-modal-updated {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

/* ============================================
   FLOATING WHATSAPP BUTTON
   ============================================ */
.whatsapp-fab {
  position: fixed;
  right: clamp(16px, 4vw, 28px);
  bottom: calc(clamp(40px, 8vw, 56px) + 74px); /* above back-to-top, with gap */
  z-index: 950;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: var(--radius-full);
  background: var(--cta);
  color: var(--void-black);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(190, 242, 100, 0.4);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.whatsapp-fab:hover,
.whatsapp-fab:focus-visible {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55), 0 0 26px rgba(190, 242, 100, 0.45);
  outline: none;
}

.wa-icon {
  position: relative;
  z-index: 2;
}

.wa-pulse {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: var(--cta);
  z-index: 1;
  animation: waPulse 2.6s ease-out infinite;
}

@keyframes waPulse {
  0%   { transform: scale(1);   opacity: 0.5; }
  70%  { transform: scale(1.7); opacity: 0; }
  100% { transform: scale(1.7); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .wa-pulse { display: none; }
  .whatsapp-fab { transition: none; }
}

/* ============================================
   BACK-TO-TOP (scroll-progress ring)
   ============================================ */
.to-top {
  position: fixed;
  right: clamp(16px, 4vw, 28px);
  bottom: clamp(40px, 8vw, 56px);
  z-index: 950;
  width: 50px;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover,
.to-top:focus-visible {
  border-color: var(--border-light);
  outline: none;
}

.to-top-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* progress starts at the top */
}

.to-top-track-ring {
  fill: none;
  stroke: rgba(250, 250, 250, 0.12);
  stroke-width: 2.5;
}

.to-top-progress {
  fill: none;
  stroke: var(--lime);
  stroke-width: 2.5;
  stroke-linecap: round;
  /* stroke-dasharray / dashoffset set in scrollfx.js */
}

.to-top-arrow {
  position: relative;
  z-index: 1;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============================================
   MOBILE BUTTON SCALING (were oversized on phones)
   ============================================ */
@media (max-width: 640px) {
  .btn {
    font-size: var(--text-xs);
    padding: 0.45rem 1rem;
    gap: var(--space-1);
  }
  .btn-lg {
    font-size: var(--text-sm);
    padding: 0.5rem 1.1rem;
  }
  .btn .icon {
    width: 22px;
    height: 22px;
    padding: 5px;
  }
  .btn-sm .icon {
    width: 20px;
    height: 20px;
  }
}