/* ==========================================================================
   Dictation Practice Component Styles (Issue #108 - Step 4)
   Full theme support: Dark Mode (default) & Light Mode ([data-theme="light"])
   ========================================================================== */

.dictation-wrapper {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

.dictation-card {
  background-color: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

[data-theme="light"] .dictation-card {
  background-color: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

/* Header & Progress */
.dictation-header {
  margin-bottom: 20px;
}

.dictation-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.dictation-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-light);
  background-color: var(--surface-color-alt);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

[data-theme="light"] .dictation-badge {
  color: var(--primary);
  background-color: #EEF2FF;
}

.dictation-pill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.dictation-pill.key {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
}

.dictation-pill.flagged {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
}

[data-theme="light"] .dictation-pill.key {
  background: #D1FAE5;
  color: #059669;
}

[data-theme="light"] .dictation-pill.flagged {
  background: #FEE2E2;
  color: #DC2626;
}

.dictation-progress-track {
  width: 100%;
  height: 6px;
  background-color: var(--surface-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

[data-theme="light"] .dictation-progress-track {
  background-color: #E2E8F0;
}

.dictation-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Audio Player Section */
.dictation-audio-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 16px;
  background-color: var(--surface-color-alt);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  border: 1px solid var(--surface-border);
}

[data-theme="light"] .dictation-audio-box {
  background-color: #F8FAFC;
  border-color: #E2E8F0;
}

.btn-dictation-play {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--primary), #4F46E5);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-full);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-dictation-play:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-dictation-play:active {
  transform: translateY(0);
}

.btn-dictation-play.playing {
  background: linear-gradient(135deg, #10B981, #059669);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.dictation-audio-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-audio-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background-color: var(--surface-color);
  border: 1px solid var(--surface-border);
  color: var(--text-color);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-audio-ctrl:hover {
  border-color: var(--primary-light);
  color: var(--primary-light);
}

[data-theme="light"] .btn-audio-ctrl {
  background-color: #FFFFFF;
  border-color: #CBD5E1;
  color: #334155;
}

.speed-selector {
  display: inline-flex;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--surface-border);
}

[data-theme="light"] .speed-selector {
  border-color: #CBD5E1;
}

.btn-speed-opt {
  padding: 6px 12px;
  background-color: var(--surface-color);
  border: none;
  color: var(--text-subtle);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-speed-opt.active {
  background-color: var(--primary);
  color: #FFFFFF;
}

[data-theme="light"] .btn-speed-opt {
  background-color: #FFFFFF;
  color: #64748B;
}

[data-theme="light"] .btn-speed-opt.active {
  background-color: var(--primary);
  color: #FFFFFF;
}

/* Cloze Sentence Context Box */
.dictation-cloze-box {
  margin-bottom: 16px;
}

.dictation-cloze-card {
  padding: 18px 20px;
  background-color: var(--surface-color-alt);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .dictation-cloze-card {
  background-color: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.cloze-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary-light);
  background: rgba(99, 102, 241, 0.15);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  margin-bottom: 10px;
}

[data-theme="light"] .cloze-badge {
  color: var(--primary);
  background: #EEF2FF;
}

.dictation-cloze-text {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.7;
  font-weight: 500;
  color: var(--text-color);
}

.dictation-blank-slot {
  display: inline-block;
  min-width: 80px;
  padding: 2px 10px;
  margin: 0 4px;
  border-bottom: 2.5px solid var(--primary);
  background: rgba(99, 102, 241, 0.12);
  border-radius: 4px;
  font-weight: 700;
  color: var(--primary-light);
  text-align: center;
  transition: all 0.2s ease;
}

[data-theme="light"] .dictation-blank-slot {
  background: #EEF2FF;
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.dictation-blank-slot.has-input {
  background: rgba(16, 185, 129, 0.15);
  border-bottom-color: #10B981;
  color: #10B981;
}

[data-theme="light"] .dictation-blank-slot.has-input {
  background: #D1FAE5;
  border-bottom-color: #059669;
  color: #059669;
}

.blank-placeholder {
  color: var(--text-subtle);
  font-size: 0.95rem;
  font-weight: 500;
}

/* Korean Meaning Box */
.dictation-korean-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background-color: var(--surface-color-alt);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  border-left: 3.5px solid var(--primary);
}

[data-theme="light"] .dictation-korean-box {
  background-color: #F8FAFC;
}

.korean-icon {
  font-size: 1.1rem;
}

.korean-text {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.5;
  color: var(--text-color);
  font-weight: 500;
}

/* Hint Box */
.dictation-hint-container {
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

[data-theme="light"] .dictation-hint-container {
  background: #FFFBEB;
  border-color: #FCD34D;
}

.hint-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hint-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #F59E0B;
}

.hint-text {
  font-family: monospace;
  font-size: 0.95rem;
  letter-spacing: 1px;
  color: var(--text-color);
}

/* Input Area */
.dictation-input-area {
  margin-top: 14px;
}

.dictation-textarea,
.dictation-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--surface-border);
  background-color: var(--surface-color-alt);
  color: var(--text-color);
  font-size: 1.05rem;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dictation-input {
  height: 52px;
  padding: 0 16px;
}

.dictation-textarea {
  resize: none;
}

.dictation-textarea:focus,
.dictation-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

[data-theme="light"] .dictation-textarea,
[data-theme="light"] .dictation-input {
  background-color: #FFFFFF;
  border-color: #CBD5E1;
  color: #0F172A;
}

[data-theme="light"] .dictation-textarea:focus,
[data-theme="light"] .dictation-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.dictation-action-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.dictation-actions-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dictation-actions-right {
  display: flex;
  align-items: center;
}

/* Feedback Box */
.dictation-feedback-box {
  padding: 20px;
  border-radius: var(--radius-lg);
  margin-top: 18px;
  border: 1px solid var(--surface-border);
}

.dictation-feedback-box.success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="light"] .dictation-feedback-box.success {
  background: #F0FDF4;
  border-color: #86EFAC;
}

.dictation-feedback-box.try-again {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
}

[data-theme="light"] .dictation-feedback-box.try-again {
  background: #FEF2F2;
  border-color: #FECACA;
}

.dictation-feedback-box.skipped {
  background: var(--surface-color-alt);
}

[data-theme="light"] .dictation-feedback-box.skipped {
  background: #F8FAFC;
}

.feedback-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.feedback-badge.success {
  color: #10B981;
}

[data-theme="light"] .feedback-badge.success {
  color: #059669;
}

.feedback-badge.mismatch {
  color: #EF4444;
}

[data-theme="light"] .feedback-badge.mismatch {
  color: #DC2626;
}

.feedback-sentence {
  padding: 12px 14px;
  background-color: var(--surface-color);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  border: 1px solid var(--surface-border);
}

[data-theme="light"] .feedback-sentence {
  background-color: #FFFFFF;
  border-color: #E2E8F0;
}

.feedback-en {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0 0 6px 0;
  line-height: 1.6;
}

.dictation-highlight {
  background-color: rgba(16, 185, 129, 0.25);
  color: #10B981;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

[data-theme="light"] .dictation-highlight {
  background-color: #D1FAE5;
  color: #059669;
}

.feedback-kr {
  font-size: 0.92rem;
  color: var(--text-subtle);
  margin: 0;
}

[data-theme="light"] .feedback-kr {
  color: #64748B;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Diff Display */
.diff-words-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px;
  background-color: var(--surface-color);
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border);
  margin-bottom: 12px;
  font-size: 1.05rem;
  font-weight: 600;
}

[data-theme="light"] .diff-words-container {
  background-color: #FFFFFF;
  border-color: #E2E8F0;
}

.diff-word.correct {
  color: #10B981;
}

[data-theme="light"] .diff-word.correct {
  color: #059669;
}

.diff-word.incorrect {
  color: #EF4444;
  text-decoration: underline;
  text-decoration-style: wavy;
}

[data-theme="light"] .diff-word.incorrect {
  color: #DC2626;
}

.diff-user-text {
  font-size: 0.88rem;
  color: var(--text-subtle);
  margin-bottom: 14px;
}

.diff-user-text p {
  margin: 4px 0 0 0;
  color: var(--text-color);
  font-style: italic;
}

/* Completed Screen */
.dictation-card.completed {
  text-align: center;
  padding: 36px 20px;
}

.dictation-complete-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.dictation-complete-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-color);
  margin: 0 0 8px 0;
}

.dictation-complete-desc {
  font-size: 0.98rem;
  color: var(--text-subtle);
  margin: 0 auto 24px;
  max-width: 480px;
  line-height: 1.6;
}

[data-theme="light"] .dictation-complete-desc {
  color: #475569;
}

.dictation-stats-card {
  display: inline-flex;
  gap: 16px;
  padding: 16px 24px;
  background-color: var(--surface-color-alt);
  border-radius: var(--radius-lg);
  border: 1px solid var(--surface-border);
  margin-bottom: 28px;
  flex-wrap: wrap;
  justify-content: center;
}

[data-theme="light"] .dictation-stats-card {
  background-color: #F8FAFC;
  border-color: #E2E8F0;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-num {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-light);
}

[data-theme="light"] .stat-num {
  color: var(--primary);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-subtle);
}

.dictation-complete-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 360px;
  margin: 0 auto;
}

/* ==========================================================================
   Mobile Responsive Alignment (Step 4: Dictation / 받아쓰기)
   Matches Step 1 Quiz button layout identically
   ========================================================================== */
@media (max-width: 640px) {
  .dictation-action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "hint hint"
      "skip check";
    gap: 10px;
    width: 100%;
  }

  .dictation-actions-left,
  .dictation-actions-right {
    display: contents;
  }

  .btn-dictation-hint {
    grid-area: hint;
    width: 100%;
    justify-content: center;
  }

  .btn-dictation-skip {
    grid-area: skip;
    width: 100%;
    justify-content: center;
  }

  .btn-dictation-submit {
    grid-area: check;
    width: 100%;
    justify-content: center;
  }

  .btn-dictation-next {
    width: 100%;
    justify-content: center;
  }
}

