/* EnglishFlow - AI Speaking & Pronunciation Lab Styles */

.speaking-lab-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 24px;
  min-height: 720px;
}

/* --- SCENARIO SELECTOR SIDEBAR --- */
.scenario-selector-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-card);
}

.sidebar-scenario-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-scenario-header .sub-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: block;
  margin-top: 4px;
}

.scenarios-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.scenario-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.scenario-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.scenario-card.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(59, 130, 246, 0.08));
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
}

.scenario-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.sc-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 0.95rem;
}

.scenario-card.active .sc-icon {
  background: var(--primary);
  color: #022c22;
}

.sc-level {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.sc-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.sc-sub {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.3;
  margin-bottom: 8px;
}

.sc-roles {
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 6px;
}

.sc-roles span strong {
  color: #cbd5e1;
}

/* --- MAIN SPEAKING STUDIO --- */
.speaking-studio {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Agent Display & Waveform */
.agent-display-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-card);
}

.agent-avatar-status {
  display: flex;
  align-items: center;
  gap: 18px;
}

.agent-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--accent-glow);
}

.agent-pulse-ring {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.4;
  animation: agentRingPulse 2s infinite ease-out;
}

@keyframes agentRingPulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.3); opacity: 0; }
}

.agent-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.agent-title-row h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
}

.status-pill {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

.status-pill .dot.recording {
  background: var(--danger);
  animation: pulse-animation 1s infinite;
}

.status-pill .dot.thinking {
  background: var(--amber);
  animation: pulse-animation 1s infinite;
}

.status-pill .dot.speaking {
  background: var(--accent);
  animation: pulse-animation 1s infinite;
}

.agent-context-hint {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Sound Waveform */
.waveform-box {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 10px;
}

.wave-bar {
  width: 4px;
  height: 8px;
  background: #334155;
  border-radius: 2px;
  transition: height 0.15s ease;
}

.waveform-box.active .wave-bar {
  background: linear-gradient(180deg, var(--primary), var(--accent));
  animation: waveMotion 0.8s infinite ease-in-out alternate;
}

.waveform-box.active .wave-bar:nth-child(1) { animation-delay: 0.0s; }
.waveform-box.active .wave-bar:nth-child(2) { animation-delay: 0.15s; }
.waveform-box.active .wave-bar:nth-child(3) { animation-delay: 0.3s; }
.waveform-box.active .wave-bar:nth-child(4) { animation-delay: 0.45s; }
.waveform-box.active .wave-bar:nth-child(5) { animation-delay: 0.6s; }
.waveform-box.active .wave-bar:nth-child(6) { animation-delay: 0.45s; }
.waveform-box.active .wave-bar:nth-child(7) { animation-delay: 0.3s; }
.waveform-box.active .wave-bar:nth-child(8) { animation-delay: 0.15s; }
.waveform-box.active .wave-bar:nth-child(9) { animation-delay: 0.25s; }
.waveform-box.active .wave-bar:nth-child(10) { animation-delay: 0.4s; }

@keyframes waveMotion {
  0% { height: 6px; }
  100% { height: 32px; }
}

/* Dialogue Chat Stream */
.dialogue-chat-stream {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-card);
}

.chat-bubble {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  position: relative;
  animation: fadeInBubble 0.3s ease;
}

@keyframes fadeInBubble {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.agent-bubble {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-top-left-radius: 4px;
}

.user-bubble {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(37, 99, 235, 0.3));
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-top-right-radius: 4px;
}

.bubble-sender {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-bubble .bubble-sender {
  color: #93c5fd;
}

.bubble-text {
  font-size: 0.98rem;
  line-height: 1.45;
  color: #ffffff;
}

.bubble-listen-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.bubble-listen-btn:hover {
  color: var(--accent);
}

/* Suggested Practice Prompts */
.suggested-prompts-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.prompts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
}

.prompts-tip {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 400;
}

.prompts-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompt-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.prompt-chip:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.prompt-chip.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: var(--accent);
}

.chip-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chip-en {
  font-size: 0.92rem;
  color: #ffffff;
}

.chip-ipa {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #60a5fa;
}

.chip-play-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
}

/* Speaking & Voice Controls Bar */
.speaking-controls-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-card);
}

.mic-action-box {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-mic-main {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #059669);
  border: none;
  color: #022c22;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-mic-main:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
}

.btn-mic-main.recording {
  background: linear-gradient(135deg, var(--danger), #be123c);
  color: white;
  animation: micPulse 1.5s infinite;
}

@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
  70% { box-shadow: 0 0 0 16px rgba(244, 63, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.mic-status-label {
  font-size: 0.9rem;
  color: var(--text-dim);
  font-weight: 500;
  max-width: 250px;
}

.controls-auxiliary {
  display: flex;
  gap: 10px;
}

.btn-aux, .btn-aux-outline {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.btn-aux {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-aux:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-aux-outline {
  background: transparent;
  border: 1px dashed var(--accent);
  color: #60a5fa;
}

.btn-aux-outline:hover {
  background: rgba(59, 130, 246, 0.1);
}

/* Real-Time Phonetic Analysis Panel */
.phonetic-feedback-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  animation: fadeInView 0.3s ease;
}

.feedback-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.feedback-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.feedback-score-badge {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 0.95rem;
  border: 1px solid;
}

/* Word Breakdown Chips */
.words-breakdown-stream {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.phonetic-word-chip {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 1px solid;
}

.phonetic-word-chip.good {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.35);
  color: #a7f3d0;
}

.phonetic-word-chip.warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fde68a;
}

.phonetic-word-chip.poor {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.35);
  color: #fecdd3;
}

.p-target {
  font-weight: 700;
  font-size: 0.95rem;
}

.p-spoken {
  font-size: 0.78rem;
  opacity: 0.8;
}

.p-pct {
  font-size: 0.7rem;
  font-weight: 800;
}

/* Advice cards */
.phonetic-advice-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.advice-card {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  line-height: 1.4;
}

.advice-card.intonation {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #bfdbfe;
}

.advice-card.intonation i {
  color: var(--accent);
  font-size: 1.1rem;
}

.advice-card.articulation {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fde68a;
}

.advice-card.articulation i {
  color: var(--amber);
  font-size: 1.1rem;
}

/* Translation Assistance in Chat Bubbles */
.btn-translate-bubble {
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition-fast);
}

.btn-translate-bubble:hover {
  background: rgba(59, 130, 246, 0.25);
  color: #ffffff;
  border-color: #60a5fa;
}

.bubble-translation {
  animation: fadeIn 0.2s ease;
  line-height: 1.45;
}
