/* ============================================
   LalaWord UI Components
   ============================================ */

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  transition: all var(--transition-fast);
  white-space: nowrap;
  min-height: 44px;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--color-coral);
  color: var(--color-white);
}

.btn-primary:hover { background: var(--color-coral-hover); }
.btn-primary:active { background: var(--color-coral-active); }

.btn-secondary {
  background: var(--color-teal);
  color: var(--color-white);
}

.btn-secondary:hover { background: var(--color-teal-hover); }

.btn-outline {
  border: 1.5px solid var(--color-border);
  color: var(--color-text-secondary);
  background: var(--color-white);
}

.btn-outline:hover { border-color: var(--color-coral); color: var(--color-coral); }

.btn-ghost {
  color: var(--color-text-secondary);
  background: transparent;
}

.btn-ghost:hover { background: var(--color-bg); }

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
  min-height: 36px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--text-lg);
  min-height: 52px;
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
}

.btn-icon.sm {
  width: 32px;
  height: 32px;
}

/* === Cards === */
.card {
  background: var(--color-white);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-base);
}

.card:active {
  box-shadow: var(--shadow-sm);
}

.card-flat {
  background: var(--color-bg);
  border: none;
  box-shadow: none;
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.card-highlight {
  background: var(--color-coral-50);
  border: 1px solid var(--color-coral-100);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

/* === Input fields === */
.input-group {
  margin-bottom: var(--space-md);
}

.input-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xs);
}

.input-field {
  width: 100%;
  min-height: 48px;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-field:focus {
  border-color: var(--color-coral);
  box-shadow: 0 0 0 3px var(--color-coral-light);
  background: var(--color-white);
}

.input-field.error {
  border-color: var(--color-rose);
  box-shadow: 0 0 0 3px var(--color-rose-light);
}

.input-hint {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2xs);
}

.input-error {
  font-size: var(--text-sm);
  color: var(--color-rose);
  margin-top: var(--space-2xs);
}

/* === Tags / Badges === */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.tag-coral { background: var(--color-coral-light); color: var(--color-coral); }
.tag-teal { background: var(--color-teal-light); color: var(--color-teal); }
.tag-amber { background: var(--color-amber-light); color: var(--color-amber); }
.tag-sky { background: var(--color-sky-light); color: var(--color-sky); }
.tag-rose { background: var(--color-rose-light); color: var(--color-rose); }
.tag-green { background: var(--color-green-light); color: var(--color-green); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: var(--weight-bold);
  background: var(--color-coral);
  color: var(--color-white);
}

/* === Progress Bar === */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  background: var(--color-coral);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.progress-bar.teal .progress-fill { background: var(--color-teal); }
.progress-bar.amber .progress-fill { background: var(--color-amber); }

/* === Avatar === */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-coral-light);
  color: var(--color-coral);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.lg { width: 64px; height: 64px; font-size: var(--text-2xl); }
.avatar.xl { width: 80px; height: 80px; font-size: var(--text-3xl); }

/* === List items === */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  min-height: 52px;
  border-bottom: 1px solid var(--color-border-light);
  transition: background var(--transition-fast);
}

.list-item:active {
  background: var(--color-bg);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item .list-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.list-item .list-content {
  flex: 1;
  min-width: 0;
}

.list-item .list-title {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
}

.list-item .list-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.list-item .list-right {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* === Switch toggle === */
.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.switch .slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: var(--color-white);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.switch input:checked + .slider {
  background: var(--color-coral);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* === Chip / Selector === */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-xs) var(--space-md);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.chip.selected {
  border-color: var(--color-coral);
  background: var(--color-coral-light);
  color: var(--color-coral);
  font-weight: var(--weight-semibold);
}

.chip:active {
  transform: scale(0.95);
}

/* === Empty State === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-4xl) var(--space-xl);
  text-align: center;
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
}

.empty-state .empty-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
}

.empty-state .empty-desc {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 260px;
  line-height: var(--line-relaxed);
}

/* === Stat Card === */
.stat-card {
  background: var(--color-white);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  text-align: center;
}

.stat-card .stat-value {
  font-family: var(--font-en);
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  color: var(--color-coral);
}

.stat-card .stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* === Word display === */
.word-display {
  font-family: var(--font-en);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.3px;
}

.word-pronunciation {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.word-meaning {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--line-relaxed);
}

.word-pos {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-teal);
  text-transform: uppercase;
}

/* === Social login buttons === */
.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  min-height: 52px;
  border-radius: var(--radius-lg);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  transition: all var(--transition-fast);
}

.social-btn:active {
  transform: scale(0.97);
}

.social-btn.google {
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  color: var(--color-text-primary);
}

.social-btn.kakao {
  background: #FEE500;
  color: #191919;
}

.social-btn.guest {
  background: var(--color-bg);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

/* === Streak === */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: var(--color-amber-light);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-amber);
}

/* === Progress Circle === */
.progress-circle {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-circle svg { transform: rotate(-90deg); }

.progress-circle .progress-bg {
  fill: none;
  stroke: var(--color-bg);
  stroke-width: 6;
}

.progress-circle .progress-value {
  fill: none;
  stroke: var(--color-coral);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}

.progress-circle .progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-en);
  font-size: var(--text-xl);
  font-weight: var(--weight-extrabold);
  color: var(--color-text-primary);
}

/* === Section Title === */
.section-title {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
}

/* === Divider === */
.divider {
  height: 1px;
  background: var(--color-border-light);
  margin: var(--space-sm) 0;
}

/* === Loading dots === */
.loading-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.loading-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-coral);
  animation: loadingDot 1.2s ease infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingDot {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* === Flex utilities === */
.flex-row { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

/* === Spacing utilities === */
.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

