@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

#slideshow {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: -5;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  justify-content: center;
  position: absolute;
  top: 50vh;
  left: 2vw;
  right: 2vw;
  transition: all 0.3s;
}

.photo-grid img {
  width: 80%;
  height: 80%;
  object-fit: cover;
  border-radius: 5%;
}

.slide {
  position: absolute;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  animation-name: slideShow;
  animation-duration: 30s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

@keyframes slideShow {
  0%, 20% {
    background-image: url('images/bg.jpg');
  }
  20%, 40% {
    background-image: url('images/bg1.jpg');
  }
  40%, 60% {
    background-image: url('images/bg2.jpg');
  }
  60%, 80% {
    background-image: url('images/bg3.jpg');
  }
  80%, 100% {
    background-image: url('images/bg4.jpg');
  }
}

.image-generator {
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  background-size: cover;
  background-position: center;
  animation: slideShow 16s infinite;
  z-index: +8;
}

.image-generator::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
  background: #121212;
}

.image-generator .content {
  z-index: 10;
  position: fixed;
  top: 10px;
  color: #fff;
  padding: 0 15px;
  max-width: 760px;
  text-align: center;
}

.image-generator h1 {
  margin-top: 5%;
  font-size: 2.5rem;
  font-weight: 700;
  color: rgb(255, 255, 255);
}

h1 span.A { color: rgb(248, 228, 48); }
h1 span.I { color: rgb(248, 228, 48); }
h1 span.Tool { color: rgb(184, 147, 232); }

.image-generator p {
  margin-top: 10px;
  font-size: 1.35rem;
  color: rgb(215, 224, 193);
}

.generate-form {
  height: 56px;
  padding: 6px;
  display: flex;
  margin-bottom: 25px;
  background: #fff;
  align-items: center;
  border-radius: 30px;
  margin-top: 10px;
  justify-content: space-between;
}

.generate-form .prompt-input {
  width: 100%;
  height: 100%;
  outline: none;
  padding: 0 17px;
  border: none;
  background: none;
  font-size: 1rem;
  border-radius: 30px;
}

.generate-form .generate-btn {
  font-size: 1rem;
  outline: none;
  border: none;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  height: 100%;
  padding: 0 25px;
  border-radius: 30px;
  background: #d186c0;
}

.generate-btn.active-state, .generate-btn:active {
  background-color: #815dd5;
}

.generate-form button:hover {
  background: #815dd5;
}

.image-gallery {
  position: absolute;
  top: 40vh;
  left: 5vw;
  right:5vw;
  display: flex;
  gap: 15px;
  padding: 0 15px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 50px auto;
  max-width: 1250px;
}

.image-gallery .img-card {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  background: #f2f2f2;
  border-radius: 10%;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  width: 230px;
}

.image-gallery .img-card img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 20;
}

.loading-gif {
  width: 30%;
  height: 50%;
}

.credits-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #d186c0;
  color: white;
  padding: 5px 15px;
  font-size: 12px;
  border-radius: 30px;
  text-decoration: none;
  transition: background-color 0.3s;
  z-index: 9;
}

.credits-btn:hover {
  background-color: #815dd5;
}

.img-card {
  position: relative;
  width: fit-content; /* Set the width to fit the image */
  margin: 10px;
}

.img-card img {
  width: 100%;
  display: block; 
}

.download-btn {
  display: none; 
  position: absolute;
  bottom: 8px; 
  left: 50%;
  transform: translateX(-50%); 
  padding: 2px 4px;
  background-color: #815dd5;
  color: white;
  text-decoration: none;
  border-radius: 10px;
  text-align: center;
}

.img-card:hover .download-btn {
  display: block; 
}

.download-btn.always-visible {
  display: block;
}


/* Media Queries for Responsive Adjustments */

@media (min-width: 320px) and (max-width: 480px) {
  .image-generator h1 { font-size: 1.4rem; }
  .image-generator p { font-size: 0.7rem; }

  .image-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two columns */
    gap: 10px; /* Adjust the gap to your preference */
    padding: 0 10px; /* Added some padding to the left and right */
    top: 25vh; /* Adjusting the vertical positioning */
    left:0;
  }

  .image-gallery .img-card {
    width: 85%; /* This ensures each card takes full width of its column */
    margin: auto; /* Center each card within its column */
    box-shadow: 0 4px 8px rgba(0,0,0,0.2); /* Optional: Adds shadow for depth (adjust as needed) */
  }

  .image-gallery .img-card img {
    width: 100%; /* Ensures the image fills the card */
    height: auto; /* Keeps the image aspect ratio intact */
    object-fit: cover; /* Ensures the image covers the card area */
  }

  .generate-form {
    height: 8vh;
    padding: 6px;
    display: flex;
    margin-bottom: 25px;
    background: #fff;
    align-items: center;
    border-radius: 30px;
    margin-top: 15px;
    justify-content: space-between;
    z-index: +10;
  }

  .generate-form .generate-btn {
    font-size: 0.6rem;
    height: 80%;
    width: 35%;
    padding: 0 25px;
    z-index: +10;
  }

  .generate-form {
    position: relative; 
    z-index: 10; 
  }

  .generate-form .prompt-input {
  
    width: 60%;
    z-index: +10; 
  }

  .credits-btn {
    bottom: 10px;
    right: 20px;
  }

  .loading-overlay {
    display: flex; 
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5); 
    z-index: 9999; 
  }

  .loading-gif {
    width: 40%; 
    height: auto; 
  }

  .download-btn {
    font-size: 10px;
    padding: 0px 2px;
    bottom: 4px;
  }
}

@media (min-width: 480px) and (max-width: 767px) {
  .image-generator h1 {
    font-size: 2.2rem; /* Larger font size for clear visibility */
  }

  .image-generator p {
    font-size: 1rem; /* Adjusted font size for paragraph for better readability */
  }

  .image-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Adjusting the grid to two columns */
    gap: 20px; /* Increasing the gap for better spacing */
    padding: 0 20px; /* More padding on the sides for a better layout */
    top: 30vh; /* Adjusting vertical positioning to better suit the display */
  }

  .image-gallery .img-card {
    width: 100%; /* Cards take full width of their column */
  }

  .image-gallery .img-card img {
    height: auto; /* Adjust height automatically to maintain aspect ratio */
    object-fit: cover; /* Ensure images cover the card area */
  }

  .generate-form {
    height: 50px; /* Adjust form height for better interaction */
    padding: 5px; /* Adjust padding for a more compact form */
    font-size: 0.9rem; /* Smaller font size for form elements */
  }

  .generate-form .prompt-input {
    width: 70%; /* More space for input field */
  }

  .generate-form .generate-btn {
    padding: 0 20px; /* Adjust padding inside the button */
    font-size: 0.9rem; /* Adjust font size for the button */
  }

  .credits-btn {
    font-size: 0.8rem; /* Smaller text size for the credits button */
    padding: 3px 10px; /* Adjust padding for a more compact look */
  }

  .loading-gif {
    width: 25%; /* Adjust loading GIF size for better visibility */
    height: auto; /* Maintain aspect ratio of the GIF */
  }
}


@media (min-width: 768px) and (max-width:1024px) {
  
  .image-generator h1 { 
    font-size: 3.5rem; 
  }

  .generate-form .generate-btn {
    height: 80%;
  }

  .image-gallery {
    left: 10vw;
    height: 80%;
    width: 80%;
    position: absolute;
    top: 30vh;
    gap:10px;
  }
 
  photo-grid {
    grid-template-columns: repeat(2, 1fr);
}

.image-generator h1 {
    font-size: 2rem;
}

.image-generator p {
    font-size: 1.1rem;
}

.image-gallery .img-card {
    width: 48%; /* Adjust to ensure 2 images per row on smaller screens */
}

.content, .generate-form {
    padding: 0 10px;
}

.loading-gif {
  width: 35%; /* Slightly larger than the default for medium screens */
}

}

@media (min-width: 1024px) and (max-width: 1078px) {

  .image-generator h1 {
    font-size: 2rem;
}

.image-generator p {
    font-size: 1.1rem;
}

  .image-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 columns */
    gap: 15px; /* Space between cards */
    padding: 0 50px; /* Padding on the sides */
    top: 40%; /* Positioning from the top */
    left: 5vw; /* Positioning from the left */
    right: 5vw; /* Positioning from the right */
    margin: auto; /* Centering the grid in the available space */
    max-width: 1500px; /* Maximum width of the gallery */
  }

  .image-gallery .img-card {
    width: 100%; /* Each card takes full width of its column */
    aspect-ratio: 1 / 1; /* Keeping aspect ratio square */
  }

  .image-gallery .img-card img {
    width: 100%; 
    height: auto;
    object-fit: cover; 
  }

  .loading-gif {
    width: 30%;
    height: 50%;  
  }
}

@media (min-width: 1080px) and (min-height: 1920px) {
  photo-grid {
    grid-template-columns: repeat(2, 1fr);
}

.image-generator h1 {
    font-size: 5.5rem;
}

.image-generator p {
    font-size: 3rem;
}
.image-gallery{
  position: absolute;
  top:3vh;
}
.image-gallery .img-card {
    width: 48%; 
}

.generate-form {
  height: 70px;
  margin-top: 40px;

}

.generate-form .generate-btn {
  font-size: 2rem;

}

.generate-form .prompt-input {
  font-size: 1.5rem;
}

.loading-gif {
  height: 20%;
  width: 40%;
}

.credits-btn {
  bottom: 40px;
  right: 60px;
  font-size:25px;
}

}


@media (min-width: 1079px) and (max-width: 1085px) {
  photo-grid {
    grid-template-columns: repeat(2, 1fr);
}

.image-generator h1 {
    font-size: 5.5rem;
}

.image-generator p {
    font-size: 3rem;
}

.image-gallery .img-card {
    width: 48%; 
}

.generate-form {
  height: 70px;
  margin-top: 40px;

}

.generate-form .generate-btn {
  font-size: 2rem;

}

.generate-form .prompt-input {
  font-size: 1.5rem;
}

.loading-gif {
  height: 20%;
  width: 40%;
}

.credits-btn {
  bottom: 40px;
  right: 60px;
  font-size:25px;
}


}