/* Review Mode Styles */

.review-mode-btn {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #1f2933;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.review-mode-btn:hover {
  background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.review-mode-btn:active {
  transform: translateY(0);
}

/* Star button styles */
.star-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 6px;
  transition: all 0.2s ease;
  line-height: 1;
  color: #64748b;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
}

.star-btn:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.star-btn.saved {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
}

.vocab-star-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
}

/* Star button giờ nằm trong line-controls, không cần absolute position nữa */

/* Dark mode for star button */
body.theme-dark .star-btn {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(148, 163, 184, 0.3);
  color: #94a3b8;
}

body.theme-dark .star-btn:hover {
  background: rgba(30, 41, 59, 1);
}

body.theme-dark .star-btn.saved {
  background: rgba(251, 191, 36, 0.2);
  border-color: rgba(251, 191, 36, 0.4);
}

.line {
  position: relative;
}

/* Review Panel */
.review-panel {
  padding: 16px;
  max-width: 900px;
  margin: 0;
  font-size: 0.85rem;
  box-sizing: border-box;
  width: 100%;
  overflow-x: hidden;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  position: relative;
}

.review-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: #1f2933;
}

.review-close-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 6px;
  color: #64748b;
  transition: color 0.2s ease;
}

.review-close-btn:hover {
  color: #1f2933;
}

@media (max-width: 768px) {
  .review-header {
    padding-right: 72px;
  }

  .review-close-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 1rem;
    color: #1f2933;
    z-index: 10001 !important;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
  }

  .review-close-btn:hover {
    color: #0f172a;
    background: rgba(148, 163, 184, 0.35);
  }
  
  /* Hide mobile-nav-trigger when review-panel is open */
  body.review-mode-active .mobile-nav-trigger {
    display: none !important;
  }
}

.review-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  padding: 12px 14px;
  background: rgba(248, 250, 252, 0.95);
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow-x: hidden;
}

.review-filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6),
    0 8px 18px rgba(15, 23, 42, 0.1);
  min-width: 200px;
  max-width: 100%;
  flex: 0 1 auto;
  box-sizing: border-box;
  overflow: hidden;
}

.review-filter-group label {
  font-weight: 600;
  color: #334155;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.review-sort,
.review-filter-type {
  padding: 8px 12px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  border-radius: 12px;
  background: rgba(226, 232, 240, 0.6);
  font-size: 0.85rem;
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.review-stats {
  font-weight: 600;
  color: #1e3a8a;
  font-size: 0.85rem;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(191, 219, 254, 0.4);
  border: 1px solid rgba(59, 130, 246, 0.35);
  text-align: center;
  min-width: 150px;
  max-width: 100%;
  flex: 0 1 auto;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  box-sizing: border-box;
  overflow: hidden;
}

@media (max-width: 768px) {
  .review-controls {
    flex-direction: column;
    padding: 14px;
    max-width: 100%;
    align-items: stretch;
  }

  .review-filter-group {
    width: 100%;
    min-width: 0;
    padding: 12px;
  }

  .review-sort,
  .review-filter-type {
    min-width: 0;
    font-size: 0.8rem;
    padding: 8px 10px;
    width: 100%;
  }

  .review-stats {
    width: 100%;
    min-width: 0;
    font-size: 0.85rem;
  }
}

.review-empty {
  text-align: center;
  padding: 48px 24px;
  color: #64748b;
}

.review-empty p {
  margin: 8px 0;
}

/* Review Content */
.review-content {
  min-height: 400px;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Review Cards */
.review-cards {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  min-height: 60vh;
}

.review-card-container {
  width: 100%;
  max-width: 520px;
  perspective: 1000px;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.review-card {
  position: relative;
  width: 100%;
  height: 400px;
  transform-style: preserve-3d;
  transition: transform 0.6s;
  cursor: pointer;
}

.review-card.flipped {
  transform: rotateY(180deg);
}

.review-card-front,
.review-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 16px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: white;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(226, 232, 240, 0.8);
  overflow-y: auto;
  transition: box-shadow 0.3s ease;
  box-sizing: border-box;
}

.review-card-back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-color: rgba(59, 130, 246, 0.2);
}

.review-card-label {
  font-size: 0.75rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  font-weight: 600;
}

.review-card-jp {
  font-size: 1.1rem;
  font-weight: 500;
  color: #1f2933;
  margin-bottom: 12px;
  line-height: 1.6;
  word-wrap: break-word;
}

.review-card-furigana {
  font-size: 0.95rem;
  color: #475569;
  margin-bottom: 12px;
}

.review-card-term {
  font-size: 1.4rem;
  font-weight: 600;
  color: #1f2933;
  margin-bottom: 12px;
  word-wrap: break-word;
}

.review-card-reading {
  font-size: 1rem;
  color: #64748b;
  margin-bottom: 16px;
}

.review-card-vi {
  font-size: 1rem;
  color: #1e40af;
  font-weight: 500;
  margin-top: 16px;
  line-height: 1.6;
}

.review-card-meaning {
  font-size: 1.1rem;
  color: #1e40af;
  font-weight: 500;
  margin-top: 16px;
  line-height: 1.6;
}

.review-card-hint {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 16px;
  font-style: italic;
}

.review-card-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  position: relative;
  z-index: 20;
  padding: 0;
  background: transparent;
  width: 100%;
}

.review-btn-audio,
.review-btn-remove {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid #e2e8f0;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  position: relative;
}

.review-btn-audio::before,
.review-btn-remove::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.review-btn-audio:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: #3b82f6;
  color: white;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.review-btn-remove:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-color: #ef4444;
  color: white;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.review-btn-audio:active,
.review-btn-remove:active {
  transform: translateY(0) scale(0.98);
}

.review-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
}

.review-progress {
  font-weight: 500;
  color: #475569;
  margin-right: 8px;
  font-size: 0.9rem;
}

.review-nav-buttons {
  display: flex;
  gap: 8px;
}

.review-btn-prev,
.review-btn-next,
.review-btn-flip {
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.review-btn-prev:hover,
.review-btn-next:hover,
.review-btn-flip:hover {
  background: #2563eb;
}

.review-btn-prev:disabled,
.review-btn-next:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

/* Dark mode support */
body.theme-dark .review-header h2 {
  color: #f1f5f9;
}

body.theme-dark .review-card-front,
body.theme-dark .review-card-back {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

body.theme-dark .review-card-jp,
body.theme-dark .review-card-term {
  color: #f1f5f9;
}

body.theme-dark .review-card-vi,
body.theme-dark .review-card-meaning {
  color: #60a5fa;
}

body.theme-dark .review-sort,
body.theme-dark .review-filter-type {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

body.theme-dark .review-navigation {
  background: #1e293b;
  border-color: #334155;
}

body.theme-dark .review-btn-audio,
body.theme-dark .review-btn-remove {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: #334155;
  color: #f1f5f9;
}

body.theme-dark .review-btn-audio:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: #3b82f6;
  color: white;
}

body.theme-dark .review-btn-remove:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-color: #ef4444;
  color: white;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .review-panel {
    padding: 8px 8px;
    margin: 0;
    max-width: 100%;
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-sizing: border-box;
    width: 100%;
  }
  
  /* Ensure all child elements align properly */
  .review-panel > * {
    width: 100%;
    box-sizing: border-box;
  }
  
  .review-header {
    margin-bottom: 10px;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .review-header h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    padding: 0;
    padding-right: 40px;
    flex: 1;
  }
  
  .review-close-btn {
    font-size: 0.9rem;
    padding: 4px;
    width: 38px;
    height: 38px;
    position: fixed;
    top: 16px;
    right: 16px;
    flex-shrink: 0;
    margin: 0;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 50%;
    color: #1f2933;
    z-index: 10001 !important;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
  }
  
  .review-close-btn:hover {
    color: #0f172a;
    background: rgba(148, 163, 184, 0.35);
  }

  .review-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
    margin: 0 0 12px;
    border-radius: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .review-filter-group {
    padding: 8px 10px;
    border-radius: 10px;
  }

  .review-filter-group label {
    font-size: 0.7rem;
  }

  .review-sort,
  .review-filter-type {
    font-size: 0.75rem;
    padding: 6px 8px;
    border-radius: 8px;
  }

  .review-stats {
    font-size: 0.75rem;
    padding: 8px 10px;
    border-radius: 10px;
    margin-left: 0;
  }

  .review-card-container {
    max-width: 100%;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 0;
  }

  .review-card {
    height: 280px;
  }

  .review-card-front,
  .review-card-back {
    padding: 14px 12px;
    border-radius: 12px;
  }

  .review-card-label {
    font-size: 0.65rem;
    margin-bottom: 8px;
  }

  .review-card-jp {
    font-size: 0.95rem;
    margin-bottom: 8px;
    line-height: 1.5;
  }

  .review-card-furigana {
    font-size: 0.8rem;
    margin-bottom: 8px;
  }

  .review-card-term {
    font-size: 1.1rem;
    margin-bottom: 8px;
  }

  .review-card-reading {
    font-size: 0.85rem;
    margin-bottom: 10px;
  }

  .review-card-vi,
  .review-card-meaning {
    font-size: 0.85rem;
    margin-top: 10px;
    line-height: 1.5;
  }

  .review-card-hint {
    font-size: 0.75rem;
    margin-top: 10px;
  }

  .review-card-controls {
    margin-top: 10px;
    padding: 4px;
    gap: 6px;
  }

  .review-btn-audio,
  .review-btn-remove {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .review-navigation {
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    margin-top: 12px;
  }

  .review-progress {
    font-size: 0.8rem;
    margin-right: 0;
    margin-bottom: 4px;
  }

  .review-nav-buttons {
    gap: 6px;
    width: 100%;
    justify-content: space-between;
  }

  .review-btn-prev,
  .review-btn-next,
  .review-btn-flip {
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 6px;
    flex: 1;
  }

  .review-empty {
    padding: 32px 16px;
    font-size: 0.85rem;
  }

  .review-empty p {
    font-size: 0.8rem;
  }

  .review-content {
    min-height: auto;
    padding: 12px 0;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .review-cards {
    min-height: 40vh;
    gap: 6px;
    margin: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0;
    align-items: stretch;
  }

  /* Review tabs - smaller on mobile */
  .review-tabs {
    margin: 0 0 8px;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
  }

  .review-tab-button {
    font-size: 0.7rem;
    padding: 5px 10px;
  }

  /* Saved words list - compact on mobile */
  .saved-words-list {
    gap: 6px;
    margin: 8px 0 0;
    width: 100%;
    max-width: 100%;
    padding: 0;
    box-sizing: border-box;
    list-style: none;
    display: flex;
    flex-direction: column;
  }

  .saved-word-item {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.78rem;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    align-self: stretch;
  }

  .saved-word-jp {
    font-size: 0.9rem;
  }

  .saved-word-reading {
    font-size: 0.75rem;
  }

  .saved-word-vi {
    font-size: 0.8rem;
  }

  .saved-word-meta {
    font-size: 0.7rem;
  }

  .saved-word-btn {
    font-size: 0.68rem;
    padding: 3px 6px;
  }

  /* Review empty state */
  .review-empty-state,
  #saved-words-empty {
    font-size: 0.75rem;
    padding: 10px;
    margin-top: 6px;
  }

  /* Quiz section */
  .review-quiz-description {
    font-size: 0.75rem;
    margin-bottom: 8px;
  }

  #review-quiz-start,
  .review-quiz-start {
    font-size: 0.75rem;
    padding: 6px 12px;
  }

  .review-quiz-area {
    padding: 10px;
    margin-top: 10px;
  }

  .review-quiz-question {
    font-size: 0.8rem;
    padding: 8px;
    margin-bottom: 8px;
  }

  .review-quiz-question strong {
    font-size: 0.95rem;
  }

  .review-quiz-options {
    gap: 6px;
    margin-bottom: 8px;
  }

  .review-quiz-option {
    font-size: 0.75rem;
    padding: 8px 10px;
  }

  .review-quiz-feedback {
    font-size: 0.75rem;
    padding: 6px 10px;
    margin-bottom: 6px;
  }

  .review-quiz-footer {
    font-size: 0.75rem;
    padding: 8px;
  }

  .review-quiz-footer button {
    font-size: 0.75rem;
    padding: 6px 12px;
  }
}

