body {
  font-family: Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f2f2f2;
}

#gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  width: 100%;
  max-width: 660px;
}

img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  cursor: pointer;
  transition: 0.3s ease;
  box-sizing: border-box; /* Esto asegura que el borde se cuente por dentro del elemento */
}

.img-wrapper {
  position: relative;
  width: 100%;
  height: 200px;
  box-sizing: border-box;
}

.img-wrapper.help::before {
  /* ... tus estilos existentes ... */
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  background-image: url("images/info-blanco.svg");
  background-size: cover;
  background-repeat: no-repeat;
  width: 20px;
  height: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 2;
}

.img-wrapper.active::before {
  border-color: blue; /* Solo cambia el color del borde para el active */
}

.img-wrapper::after {
  content: attr(data-text);
  position: absolute;
  bottom: 10px;
  right: 10px;
  background-color: black;
  color: white;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 14px;
}

.category {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-family: "Arial", sans-serif;
  font-weight: bold;
  font-size: 24px;
  background-color: #000000;
  color: white;
  text-shadow: 1px 1px 3px rgba(255, 255, 255, 0.5);
  height: 100%;
}

.img-wrapper.active {
  border: 10px solid blue;
  overflow: hidden;
}

/* Estilos base para el modal */
#modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  padding: 20px;
  z-index: 1000; /* Asegurémonos de que esté en la parte superior */
  width: 300px; /* Ancho fijo para el modal */
  border: 2px solid black;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1); /* Sombra sutil */
}

/* Estilo para el input dentro del modal */
#dataTextValue {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid black;
  font-size: 16px;
  box-sizing: border-box; /* Asegura que padding y border se cuenten dentro del ancho total */
  text-align: center;
}

/* Estilo para los botones dentro del modal */
#modal button {
  padding: 8px 15px;
  margin-right: 10px;
  width: 100%;
  border: none;
  cursor: pointer;
  background-color: black;
  color: white;
  font-size: 16px;
  transition: 0.3s; /* Transición suave para el hover */
}

#modal button:hover {
  background-color: white;
  color: black;
  border: 1px solid black;
}

#toggleActive {
  grid-column: 1 / -1; /* Hace que ocupe todo el ancho del grid */
  position: sticky;
  bottom: 0; /* Se pegará a la parte superior cuando hagas scroll */
  z-index: 10; /* Para asegurarse de que esté por encima de otros elementos si es necesario */
  background-color: black; /* Estilo a tu preferencia */
  color: white;
  border: none;
  padding: 20px 0;
  cursor: pointer;
  font-size: 24px;
  transition: background-color 0.3s ease;
  font-family: "Arial", sans-serif;
  font-weight: bold;
}

#toggleActive:hover {
  background-color: #333333; /* Cambio de color al pasar el mouse */
}

.img-wrapper[data-text=""]::after {
  display: none;
}

/* Estilos base para el infoModal */
#infoModal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  padding: 20px;
  z-index: 1001; /* Un número mayor que el modal existente para asegurarse de que esté en la parte superior si ambos están abiertos al mismo tiempo */
  width: 300px; /* Ancho fijo para el modal, ajusta según tu preferencia */
  border: 2px solid black;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}

/* Estilo para los inputs y textarea dentro del infoModal */
#infoModal input,
#infoModal textarea {
  width: 100%;
  padding: 9px;
  margin-bottom: 10px;
  border: 1px solid black;
  font-size: 16px;
  box-sizing: border-box;
}

/* Estilo para los botones dentro del infoModal */
#infoModal button {
  padding: 8px 15px;
  margin-right: 10px;
  margin-top: 20px;
  width: 100%;
  border: none;
  cursor: pointer;
  background-color: black;
  color: white;
  font-size: 16px;
  transition: 0.3s;
  font-family: "Arial", sans-serif;
  font-weight: bold;
}

#infoModal button:hover {
  background-color: white;
  color: black;
  border: 1px solid black;
}

#exerciseTitle {
  margin-top: 5px;
}

#exerciseLink {
  width: 100%;
}

#exerciseLink iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Estilos específicos para dispositivos móviles */
@media (max-width: 768px) {
  #gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin: 0 5px;
  }

  .category {
    font-size: 3.5vw;
    width: 100%;
    padding: 0 5px;
    position: relative;
    box-sizing: border-box;
    height: auto;
    border: 3px solid transparent;
  }

  .img-wrapper {
    position: relative;
    padding-top: 100%; /* Para mantenerlo cuadrado */
    height: auto;
    border: 3px solid transparent;
    box-sizing: border-box;
  }

  .img-wrapper.active {
    border: 3px solid blue;
    overflow: hidden;
  }

  .img-wrapper::after {
    font-size: 12px;
    padding: 1px 3px;
  }

  #modal {
    width: 70%; /* O el porcentaje o px que prefieras */
    padding: 10px; /* Reduce el padding para que el modal no sea muy espacioso en el interior */
    font-size: 14px; /* Si quieres reducir también el tamaño de fuente en dispositivos móviles */
  }

  img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .img-wrapper,
  .category {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #infoModal {
    width: 80%; /* Ajusta para dispositivos móviles */
  }
}
