/* Chat Funnel — front-end chat (WhatsApp style) */

.cf-chat * { box-sizing: border-box; }

.cf-chat {
  --cf-primary: #25d366;
  --cf-header: #075e54;
  --cf-bg: #efe7dd;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body.cf-lock { overflow: hidden; }

.cf-chat.cf-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 999999;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

.cf-stage {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  background: #000;
}

.cf-phone {
  width: 100%;
  max-width: 520px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--cf-bg);
  position: relative;
}

.cf-chat.cf-embedded .cf-phone {
  height: 600px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,.18);
}

/* Header */
.cf-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--cf-header);
  color: #fff;
  flex-shrink: 0;
}
.cf-header img {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,.2);
}
.cf-header-text { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.cf-name { font-weight: 600; font-size: 16px; }
.cf-status { font-size: 12px; opacity: .85; }
.cf-reset {
  background: transparent; border: none; color: #fff;
  font-size: 18px; cursor: pointer; opacity: .8; padding: 4px 8px;
}
.cf-reset:hover { opacity: 1; }

/* Messages */
.cf-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cf-bubble {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: cf-pop .18s ease;
}
@keyframes cf-pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
.cf-bot {
  align-self: flex-start;
  background: #fff;
  border-top-left-radius: 4px;
  box-shadow: 0 1px 1px rgba(0,0,0,.07);
}
.cf-user {
  align-self: flex-end;
  background: #dcf8c6;
  border-top-right-radius: 4px;
  box-shadow: 0 1px 1px rgba(0,0,0,.07);
}

/* Image bubble */
.cf-image-bubble { padding: 4px; }
.cf-photo {
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0,0,0,.05);
  aspect-ratio: var(--cf-ratio, 4 / 5);
}
.cf-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cf-caption { display: block; font-size: 13px; color: #555; padding: 6px 6px 2px; }

/* Card bubble */
.cf-card-bubble { display: flex; flex-direction: column; gap: 8px; max-width: 88%; }
.cf-card-title { font-size: 16px; font-weight: 600; }
.cf-card-text { font-size: 14px; color: #444; }
.cf-card-button {
  display: block;
  text-align: center;
  text-decoration: none;
  background: var(--cf-primary);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  border: 2px solid var(--cf-primary);
}
.cf-card-button + .cf-card-button { margin-top: 4px; }
.cf-card-button-outline {
  background: transparent !important;
  color: var(--cf-primary) !important;
  border: 2px solid var(--cf-cta-bg, var(--cf-primary)) !important;
}
.cf-card-button-pulse { animation: cf-pulse 1.6s ease-in-out infinite; }
@keyframes cf-pulse {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0 rgba(37,211,102,.45); }
  70%  { transform: scale(1.03); box-shadow: 0 0 0 12px rgba(37,211,102,0); }
  100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(37,211,102,0); }
}

/* Typing indicator */
.cf-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.cf-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #b0b0b0; animation: cf-blink 1.2s infinite both;
}
.cf-typing span:nth-child(2) { animation-delay: .2s; }
.cf-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes cf-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

/* Options */
.cf-options {
  padding: 10px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.cf-option {
  background: #fff;
  border: 1.5px solid var(--cf-primary);
  color: var(--cf-header);
  border-radius: 22px;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background .15s, transform .1s;
}
.cf-option:hover { background: #f0fff5; }
.cf-option:active { transform: scale(.98); }
.cf-option-primary { background: var(--cf-primary); color: #fff; }
.cf-ended { text-align: center; color: #888; font-size: 13px; padding: 8px; }
.cf-error { padding: 16px; color: #a00; font-family: sans-serif; }

/* Push modal */
.cf-push-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 10;
}
.cf-push-modal {
  background: #fff; border-radius: 16px; padding: 22px 20px;
  max-width: 320px; text-align: center; position: relative;
}
.cf-push-modal img { width: 56px; height: 56px; border-radius: 50%; margin-bottom: 10px; }
.cf-push-title { display: block; font-weight: 600; font-size: 16px; margin-bottom: 6px; }
.cf-push-text { display: block; font-size: 14px; color: #555; margin-bottom: 14px; }
.cf-push-actions { display: flex; flex-direction: column; gap: 8px; }
.cf-push-allow { background: var(--cf-primary); color: #fff; border: none; padding: 11px; border-radius: 10px; font-weight: 600; cursor: pointer; }
.cf-push-deny { background: transparent; border: none; color: #888; padding: 6px; cursor: pointer; }

@media (max-width: 560px) {
  .cf-bubble { font-size: 15px; max-width: 86%; }
}
@media (prefers-reduced-motion: reduce) {
  .cf-card-button-pulse, .cf-bubble { animation: none; }
}
