/* ============================================================
   Voice AI Agent — Premium Dark Glassmorphic Theme
   ============================================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.07);
  --text-primary: #f0f0f5;
  --text-secondary: #8888a0;
  --text-muted: #55556a;
  --accent: #7c6aef;
  --accent-glow: rgba(124, 106, 239, 0.35);
  --accent-light: #a594ff;
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --user-bubble: rgba(124, 106, 239, 0.15);
  --ai-bubble: rgba(255, 255, 255, 0.05);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 999px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Animated background gradient */
.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(124, 106, 239, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(168, 85, 247, 0.05) 0%, transparent 40%);
  animation: bgShift 20s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes bgShift {
  0%   { transform: scale(1) translate(0, 0); }
  50%  { transform: scale(1.05) translate(-2%, 3%); }
  100% { transform: scale(1) translate(2%, -2%); }
}

/* Floating particles */
.particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(124, 106, 239, 0.25);
  animation: float linear infinite;
}

@keyframes float {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ---- Layout ---- */
.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 12px;
  border-bottom: 1px solid var(--glass-border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #a855f7);
  color: #fff;
}

.logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  backdrop-filter: blur(12px);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(0.85); }
}

.status-badge.listening .status-dot { background: var(--accent-light); box-shadow: 0 0 8px var(--accent-glow); }
.status-badge.thinking .status-dot  { background: var(--warning); box-shadow: 0 0 8px rgba(251, 191, 36, 0.4); }
.status-badge.speaking .status-dot  { background: #60a5fa; box-shadow: 0 0 8px rgba(96, 165, 250, 0.4); }
.status-badge.error .status-dot     { background: var(--danger); box-shadow: 0 0 8px rgba(248, 113, 113, 0.4); }

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: 16px;
}

/* Conversation Panel */
.conversation-panel {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 8px;
  scroll-behavior: smooth;
}

.conversation-panel::-webkit-scrollbar { width: 5px; }
.conversation-panel::-webkit-scrollbar-track { background: transparent; }
.conversation-panel::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  animation: fadeIn 0.6s ease;
}

.empty-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--accent);
  margin-bottom: 20px;
  animation: gentleFloat 4s ease-in-out infinite;
}

@keyframes gentleFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.empty-state h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Messages */
.messages-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  gap: 12px;
  animation: slideUp 0.35s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.message.user { flex-direction: row-reverse; }

.message-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
}

.message.user .message-avatar {
  background: linear-gradient(135deg, var(--accent), #a855f7);
}

.message.assistant .message-avatar {
  background: linear-gradient(135deg, #3b82f6, #2dd4bf);
}

.message-bubble {
  max-width: 75%;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  line-height: 1.6;
  position: relative;
}

.message.user .message-bubble {
  background: var(--user-bubble);
  border: 1px solid rgba(124, 106, 239, 0.2);
  border-top-right-radius: 4px;
  color: var(--text-primary);
}

.message.assistant .message-bubble {
  background: var(--ai-bubble);
  border: 1px solid var(--glass-border);
  border-top-left-radius: 4px;
  color: var(--text-primary);
  backdrop-filter: blur(8px);
}

/* Typing indicator */
.typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 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 typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

/* ---- Transcript Bar ---- */
.transcript-bar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  margin: 8px 0;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  animation: fadeIn 0.3s ease;
}

.transcript-bar.visible {
  display: flex;
}

.transcript-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-light);
  white-space: nowrap;
}

.transcript-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse-dot 1s ease-in-out infinite;
}

.transcript-text {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Mic Button ---- */
.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 28px;
  gap: 10px;
}

.mic-button {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 24px var(--accent-glow);
  z-index: 2;
}

.mic-button:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 32px var(--accent-glow);
}

.mic-button:active {
  transform: scale(0.96);
}

.mic-button.listening {
  background: linear-gradient(135deg, #ef4444, #f97316);
  box-shadow: 0 4px 24px rgba(239, 68, 68, 0.35);
}

.mic-icon, .mic-icon-stop {
  position: relative;
  z-index: 2;
}

/* Pulse Rings */
.mic-rings {
  position: absolute;
  inset: -20px;
  pointer-events: none;
}

.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  transform: scale(0.7);
}

.mic-button.listening .ring {
  animation: ringPulse 2s ease-out infinite;
}

.mic-button.listening .ring-1 { animation-delay: 0s; border-color: #ef4444; }
.mic-button.listening .ring-2 { animation-delay: 0.5s; border-color: #f97316; }
.mic-button.listening .ring-3 { animation-delay: 1s; border-color: #fbbf24; }

@keyframes ringPulse {
  0%   { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(1.3); opacity: 0; }
}

.mic-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .app-container { padding: 0 14px; }
  .message-bubble { max-width: 85%; }
  .mic-button { width: 64px; height: 64px; }
}
