/* Schulkompass Custom Styles */

:root {
  --color-primary: #3b82f6;
  --color-primary-dark: #2563eb;
  --color-secondary: #6366f1;
  --color-accent: #22c55e;
  --color-accent-dark: #16a34a;
}

/* View Transitions */
.view-enter {
  animation: viewFadeIn 0.3s ease-out;
}

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

/* Flashcard Flip Animation */
.flashcard-container {
  perspective: 1000px;
}

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

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

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border-radius: 1rem;
  text-align: center;
  font-size: 1.25rem;
  line-height: 1.6;
}

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

/* Quiz Option Animations */
.quiz-option {
  transition: all 0.2s ease;
}

.quiz-option:hover {
  transform: translateX(4px);
}

.quiz-option.correct {
  animation: correctPulse 0.5s ease;
}

.quiz-option.wrong {
  animation: wrongShake 0.5s ease;
}

@keyframes correctPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* Crossword Grid */
.crossword-grid {
  display: inline-grid;
  gap: 1px;
  background-color: #d1d5db;
  border: 2px solid #374151;
}

.dark .crossword-grid {
  background-color: #4b5563;
  border-color: #9ca3af;
}

.crossword-cell {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.95rem;
  text-transform: uppercase;
  position: relative;
}

.crossword-cell input {
  width: 100%;
  height: 100%;
  border: none;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  text-transform: uppercase;
  background: white;
  outline: none;
}

.dark .crossword-cell input {
  background: #1f2937;
  color: #f3f4f6;
}

.crossword-cell input:focus {
  background: #dbeafe;
}

.dark .crossword-cell input:focus {
  background: #1e40af;
}

.crossword-cell .cell-number {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 0.55rem;
  font-weight: 400;
  color: #6b7280;
  line-height: 1;
  pointer-events: none;
}

.crossword-cell.blocked {
  background: #374151;
}

.dark .crossword-cell.blocked {
  background: #111827;
}

.crossword-cell.correct input {
  background: #dcfce7;
  color: #166534;
}

.dark .crossword-cell.correct input {
  background: #14532d;
  color: #bbf7d0;
}

.crossword-cell.wrong input {
  background: #fee2e2;
  color: #991b1b;
}

.dark .crossword-cell.wrong input {
  background: #7f1d1d;
  color: #fecaca;
}

/* Word Search Grid */
.wordsearch-grid {
  display: inline-grid;
  gap: 0;
  user-select: none;
}

.wordsearch-cell {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.95rem;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  transition: all 0.15s ease;
}

.dark .wordsearch-cell {
  border-color: #374151;
}

.wordsearch-cell:hover {
  background: #dbeafe;
}

.dark .wordsearch-cell:hover {
  background: #1e40af;
}

.wordsearch-cell.selected {
  background: #bfdbfe;
  color: #1e40af;
}

.dark .wordsearch-cell.selected {
  background: #1d4ed8;
  color: #dbeafe;
}

.wordsearch-cell.found {
  background: #dcfce7;
  color: #166534;
  font-weight: 700;
}

.dark .wordsearch-cell.found {
  background: #14532d;
  color: #bbf7d0;
}

.wordsearch-cell.start-cell {
  background: #93c5fd;
}

/* Progress Bar Animation */
.progress-bar-fill {
  transition: width 0.5s ease-out;
}

/* Toast Animation */
.toast-enter {
  animation: toastIn 0.3s ease-out;
}

.toast-exit {
  animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

/* Drag & Drop Zone */
.drop-zone {
  transition: all 0.3s ease;
}

.drop-zone.drag-over {
  border-color: var(--color-primary);
  background-color: rgba(59, 130, 246, 0.05);
  transform: scale(1.01);
}

.dark .drop-zone.drag-over {
  background-color: rgba(59, 130, 246, 0.1);
}

/* Difficulty Badge Colors */
.badge-leicht { background: #dcfce7; color: #166534; }
.badge-mittel { background: #fef3c7; color: #92400e; }
.badge-schwer { background: #fee2e2; color: #991b1b; }

.dark .badge-leicht { background: #14532d; color: #bbf7d0; }
.dark .badge-mittel { background: #78350f; color: #fde68a; }
.dark .badge-schwer { background: #7f1d1d; color: #fecaca; }

/* Print Styles */
@media print {
  #sidebar, header, #toast-container, #modal-container,
  .no-print, button, .nav-link {
    display: none !important;
  }

  main {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .flashcard {
    transform: none !important;
    page-break-inside: avoid;
  }

  .flashcard-face {
    position: relative !important;
    backface-visibility: visible !important;
    border: 1px solid #ccc;
    margin-bottom: 1rem;
  }

  .flashcard-back {
    transform: none !important;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.dark ::-webkit-scrollbar-thumb {
  background: #475569;
}

/* Grammar Fill-in Styling */
.grammar-blank {
  display: inline-block;
  min-width: 100px;
  border-bottom: 2px solid #3b82f6;
  padding: 2px 8px;
  margin: 0 4px;
  text-align: center;
  font-weight: 600;
}

.grammar-blank.correct {
  border-bottom-color: #22c55e;
  color: #166534;
}

.grammar-blank.wrong {
  border-bottom-color: #ef4444;
  color: #991b1b;
}

/* Card hover effect */
.package-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.package-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* Letter Gap — aktive Kachel blinkt */
.lg-cell-active {
  animation: lgBlink 0.9s ease-in-out infinite;
}

@keyframes lgBlink {
  0%, 100% { background-color: #dbeafe; border-color: #3b82f6; }
  50%       { background-color: #bfdbfe; border-color: #2563eb; }
}

.dark .lg-cell-active {
  animation: lgBlinkDark 0.9s ease-in-out infinite;
}

@keyframes lgBlinkDark {
  0%, 100% { background-color: #1e3a8a; border-color: #60a5fa; }
  50%       { background-color: #1e40af; border-color: #93c5fd; }
}

/* Section Gap Slots */
.gap-slot {
  display: inline-block;
  min-width: 80px;
  padding: 1px 10px;
  margin: 0 3px;
  border: 2px dashed #3b82f6;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  font-weight: 600;
  vertical-align: middle;
  transition: all 0.15s ease;
  color: #9ca3af;
}

.gap-slot.filled {
  border-style: solid;
  background-color: #dbeafe;
  color: #1e40af;
}

.dark .gap-slot.filled {
  background-color: #1e3a8a;
  color: #bfdbfe;
}

.gap-slot.correct {
  border-color: #22c55e;
  border-style: solid;
  background-color: #dcfce7;
  color: #166534;
}

.dark .gap-slot.correct {
  background-color: #14532d;
  color: #bbf7d0;
}

.gap-slot.wrong {
  border-color: #ef4444;
  border-style: solid;
  background-color: #fee2e2;
  color: #991b1b;
}

.dark .gap-slot.wrong {
  background-color: #7f1d1d;
  color: #fecaca;
}

/* Markdown content styling */
.markdown-content h1 { font-size: 1.5rem; font-weight: 700; margin: 1rem 0 0.5rem; }
.markdown-content h2 { font-size: 1.25rem; font-weight: 600; margin: 0.75rem 0 0.5rem; }
.markdown-content h3 { font-size: 1.1rem; font-weight: 600; margin: 0.5rem 0 0.25rem; }
.markdown-content p { margin: 0.5rem 0; line-height: 1.7; }
.markdown-content ul { list-style: disc; padding-left: 1.5rem; margin: 0.5rem 0; }
.markdown-content ol { list-style: decimal; padding-left: 1.5rem; margin: 0.5rem 0; }
.markdown-content li { margin: 0.25rem 0; }
.markdown-content code {
  background: #f1f5f9;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}
.dark .markdown-content code {
  background: #334155;
}
.markdown-content strong { font-weight: 700; }
.markdown-content em { font-style: italic; }
