@import url('foundations/colors.css');
@import url('foundations/typography.css');

/* 🛠 Evita conflictos con el CSS global */
.demography-day * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 🖥 Ajuste general del body */
body.demography-day-page {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--background);
}

/* 📦 Contenedor principal: ---------- Xavi he cambiado aquí cosas ---------- */
.demography-day-container {
  padding: 80px;
  display: flex;
  width: 100%;
  gap: 80px;
  justify-items: flex-end;
  align-items: flex-start;
}

/* 🌟 Imagen del nombre dentro del modal */
.image-text img {
  width: 100%;
  max-width: 250px;
  height: auto;
  display: none; /* Oculta por defecto hasta que se cargue en JS */
}

/* 📖 Sección de texto */
.demography-day-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 24px;
  padding: 16px;
}

/* 🎯 Nueva Clase para la cuadrícula de imágenes */
.demography-day-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  flex: 1;
  min-width: 200px;
  justify-items: center; /* Centra los botones */
}

/* 📌 Estilos para los labels dentro del modal */
.demography-day-modal-details label {
  font-weight: bold;
  color: var(--purple);
}

/* 🖼 Botones circulares con imágenes */
.demography-day-button {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: none;
  overflow: hidden;
  cursor: pointer;
  transition: background 0.3s ease-in-out;
  background-size: cover;
  background-position: center;
  background-color: #ddd; /* Asegurar un color de fondo si la imagen no carga */
}

/* 🌟 Asegurar visibilidad de las imágenes */
.demography-day-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* 🖱 Efecto hover */
.demography-day-button:hover {
  background-color: rgba(0, 0, 0, 0.2);
}

/* 🎭 Modal: ---------- Xavi he cambiado aquí cosas ----------  */
.demography-day-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 100000;
  padding: 56px 0;
}

/* 📑 Contenido del modal */
.demography-day-modal-content {
  background: white;
  padding: 64px;
  border-radius: 10px;
  display: flex;
  align-items: flex-start;
  position: relative;
  z-index: 100001; /* 🔹 Mayor que el header */
  /*width: 100%;
  height: 100%;*/
    max-width: 900px;
}


/* ❌ Botón de cierre */
.demography-day-close-btn {
  position: absolute;
  top: 24px;
right: 24px;
    font-size: 40px;
  cursor: pointer;
  background: none;
  border: none;
}

/* 📸 Imagen dentro del modal */
.demography-day-modal-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-right: 20px;
}

.demography-day-modal-left img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
}

/* 📝 Detalles dentro del modal */
.demography-day-modal-details {
  overflow: scroll;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 24px;
  height: 66vh;
}

/* 📱 Responsividad */
@media (max-width: 1024px) {
  .demography-day-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .demography-day-modal-content {
    flex-direction: column;
    align-items: center;
    width: 90%;
  }
}

/*  Xavi he añadido esto  ----------  */
@media (max-width: 768px) {
  h1 {
    padding: 0 !important;
  }
  .demography-day-container {
    padding: 40px;
    gap: 0px;
    justify-items: flex-end;
    align-items: flex-start;
    flex-direction: column;
  }
  .demography-day-text {
    width: 100%;
  }
  demography-day-modal-content {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    padding: 10px;
  }

    demography-day-modal-left {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    }

    demography-day-modal-left img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    }

    demography-day-modal-details {
    flex: 2;
    overflow-y: auto;
    max-height: 80vh; /* Para evitar que se salga de la pantalla */
    padding-right: 10px;
    }
}

@media (max-width: 500px) {
  .demography-day-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .demography-day-button {
    width: 120px;
    height: 120px;
  }

  .demography-day-modal-content {
    width: 100%;
  }
  demography-day-modal-content {
    flex-direction: column;
    overflow: auto;
  }

  demography-day-modal-left {
    width: 100%;
    justify-content: center;
  }

  demography-day-modal-details {
    max-height: none;
    padding-top: 24px;
  }

}
