/* Game specific styles for Memory Match */

:root {
  --primary: #FF8906;
  --accent: #F25F4C;
  --surface: #2A2A2A;
  --text: #FFFFFE;
  --card-front: linear-gradient(135deg, #4a6aff 0%, #9130ff 100%);
  --card-back: linear-gradient(135deg, #41295a 0%, #2F0743 100%);
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --animation-duration: 0.5s;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.back-btn {
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.3s ease;
}

.back-btn:hover {
  transform: translateX(-5px);
  color: var(--primary);
}

.game-container {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 2rem;
  margin-bottom: 3rem;
}

.game-info {
  background-color: var(--surface);
  padding: 2rem;
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.stat-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem;
  border-radius: 10px;
  background-color: rgba(255, 255, 255, 0.15);
}

.stat-item i {
  font-size: 1.2rem;
  color: var(--primary);
}

.difficulty-selector,
.theme-selector {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.difficulty-buttons,
.theme-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.difficulty-btn,
.theme-btn {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: none;
  padding: 0.8rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.difficulty-btn.active,
.theme-btn.active {
  background-color: var(--primary);
  transform: scale(1.05);
  box-shadow: 0 2px 10px rgba(255, 137, 6, 0.3);
}

.difficulty-btn:hover:not(.active),
.theme-btn:hover:not(.active) {
  background-color: rgba(255, 255, 255, 0.2);
}

.action-btn {
  background-color: var(--accent);
  color: var(--text);
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 30px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: auto;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.action-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(255, 137, 6, 0.4);
}

/* Game Board */
.game-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 1rem;
  aspect-ratio: 4/3;
  max-width: 800px;
  margin: 0 auto;
}

.game-board.medium {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  aspect-ratio: 1/1;
}

.game-board.hard {
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(4, 1fr);
  aspect-ratio: 6/4;
}

/* Card Styles */
.card {
  position: relative;
  cursor: pointer;
  perspective: 1000px;
  transform-style: preserve-3d;
  transition: transform var(--animation-duration) ease;
}

.card:not(.flipped):not(.matched):hover {
  transform: scale(1.05);
}

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

.card.matched {
  transform: rotateY(180deg);
  opacity: 0.8;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-front {
  background: var(--card-front);
  color: white;
  transform: rotateY(180deg);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.card-front svg {
  width: 60%;
  height: 60%;
  max-width: 60px;
  max-height: 60px;
}

.card-back {
  background: var(--card-back);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Add question mark to card back */
.card-back::after {
  content: "?";
  font-size: 2.5rem;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.4);
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Theme-specific card styling */
.card.colors .card-front {
  background: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.card.colors .card-front svg {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}

.card.animals .card-front {
  background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
  color: #333;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.card.animals .card-front svg {
  width: 70%;
  height: 70%;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

.card.icons .card-front {
  background: linear-gradient(135deg, #4364f7 0%, #6fb1fc 100%);
  box-shadow: 0 0 15px rgba(99, 179, 237, 0.3);
}

/* Win Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.modal.active {
  display: flex;
}

.modal-content {
  background-color: var(--surface);
  padding: 2rem;
  border-radius: 15px;
  text-align: center;
  max-width: 90%;
  width: 400px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem;
  border-radius: 10px;
  background-color: rgba(255, 255, 255, 0.1);
}

.result-item i {
  color: var(--primary);
}

/* Keyframe Animations */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.card.matched .card-inner {
  animation: pulse 0.5s ease;
}

/* Media Queries */
@media (max-width: 768px) {
  .game-container {
    grid-template-columns: 1fr;
  }
  
  .game-info {
    order: 2;
  }
  
  .game-board {
    order: 1;
    max-width: 100%;
  }
  
  .difficulty-buttons,
  .theme-buttons {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .difficulty-btn,
  .theme-btn {
    flex: 1;
  }

  .card-front svg {
    width: 50%;
    height: 50%;
  }
}