/* Painel visual WhatsApp — idle / QR / conectado */

.wa-qr-panel {
  margin-top: 0.5rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border-color, #d8dde6);
  border-radius: 14px;
  background: linear-gradient(165deg, color-mix(in srgb, var(--primary) 10%, transparent), transparent 72%);
}

.wa-qr-panel__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.wa-qr-panel__head h3,
.wa-qr-panel__head h4 {
  margin: 0 0 0.35rem;
}

.wa-qr-panel__body {
  display: flex;
  gap: 1.35rem;
  align-items: stretch;
  flex-wrap: wrap;
}

.wa-stage {
  position: relative;
  width: min(100%, 300px);
  min-height: 280px;
  border-radius: 18px;
  overflow: hidden;
  flex: 0 0 auto;
}

.wa-stage-view {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 280px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 1.25rem;
  box-sizing: border-box;
}

.wa-stage[data-mode="idle"] .wa-stage-idle,
.wa-stage[data-mode="qr"] .wa-stage-qr,
.wa-stage[data-mode="connecting"] .wa-stage-qr,
.wa-stage[data-mode="connected"] .wa-stage-live {
  display: flex;
}

/* --- Idle / offline --- */
.wa-stage-idle {
  background:
    radial-gradient(circle at 30% 20%, rgba(148, 163, 184, 0.22), transparent 45%),
    linear-gradient(160deg, #1e293b 0%, #0f172a 55%, #111827 100%);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.wa-stage-idle .wa-stage-icon {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  margin-bottom: 0.85rem;
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.35);
  font-size: 2rem;
}

.wa-stage-idle .wa-stage-title {
  font-family: "Outfit", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

.wa-stage-idle .wa-stage-sub {
  margin: 0;
  font-size: 0.9rem;
  color: #94a3b8;
  line-height: 1.45;
  max-width: 16rem;
}

/* --- QR --- */
.wa-stage-qr {
  background: #fff;
  border: 1px solid #cbd5e1;
  color: #334155;
}

.wa-stage-qr img {
  width: 100%;
  max-width: 220px;
  height: auto;
  display: block;
  border-radius: 8px;
}

.wa-stage-qr .wa-stage-qr-wait {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: #64748b;
  font-size: 0.92rem;
}

.wa-stage[data-mode="connecting"] .wa-stage-qr img[hidden] ~ .wa-stage-qr-wait,
.wa-stage[data-mode="qr"] .wa-stage-qr img[hidden] ~ .wa-stage-qr-wait {
  display: flex;
}

.wa-stage-qr .wa-stage-qr-caption {
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: #64748b;
}

/* --- Connected / live --- */
.wa-stage-live {
  background:
    radial-gradient(circle at 70% 15%, rgba(52, 211, 153, 0.35), transparent 40%),
    radial-gradient(circle at 20% 80%, rgba(16, 185, 129, 0.2), transparent 42%),
    linear-gradient(155deg, #064e3b 0%, #065f46 42%, #022c22 100%);
  color: #ecfdf5;
  border: 1px solid rgba(52, 211, 153, 0.45);
  box-shadow: 0 18px 40px rgba(6, 95, 70, 0.28);
}

.wa-pulse {
  position: relative;
  width: 96px;
  height: 96px;
  margin-bottom: 0.9rem;
  display: grid;
  place-items: center;
}

.wa-pulse::before,
.wa-pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(110, 231, 183, 0.55);
  animation: wa-pulse-ring 2.2s ease-out infinite;
}

.wa-pulse::after {
  animation-delay: 1.1s;
}

.wa-pulse-core {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #34d399, #059669);
  box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.22);
  font-size: 1.7rem;
  z-index: 1;
}

@keyframes wa-pulse-ring {
  0% { transform: scale(0.75); opacity: 0.85; }
  100% { transform: scale(1.45); opacity: 0; }
}

.wa-stage-live .wa-stage-title {
  font-family: "Outfit", sans-serif;
  font-size: clamp(1.55rem, 3vw, 1.9rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 0.35rem;
  color: #a7f3d0;
}

.wa-stage-live .wa-stage-number {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  word-break: break-all;
}

.wa-stage-live .wa-stage-sub {
  margin: 0;
  font-size: 0.88rem;
  color: #a7f3d0;
  line-height: 1.4;
  max-width: 15rem;
}

.wa-qr-meta {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.wa-qr-panel.is-connected {
  border-color: color-mix(in srgb, #10b981 55%, var(--border-color, #d8dde6));
  background: linear-gradient(165deg, rgba(16, 185, 129, 0.14), transparent 70%);
}

.wa-qr-panel.is-wait {
  border-color: color-mix(in srgb, #f59e0b 45%, var(--border-color, #d8dde6));
}

.wa-status-pill {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #fee2e2;
  color: #991b1b;
}

.wa-status-pill.is-on {
  background: #d1fae5;
  color: #065f46;
}

.wa-status-pill.is-wait {
  background: #fef3c7;
  color: #92400e;
}

@media (max-width: 640px) {
  .wa-stage {
    width: 100%;
  }
}
