/* Speaking Dashboard Styles - Consistent with other features */

.speaking-dashboard {
  min-height: 100vh;
  background: linear-gradient(225deg, #f3efff 0%, #ebf8ff 50%, #ffeef6 100%);
  font-family: var(--body-font);
  color: #111827;
}

/* Header */
.speaking-header {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(226, 214, 255, 0.8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 0;
}

.speaking-header-inner {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 8px;
  color: #4b5563;
  transition: background 0.15s ease;
  text-decoration: none;
}

.back-button:hover {
  background: rgba(249, 115, 22, 0.1);
}

.back-icon {
  width: 18px;
  height: 18px;
  color: #374151;
}

.speaking-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.speaking-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

/* Main container */
.speaking-main {
  max-width: 1024px;
  margin: 0 auto;
  padding: 28px 20px;
}

/* Stats Section */
.speaking-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 8px 28px rgba(17, 24, 39, 0.06);
  border: 1px solid rgba(233, 213, 255, 0.85);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: #6b7280;
}

/* Levels Section */
.speaking-levels {
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 8px 28px rgba(17, 24, 39, 0.06);
  padding: 24px;
  border: 1px solid rgba(233, 213, 255, 0.85);
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #111827;
}

.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.level-card {
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  padding: 20px;
  transition: all 0.2s ease;
  position: relative;
}

.level-card:hover:not(.level-locked) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.15);
  border-color: #f97316;
}

.level-card.level-current {
  border-color: #f97316;
  background: #fff7ed;
}

.level-card.level-complete {
  border-color: #22c55e;
  background: #f0fdf4;
}

.level-card.level-locked {
  opacity: 0.6;
  background: #f3f4f6;
}

.level-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.level-icon {
  flex-shrink: 0;
}

.level-info {
  flex: 1;
}

.level-name {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 4px 0;
}

.level-topic {
  font-size: 13px;
  color: #f97316;
  font-weight: 600;
  margin: 0;
}

.level-progress {
  margin-top: 12px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: #f97316;
  transition: width 0.3s;
}

.progress-text {
  font-size: 13px;
  color: #6b7280;
}

.level-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #22c55e;
  color: white;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.level-badge.locked {
  background: #9ca3af;
}

/* Speaking Session Styles */
.speaking-session {
  min-height: 100vh;
  background: linear-gradient(225deg, #f3efff 0%, #ebf8ff 50%, #ffeef6 100%);
  font-family: var(--body-font);
}

.session-header {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(226, 214, 255, 0.8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  padding: 0;
}

.session-header-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.session-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.session-progress {
  font-size: 13px;
  color: #6b7280;
}

.session-main {
  max-width: 800px;
  margin: 0 auto;
  padding: 28px 20px;
}

.exercise-section {
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 8px 28px rgba(17, 24, 39, 0.06);
  padding: 24px;
  border: 1px solid rgba(233, 213, 255, 0.85);
}

.exercise-card {
  text-align: center;
}

.exercise-text {
  font-size: 24px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 24px;
  line-height: 1.4;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.exercise-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: #fef3c7;
  border-radius: 12px;
  color: #92400e;
  margin-bottom: 24px;
  font-size: 13px;
}

.audio-controls {
  margin-bottom: 32px;
}

.audio-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.audio-button:hover:not(:disabled) {
  opacity: 0.9;
}

.audio-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.recording-section {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pronunciation-check {
  background: radial-gradient(circle at top left, #eef2ff 0%, #f9fafb 40%, #eff6ff 100%);
  border-radius: 20px;
  padding: 16px 18px;
  border: 1px solid rgba(191, 219, 254, 0.9);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  text-align: left;
}

.pronunciation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.pronunciation-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
}

.pronunciation-result {
  margin-top: 14px;
  padding: 14px 14px 12px;
  background: rgba(59, 130, 246, 0.03);
  border-radius: 16px;
  font-size: 13px;
  color: #1f2937;
  border: 1px dashed rgba(191, 219, 254, 0.9);
}

.pronunciation-result p {
  margin: 2px 0;
}

.pronunciation-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.heard-text .label,
.score-badge-wrapper .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin-bottom: 2px;
}

.heard-text .value {
  font-weight: 600;
  color: #111827;
}

.score-badge-wrapper {
  text-align: right;
}

.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.score-badge span:first-child {
  font-variant-numeric: tabular-nums;
}

.score-badge-text {
  font-size: 11px;
}

.score-great {
  background: #ecfdf5;
  color: #16a34a;
}

.score-good {
  background: #fffbeb;
  color: #d97706;
}

.score-try {
  background: #fef2f2;
  color: #dc2626;
}

.score-message {
  margin-top: 8px;
  font-size: 13px;
  color: #374151;
}

.next-word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.next-word-text {
  margin: 0;
  font-size: 13px;
  color: #15803d;
  font-weight: 600;
}

.try-again-text {
  margin-top: 8px;
  font-size: 12px;
  color: #ea580c;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.secondary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(79, 70, 229, 0.4);
  opacity: 0.95;
}

.secondary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.record-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.record-button.start {
  background: linear-gradient(90deg, #dc2626 0%, #b91c1c 100%);
  color: white;
}

.record-button.start:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

.record-button.stop {
  background: #6b7280;
  color: white;
}

.record-button.stop:hover {
  background: #4b5563;
}

.recording-active {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #dc2626;
  font-weight: 600;
  font-size: 15px;
}

.pulse-dot {
  width: 12px;
  height: 12px;
  background: #dc2626;
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

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

.recording-complete {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.recording-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.play-recording-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.play-recording-button:hover:not(:disabled) {
  opacity: 0.9;
}

.play-recording-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.record-again-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: #6b7280;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.record-again-button:hover {
  background: #4b5563;
}

.submit-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 32px;
  background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.submit-button:hover {
  opacity: 0.9;
}

.warning-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: #fef3c7;
  border: 2px solid #fbbf24;
  border-radius: 12px;
  color: #92400e;
  margin-top: 24px;
}

.warning-message p {
  margin: 0;
  flex: 1;
  font-size: 13px;
}

.exercise-complete-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

.complete-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 8px 28px rgba(17, 24, 39, 0.06);
  padding: 40px;
  text-align: center;
  border: 1px solid rgba(233, 213, 255, 0.85);
  max-width: 500px;
}

.complete-icon {
  margin-bottom: 20px;
}

.complete-title {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 12px 0;
}

.complete-message {
  font-size: 18px;
  color: #6b7280;
  margin-bottom: 32px;
}

.complete-actions {
  margin-top: 24px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 32px;
  background: linear-gradient(90deg, #f97316 0%, #ea580c 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.primary-button:hover {
  opacity: 0.9;
}

.error-message {
  padding: 16px;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 12px;
  margin: 20px;
  text-align: center;
  font-size: 14px;
}

.loading-spinner {
  border: 4px solid #f3f4f6;
  border-top: 4px solid #f97316;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .speaking-header-inner,
  .session-header-inner {
    padding: 0 16px;
  }

  .speaking-main,
  .session-main {
    padding: 20px 16px;
  }

  .speaking-stats {
    grid-template-columns: 1fr;
  }

  .levels-grid {
    grid-template-columns: 1fr;
  }

  .session-header-inner {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    padding: 12px 16px;
  }

  .exercise-section {
    padding: 20px;
  }

  .exercise-text {
    font-size: 20px;
  }

  .recording-actions {
    flex-direction: column;
    width: 100%;
  }

  .play-recording-button,
  .record-again-button {
    width: 100%;
    justify-content: center;
  }
}
