/* ==========================================================================
   John Pork — chatbot styles
   base.css handles tokens, reset, body, Inter font, .home-btn, focus, site-foot
   ========================================================================== */

:root {
  --pork: #ff8ab3;
  --pork-soft: rgba(255, 138, 179, 0.16);
  --bubble-me: linear-gradient(160deg, #ff8ab3, #e0639a);
  --bubble-bot: rgba(255, 255, 255, 0.06);
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ---------- Incoming call ---------- */
.call {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  text-align: center;
  padding: var(--space-5) var(--space-4) calc(var(--space-7) + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 138, 179, 0.18), transparent 60%),
    var(--bg);
}

.call-status {
  margin: 0;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
}
.dots i { animation: blink 1.4s infinite both; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }

.avatar {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 38%, #2a1a22, #14101a);
  box-shadow: 0 0 0 4px rgba(255, 138, 179, 0.25), var(--shadow-soft);
}
.avatar .pig { width: 78%; height: 78%; }
.avatar.ring { animation: ring-shake 1.1s ease-in-out infinite; }
.avatar.ring::after {
  content: "";
  position: absolute;
  width: 148px; height: 148px;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(255, 138, 179, 0.5);
  animation: ring-pulse 1.6s ease-out infinite;
}
@keyframes ring-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-7deg); }
  40% { transform: rotate(6deg); }
  60% { transform: rotate(-4deg); }
  80% { transform: rotate(3deg); }
}
@keyframes ring-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 138, 179, 0.45); }
  100% { box-shadow: 0 0 0 36px rgba(255, 138, 179, 0); }
}

.call-name {
  margin: 0;
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.02em;
}
.call-sub { margin: 0; color: var(--muted); font-size: 0.95rem; }

.call-actions {
  margin-top: var(--space-4);
  display: flex;
  gap: var(--space-6);
}
.call-btn {
  width: 68px; height: 68px;
  border-radius: 50%;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.call-btn svg { width: 28px; height: 28px; }
.call-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.call-btn:active { transform: scale(0.94); }
.call-btn.accept {
  background: #21c46a;
  box-shadow: 0 10px 26px rgba(33, 196, 106, 0.4);
  animation: jiggle 1.1s ease-in-out infinite;
}
.call-btn.decline {
  background: #ff4d61;
  box-shadow: 0 10px 26px rgba(255, 77, 97, 0.4);
}
.call-btn.decline svg { transform: rotate(135deg); }
@keyframes jiggle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* ---------- Chat ---------- */
.chat {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  height: 100dvh;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: calc(var(--space-3) + env(safe-area-inset-top)) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--line);
  background: rgba(13, 13, 18, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.chat-head .avatar.sm {
  width: 44px; height: 44px;
  box-shadow: 0 0 0 2px rgba(255, 138, 179, 0.3);
}
.chat-id { display: flex; flex-direction: column; line-height: 1.25; margin-right: auto; }
.chat-id strong { font-size: 1rem; }
.status { font-size: 0.78rem; color: #5fd08a; }
.status.typing { color: var(--pork); }

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--pork);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--surface-hover); transform: translateY(-1px); }

/* messages */
.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  scroll-behavior: smooth;
}
.msg {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.97rem;
  line-height: 1.45;
  word-wrap: break-word;
  animation: pop-in 0.22s ease;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
.msg.bot {
  align-self: flex-start;
  background: var(--bubble-bot);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}
.msg.me {
  align-self: flex-end;
  background: var(--bubble-me);
  color: #fff;
  border-bottom-right-radius: 5px;
}

/* typing indicator */
.typing-bubble {
  align-self: flex-start;
  display: inline-flex;
  gap: 5px;
  padding: 14px 16px;
  background: var(--bubble-bot);
  border: 1px solid var(--line);
  border-radius: 16px;
  border-bottom-left-radius: 5px;
}
.typing-bubble span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--pork);
  animation: typing 1.2s infinite ease-in-out;
}
.typing-bubble span:nth-child(2) { animation-delay: 0.18s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.36s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* quick-reply chips */
.chips {
  display: flex;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip-btn {
  flex: 0 0 auto;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--pork-soft);
  background: var(--pork-soft);
  color: var(--pork);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, transform 0.15s ease;
}
.chip-btn:hover { background: rgba(255, 138, 179, 0.26); transform: translateY(-1px); }
.chip-btn:active { transform: scale(0.96); }

/* composer */
.composer {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(13, 13, 18, 0.9);
}
.composer input {
  flex: 1 1 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 12px 18px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
.composer input:focus { outline: none; border-color: var(--pork); box-shadow: 0 0 0 3px var(--pork-soft); }
.send {
  flex: 0 0 auto;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--pork);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.send svg { width: 22px; height: 22px; }
.send:hover { filter: brightness(1.08); transform: translateY(-1px); }
.send:active { transform: scale(0.92); }

@media (max-width: 600px) {
  .msg { max-width: 84%; }
  .avatar { width: 128px; height: 128px; }
  .avatar.ring::after { width: 128px; height: 128px; }
}
