@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@900&display=swap");

/* ===== RESET Y CONFIGURACIONES GENERALES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: block;
  min-height: 1vh;
  padding: 0;
  margin: 0;
  font-family: "Montserrat", sans-serif;
  --blue: #1e3a8a;
  --bkg: #5eb3fd;
  --white: #e7e6e6;
  background-color: var(--white);
  background-image: url("https://www.transparenttextures.com/patterns/concrete-wall.png");
}

/* ===== ESTILOS DEL HEADER Y NAVEGACIÓN ===== */
header {
  padding: 1rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  position: relative;
  border-bottom: 4px solid rgb(0, 0, 0, 0, 2);
  text-align: center;
  overflow: hidden;
}

nav ul {
  display: flex;
  list-style: none;
  justify-content: center;
}

nav ul li {
  margin: 0 15px;
}

/* ===== FANTASMA ANIMADO ===== */
.ghost {
  width: 3vmin;
  height: 5vmin;
  background-color: #e7e6e6;
  background-image: radial-gradient(ellipse at 35% 40%, #000 8%, transparent 0%),
    radial-gradient(ellipse at 65% 40%, #000 8%, transparent 0%),
    radial-gradient(ellipse at 50% 60%, #000 8%, transparent 0%);
  border-radius: 100% / 70% 70% 0 0;
  position: absolute;
  top: 24%;
  left: 100%;
  opacity: 0.9;
  mix-blend-mode: exclusion;
  animation: ghostMove 6s linear infinite;
  z-index: 0;
}

.ghost div {
  position: absolute;
  width: 20%;
  background-color: #e7e6e6;
}

.ghost div:nth-of-type(1) {
  height: 3.5vmin;
  left: 0;
  bottom: -3vmin;
  border-radius: 100% / 0 0 50% 50%;
}

.ghost div:nth-of-type(2),
.ghost div:nth-of-type(4) {
  height: 2vmin;
  left: 20%;
  bottom: -1.5vmin;
  border-radius: 100% / 50% 50% 0 0;
  background-color: transparent;
}

.ghost div:nth-of-type(3) {
  height: 2vmin;
  left: 40%;
  bottom: -2vmin;
  border-radius: 100% / 0 0 60% 60%;
}

.ghost div:nth-of-type(4) {
  left: 60%;
}

.ghost div:nth-of-type(5) {
  height: 1.5vmin;
  left: 80%;
  bottom: -1.4vmin;
  border-radius: 100% / 0 0 70% 70%;
}

@keyframes ghostMove {
  0% {
    transform: translateX(0vw) translateY(0) rotateZ(-90deg);
  }
  100% {
    transform: translateX(-120vw) translateY(0) rotateZ(-90deg);
  }
}

/* ===== ESTILOS DE TODOS LOS BOTONES ===== */
.Inicio {
  appearance: none;
  background-color: transparent;
  border: 0.125em solid #1a1a1a;
  border-radius: 0.9375em;
  box-sizing: border-box;
  color: #1a1a1a;
  cursor: pointer;
  display: inline-block;
  font-family: "Montserrat", sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: normal;
  margin: 0;
  min-height: 3em;
  min-width: 0;
  outline: none;
  padding: 1em 1.3em;
  text-align: center;
  text-decoration: none;
  transition: all 300ms cubic-bezier(0.23, 1, 0.32, 1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  will-change: transform;
}

.Inicio:hover {
  color: #fff;
  background-color: #1a1a1a;
  box-shadow: rgba(0, 0, 0, 0.25) 0 8px 15px;
  transform: translateY(-2px);
}

.Inicio:active {
  box-shadow: none;
  transform: translateY(0);
}

.Juegos {
  appearance: none;
  background-color: transparent;
  border: 0.125em solid #1a1a1a;
  border-radius: 0.9375em;
  box-sizing: border-box;
  color: #1a1a1a;
  cursor: pointer;
  display: inline-block;
  font-family: "Montserrat", sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: normal;
  margin: 0;
  min-height: 3em;
  min-width: 0;
  outline: none;
  padding: 1em 1.3em;
  text-align: center;
  text-decoration: none;
  transition: all 300ms cubic-bezier(0.23, 1, 0.32, 1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.Juegos:hover {
  color: #fff;
  background-color: #1a1a1a;
  box-shadow: rgba(0, 0, 0, 0.25) 0 8px 15px;
  transform: translateY(-2px);
}

.Juegos:active {
  box-shadow: none;
  transform: translateY(0);
}

/* ===== ESTRUCTURA PRINCIPAL DEL CONTENIDO ===== */
main {
  width: 100%;
}

.contenido {
  background-color: var(--primary-color);
  color: white;
  position: relative;
  border-bottom: 4px solid var(--border-color);
  text-align: center;
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 25px;
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
}

/* ===== ESTILOS DEL BUSCADOR ===== */
.buscador {
  margin-bottom: 30px;
  position: relative;
}

.buscador input {
  width: 100%;
  padding: 12px 15px;
  border: 3px solid;
  border-radius: 8px;
  font-size: 1rem;
  box-shadow: 3px 3px 0;
  background-color: #ffffff;
  color: #000000;
  font-weight: 500;
}

.buscador::after {
  content: "🔍";
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
}

/* ===== ESTILOS DEL FORMULARIO AGREGAR JUEGOS ===== */
.agregar-juegos {
  display: flex;
  flex-direction: column;
  background: linear-gradient(to bottom, #4c4d4e, #ffffff);
  padding: 20px;
  border-radius: 8px;
  border: 2px;
  border: 3px solid black;
}

.agregar-juegos h3 {
  margin-bottom: 15px;
  text-align: center;
  font-size: 1.4rem;
  text-shadow: 2px 2px 0 black;
  letter-spacing: 1px;
  color: #ffffff;
}

.agregar-juegos input {
  padding: 12px;
  margin-bottom: 15px;
  font-family: "Montserrat", sans-serif;
  flex: 1;
  border: 2px solid #444;
  border-radius: 8px;
  font-size: 1rem;
  box-shadow: 2px 2px 0 black;
  background-color: #ffffff;
  color: #000000;
  font-weight: 500;
}

.agregar-juegos textarea {
  min-height: 80px;
  resize: vertical;
  padding: 12px;
  margin-bottom: 15px;
  font-family: "Montserrat", sans-serif;
  flex: 1;
  border: 2px solid #444;
  border-radius: 8px;
  font-size: 1rem;
  box-shadow: 2px 2px 0 black;
  background-color: #ffffff;
  color: #000000;
  font-weight: 500;
}

/* ===== ESTILOS DEL ASIDE ===== */
aside {
  background-color: rgb(107, 106, 106);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 6px 6px 0 black;
  border: 3px solid black;
  position: relative;
  width: 300px;
}

aside::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border: 2px dashed var(--accent-color);
  border-radius: 12px;
  z-index: -1;
  pointer-events: none;
}

/* ===== ESTILOS DEL GRID DE JUEGOS ===== */
.juegos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 25px;
}

/* ===== ESTILOS DE LAS TARJETAS DE JUEGO ===== */

.juego {
  text-align: center;
  position: relative;
  align-items: center;
  font-family: "Montserrat", sans-serif;
  border: 2px solid #a5a1a1;
  border-radius: 15px;
  padding: 0;
  background-color: #9e9a9a;
  text-align: center;
  box-shadow: 0 10px 30px 5px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease;
  height: 300px;
}
.juego:hover {
  transform: scale(1.05);
}

.juego-card {
  font-family: "Montserrat", sans-serif;
  align-items: center;
  color: #000000;
  text-decoration: none;
  display: block;
  height: 100%;
  position: relative;
}

.juego img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 13px;
  margin-bottom: 0;
  transition: transform 0.3s ease-out;
}

.juego:hover img {
  transform: scale(1.07);
}

.juego h3 {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 20px 10px 15px 10px; /* Más padding arriba para el gradiente */
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.95) 0%,
    /* Comienza negro sólido abajo */ rgba(0, 0, 0, 0.9) 40%,
    /* Muy oscuro */ rgba(30, 30, 30, 0.8) 70%,
    /* Gris muy oscuro */ rgba(60, 60, 60, 0.4) 90%,
    /* Transición suave */ transparent 100% /* Totalmente transparente arriba */
  );
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 700;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 1); /* Sombra más pronunciada */
  z-index: 2;
}

/*.juego h3 {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 15px 10px;
  background: linear-gradient(
    to top,
    rgba(94, 92, 92, 0.9) 20%,
    rgba(0, 0, 0, 0.8) 35%,
    rgba(0, 0, 0, 0.8) 80%,
    transparent
  );
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  z-index: 2;
} */

/* MOVER IMAGEN ESPECIFICAMENTE */
.juego[data-juego-id="17"] img {
  object-position: 80% center;
}

.juego[data-juego-id="18"] img {
  object-position: 20% center;
}
/* ===== ESTILOS DEL TÍTULO PRINCIPAL ===== */
.title {
  color: black;
  position: relative;
  width: 100%;
  text-align: center;
  margin: 25px 0;
  font-size: 2.5rem;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

/* ===== ESTILOS DEL FOOTER ===== */
footer {
  text-align: center;
  padding: 20px;
  margin-top: 40px;
  color: rgb(0, 0, 0);
}

/* ===== ESTILOS DE MENSAJES DE ERROR/VALIDACIÓN ===== */
#mensajeError {
  font-family: "Montserrat", sans-serif;
  max-width: 400px;
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  font-weight: bold;
  transition: opacity 0.3s ease;
}

/* ===== ESTILOS PARA CONTENEDOR DETALLE CON GRID ===== */
.contenedor-detalle {
  display: flex;
  justify-content: center;
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
  position: relative;
  min-height: 80vh;
}

.seccion-tarjeta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 800px;
}

/* ===== ESTILOS PARA FORMULARIO DE EDICIÓN ===== */
#formularioEdicion {
  background: linear-gradient(to bottom, #4c4d4e, #ffffff);
  padding: 25px;
  border-radius: 12px;
  border: 3px solid black;
  box-shadow: 6px 6px 0 black;
  position: fixed;
  right: 130px;
  top: 56%;
  transform: translateY(-50%);
  width: 400px;
  height: 70%; /* Nueva línea - altura automática */
  min-height: 500px; /* Altura mínima más grande */
  z-index: 100;
}

#formularioEdicion::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border: 2px dashed #1a1a1a;
  border-radius: 15px;
  z-index: -1;
  pointer-events: none;
}

#formularioEdicion h3 {
  margin-bottom: 20px;
  text-align: center;
  font-size: 1.5rem;
  text-shadow: 2px 2px 0 black;
  letter-spacing: 1px;
  color: #ffffff;
  font-family: "Montserrat", sans-serif;
}

#formularioEdicion input,
#formularioEdicion textarea {
  width: 100%;
  padding: 14px;
  margin-bottom: 18px;
  font-family: "Montserrat", sans-serif;
  border: 3px solid #444;
  border-radius: 10px;
  font-size: 1.1rem;
  box-shadow: 3px 3px 0 black;
  background-color: #ffffff;
  color: #000000;
  font-weight: 500;
}

#formularioEdicion textarea {
  min-height: 140px;
  resize: vertical;
}

/* Fondo oscuro cuando el formulario está abierto */
.fondo-oscuro {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

/* Mensaje de éxito debajo del formulario */
.mensaje-formulario {
  margin-top: 15px;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  font-weight: bold;
  font-family: "Montserrat", sans-serif;
  display: none;
}

.botones-formulario {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 10px;
}

.boton-secundario {
  appearance: none;
  background-color: #6c757d;
  border: 0.125em solid #1a1a1a;
  border-radius: 0.9375em;
  box-sizing: border-box;
  color: #ffffff;
  cursor: pointer;
  font-family: "Montserrat", sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: normal;
  margin: 0;
  min-height: 3em;
  min-width: 120px;
  outline: none;
  padding: 1em 1.3em;
  text-align: center;
  text-decoration: none;
  transition: all 300ms cubic-bezier(0.23, 1, 0.32, 1);
  user-select: none;
}

.boton-secundario:hover {
  background-color: #5a6268;
  box-shadow: rgba(0, 0, 0, 0.25) 0 8px 15px;
  transform: translateY(-2px);
}

.boton-secundario:active {
  box-shadow: none;
  transform: translateY(0);
}

/* ===== ESTILOS PARA BOTONES DE ACCIÓN EN DETALLE ===== */
.botones-acciones {
  margin-top: 0;
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}

/* ===== ESTILOS PARA MENSAJES EN DETALLE ===== */
#mensajeDetalle {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 18px 25px;
  border-radius: 10px;
  color: white;
  font-family: "Montserrat", sans-serif;
  font-weight: bold;
  z-index: 1000;
  display: none;
  max-width: 350px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

/* ===== ESTILOS DEL LOADING ===== */
.loading-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(231, 230, 230, 0.95);
  background-image: url("https://www.transparenttextures.com/patterns/concrete-wall.png");
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 9999;
  font-family: "Montserrat", sans-serif;
}

.spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #1a1a1a;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1.5s linear infinite;
  margin-bottom: 20px;
}

.loading-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1a1a1a;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
}

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

/* ===== MEDIA QUERIES ===== */
@media screen and (min-width: 768px) {
  .contenido {
    grid-template-columns: 2fr 1fr;
    gap: 30px;
  }

  .aside {
    width: 100%;
  }

  .juegos-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .title {
    font-size: 2.5rem;
  }
}

@media screen and (min-width: 1024px) {
  .contenido {
    grid-template-columns: 3fr 1fr;
  }

  .juegos-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .title {
    font-size: 3rem;
  }
}

@media screen and (max-width: 768px) {
  .contenedor-detalle {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  #formularioEdicion {
    margin-top: 20px;
  }
}

@media screen and (max-width: 480px) {
  nav ul {
    flex-direction: column;
    gap: 5px;
  }

  .juegos-grid {
    grid-template-columns: 1fr;
  }

  .title {
    font-size: 1.8rem;
  }

  .juego {
    padding: 15px;
  }

  .botones-acciones {
    flex-direction: column;
    align-items: center;
  }

  .botones-acciones .Juegos {
    min-width: 200px;
  }

  .botones-formulario {
    flex-direction: column;
  }

  #formularioEdicion {
    margin: 20px 10px;
    padding: 20px 15px;
  }

  #mensajeDetalle {
    left: 20px;
    right: 20px;
    max-width: none;
  }
}

@media screen and (max-width: 768px) {
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Estilos responsive */
@media screen and (max-width: 1024px) {
  #formularioEdicion {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    right: auto;
    width: 90%;
    max-width: 500px;
  }
}
