/* ============================================================
   WHATSAPP DEMO MODAL — simulación UI
   ============================================================ */

.wa-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  transition: opacity 0.35s var(--ease-out);
}

.wa-modal.is-open {
  display: flex;
  opacity: 1;
}

.wa-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 8, 0.85);
  backdrop-filter: blur(12px);
  cursor: pointer;
}

/* ---------- PHONE FRAME ---------- */
.wa-modal__phone {
  position: relative;
  width: 100%;
  max-width: 400px;
  height: 100%;
  max-height: 840px;
  background: var(--wa-bg);
  border-radius: 36px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 0 0 12px rgba(30, 30, 34, 0.9),
    0 30px 80px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(255,255,255,0.04);
  transform: translateY(30px) scale(0.96);
  transition: transform 0.45s var(--ease-out);
}

.wa-modal.is-open .wa-modal__phone {
  transform: translateY(0) scale(1);
}

.wa-modal__notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 22px;
  background: #0a0a0c;
  border-radius: 20px;
  z-index: 10;
}

/* ---------- HEADER ---------- */
.wa-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-3) var(--space-3);
  background: var(--wa-header);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  position: relative;
  z-index: 2;
}

.wa-header__back {
  padding: 6px;
  color: var(--wa-text);
  display: flex;
  align-items: center;
}

.wa-header__avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.wa-header__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wa-header__dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: var(--wa-green);
  border: 2px solid var(--wa-header);
  border-radius: 50%;
}

.wa-header__info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.wa-header__name {
  color: var(--wa-text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-header__status {
  color: var(--wa-text-secondary);
  font-size: 0.72rem;
}

.wa-header__status.is-typing {
  color: var(--wa-green);
}

.wa-header__actions {
  display: flex;
  gap: var(--space-4);
  color: var(--wa-text-secondary);
  padding-right: var(--space-2);
}

/* ---------- BODY ---------- */
.wa-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-3) var(--space-6);
  background:
    radial-gradient(circle at 20% 10%, rgba(37, 211, 102, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(37, 211, 102, 0.03) 0%, transparent 40%),
    var(--wa-bg);
  display: flex;
  flex-direction: column;
  gap: 2px;
  scroll-behavior: smooth;
}

.wa-body::-webkit-scrollbar { width: 4px; }
.wa-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

.wa-date-chip {
  align-self: center;
  padding: 4px 12px;
  background: rgba(32, 44, 51, 0.9);
  color: var(--wa-text-secondary);
  font-size: 0.7rem;
  border-radius: 8px;
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wa-system {
  align-self: center;
  padding: 8px 14px;
  background: rgba(28, 37, 43, 0.95);
  color: var(--wa-text-secondary);
  font-size: 0.72rem;
  border-radius: 8px;
  margin-bottom: var(--space-4);
  text-align: center;
  max-width: 85%;
  line-height: 1.4;
}

.wa-system strong {
  color: var(--gold-light);
  font-weight: 600;
}

/* ---------- BUBBLES ---------- */
.wa-msg {
  max-width: 82%;
  padding: 7px 10px 7px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--wa-text);
  animation: wa-pop 0.25s var(--ease-out);
  word-wrap: break-word;
  position: relative;
}

@keyframes wa-pop {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

.wa-msg--in {
  align-self: flex-start;
  background: var(--wa-bubble-in);
  border-top-left-radius: 2px;
  margin-right: auto;
  margin-top: 4px;
}

.wa-msg--out {
  align-self: flex-end;
  background: var(--wa-bubble-out);
  border-top-right-radius: 2px;
  margin-left: auto;
  margin-top: 4px;
}

/* Agrupar burbujas consecutivas */
.wa-msg + .wa-msg--in { border-top-left-radius: 8px; }
.wa-msg + .wa-msg--out { border-top-right-radius: 8px; }

.wa-msg__time {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.65rem;
  color: var(--wa-text-secondary);
  float: right;
  margin-top: 4px;
}

.wa-msg--out .wa-msg__time {
  color: rgba(255, 255, 255, 0.55);
}

.wa-msg__check {
  display: inline-block;
  margin-left: 3px;
  color: #53bdeb;
  font-size: 0.7rem;
  vertical-align: -1px;
}

.wa-msg strong { color: var(--wa-text); font-weight: 600; }

.wa-msg em { color: var(--gold-light); font-style: normal; font-weight: 500; }

/* ---------- TYPING INDICATOR ---------- */
.wa-typing {
  align-self: flex-start;
  background: var(--wa-bubble-in);
  border-radius: 14px;
  border-top-left-radius: 2px;
  padding: 10px 14px;
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.wa-typing span {
  width: 6px;
  height: 6px;
  background: var(--wa-text-secondary);
  border-radius: 50%;
  animation: wa-bounce 1.2s ease-in-out infinite;
}

.wa-typing span:nth-child(2) { animation-delay: 0.15s; }
.wa-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes wa-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ---------- MENU CARD (desplegable con servicios) ---------- */
.wa-menu-card {
  align-self: flex-start;
  max-width: 90%;
  background: var(--wa-bubble-in);
  border-radius: 8px;
  border-top-left-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
  animation: wa-pop 0.3s var(--ease-out);
}

.wa-menu-card__header {
  padding: var(--space-3) var(--space-4);
  background: rgba(37, 211, 102, 0.1);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.wa-menu-card__title {
  font-size: 0.9rem;
  color: var(--wa-text);
  font-weight: 600;
  margin: 0;
}

.wa-menu-card__sub {
  font-size: 0.72rem;
  color: var(--wa-text-secondary);
  margin-top: 2px;
}

.wa-menu-card__body {
  max-height: 260px;
  overflow-y: auto;
  padding: var(--space-2) 0;
}

.wa-menu-card__body::-webkit-scrollbar { width: 3px; }
.wa-menu-card__body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }

.wa-menu-cat {
  padding: var(--space-2) var(--space-4);
}

.wa-menu-cat__name {
  font-size: 0.68rem;
  color: var(--gold-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-bottom: 6px;
}

.wa-menu-item {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 5px 0;
  font-size: 0.8rem;
  color: var(--wa-text);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.wa-menu-item:last-child { border-bottom: none; }

.wa-menu-item__name {
  flex: 1 1 auto;
  line-height: 1.3;
}

.wa-menu-item__price {
  flex: 0 0 auto;
  color: var(--wa-green);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- APPT CARD (confirmación de cita) ---------- */
.wa-appt-card {
  align-self: flex-start;
  max-width: 86%;
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.12) 0%, var(--wa-bubble-in) 100%);
  border: 1px solid rgba(37, 211, 102, 0.25);
  border-radius: 8px;
  padding: var(--space-4);
  margin-top: 4px;
  animation: wa-pop 0.35s var(--ease-out);
}

.wa-appt-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--wa-green);
  color: white;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-3);
}

.wa-appt-card__row {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  padding: 6px 0;
  font-size: 0.82rem;
  color: var(--wa-text);
  border-bottom: 1px dashed rgba(255,255,255,0.05);
}

.wa-appt-card__row:last-child { border-bottom: none; }

.wa-appt-card__icon {
  flex: 0 0 20px;
  font-size: 1rem;
}

.wa-appt-card__text {
  flex: 1;
  line-height: 1.35;
}

.wa-appt-card__text strong {
  display: block;
  color: var(--wa-text);
  font-weight: 600;
}

.wa-appt-card__text small {
  color: var(--wa-text-secondary);
  font-size: 0.72rem;
}

/* ---------- STRIPE OVERLAY ---------- */
.wa-stripe {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(8, 10, 14, 0.92);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
}

.wa-stripe.is-open {
  display: flex;
  opacity: 1;
}

.wa-stripe__card {
  width: 100%;
  max-width: 320px;
  background: #ffffff;
  color: #1a1f36;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  transform: scale(0.92);
  transition: transform 0.35s var(--ease-bounce);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.wa-stripe.is-open .wa-stripe__card {
  transform: scale(1);
}

.wa-stripe__header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e6e6e6;
}

.wa-stripe__logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: #635bff;
  letter-spacing: -0.02em;
}

.wa-stripe__lock {
  font-size: 0.72rem;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 4px;
}

.wa-stripe__body { padding: 20px; }

.wa-stripe__amount {
  text-align: center;
  padding: 12px 0 18px;
}

.wa-stripe__amount-label {
  font-size: 0.75rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.wa-stripe__amount-num {
  font-size: 2rem;
  font-weight: 700;
  color: #1a1f36;
  letter-spacing: -0.02em;
}

.wa-stripe__amount-mxn {
  font-size: 0.85rem;
  color: #6b7280;
  margin-left: 6px;
}

.wa-stripe__desc {
  text-align: center;
  font-size: 0.85rem;
  color: #4b5563;
  margin-bottom: 16px;
  line-height: 1.4;
}

.wa-stripe__field {
  border: 1px solid #e6e6e6;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.85rem;
  color: #4b5563;
  background: #f9fafb;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wa-stripe__field-icon {
  width: 20px;
  height: 14px;
  background: linear-gradient(135deg, #ff9966, #ff5e62);
  border-radius: 2px;
  flex-shrink: 0;
}

.wa-stripe__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.wa-stripe__btn {
  width: 100%;
  padding: 12px;
  background: #635bff;
  color: white;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background 0.2s;
}

.wa-stripe__btn:hover { background: #5046e5; }

.wa-stripe__btn.is-loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: wa-spin 0.7s linear infinite;
}

.wa-stripe__btn.is-loading .wa-stripe__btn-text { opacity: 0; }

@keyframes wa-spin {
  to { transform: rotate(360deg); }
}

.wa-stripe__success {
  display: none;
  text-align: center;
  padding: 32px 20px;
}

.wa-stripe__success.is-visible { display: block; animation: wa-pop 0.4s var(--ease-bounce); }

.wa-stripe__check {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: #10b981;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: wa-check-pulse 0.8s var(--ease-out) 0.1s;
}

@keyframes wa-check-pulse {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 0 12px rgba(16, 185, 129, 0.15); }
  100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.wa-stripe__success h4 {
  font-size: 1.1rem;
  color: #1a1f36;
  margin-bottom: 6px;
  font-family: inherit;
  font-weight: 600;
}

.wa-stripe__success p {
  font-size: 0.82rem;
  color: #6b7280;
}

/* ---------- INPUT FUNCIONAL (chat real) ---------- */
.wa-input {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--wa-bg);
  border-top: 1px solid rgba(255,255,255,0.04);
  color: var(--wa-text);
}

.wa-input__emoji {
  padding: 6px;
  color: var(--wa-text-secondary);
  display: flex;
  align-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s;
}

.wa-input__emoji:hover { color: var(--gold-light); }

.wa-input__field {
  flex-grow: 1;
  background: var(--wa-bubble-in);
  padding: 10px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  color: var(--wa-text);
  border: none;
  outline: none;
  font-family: inherit;
  min-width: 0;
  line-height: 1.35;
  transition: background 0.2s, box-shadow 0.2s;
}

.wa-input__field::placeholder {
  color: var(--wa-text-secondary);
  opacity: 0.85;
}

.wa-input__field:focus {
  background: #2a3942;
  box-shadow: 0 0 0 1px rgba(37, 211, 102, 0.25);
}

.wa-input__field:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.wa-input__action {
  background: var(--wa-green);
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 10px rgba(37, 211, 102, 0.25);
}

.wa-input__action:hover:not(:disabled) {
  background: #1fbf5a;
  transform: scale(1.05);
}

.wa-input__action:active:not(:disabled) {
  transform: scale(0.92);
}

.wa-input__action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* Swap mic ↔ send según haya texto */
.wa-icon-send { display: none; }
.wa-input.has-text .wa-icon-mic { display: none; }
.wa-input.has-text .wa-icon-send { display: block; }

/* ---------- PAYMENT BUTTON (inyectado por el bot) ---------- */
.wa-pay-button {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px 12px 14px;
  background: linear-gradient(135deg, #635bff 0%, #8b7dff 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(99, 91, 255, 0.35), inset 0 1px 0 rgba(255,255,255,0.2);
  margin-top: 6px;
  max-width: 86%;
  animation: wa-pop 0.35s var(--ease-out);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
  text-align: left;
}

.wa-pay-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(99, 91, 255, 0.5), inset 0 1px 0 rgba(255,255,255,0.25);
}

.wa-pay-button:active {
  transform: translateY(0);
}

.wa-pay-button__icon {
  width: 34px;
  height: 24px;
  background: white;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #635bff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.wa-pay-button__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.wa-pay-button__title {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.15;
}

.wa-pay-button__sub {
  font-size: 0.72rem;
  opacity: 0.92;
  line-height: 1.2;
}

/* ---------- FAB REINICIAR DEMO (dentro del phone, flotante) ---------- */
.wa-fab {
  position: absolute;
  right: var(--space-4);
  bottom: 76px; /* encima del input decorativo */
  z-index: 15;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-dark) 100%);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    0 8px 24px rgba(212, 165, 116, 0.45),
    0 0 0 1px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.25s var(--ease-out),
              box-shadow 0.25s var(--ease-out),
              filter 0.2s ease;
}

.wa-fab:hover {
  transform: scale(1.08) rotate(-20deg);
  box-shadow:
    0 14px 36px rgba(212, 165, 116, 0.6),
    0 0 0 1px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  filter: brightness(1.08);
}

.wa-fab:active {
  transform: scale(0.92) rotate(-40deg);
}

.wa-fab:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 3px;
}

/* ---------- BADGE "Demo simulada" (top del phone, sutil) ---------- */
.wa-demo-badge {
  position: absolute;
  top: 44px; /* debajo del notch decorativo */
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  padding: 4px 11px;
  background: rgba(10, 10, 14, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--gold-light);
  font-family: var(--font-heading);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(212, 165, 116, 0.22);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ---------- Mobile: phone ocupa toda la pantalla ---------- */
@media (max-width: 640px) {
  .wa-modal { padding: 0; }
  .wa-modal__phone {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    box-shadow: none;
  }
  .wa-modal__notch { display: none; }
  .wa-header { padding-top: var(--space-4); }
  .wa-demo-badge {
    top: var(--space-2);
  }
  .wa-fab {
    right: var(--space-3);
    bottom: 72px;
    width: 42px;
    height: 42px;
  }
}
