/* Demo page styles: pill switcher, view transitions, WhatsApp 1:1 replica */

body.demo-customizer-open {
  overflow: hidden;
}

/* ---- Page background for WA view ---- */
#wa-view {
  position: fixed;
  inset: 0;
  background-color: #2D2927;
  /* Subtle noise texture via SVG */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* ---- Demo views: show/hide with transitions ---- */
.demo-view {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow-y: auto;
  transition: opacity 400ms ease, transform 400ms ease;
}

.demo-view:not(.active) {
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.demo-view.active {
  opacity: 1;
  visibility: visible;
}

/* Slide transitions when switching */
.demo-view.wa-view {
  transform: translateX(0);
}

.demo-view.webchat-view {
  transform: translateX(0);
}

body.view-webchat .demo-view.wa-view:not(.active) {
  transform: translateX(-30px);
}

body.view-webchat .demo-view.webchat-view.active {
  transform: translateX(0);
}

body.view-whatsapp .demo-view.webchat-view:not(.active) {
  transform: translateX(30px);
}

body.view-whatsapp .demo-view.wa-view.active {
  transform: translateX(0);
}

body.view-voice .demo-view.wa-view:not(.active) {
  transform: translateX(-30px);
}

body.view-voice .demo-view.webchat-view:not(.active) {
  transform: translateX(30px);
}

body.view-voice .demo-view.voice-view.active {
  transform: translateX(0);
}

/* ---- Pill switcher (visible on hover over top center area) ---- */
.pill-switcher-zone {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 52px;
  z-index: 9998;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pill-switcher {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 4px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 9999px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.pill-switcher-zone:hover .pill-switcher {
  opacity: 1;
  pointer-events: auto;
}

.pill-track {
  position: relative;
  display: flex;
  align-items: center;
}

.pill-indicator {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: calc(100% / var(--pill-count, 2));
  background: #f3f4f6;
  border-radius: 9999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
  transform: translateX(calc(100% * var(--pill-index, 0)));
}

.pill-option {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  background: transparent;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: color 200ms ease;
}

.pill-option:hover {
  color: #374151;
}

.pill-option.active {
  color: #111827;
}

/* ---- Voice view ---- */
.voice-view {
  background-color: #2D2927;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  display: flex;
  align-items: center;
  justify-content: center;
}

.vc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  transition: gap 400ms ease;
}

.vc.vc--active {
  gap: 36px;
}

.vc-wave-area {
  width: min(560px, 80vw);
  height: 120px;
  overflow: hidden;
  opacity: 0;
  max-height: 0;
  transition: opacity 500ms ease, max-height 500ms ease;
}

.vc.vc--active .vc-wave-area {
  opacity: 1;
  max-height: 120px;
}

.vc-wave-area canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.vc-call-btn {
  width: 80px;
  height: 80px;
  border: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  color: #1b120a;
  background: linear-gradient(135deg, #f28c28, #ffb86f);
  box-shadow: 0 12px 36px rgba(242, 140, 40, 0.3);
  transition: transform 300ms ease, border-radius 300ms ease, background 300ms ease, box-shadow 300ms ease;
}

.vc-call-btn:hover {
  transform: scale(1.04);
}

.vc-call-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 4px;
}

.vc-icon-phone,
.vc-icon-stop {
  position: absolute;
  transition: opacity 200ms ease, transform 200ms ease;
}

.vc-icon-phone {
  width: 30px;
  height: 30px;
  opacity: 1;
  transform: scale(1);
}

.vc-icon-phone svg {
  width: 100%;
  height: 100%;
}

.vc-icon-stop {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: currentColor;
  opacity: 0;
  transform: scale(0.6);
}

.vc-call-btn[data-state="pending"],
.vc-call-btn[data-state="live"] {
  border-radius: 16px;
  background: linear-gradient(135deg, #e8ddd4, #f5ede5);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.vc-call-btn[data-state="pending"] .vc-icon-phone,
.vc-call-btn[data-state="live"] .vc-icon-phone {
  opacity: 0;
  transform: scale(0.6);
}

.vc-call-btn[data-state="pending"] .vc-icon-stop,
.vc-call-btn[data-state="live"] .vc-icon-stop {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  opacity: 1;
  transform: scale(1);
}

.vc-status {
  display: none;
}

.vc.vc--active .vc-call-btn {
  width: 52px;
  height: 52px;
  pointer-events: none;
  cursor: default;
}

@media (max-width: 720px) {
  .pill-switcher-zone {
    width: 296px;
  }

  .pill-option {
    padding: 8px 14px;
    font-size: 13px;
  }

  .vc-wave-area {
    width: 90vw;
  }
}

/* ---- WhatsApp phone container (1:1 replica) ---- */
.wa-phone-container {
  width: 100%;
  max-width: 420px;
  height: 90vh;
  max-height: 780px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.05),
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 10px 20px -5px rgba(0, 0, 0, 0.15),
    0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  background: #fff;
}

/* WA header - frosted glass over chat background */
.wa-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(245, 245, 245, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #111;
  flex-shrink: 0;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}

.wa-header-back {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  color: #007AFF;
}

.wa-header-back svg {
  width: 22px;
  height: 22px;
}

.wa-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

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

.wa-header-info {
  flex: 1;
  min-width: 0;
}

.wa-header-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: #000;
}

.wa-header-status {
  font-size: 12px;
  color: #667781;
}

/* WA chat area - iOS WA style warm off-white */
.wa-chat-area {
  flex: 1;
  overflow-y: auto;
  background: #EFEAE2;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* WA chat wallpaper pattern (subtle) */
.wa-chat-area::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
}

.wa-chat-area {
  position: relative;
}

/* WA message bubbles */
.wa-bubble {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
}

.wa-bubble.sent {
  align-self: flex-end;
  background: #DCF8C6;
  border-top-right-radius: 2px;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.08);
}

.wa-bubble.received {
  align-self: flex-start;
  background: #FFFFFF;
  border-top-left-radius: 2px;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.08);
}

.wa-bubble-content {
  margin-bottom: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.wa-bubble-content strong {
  font-weight: 600;
}

.wa-bubble-content .wa-blockquote {
  border-left: 3px solid rgba(0, 0, 0, 0.15);
  padding-left: 10px;
  margin: 6px 0;
  color: rgba(0, 0, 0, 0.8);
}

.wa-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.wa-bubble-time {
  font-size: 11px;
  color: #667781;
}

.wa-bubble.sent .wa-bubble-time {
  color: #4a7c59;
}

.wa-bubble-ticks {
  color: #53bdeb;
}

.wa-bubble-ticks svg {
  width: 16px;
  height: 16px;
}

/* WA input bar - frosted glass */
.wa-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 8px 10px;
  background: rgba(245, 245, 245, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex-shrink: 0;
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
}

.wa-plus-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  flex-shrink: 0;
  color: #007AFF;
  margin-bottom: 2px;
}

.wa-plus-btn svg {
  width: 28px;
  height: 28px;
}

.wa-input-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: #fff;
  border-radius: 20px;
  padding: 8px 12px;
  min-height: 36px;
  border: 0.5px solid rgba(0, 0, 0, 0.12);
}

.wa-input-wrap textarea {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  background: transparent;
  resize: none;
  overflow-y: auto;
  min-height: 20px;
  max-height: 120px;
  line-height: 1.35;
}

.wa-input-wrap textarea::placeholder {
  color: #8e8e93;
}

.wa-sticker-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  color: #8e8e93;
  flex-shrink: 0;
  padding: 0;
}

.wa-sticker-btn svg {
  width: 24px;
  height: 24px;
}

.wa-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #25D366;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
  margin-bottom: 2px;
}

.wa-send-btn:hover {
  background: #20bd5a;
}

.wa-send-btn svg {
  width: 18px;
  height: 18px;
  color: white;
  margin-left: 1px;
}

/* ---- Demo customizer modal ---- */
.demo-customizer-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.demo-customizer-overlay.hidden {
  display: none;
}

.demo-customizer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(10px);
}

.demo-customizer-modal {
  position: relative;
  width: min(100%, 420px);
  padding: 24px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  border: 1px solid rgba(229, 231, 235, 0.9);
}

.demo-customizer-title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 600;
  color: #111827;
}

.demo-customizer-tabs {
  display: flex;
  gap: 8px;
  padding: 4px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: #f3f4f6;
}

.demo-customizer-tab {
  flex: 1;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #6b7280;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.demo-customizer-tab.active {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.demo-customizer-copy {
  margin: 0 0 16px;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.5;
}

.demo-customizer-fields.hidden {
  display: none;
}

.demo-customizer-label {
  display: block;
  margin: 0 0 6px;
  color: #374151;
  font-size: 14px;
  font-weight: 600;
}

.demo-customizer-input {
  width: 100%;
  margin: 0 0 14px;
  padding: 11px 12px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  background: #fff;
  color: #111827;
  font-size: 14px;
}

.demo-customizer-input:focus {
  outline: none;
  border-color: #f28c28;
  box-shadow: 0 0 0 3px rgba(242, 140, 40, 0.16);
}

.demo-customizer-dropzone {
  margin-bottom: 8px;
  padding: 18px;
  border: 2px dashed #d1d5db;
  border-radius: 14px;
  background: #f9fafb;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.demo-customizer-dropzone.dragging {
  border-color: #f28c28;
  background: rgba(242, 140, 40, 0.08);
}

.demo-customizer-hint {
  margin: -2px 0 8px;
  font-size: 12px;
  line-height: 1.5;
  color: #9ca3af;
}

.demo-customizer-dropzone-copy {
  color: #6b7280;
  text-align: center;
  font-size: 14px;
}

.demo-customizer-logo-preview.hidden {
  display: none;
}

.demo-customizer-logo-preview {
  display: flex;
  align-items: center;
  gap: 12px;
}

.demo-customizer-logo-preview img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: contain;
  background: rgba(17, 24, 39, 0.06);
}

.demo-customizer-logo-meta {
  min-width: 0;
}

.demo-customizer-logo-meta p {
  margin: 0;
}

.demo-customizer-logo-meta p:first-child {
  color: #111827;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-customizer-logo-meta p:last-child {
  margin-top: 4px;
  color: #6b7280;
  font-size: 12px;
}

.demo-customizer-error.hidden {
  display: none;
}

.demo-customizer-error {
  margin: 8px 0 0;
  color: #dc2626;
  font-size: 14px;
}

.demo-customizer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.demo-customizer-secondary,
.demo-customizer-primary {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.demo-customizer-secondary {
  background: #f3f4f6;
  color: #111827;
}

.demo-customizer-primary {
  background: #f28c28;
  color: #fff;
}

.demo-customizer-primary:hover {
  background: #df7d1f;
}
