/* css/components.css */

/* Game Container - Layout for active modules */
#game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    align-items: center;
    overflow-y: auto;
}

/* Card components used across modules */
.game-card {
    background: white;
    border-radius: var(--radius-card);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    transition: transform 0.1s;
}

.game-card:active {
    transform: scale(0.96);
}

.game-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.game-card.wrong {
    animation: shake 0.4s ease-in-out;
}

/* Shake Animation for wrong answers */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* General Layout helpers */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
    max-width: 600px;
}

.grid-3x3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 4px;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1/1;
    background: white;
    padding: 4px;
    border-radius: var(--radius-card);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-large {
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-btn);
    padding: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.4);
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 300px;
}

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

.success-message {
    text-align: center;
    font-size: 2rem;
    color: var(--color-success);
    font-weight: bold;
    margin-top: 30px;
    animation: popIn 0.5s ease-out backwards;
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    80% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Memory Module Specific Styles */
.memory-progress {
  font-size: 1.2rem;
  font-weight: bold;
  color: #888;
  margin-top: 16px;
}
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 600px;
  padding: 10px;
}
.memory-card {
  perspective: 600px;
  cursor: pointer;
  aspect-ratio: 1/1;
  min-height: 80px;
}
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.4s;
  transform-style: preserve-3d;
}
.memory-card.flipped .card-inner { transform: rotateY(180deg); }
.card-back, .card-front {
  position: absolute;
  width: 100%; height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  overflow: hidden;
}
.card-back {
  background: var(--color-primary);
  font-size: 2rem;
  color: white;
}
.card-front {
  transform: rotateY(180deg);
  background: white;
}
.card-front img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}
.memory-gr {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--color-primary);
  text-align: center;
}
.memory-audio {
  font-size: 1.5rem;
  margin-top: 4px;
}
.memory-card.matched .card-inner { 
  opacity: 0.6; 
}
.memory-card.matched .card-front { 
  border: 4px solid var(--color-success); 
}

/* Puzzle Module Specific Styles */
.puzzle-wrap { position: relative; width: 80vw; max-width: 400px; aspect-ratio: 1; }
.puzzle-img { width: 100%; height: 100%; object-fit: cover; border-radius: 16px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.puzzle-grid {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  display: grid; gap: 4px;
}
.puzzle-tile {
  background: linear-gradient(135deg, #a8edea, #fed6e3);
  border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; transition: opacity 0.3s;
  box-shadow: inset 0 0 10px rgba(255,255,255,0.5);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.puzzle-tile:active { transform: scale(0.95); }
.puzzle-tile.gone { opacity: 0; pointer-events: none; }
.puzzle-word.hidden { opacity: 0; pointer-events: none; }
.puzzle-word.visible { opacity: 1; transition: opacity 0.5s; }

/* Mal und Lern Specific Styles */
.mal-screen { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 16px; width: 100%; }
.mal-canvas-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; }
.mal-svg { width: 80vw; max-width: 320px; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.1)); }
.mal-palette {
  display: flex; flex-wrap: wrap;
  gap: 12px; justify-content: center; padding: 12px;
  max-width: 400px;
}
.mal-color-btn {
  width: 56px; height: 56px;
  border-radius: 50%; border: 4px solid transparent;
  cursor: pointer; transition: transform 0.15s, border-color 0.15s;
}
.mal-color-btn:active { transform: scale(0.9); }
.mal-color-btn.active { border-color: var(--color-text); transform: scale(1.15); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.mal-gr { font-size: 2.5rem; font-weight: bold; color: var(--color-primary); margin-top: 10px; }

/* Bilderbuch Specific Styles */
.buch-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding: 16px;
  gap: 16px;
  width: 100%;
}

.buch-image-wrap {
  flex: 1;
  width: 100%;
  max-width: 420px;
  cursor: pointer;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
  transition: transform 0.15s;
  min-height: 200px;
}
.buch-image-wrap:active { transform: scale(0.98); }

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

.buch-text-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  padding: 12px 20px;
  border-radius: 14px;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: background 0.2s;
  width: 100%;
  max-width: 420px;
}
.buch-text-wrap:active { background: #f0f8ff; }

.buch-sentence {
  font-size: 1.4rem;
  font-family: var(--font-greek);
  color: var(--color-text);
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}
.buch-sentence.playing {
  color: var(--color-primary);
  text-shadow: 0 0 12px rgba(74,144,217,0.3);
}

.buch-audio-icon { font-size: 1.4rem; }

.buch-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 420px;
  justify-content: space-between;
  padding: 8px 0;
}
.buch-dots { display: flex; gap: 8px; justify-content: center; flex: 1; }
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #ccc;
  transition: all 0.2s;
}
.dot.active { background: var(--color-primary); transform: scale(1.3); }
