/* ==========================================================================
   Flashcard Component Styles
   A modern, accessible flashcard UI for learning
   ========================================================================== */

/* Container */
.flashcard-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
}

/* Controls Bar */
.flashcard-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 12px;
  align-items: center;
  justify-content: space-between;
}

.flashcard-filter {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.flashcard-filter label {
  font-weight: 600;
  color: #333;
  font-size: 0.9rem;
}

.flashcard-filter select {
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  min-width: 150px;
}

.flashcard-filter select:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.flashcard-actions {
  display: flex;
  gap: 0.5rem;
}

.flashcard-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.flashcard-btn-primary {
  background: #007cba;
  color: #fff;
}

.flashcard-btn-primary:hover {
  background: #006399;
}

.flashcard-btn-secondary {
  background: #e9ecef;
  color: #333;
}

.flashcard-btn-secondary:hover {
  background: #dee2e6;
}

.flashcard-btn-success {
  background: #28a745;
  color: #fff;
}

.flashcard-btn-warning {
  background: #ffc107;
  color: #333;
}

.flashcard-btn-danger {
  background: #dc3545;
  color: #fff;
}

/* Progress Bar */
.flashcard-progress {
  margin-bottom: 1.5rem;
}

.progress-bar-container {
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #007cba, #00a8e8);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #666;
}

.progress-stats {
  display: flex;
  gap: 1rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-easy { color: #28a745; }
.stat-medium { color: #ffc107; }
.stat-hard { color: #dc3545; }

/* Flashcard */
.flashcard-wrapper {
  perspective: 1000px;
  margin-bottom: 1.5rem;
}

.flashcard {
  position: relative;
  width: 100%;
  min-height: 350px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  width: 100%;
  min-height: 350px;
  backface-visibility: hidden;
  border-radius: 16px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.flashcard-front {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.flashcard-back {
  background: #fff;
  color: #333;
  transform: rotateY(180deg);
  border: 2px solid #e9ecef;
}

.flashcard-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
  margin-bottom: 0.5rem;
}

.flashcard-front .flashcard-label {
  color: rgba(255, 255, 255, 0.8);
}

.flashcard-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.flashcard-question {
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

.flashcard-answer {
  font-size: 1.1rem;
  line-height: 1.6;
}

.flashcard-answer p {
  margin-bottom: 1rem;
}

.flashcard-answer strong {
  color: #007cba;
}

.flashcard-answer code {
  background: #f4f4f4;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Hint */
.flashcard-hint {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.85rem;
  opacity: 0.7;
  text-align: center;
}

.flashcard-front .flashcard-hint {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.hint-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.hint-toggle:hover {
  opacity: 1;
}

.hint-text {
  display: none;
  margin-top: 0.5rem;
  font-style: italic;
}

.hint-text.visible {
  display: block;
}

/* Difficulty Badge */
.difficulty-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.difficulty-easy {
  background: rgba(40, 167, 69, 0.2);
  color: #28a745;
}

.difficulty-medium {
  background: rgba(255, 193, 7, 0.2);
  color: #c79100;
}

.difficulty-hard {
  background: rgba(220, 53, 69, 0.2);
  color: #dc3545;
}

.flashcard-front .difficulty-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Navigation */
.flashcard-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.nav-btn {
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: #f8f9fa;
  color: #333;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-btn:hover:not(:disabled) {
  background: #007cba;
  color: #fff;
  transform: scale(1.1);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.card-counter {
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
  min-width: 100px;
  text-align: center;
}

/* Rating Buttons */
.flashcard-rating {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 12px;
}

.rating-btn {
  padding: 0.75rem 1.5rem;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.rating-btn span:first-child {
  font-size: 1.2rem;
}

.rating-btn-easy {
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
  border-color: #28a745;
}

.rating-btn-easy:hover {
  background: #28a745;
  color: #fff;
}

.rating-btn-medium {
  background: rgba(255, 193, 7, 0.1);
  color: #c79100;
  border-color: #ffc107;
}

.rating-btn-medium:hover {
  background: #ffc107;
  color: #333;
}

.rating-btn-hard {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
  border-color: #dc3545;
}

.rating-btn-hard:hover {
  background: #dc3545;
  color: #fff;
}

/* Keyboard Shortcuts Info */
.keyboard-shortcuts {
  text-align: center;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  margin-top: 1rem;
}

.keyboard-shortcuts h4 {
  margin-bottom: 0.5rem;
  color: #333;
  font-size: 0.9rem;
}

.shortcuts-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: #666;
}

.shortcut {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.shortcut kbd {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-size: 0.75rem;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Study Complete Screen */
.study-complete {
  text-align: center;
  padding: 3rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  color: #fff;
}

.study-complete h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.study-complete .trophy {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.study-complete p {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 2rem;
}

.final-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.final-stat {
  text-align: center;
}

.final-stat-number {
  font-size: 2rem;
  font-weight: 700;
}

.final-stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
}

/* Math rendering (KaTeX) */
.flashcard-answer .katex {
  font-size: 1.1em;
}

.flashcard-question .katex {
  font-size: 1em;
}

/* Responsive */
@media (max-width: 768px) {
  .flashcard-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .flashcard-filter {
    justify-content: center;
  }

  .flashcard-actions {
    justify-content: center;
  }

  .flashcard {
    min-height: 400px;
  }

  .flashcard-face {
    min-height: 400px;
    padding: 1.5rem;
  }

  .flashcard-question {
    font-size: 1.2rem;
  }

  .flashcard-answer {
    font-size: 1rem;
  }

  .flashcard-navigation {
    gap: 0.5rem;
  }

  .nav-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .flashcard-rating {
    flex-wrap: wrap;
  }

  .rating-btn {
    flex: 1;
    min-width: 80px;
    padding: 0.5rem 1rem;
  }

  .shortcuts-list {
    flex-direction: column;
    gap: 0.5rem;
  }

  .final-stats {
    flex-direction: column;
    gap: 1rem;
  }
}

/* Animation for card change */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.flashcard-wrapper.animate {
  animation: slideIn 0.3s ease;
}

/* Empty state */
.flashcard-empty {
  text-align: center;
  padding: 3rem;
  color: #666;
}

.flashcard-empty i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.flashcard-empty p {
  font-size: 1.1rem;
}
