/* Episode Translator Styles - High Fidelity Modern Dual-Pane */

.translator-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  width: 100%;
}

.translator-hero {
  margin-bottom: 1.25rem;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.hero-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main, #f8fafc);
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.hero-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted, #94a3b8);
  max-width: 760px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Dual Pane Workbench */
.translate-workbench {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: stretch;
}

@media (max-width: 960px) {
  .translate-workbench {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

.pane-box {
  background: var(--bg-surface, #12141c);
  border: 1px solid var(--border, #262938);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 480px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.pane-box:focus-within {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 10px 35px rgba(139, 92, 246, 0.12);
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(24, 26, 36, 0.6);
  border-bottom: 1px solid var(--border, #262938);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.lang-tabs-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.lang-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted, #94a3b8);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.lang-tab:hover {
  color: var(--text-main, #f8fafc);
  background: rgba(255, 255, 255, 0.05);
}

.lang-tab.active {
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.35);
}

.detected-badge {
  font-size: 0.75rem;
  font-weight: 500;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
}

.tone-select-wrap select {
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border, #334155);
  color: #e2e8f0;
  cursor: pointer;
}

/* Divider / Swap button */
.workbench-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
}

@media (max-width: 960px) {
  .workbench-divider {
    padding: 0.5rem 0;
  }
}

.swap-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface, #12141c);
  border: 1px solid var(--border, #334155);
  color: #a78bfa;
  cursor: pointer;
  transition: transform 0.25s ease, background 0.2s ease, border-color 0.2s ease;
}

.swap-btn:hover {
  transform: rotate(180deg);
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.15);
}

/* Textareas & Body */
.pane-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  position: relative;
}

.translate-textarea {
  width: 100%;
  height: 100%;
  min-height: 220px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text-main, #f8fafc);
}

.translate-textarea::placeholder {
  color: #475569;
}

.target-output-wrap {
  width: 100%;
  height: 100%;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.translate-target-text {
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text-main, #f8fafc);
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}

.translate-target-text:empty::before {
  content: attr(placeholder);
  color: #475569;
}

/* Skeleton Loading */
.target-skeleton {
  padding-top: 0.5rem;
}

.skeleton-line {
  height: 1.25rem;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s infinite;
  border-radius: 6px;
  margin-bottom: 0.85rem;
}

@keyframes skeletonPulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Pane Footer Toolbar */
.pane-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border, #262938);
  background: rgba(18, 20, 28, 0.7);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-left, .footer-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.char-count {
  font-size: 0.75rem;
  color: #64748b;
  font-family: ui-monospace, monospace;
}

/* Speech / TTS Button & Waves */
.speech-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.speech-btn.btn-speaking {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
  color: #34d399 !important;
}

.speech-waves {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.wave-bar {
  width: 2.5px;
  background: #34d399;
  border-radius: 2px;
  animation: waveGrow 0.8s ease-in-out infinite alternate;
}

.wave-bar:nth-child(1) { height: 4px; animation-delay: 0s; }
.wave-bar:nth-child(2) { height: 10px; animation-delay: 0.2s; }
.wave-bar:nth-child(3) { height: 6px; animation-delay: 0.4s; }

@keyframes waveGrow {
  0% { height: 3px; }
  100% { height: 12px; }
}

.speed-toggle-btn {
  font-family: ui-monospace, monospace;
  font-size: 0.6875rem;
  padding: 0.2rem 0.45rem;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border, #334155);
  color: #cbd5e1;
}

.speed-toggle-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
}

.voice-badge {
  font-size: 0.6875rem;
  color: #94a3b8;
  font-family: ui-monospace, monospace;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.2rem 0.45rem;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Quick Samples */
.quick-samples {
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.4);
  border-top: 1px solid var(--border, #262938);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.quick-samples-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.04em;
}

.sample-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sample-chip:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
  color: #f1f5f9;
}

/* Cultural Notes Card */
.notes-card {
  margin: 0.75rem 1rem;
  padding: 0.85rem 1rem;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 10px;
  animation: fadeIn 0.2s ease;
}

.notes-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #34d399;
  margin-bottom: 0.35rem;
}

.notes-body {
  font-size: 0.8125rem;
  color: #cbd5e1;
  line-height: 1.5;
  margin: 0;
}

/* Alternatives Card */
.alternatives-card {
  margin: 0 1rem 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 10px;
  animation: fadeIn 0.2s ease;
}

.alternatives-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #c4b5fd;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.alternatives-hint {
  font-size: 0.6875rem;
  font-weight: 400;
  color: #94a3b8;
  margin-left: auto;
}

.alternatives-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.alt-item {
  padding: 0.4rem 0.65rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  font-size: 0.8125rem;
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.alt-item:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
  color: #ffffff;
}

/* Toast */
.toast-notification {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #3b82f6;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  animation: toastFade 0.2s ease;
}

@keyframes toastFade {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}


/* Dynamic Samples & AI Studio */
.quick-samples {
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.4);
  border-top: 1px solid var(--border, #262938);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quick-samples-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.shuffle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border, #334155);
  color: #cbd5e1;
  font-size: 0.6875rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.shuffle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.ai-sample-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: linear-gradient(135deg, #8b5cf6, #06b6d4);
  border: none;
  color: #ffffff;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ai-sample-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.45);
}

.quick-samples-list {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.sample-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
}

.sample-chip:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
  color: #f1f5f9;
  transform: translateY(-1px);
}

.sample-chip-cat {
  font-size: 0.6875rem;
  color: #a78bfa;
  font-weight: 600;
}

/* Sample Modal Dialog */
.sample-modal-dialog {
  max-width: 540px;
  width: 95%;
  background: var(--bg-surface, #12141c);
  border: 1px solid var(--border, #334155);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: fadeIn 0.2s ease;
}

.modal-desc {
  font-size: 0.8125rem;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.category-pills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.category-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.category-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.category-pill.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.5);
  color: #c4b5fd;
  font-weight: 600;
}


/* Modal Overlay Centering & Dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-overlay[hidden] {
  display: none !important;
}

.modal-dialog {
  background: #18191d;
  border: 1px solid var(--border, #2d3139);
  border-radius: 16px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #2d3139);
  background: #121316;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: #f8fafc;
}

.modal-close-btn {
  font-size: 1.25rem;
  color: #94a3b8;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 20px;
  background: #131416;
  border-top: 1px solid var(--border, #2d3139);
}

.step-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
  display: block;
}

.game-input {
  width: 100%;
  padding: 10px 14px;
  background: #0f1013;
  border: 1px solid var(--border, #2d3139);
  border-radius: 8px;
  color: #f8fafc;
  font-size: 0.875rem;
  outline: none;
  box-sizing: border-box;
}

.game-input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
}


/* Ultra-forced Modal Overlay Centering */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.78) !important;
  backdrop-filter: blur(8px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 999999 !important;
  padding: 16px !important;
  box-sizing: border-box !important;
}

.modal-overlay[hidden] {
  display: none !important;
}

/* ====================================================
   Pedagogical Context & Selectable Explanation Language
   ==================================================== */
.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #34d399;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.notes-header-left {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.notes-lang-group {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.2rem 0.35rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.notes-lang-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #94a3b8;
  margin-right: 0.2rem;
  padding-left: 0.2rem;
}

.notes-lang-tab {
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notes-lang-tab:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
}

.notes-lang-tab.active {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
}

/* Notes Meta Row */
.notes-meta-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

.notes-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.6875rem;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

.cefr-badge {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  font-weight: 700;
}

.cefr-badge strong {
  color: #ffffff;
  background: rgba(59, 130, 246, 0.35);
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
}

.register-badge {
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.35);
  color: #d8b4fe;
}

.notes-lang-badge {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}

/* Key Terms Breakdown */
.key-terms-section {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.key-terms-heading {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #6ee7b7;
  margin-bottom: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.key-terms-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.45rem;
}

.key-term-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.key-term-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: #34d399;
}

.key-term-expl {
  font-size: 0.6875rem;
  color: #cbd5e1;
  line-height: 1.35;
}
