/* ============================================
   Voice Call Interface — Dr. Jonah Tebaa
   Premium dark theme, mobile-first
   ============================================ */

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-card: #1a1a2e;
  --bg-card-alt: #16162a;
  --bg-elevated: #1e1e3a;
  --accent: #2563eb;
  --accent-light: #3b82f6;
  --accent-glow: rgba(37, 99, 235, 0.3);
  --accent-subtle: rgba(37, 99, 235, 0.08);
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --border: rgba(255, 255, 255, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-full: 9999px;
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px var(--accent-glow);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Background Effects */
.page-wrapper {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.bg-glow--1 {
  width: 600px;
  height: 600px;
  background: var(--accent);
  top: -200px;
  right: -200px;
}

.bg-glow--2 {
  width: 400px;
  height: 400px;
  background: #7c3aed;
  bottom: -100px;
  left: -100px;
}

/* Header */
.header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  background: rgba(10, 10, 10, 0.8);
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.header__icon {
  width: 22px;
  height: 22px;
  color: var(--accent-light);
}

.header__back {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.header__back:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Main */
.main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px 60px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* Intro */
.intro {
  text-align: center;
  margin-bottom: 48px;
}

.intro__title {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.intro__highlight {
  background: linear-gradient(135deg, var(--accent-light), #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.intro__subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 12px;
}

.intro__description {
  font-size: 0.925rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Call Interface */
.call-interface {
  width: 100%;
  max-width: 440px;
  margin-bottom: 60px;
}

.call-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 48px 32px;
  background: linear-gradient(180deg, var(--bg-card), var(--bg-card-alt));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.call-state--hidden {
  display: none;
}

/* Avatar */
.call-avatar {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-avatar__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.08);
  transition: all var(--transition);
}

.call-avatar__ring--pulse {
  border-color: var(--accent);
  animation: ring-pulse 1.5s ease-in-out infinite;
}

.call-avatar__ring--active {
  border-color: var(--success);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.2);
}

.call-avatar__ring--error {
  border-color: var(--error);
}

.call-avatar__inner {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.call-avatar__inner svg {
  width: 36px;
  height: 36px;
  color: var(--text-secondary);
}

.call-avatar--connecting .call-avatar__inner {
  background: var(--accent-subtle);
}

.call-avatar--active .call-avatar__inner {
  background: rgba(16, 185, 129, 0.1);
}

.call-avatar--active .call-avatar__inner svg {
  color: var(--success);
}

.call-avatar__inner--error {
  background: rgba(239, 68, 68, 0.1) !important;
}

.call-avatar__inner--error svg {
  color: var(--error) !important;
}

/* Speaking animation on avatar */
.call-avatar--speaking .call-avatar__ring--active {
  animation: speaking-ring 0.6s ease-in-out infinite alternate;
}

@keyframes speaking-ring {
  from {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
    transform: scale(1);
  }
  to {
    box-shadow: 0 0 40px rgba(16, 185, 129, 0.4);
    transform: scale(1.05);
  }
}

@keyframes ring-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.08);
  }
}

/* Spinner */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--accent-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Audio Visualizer */
.visualizer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 48px;
  padding: 0 8px;
}

.visualizer__bar {
  width: 3px;
  height: 4px;
  min-height: 4px;
  background: var(--accent-light);
  border-radius: 2px;
  transition: height 0.08s ease;
}

.visualizer--active .visualizer__bar {
  animation: bar-idle 1.2s ease-in-out infinite;
}

.visualizer__bar:nth-child(1)  { animation-delay: 0s; }
.visualizer__bar:nth-child(2)  { animation-delay: 0.05s; }
.visualizer__bar:nth-child(3)  { animation-delay: 0.1s; }
.visualizer__bar:nth-child(4)  { animation-delay: 0.15s; }
.visualizer__bar:nth-child(5)  { animation-delay: 0.2s; }
.visualizer__bar:nth-child(6)  { animation-delay: 0.25s; }
.visualizer__bar:nth-child(7)  { animation-delay: 0.3s; }
.visualizer__bar:nth-child(8)  { animation-delay: 0.35s; }
.visualizer__bar:nth-child(9)  { animation-delay: 0.4s; }
.visualizer__bar:nth-child(10) { animation-delay: 0.45s; }
.visualizer__bar:nth-child(11) { animation-delay: 0.5s; }
.visualizer__bar:nth-child(12) { animation-delay: 0.55s; }
.visualizer__bar:nth-child(13) { animation-delay: 0.6s; }
.visualizer__bar:nth-child(14) { animation-delay: 0.65s; }
.visualizer__bar:nth-child(15) { animation-delay: 0.7s; }
.visualizer__bar:nth-child(16) { animation-delay: 0.75s; }
.visualizer__bar:nth-child(17) { animation-delay: 0.8s; }
.visualizer__bar:nth-child(18) { animation-delay: 0.85s; }
.visualizer__bar:nth-child(19) { animation-delay: 0.9s; }
.visualizer__bar:nth-child(20) { animation-delay: 0.95s; }

@keyframes bar-idle {
  0%, 100% { height: 4px; }
  50% { height: 12px; }
}

/* Call Info */
.call-info {
  text-align: center;
}

.call-status {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.call-status--live {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--success);
  font-weight: 600;
}

.call-status--error {
  color: var(--error);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: live-pulse 1.5s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.call-timer {
  font-size: 2rem;
  font-weight: 300;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* Speaking Indicator */
.speaking-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

.speaking-indicator__label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.speaking-indicator--bot-speaking .speaking-indicator__label {
  color: var(--accent-light);
}

.speaking-indicator--user-speaking .speaking-indicator__label {
  color: var(--success);
}

/* Dots animation */
.dots span {
  animation: dot-blink 1.4s infinite;
  opacity: 0;
}
.dots span:nth-child(1) { animation-delay: 0s; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-blink {
  0%, 20% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

/* Call Hint */
.call-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* Buttons */
.btn-call {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 40px;
  border: none;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: -0.01em;
}

.btn-call svg {
  width: 20px;
  height: 20px;
}

.btn-call--start {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-call--start:hover {
  background: var(--accent-light);
  box-shadow: 0 8px 30px var(--accent-glow);
  transform: translateY(-2px);
}

.btn-call--start:active {
  transform: translateY(0);
}

.btn-call--end {
  background: var(--error);
  color: white;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

.btn-call--end:hover {
  background: #dc2626;
  box-shadow: 0 8px 30px rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}

.btn-call--end:active {
  transform: translateY(0);
}

.btn-call--cancel {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 10px 28px;
  font-size: 0.9rem;
}

.btn-call--cancel:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-call:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
  max-width: 700px;
}

.feature {
  text-align: center;
  padding: 28px 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.feature:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.feature__icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-subtle);
  border-radius: 12px;
}

.feature__icon svg {
  width: 22px;
  height: 22px;
  color: var(--accent-light);
}

.feature h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.feature p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Footer */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px 32px;
  border-top: 1px solid var(--border);
}

.footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent-light);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}

.footer a:hover {
  color: var(--text-primary);
}

.footer__sub {
  font-size: 0.75rem;
  margin-top: 4px;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
  .header {
    padding: 16px 20px;
  }

  .main {
    padding: 32px 16px 48px;
  }

  .intro__title {
    font-size: 1.65rem;
  }

  .intro__subtitle {
    font-size: 0.95rem;
  }

  .intro__description {
    font-size: 0.85rem;
  }

  .call-state {
    padding: 36px 24px;
  }

  .call-timer {
    font-size: 1.75rem;
  }

  .features {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .feature {
    padding: 20px 16px;
  }

  .btn-call {
    padding: 14px 32px;
  }
}

@media (max-width: 380px) {
  .intro__title {
    font-size: 1.4rem;
  }

  .call-avatar {
    width: 100px;
    height: 100px;
  }

  .call-avatar__inner {
    width: 68px;
    height: 68px;
  }

  .visualizer {
    gap: 2px;
  }

  .visualizer__bar {
    width: 2px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles */
.btn-call:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 3px;
}

.header__back:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}
