/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-dark: #0d0d1a;
  --bg-surface: #1a1a2e;
  --pink-primary: #d946ef;
  --pink-hot: #ec4899;
  --pink-deep: #be185d;
  --magenta: #c026d3;
  --red-accent: #ef4444;
  --green-accent: #22c55e;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-muted: rgba(255, 255, 255, 0.35);
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --user-bubble: linear-gradient(135deg, #7c3aed, #6d28d9);
  --ai-bubble-bg: #1e1e36;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #fce7f3 0%, #f9a8d4 30%, #f0abfc 60%, #fce7f3 100%);
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
  -webkit-font-smoothing: antialiased;
}

/* ===== PHONE SHELL ===== */
.phone-shell {
  width: 360px; height: 720px;
  background: var(--bg-dark); border-radius: 44px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.05), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: phoneEntry 0.6s ease-out both;
}
@keyframes phoneEntry { from { opacity: 0; transform: translateY(30px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

.notch { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 130px; height: 30px; background: #000; border-radius: 0 0 20px 20px; z-index: 20; }

/* ===== STATUS BAR ===== */
.status-bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 28px 6px; color: var(--text-primary); font-size: 0.78rem; font-weight: 600; z-index: 15; position: relative; flex-shrink: 0; }
.status-icons { display: flex; gap: 6px; align-items: center; }

/* ===== HEADER ===== */
.recording-header { display: flex; align-items: center; gap: 12px; padding: 10px 20px 12px; border-bottom: 1px solid var(--glass-border); flex-shrink: 0; width: 100%; }
.recording-header-title { color: var(--text-primary); font-size: 0.9rem; font-weight: 600; flex: 1; }
.recording-status { color: var(--green-accent); font-size: 0.68rem; font-weight: 400; }

/* ===== VOICE WAVEFORM BAR ===== */
.waveform-bar { width: 100%; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.02); border-bottom: 1px solid var(--glass-border); }
.waveform-bar canvas { width: 100%; height: 40px; }

/* ===== CONVERSATION AREA ===== */
.conversation-area { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; width: 100%; scroll-behavior: smooth; }
.conversation-area::-webkit-scrollbar { width: 3px; }
.conversation-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; }

/* ===== MESSAGE BUBBLES ===== */
.msg-wrapper { width: 100%; animation: msgIn 0.3s ease-out both; }
.msg-label { color: var(--text-muted); font-size: 0.7rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.msg-user-bubble { background: var(--user-bubble); color: white; padding: 12px 16px; border-radius: 18px; border-bottom-right-radius: 6px; font-size: 0.82rem; line-height: 1.6; word-wrap: break-word; }
.msg-user-bubble.partial { opacity: 0.5; font-style: italic; }
.msg-ai-bubble { background: var(--ai-bubble-bg); color: var(--text-primary); border: 1px solid var(--glass-border); padding: 12px 16px; border-radius: 18px; border-bottom-left-radius: 6px; font-size: 0.82rem; line-height: 1.6; word-wrap: break-word; white-space: pre-wrap; }
.msg-ai-bubble.typing::after { content: ''; display: inline-block; width: 2px; height: 0.85em; background: var(--pink-primary); margin-left: 3px; vertical-align: text-bottom; animation: blink 1s step-end infinite; }

.msg-separator { width: 100%; height: 1px; background: var(--glass-border); margin: 4px 0; }

@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 50% { opacity: 0; } }

/* Typing indicator */
.typing-indicator { display: flex; gap: 4px; padding: 14px 18px; }
.typing-indicator span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); animation: dotBounce 1.4s ease-in-out infinite; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce { 0%,60%,100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-6px); opacity: 1; } }

/* ===== MIC BOTTOM AREA ===== */
.mic-bottom-area { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0 8px; flex-shrink: 0; border-top: 1px solid var(--glass-border); }

.mic-label { color: var(--text-muted); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.03em; transition: color 0.2s; }
.mic-label.active { color: var(--pink-primary); }

.mic-hold-container { position: relative; width: 110px; height: 110px; display: flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; -webkit-user-select: none; }

.mic-hold-circle { width: 96px; height: 96px; border-radius: 50%; background: linear-gradient(145deg, var(--magenta), var(--pink-hot), var(--pink-deep)); display: flex; align-items: center; justify-content: center; position: relative; z-index: 2; box-shadow: 0 4px 20px rgba(217,70,239,0.35), 0 0 40px rgba(217,70,239,0.12); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.mic-hold-container:hover .mic-hold-circle { transform: scale(1.06); box-shadow: 0 6px 28px rgba(217,70,239,0.5), 0 0 60px rgba(217,70,239,0.2); }
.mic-hold-container:active .mic-hold-circle { transform: scale(0.92); }

.mic-hold-icon { width: 44px; height: 44px; }

.mic-hold-glow { position: absolute; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, rgba(217,70,239,0.2) 0%, transparent 70%); z-index: 1; opacity: 0; transition: opacity 0.3s; }
.mic-hold-container.recording .mic-hold-glow { opacity: 1; }

.mic-hold-pulse { position: absolute; width: 96px; height: 96px; border-radius: 50%; border: 2px solid rgba(217,70,239,0.3); z-index: 1; opacity: 0; pointer-events: none; }
.mic-hold-container.recording .mic-hold-pulse { animation: pulse-ring 2s ease-out infinite; }
@keyframes pulse-ring { 0% { transform: scale(1); opacity: 0.6; } 100% { transform: scale(1.8); opacity: 0; } }

/* Circular wave ripples around mic while recording — pink/magenta gradient rings */
.mic-hold-wave {
  position: absolute;
  top: 50%; left: 50%;
  width: 96px; height: 96px;
  margin: -48px 0 0 -48px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: conic-gradient(from 0deg,
      #d946ef,   /* pink */
      #ec4899,   /* hot pink */
      #f97316,   /* amber accent */
      #c026d3,   /* magenta */
      #8b5cf6,   /* violet */
      #06b6d4,   /* cyan sparkle */
      #ec4899,
      #d946ef) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  box-shadow:
      0 0 22px rgba(217,70,239,0.55),
      0 0 40px rgba(236,72,153,0.35),
      0 0 60px rgba(139,92,246,0.25),
      0 0 80px rgba(6,182,212,0.15);
  z-index: 1;
  opacity: 0;
  pointer-events: none;
}
.mic-hold-container.recording .mic-hold-wave { animation: mic-wave 2.2s cubic-bezier(0.2,0.8,0.2,1) infinite, mic-wave-spin 4s linear infinite; }
.mic-hold-container.recording .mic-hold-wave-2 { animation-delay: 0.55s, 0s; }
.mic-hold-container.recording .mic-hold-wave-3 { animation-delay: 1.10s, 0s; }
.mic-hold-container.recording .mic-hold-wave-4 { animation-delay: 1.65s, 0s; }
@keyframes mic-wave {
  0%   { transform: scale(0.85) rotate(0deg);   opacity: 0.9;  border-width: 3px; }
  70%  { opacity: 0.3; border-width: 2px; }
  100% { transform: scale(2.4)  rotate(180deg); opacity: 0;    border-width: 1px; }
}
@keyframes mic-wave-spin { to { filter: hue-rotate(360deg); } }

/* Rotating conic halo behind the rings — constant glow, not expanding */
.mic-hold-conic {
  position: absolute;
  top: 50%; left: 50%;
  width: 130px; height: 130px;
  margin: -65px 0 0 -65px;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
      rgba(217,70,239,0.0),
      rgba(217,70,239,0.6),
      rgba(236,72,153,0.65),
      rgba(249,115,22,0.45),
      rgba(192,38,211,0.6),
      rgba(139,92,246,0.55),
      rgba(6,182,212,0.45),
      rgba(236,72,153,0.6),
      rgba(217,70,239,0.0));
  filter: blur(10px);
  opacity: 0;
  z-index: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.mic-hold-container.recording .mic-hold-conic { opacity: 0.85; animation: mic-halo-spin 3.5s linear infinite; }
@keyframes mic-halo-spin { to { transform: rotate(360deg); } }

/* Recording state — keep pink gradient (matches UI), brighter glow */
.mic-hold-container.recording .mic-hold-circle {
  background: linear-gradient(145deg, var(--pink-hot), var(--pink-primary), var(--magenta));
  box-shadow: 0 4px 28px rgba(217,70,239,0.55), 0 0 60px rgba(236,72,153,0.3);
}
.mic-hold-container.recording .mic-hold-pulse { border-color: rgba(217,70,239,0.45); }

/* ===== HOME INDICATOR ===== */
.home-indicator { width: 130px; height: 4px; background: rgba(255,255,255,0.2); border-radius: 4px; margin: 6px auto 8px; flex-shrink: 0; }

/* ===== RESPONSIVE ===== */
@media (max-width: 400px) {
  .phone-shell { width: 100%; height: 100vh; border-radius: 0; border: none; }
  body { padding: 0; background: var(--bg-dark); }
}
