/* IPA Master - Custom Styles & Animations */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --secondary: #06b6d4;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --font-ipa: "Lucida Sans Unicode", "Segoe UI", "Arial Unicode MS", "DejaVu Sans", sans-serif;
}

.dark {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #312e81;
  --secondary: #22d3ee;
  --accent: #fbbf24;
  --success: #34d399;
  --danger: #f87171;
  --bg-main: #0f172a;
  --card-bg: #1e293b;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  transition: background-color 0.25s ease, color 0.25s ease;
  min-height: 100vh;
}

.font-ipa {
  font-family: var(--font-ipa);
}

/* Glass effect */
.glass-panel {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.8);
}
.dark .glass-panel {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(51, 65, 85, 0.8);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.dark ::-webkit-scrollbar-thumb {
  background: #475569;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* IPA Sound Badges & Cards */
.ipa-badge {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.ipa-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Glowing Border for Active/Completed items */
.glow-primary {
  box-shadow: 0 0 15px rgba(79, 70, 229, 0.35);
}
.glow-gold {
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.45);
}
.glow-success {
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.4);
}

/* Voice Wave Animation */
.wave-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 24px;
}

.wave-bar {
  width: 3px;
  background-color: currentColor;
  border-radius: 3px;
  height: 8px;
  transition: height 0.1s ease;
}

.is-listening .wave-bar:nth-child(1) { animation: wave 1s infinite ease-in-out; }
.is-listening .wave-bar:nth-child(2) { animation: wave 0.8s infinite ease-in-out 0.2s; }
.is-listening .wave-bar:nth-child(3) { animation: wave 1.2s infinite ease-in-out 0.4s; }
.is-listening .wave-bar:nth-child(4) { animation: wave 0.9s infinite ease-in-out 0.1s; }
.is-listening .wave-bar:nth-child(5) { animation: wave 1.1s infinite ease-in-out 0.3s; }

@keyframes wave {
  0%, 100% { height: 6px; }
  50% { height: 24px; }
}

/* Flashcard Pulse & Triumph Animation */
@keyframes correctPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); box-shadow: 0 0 30px rgba(16, 185, 129, 0.4); }
  100% { transform: scale(1); }
}

.animate-correct {
  animation: correctPulse 0.5s ease-out;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.animate-error {
  animation: shakeError 0.4s ease-in-out;
}

/* Highlight target sound letters in words */
.sound-highlight {
  color: #4f46e5;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 3px;
}
.dark .sound-highlight {
  color: #818cf8;
}

/* Milestone Pin */
.milestone-node {
  position: relative;
  transition: all 0.3s ease;
}
.milestone-node.active {
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(79, 70, 229, 0.4);
}

/* Modal transition */
.modal-overlay {
  transition: opacity 0.25s ease-out;
}

/* Tooltip */
[data-tooltip] {
  position: relative;
}
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background-color: #1e293b;
  color: #ffffff;
  font-size: 11px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.2s;
  z-index: 50;
  margin-bottom: 6px;
}
