/**
 * Archivo: /template-parts/custom-shorts/museo-de-oran/styles/memoria-screen.css
 * Estilos para el juego de memoria 3x4
 */

/* ====== CONTENEDOR PRINCIPAL ====== */
.memoria-screen {
  /*background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);*/
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.memoria-container {
  max-width: 1000px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  z-index: 10;
  position: relative;
}

/* ====== HEADER ====== */
.memoria-header {
  text-align: center;
  background: #0b8644;
  border-radius: 20px;
  padding: 1.5rem 2rem;
  box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
  backdrop-filter: blur(10px);
}

.memoria-title {
  font-family: "Chewy", system-ui;
  font-size: 2.5rem;
  color: white;
  margin: 0;
  text-shadow: 2px 2px 1px rgba(0,0,0,0.81);
}

/* ====== CONTENEDOR PRINCIPAL ====== */
.memoria-main {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.1);
  padding: 2rem;
  border-radius: 20px;
  backdrop-filter: blur(5px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

/* ====== TABLERO DE CARTAS 3x4 ====== */
.memoria-board {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 1rem;
  aspect-ratio: 4/3;
}

/* ====== STATS A LA DERECHA ====== */
.memoria-stats {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: rgba(255, 255, 255, 0.95);
  padding: 2rem;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  flex-shrink: 0;
  width: 200px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: rgba(103, 126, 234, 0.1);
  border-radius: 15px;
  border: 2px solid rgba(103, 126, 234, 0.2);
}

.stat-label {
  font-family: "Chewy", system-ui;
  font-size: 0.9rem;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-family: "Chewy", system-ui;
  font-size: 1.8rem;
  color: #2d3748;
  font-weight: 600;
}

/* ====== CARTAS ====== */
.memoria-card {
  perspective: 1000px;
  cursor: pointer;
  animation: cardEntrance 0.6s ease-out both;
}

.memoria-card:nth-child(1) { animation-delay: 0.1s; }
.memoria-card:nth-child(2) { animation-delay: 0.15s; }
.memoria-card:nth-child(3) { animation-delay: 0.2s; }
.memoria-card:nth-child(4) { animation-delay: 0.25s; }
.memoria-card:nth-child(5) { animation-delay: 0.3s; }
.memoria-card:nth-child(6) { animation-delay: 0.35s; }
.memoria-card:nth-child(7) { animation-delay: 0.4s; }
.memoria-card:nth-child(8) { animation-delay: 0.45s; }
.memoria-card:nth-child(9) { animation-delay: 0.5s; }
.memoria-card:nth-child(10) { animation-delay: 0.55s; }
.memoria-card:nth-child(11) { animation-delay: 0.6s; }
.memoria-card:nth-child(12) { animation-delay: 0.65s; }

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  border-radius: 15px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

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

.memoria-card.matched .card-inner {
  animation: matchPulse 0.6s ease-out;
}

.memoria-card.shake .card-inner {
  animation: cardShake 0.5s ease-out;
}

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

.card-front {
  background: linear-gradient(135deg, #e2e2e2, #ffffff);
  border: 3px solid rgba(255,255,255,0.3);
}

.card-back {
  background: white;
  transform: rotateY(180deg);
  border: 3px solid #e2e8f0;
}

/* Patrón de la parte frontal */
.card-pattern {
  width: 60%;
  height: 60%;
  background: #0b8644;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-pattern::before {
  content: '?';
  font-family: "Chewy", system-ui;
  font-size: 2rem;
  color: white;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* Imagen de la parte trasera */
.card-back img {
  width: 80%;
  height: 80%;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Estados especiales */
.memoria-card.matched {
  pointer-events: none;
}

.memoria-card.matched .card-back {
  background: linear-gradient(135deg, #48bb78, #38a169);
  border-color: #68d391;
}

/* ====== CONTROLES ====== */
.memoria-controls {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.memoria-btn {
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 15px;
  padding: 1rem 2rem;
  font-family: "Chewy", system-ui;
  font-size: 1rem;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  backdrop-filter: blur(10px);
}

.memoria-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  background: white;
}

.back-btn:hover {
  color: #0b8644;
  border: 2px solid #e9d8fd;
}

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

.memoria-btn svg {
  transition: all 0.3s ease;
}

.memoria-btn:hover svg {
  transform: scale(1.1);
}

/* ====== LOADING ====== */
.memoria-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 2rem;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 15px 35px rgba(0,0,0,0.2);
  backdrop-filter: blur(10px);
  z-index: 100;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e2e8f0;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem auto;
}

.memoria-loading p {
  font-family: "Chewy", system-ui;
  color: #4a5568;
  margin: 0;
  font-size: 1.1rem;
}

/* ====== VICTORIA ====== */
.memoria-victory {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.5s ease-out;
}

.victory-content {
  background: white;
  padding: 3rem 2rem;
  border-radius: 25px;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
  animation: victoryPop 0.6s ease-out;
  max-width: 400px;
  width: 90%;
}

.victory-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: bounce 2s infinite;
}

.victory-content h3 {
  font-family: "Chewy", system-ui;
  font-size: 2rem;
  color: #2d3748;
  margin: 0 0 1rem 0;
}

.victory-content p {
  font-family: "Chewy", system-ui;
  color: #718096;
  margin: 0 0 2rem 0;
  font-size: 1.1rem;
}

.victory-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 2rem;
  padding: 1rem;
  background: #f7fafc;
  border-radius: 15px;
}

.victory-stat {
  text-align: center;
}

.victory-label {
  display: block;
  font-family: "Chewy", system-ui;
  font-size: 0.9rem;
  color: #718096;
  margin-bottom: 0.5rem;
}

.victory-value {
  font-family: "Chewy", system-ui;
  font-size: 1.5rem;
  color: #2d3748;
  font-weight: 600;
}

.victory-btn {
  background: linear-gradient(135deg, #48bb78, #38a169);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 20px;
  font-family: "Chewy", system-ui;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(72, 187, 120, 0.3);
}

.victory-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
}

/* ====== ANIMACIONES ====== */
@keyframes cardEntrance {
  0% {
    opacity: 0;
    transform: scale(0.8) rotateY(-90deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotateY(0deg);
  }
}

@keyframes matchPulse {
  0% { transform: scale(1) rotateY(180deg); }
  50% { transform: scale(1.1) rotateY(180deg); }
  100% { transform: scale(1) rotateY(180deg); }
}

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

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes victoryPop {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(-50px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* ====== RESPONSIVO ====== */
@media (max-width: 768px) {
  .memoria-screen {
    padding: 1rem;
  }
  
  .memoria-title {
    font-size: 2rem;
  }
  
  .memoria-main {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .memoria-board {
    gap: 0.5rem;
    max-width: 100%;
  }
  
  .memoria-stats {
    flex-direction: row;
    justify-content: space-around;
    min-width: unset;
  }
  
  .stat-item {
    flex: 1;
    margin: 0 0.5rem;
  }
  
  .stat-value {
    font-size: 1.4rem;
  }
  
  .card-pattern::before {
    font-size: 1.5rem;
  }
  
  .memoria-btn {
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
  }
  
  .victory-content {
    padding: 2rem 1.5rem;
  }
  
  .victory-content h3 {
    font-size: 1.5rem;
  }
  
  .victory-icon {
    font-size: 3rem;
  }
}

@media (max-width: 480px) {
  .memoria-container {
    gap: 1.5rem;
  }
  
  .memoria-header {
    padding: 1rem;
  }
  
  .memoria-title {
    font-size: 1.5rem;
  }
  
  .memoria-main {
    padding: 1rem;
  }
  
  .memoria-board {
    gap: 0.3rem;
  }
  
  .memoria-stats {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .stat-value {
    font-size: 1.2rem;
  }
  
  .card-pattern::before {
    font-size: 1.2rem;
  }
}

/* ====== CLASES DE TRANSICIÓN ====== */
.interactive-567.transitioning-to-memoria .memoria-screen {
  animation: slideInFromBottom 0.5s ease-out;
}

.interactive-567.transitioning-to-initial .memoria-screen {
  transform: scale(0.8) rotateX(-15deg);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInFromBottom {
  0% {
    transform: translateY(100%) scale(0.8);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* ✅ ESTILOS PARA MEMORIA MINI (2x3) */
.memoria-small-mode .memoria-board {
  grid-template-columns: repeat(3, 1fr); /* 3 columnas */
  grid-template-rows: repeat(2, 1fr);    /* 2 filas */
  gap: 15px;
}

.memoria-small-mode .memoria-card {
  border-radius: 12px;
}

.memoria-small-mode .memoria-title::after {
  content: ' - Mini';
  color: #ff6b6b;
  font-weight: normal;
}

.memoria-small-mode .memoria-stats {
  margin-left: 20px; /* Menos separación */
}

.memoria-small-mode .memoria-stats .stat-item {
  margin-bottom: 15px; /* Menos espacio */
}

/* Responsive para memoria mini */
@media (max-width: 768px) {
  .memoria-small-mode .memoria-board {
    max-width: 300px;
    max-height: 200px;
    gap: 10px;
  }
  
  .memoria-small-mode .memoria-card {
    width: 80px;
    height: 80px;
  }
}
