/* css/style.css - HSK Chinese Vocabulary Learning & Exam Practice System */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700;900&family=Noto+Serif+SC:wght@600;900&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  --primary-color: #0d9488;
  --primary-dark: #0f766e;
  --secondary-color: #f59e0b;
  --accent-color: #6366f1;
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  --chinese-font: 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --chinese-serif: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
}

body {
  font-family: 'Outfit', var(--chinese-font);
  background: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
  overflow-x: hidden;
}

.chinese-char {
  font-family: var(--chinese-font);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.chinese-serif {
  font-family: var(--chinese-serif);
}

/* Glassmorphism Cards */
.glass-panel {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
}

.glass-card-hover {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.glass-card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-color: #cbd5e1;
}

/* Segmented Control for Unit Mode [生詞卡 | 測驗 Test] */
.mode-segmented-control {
  background: #f1f5f9;
  padding: 3px;
  border-radius: 12px;
  display: inline-flex;
  gap: 3px;
  border: 1px solid #e2e8f0;
}
.mode-tab-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 9px;
  color: #64748b;
  transition: all 0.2s ease;
}
.mode-tab-btn.active {
  background: #0d9488;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(13, 148, 136, 0.2);
}

/* Audio wave animation */
.audio-wave {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 18px;
}
.audio-wave span {
  display: inline-block;
  width: 3px;
  background-color: currentColor;
  border-radius: 9999px;
  animation: wave 1.2s ease-in-out infinite;
}
.audio-wave span:nth-child(1) { height: 6px; animation-delay: 0.1s; }
.audio-wave span:nth-child(2) { height: 16px; animation-delay: 0.2s; }
.audio-wave span:nth-child(3) { height: 10px; animation-delay: 0.3s; }
.audio-wave span:nth-child(4) { height: 18px; animation-delay: 0.15s; }
.audio-wave span:nth-child(5) { height: 8px; animation-delay: 0.25s; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

/* Quiz Option styling */
.quiz-option-btn {
  transition: all 0.2s ease-in-out;
  border: 2px solid #e2e8f0;
  position: relative;
  overflow: hidden;
}
.quiz-option-btn:hover:not(:disabled) {
  border-color: #0d9488;
  background-color: #f0fdfa;
  transform: translateY(-2px);
}
.quiz-option-btn.correct {
  border-color: #10b981 !important;
  background-color: #ecfdf5 !important;
  color: #065f46 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}
.quiz-option-btn.incorrect {
  border-color: #ef4444 !important;
  background-color: #fef2f2 !important;
  color: #991b1b !important;
  animation: shake 0.4s ease-in-out;
}

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

/* Progress bar animation */
.progress-bar-fill {
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hanzi Writer styling */
#hanzi-writer-target svg {
  display: block;
  margin: 0 auto;
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
}

/* Tianzige grid background for handwriting */
.tianzige-bg {
  background-color: #fff;
  background-image:
    linear-gradient(to right, rgba(239, 68, 68, 0.25) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(239, 68, 68, 0.25) 1px, transparent 1px),
    linear-gradient(45deg, transparent 49.5%, rgba(239, 68, 68, 0.15) 50%, transparent 50.5%),
    linear-gradient(-45deg, transparent 49.5%, rgba(239, 68, 68, 0.15) 50%, transparent 50.5%);
  background-size: 100% 100%;
  border: 2px solid #ef4444;
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Vocabulary Review Table Styling */
.vocab-review-table th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  border-bottom: 2px solid #e2e8f0;
}
.vocab-review-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.vocab-review-table tbody tr:hover {
  background-color: #f8fafc;
}
