/**
 * Vocabulary Kanban Board Styles
 * Modern, clean design for vocabulary management
 */

/* Main container */
.vocabulary-view {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.vocabulary-header {
  text-align: center;
  margin-bottom: 30px;
}

.vocabulary-header h1 {
  color: var(--text-primary, #1d1d1f);
  font-size: var(--fs-title-1, 28px);
  font-weight: 600;
  margin-bottom: 10px;
}

.vocabulary-stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: var(--fs-subhead, 16px);
  color: var(--text-secondary, #6e6e73);
}

.stat-total {
  font-weight: 500;
}

.stat-completion {
  color: var(--success-color, #34c759);
  font-weight: 500;
}

/* Kanban board layout */
.vocabulary-kanban {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

/* Kanban columns */
.kanban-column {
  background: var(--bg-secondary, #f5f5f7);
  border-radius: var(--border-radius-lg, 12px);
  padding: 0;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color, #d1d1d6);
}

.kanban-column-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color, #d1d1d6);
  background: var(--bg-primary, #ffffff);
  border-radius: 12px 12px 0 0;
}

.kanban-column-header h2 {
  margin: 0 0 4px 0;
  font-size: var(--fs-title-2, 20px);
  font-weight: 600;
  color: var(--text-primary, #1d1d1f);
}

.column-count {
  color: var(--text-tertiary, #86868b);
  font-size: var(--fs-caption-1, 14px);
  font-weight: 500;
}

.column-subtitle {
  margin: 0;
  font-size: var(--fs-caption-1, 12px);
  color: var(--text-tertiary, #86868b);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kanban-column-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

/* Word cards */
.word-card {
  background: var(--card-bg, #ffffff);
  border-radius: var(--border-radius-md, 8px);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color, #d1d1d6);
  cursor: grab;
  transition: all 0.2s ease;
  position: relative;
}

.word-card:active {
  cursor: grabbing;
}

.word-card.is-dragging {
  opacity: 0.5;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.kanban-column.is-drag-over {
  background: var(--bg-secondary);
  border: 2px dashed var(--primary-color, #007aff);
}


.word-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.word-card:last-child {
  margin-bottom: 0;
}

/* Delete button */
.btn-delete-word {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--error-color, #ff3b30);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: all 0.2s ease;
  z-index: 10;
}

.btn-delete-word:hover {
  opacity: 1;
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(255, 59, 48, 0.4);
}

.btn-delete-word:active {
  transform: scale(0.95);
}

.word-text {
  font-size: var(--fs-title-3, 18px);
  font-weight: 600;
  color: var(--text-primary, #1d1d1f);
  margin-bottom: 4px;
  padding-right: 30px; /* Make space for delete button */
}

.word-phonetic {
  font-size: var(--fs-caption-1, 14px);
  color: var(--text-secondary, #6e6e73);
  font-family: var(--font-mono, 'SF Mono', monospace);
  margin-bottom: 6px;
}

.word-translation {
  font-size: var(--fs-body, 16px);
  color: var(--text-secondary, #6e6e73);
  margin-bottom: 8px;
}

.word-review-count {
  font-size: var(--fs-caption-2, 12px);
  color: var(--text-tertiary, #86868b);
  margin-bottom: 12px;
}

.word-actions {
  display: flex;
  justify-content: flex-end;
}

/* Column-specific styles */
/* Note: In dark mode, we need slightly darker/different gradients or use opacity to blend with bg */
.kanban-to_know .kanban-column-header {
  background: linear-gradient(135deg, rgba(227, 242, 253, 0.5) 0%, rgba(187, 222, 251, 0.5) 100%);
  border-bottom-color: var(--border-color);
}
[data-theme='dark'] .kanban-to_know .kanban-column-header {
  background: linear-gradient(135deg, rgba(30, 60, 90, 0.5) 0%, rgba(20, 40, 60, 0.5) 100%);
}

.kanban-learning .kanban-column-header {
  background: linear-gradient(135deg, rgba(255, 243, 224, 0.5) 0%, rgba(255, 204, 2, 0.2) 100%);
  border-bottom-color: var(--border-color);
}
[data-theme='dark'] .kanban-learning .kanban-column-header {
  background: linear-gradient(135deg, rgba(90, 70, 20, 0.5) 0%, rgba(60, 50, 10, 0.5) 100%);
}

.kanban-known .kanban-column-header {
  background: linear-gradient(135deg, rgba(232, 245, 232, 0.5) 0%, rgba(129, 199, 132, 0.5) 100%);
  border-bottom-color: var(--border-color);
}
[data-theme='dark'] .kanban-known .kanban-column-header {
  background: linear-gradient(135deg, rgba(30, 90, 30, 0.5) 0%, rgba(20, 60, 20, 0.5) 100%);
}


/* Action buttons */
.btn-start-learning,
.btn-practice,
.btn-move-back {
  padding: 8px 16px;
  border: none;
  border-radius: var(--border-radius-sm, 6px);
  font-size: var(--fs-caption-1, 14px);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-start-learning {
  background: var(--primary-color, #007aff);
  color: white;
}

.btn-start-learning:hover {
  background: var(--primary-hover, #0056cc);
}

.btn-practice {
  background: var(--warning-color, #ff9500);
  color: white;
}

.btn-practice:hover {
  background: var(--warning-hover, #e68600);
}

.btn-move-back {
  background: var(--secondary-color, #6e6e73);
  color: white;
}

.btn-move-back:hover {
  background: var(--secondary-hover, #545456);
}

/* Column actions */
.column-actions {
  padding: 16px;
  border-top: 1px solid var(--border-color, #d1d1d6);
  background: var(--bg-primary, #ffffff);
}

.btn-practice-all {
  width: 100%;
  padding: 12px;
  background: var(--success-color, #34c759);
  color: white;
  border: none;
  border-radius: var(--border-radius-md, 8px);
  font-size: var(--fs-subhead, 16px);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-practice-all:hover {
  background: var(--success-hover, #28a745);
  transform: translateY(-1px);
}

/* Empty column state */
.empty-column {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary, #86868b);
  font-style: italic;
}

/* Vocabulary actions */
.vocabulary-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  border-top: 1px solid var(--border-color, #d1d1d6);
  background: var(--bg-secondary, #f5f5f7);
  border-radius: var(--border-radius-lg, 12px);
}

.btn-primary,
.btn-secondary {
  padding: 12px 24px;
  border: none;
  border-radius: var(--border-radius-md, 8px);
  font-size: var(--fs-subhead, 16px);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: var(--primary-color, #007aff);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover, #0056cc);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--secondary-color, #6e6e73);
  color: white;
}

.btn-secondary:hover {
  background: var(--secondary-hover, #545456);
  transform: translateY(-1px);
}

/* Confirmation dialog */
.confirm-dialog-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.confirm-dialog-modal .modal-content {
  background: var(--bg-primary, #ffffff);
  border-radius: var(--border-radius-lg, 12px);
  max-width: 400px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.confirm-dialog-modal .modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color, #d1d1d6);
}

.confirm-dialog-modal .modal-header h3 {
  margin: 0;
  font-size: var(--fs-title-2, 20px);
  color: var(--text-primary, #1d1d1f);
  font-weight: 600;
}

.confirm-dialog-modal .modal-body {
  padding: 20px;
}

.confirm-dialog-modal .modal-body p {
  margin: 0;
  font-size: var(--fs-body, 16px);
  color: var(--text-secondary, #6e6e73);
  line-height: 1.5;
}

.confirm-dialog-modal .modal-actions {
  padding: 20px;
  border-top: 1px solid var(--border-color, #d1d1d6);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-danger {
  padding: 10px 20px;
  background: var(--error-color, #ff3b30);
  color: white;
  border: none;
  border-radius: var(--border-radius-sm, 6px);
  cursor: pointer;
  font-size: var(--fs-subhead, 16px);
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: var(--error-hover, #d63027);
  transform: translateY(-1px);
}

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

/* Word details modal */
.word-details-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.word-details-modal .modal-content {
  background: var(--bg-primary, #ffffff);
  border-radius: var(--border-radius-lg, 12px);
  max-width: 400px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color, #d1d1d6);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: var(--fs-title-2, 20px);
  color: var(--text-primary, #1d1d1f);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-tertiary, #86868b);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-secondary, #f2f2f7);
}

.modal-body {
  padding: 20px;
}

.detail-item {
  margin-bottom: 12px;
  font-size: var(--fs-body, 16px);
  color: var(--text-secondary);
}

.detail-item strong {
  color: var(--text-primary, #1d1d1f);
  font-weight: 600;
}

.modal-actions {
  padding: 20px;
  border-top: 1px solid var(--border-color, #d1d1d6);
  text-align: right;
}

.modal-actions button {
  padding: 8px 16px;
  background: var(--secondary-color, #6e6e73);
  color: white;
  border: none;
  border-radius: var(--border-radius-sm, 6px);
  cursor: pointer;
  font-size: var(--fs-subhead, 16px);
}

/* Error message */
.error-message {
  text-align: center;
  padding: 40px 20px;
  color: var(--error-color, #ff3b30);
}

.error-message h2 {
  margin-bottom: 16px;
  color: var(--error-color, #ff3b30);
}

.error-message button {
  padding: 10px 20px;
  background: var(--error-color, #ff3b30);
  color: white;
  border: none;
  border-radius: var(--border-radius-md, 8px);
  cursor: pointer;
  font-size: var(--fs-subhead, 16px);
}

/* FLASHCARD SPECIFIC STYLES */
.flashcards-simplified {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.flashcard-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  color: var(--text-secondary);
}

.flashcard-container {
  perspective: 1000px;
  margin-bottom: 24px;
}

.flashcard {
  background-color: transparent;
  width: 100%;
  height: 300px;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  border-radius: 16px;
}

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

.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform-style: preserve-3d; /* Force 3D rendering context */
  background-color: var(--card-bg, #fff);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  /* Ensure text is always readable in dark mode */
  color: var(--text-primary);
}

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

/* Fix visibility bug on Safari/Mobile where backface hidden might cause issues */
.flashcard.flipped .flashcard-front {
  visibility: hidden; /* Fallback for some browsers */
}

.card-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%; /* Ensure content takes full width */
}

.card-content .word-text {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  padding-right: 0; /* Override vocabulary card style */
}

.card-content .word-translation {
  font-size: 24px;
  color: var(--primary-color);
  margin-top: 8px;
  font-weight: 500;
}

.card-content .word-phonetic {
  font-size: 18px;
  color: var(--text-secondary);
  font-family: monospace;
}

.rating-prompt {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.flip-hint {
  margin-top: 32px;
  font-size: 14px;
  color: var(--text-tertiary);
  opacity: 0.7;
}

.rating-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-rating {
  flex: 1;
  padding: 16px;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
}

.btn-rating:active {
  transform: scale(0.98);
}

.btn-dont-know {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

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

.btn-mastered {
  background-color: var(--success-color, #34C759);
  color: white;
}

/* TTS Button */
.btn-tts {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  padding: 8px;
  border-radius: 50%;
  color: var(--text-primary);
}

.btn-tts:hover {
  opacity: 1;
  background-color: var(--bg-secondary);
}


/* Responsive design */
@media (max-width: 768px) {
  .vocabulary-kanban {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .vocabulary-stats {
    flex-direction: column;
    gap: 8px;
  }

  .vocabulary-actions {
    flex-direction: column;
    align-items: center;
  }

  .word-card {
    padding: 12px;
  }

  .modal-content {
    margin: 20px;
    width: calc(100% - 40px);
  }
}
