/* ------------------------------------------------------------------
   WhatsApp click-to-chat generator page
   ------------------------------------------------------------------ */

.wa-hero {
  padding: clamp(3.5rem, 7vw, 5.5rem) 0 clamp(1.5rem, 3vw, 2.5rem);
}
.wa-hero-inner { max-width: 760px; }
.wa-hero h1 { margin-bottom: 0.6rem; }
.wa-hero .lead { max-width: 60ch; }

.wa-tool { padding-top: clamp(1.5rem, 3vw, 2.5rem); }

.wa-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}
@media (max-width: 900px) {
  .wa-grid { grid-template-columns: 1fr; }
}

/* ---- Left pane: form ---- */
.wa-form-pane {
  background: rgba(244, 239, 230, 0.04);
  border: 1px solid rgba(244, 239, 230, 0.1);
  border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 3vw, 2rem);
}

.wa-phone-row {
  grid-template-columns: 150px 1fr;
}
@media (max-width: 540px) {
  .wa-phone-row { grid-template-columns: 1fr; }
}

.wa-form-pane select {
  font: inherit;
  font-family: var(--font-body);
  color: var(--cream);
  background: rgba(22, 17, 15, 0.6);
  border: 1.5px solid rgba(244, 239, 230, 0.15);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  min-height: 48px;
  width: 100%;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%23b9b0a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.6rem;
  transition: border-color 0.2s, background 0.2s;
}
.wa-form-pane select:focus-visible {
  outline: none;
  border-color: var(--orange);
  background-color: rgba(22, 17, 15, 0.85);
  box-shadow: 0 0 0 3px rgba(245, 115, 27, 0.25);
}
.wa-form-pane select option { background: var(--bg); color: var(--cream); }

.field-hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.4rem;
}

.wa-link-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.wa-link-row input {
  flex: 1;
  font: inherit;
  font-family: var(--font-body);
  color: var(--cream);
  background: rgba(22, 17, 15, 0.6);
  border: 1.5px solid rgba(244, 239, 230, 0.15);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  min-height: 48px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-link-row input:focus-visible {
  outline: none;
  border-color: var(--orange);
  background: rgba(22, 17, 15, 0.85);
  box-shadow: 0 0 0 3px rgba(245, 115, 27, 0.25);
}
.wa-link-row .btn { white-space: nowrap; }

.wa-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid rgba(244, 239, 230, 0.1);
  flex-wrap: wrap;
}
.wa-actions .btn { flex: 1; min-width: 180px; }
.wa-test-btn[aria-disabled="true"],
.wa-actions .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---- Right pane: WhatsApp preview + QR ---- */
.wa-preview-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
  position: sticky;
  top: 100px;
}
@media (max-width: 900px) {
  .wa-preview-pane { position: static; }
}

/* Phone-ish chat frame */
.wa-phone-frame {
  width: 100%;
  max-width: 320px;
  background: #0b141a;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
}
.wa-phone-header {
  background: #202c33;
  padding: 0.7rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.wa-phone-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25D366, #128C7E);
  flex-shrink: 0;
}
.wa-phone-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.wa-phone-meta strong {
  color: #e9edef;
  font-size: 0.95rem;
  font-family: var(--font-head);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wa-phone-meta span {
  color: #8696a0;
  font-size: 0.75rem;
}
.wa-phone-chat {
  background: #0b141a url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'><g fill='%23182229' opacity='0.4'><circle cx='10' cy='10' r='1.3'/><circle cx='30' cy='25' r='1.1'/><circle cx='50' cy='15' r='1.4'/><circle cx='18' cy='45' r='1.2'/><circle cx='42' cy='48' r='1.3'/></g></svg>");
  padding: 1rem 0.8rem;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.wa-bubble {
  max-width: 80%;
  padding: 0.5rem 0.7rem 0.4rem;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.4;
  color: #e9edef;
  position: relative;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.wa-bubble-system {
  align-self: center;
  background: rgba(32, 44, 51, 0.9);
  color: #8696a0;
  font-size: 0.72rem;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
}
.wa-bubble-out {
  align-self: flex-end;
  background: #005c4b;
  border-top-right-radius: 2px;
}
.wa-bubble-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  float: right;
  margin-top: 0.3rem;
  margin-left: 0.5rem;
}
.wa-bubble-time {
  font-size: 0.65rem;
  color: #a9b3b8;
}

/* QR output */
.wa-qr-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  background: var(--cream);
  border-radius: var(--radius-lg);
  padding: clamp(0.9rem, 2.5vw, 1.3rem);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
#wa-qr-canvas {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.wa-qr-wrap.is-empty #wa-qr-canvas { visibility: hidden; }
.wa-qr-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a8177;
  font-family: var(--font-head);
  font-size: 0.9rem;
  padding: 1rem;
  text-align: center;
  pointer-events: none;
}
.wa-qr-wrap:not(.is-empty) .wa-qr-placeholder { display: none; }

.wa-meta {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* "Why this works" cream band */
.wa-why { text-align: center; }
.wa-why .container { max-width: 720px; }
.wa-why p { color: #4a3f36; }
.wa-why a { color: var(--orange); font-weight: 600; }
