@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Bungee+Spice&display=swap");

* {
  margin: 0px;
  padding: 0px;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

::selection {
  color: #fff;
  background: #007bff;
}

body {
  background-color: #f4f4f4;
  padding: 20px;
}

.title {
  text-align: center;
  font-size: 70px;
  font-family: "Bungee Spice", cursive;
  padding: 27px 14px 1px 1px;
}

.wrapper {
  margin: 20px auto;
  max-width: 1100px;
}
 
.wrapper nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: absolute; 
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  z-index: 1000;
  padding: 15px 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.wrapper .items {
  display: flex;
  max-width: 720px;
  width: 100%;
  justify-content: space-around;
  gap: 15px;
}

.item {
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 5px;
  color: white;
  transition: background 0.3s ease;
}

.item:hover,
.item.active {
  background: rgb(144, 23, 23);
}

#searchBox {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 5px;
  outline: none;
}

#searchBox::placeholder {
  color: #333;
  font-style: italic;
}

#searchBox:focus {
  border-color: #9b51e0;
  box-shadow: 0 0 10px rgba(155, 81, 224, 0.7);
}

.search-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  padding: 10px;
}

.gallery .image {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery .image:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.gallery .image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 10px;
  transition: transform 0.3s ease-in-out;
}

.gallery .image:hover img {
  transform: scale(1.03);
}

.gallery .image .caption {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 8px;
  font-size: 14px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.gallery .image:hover .caption {
  opacity: 1;
}

.preview-box {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  backdrop-filter: blur(5px);
  background-color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  max-width: 700px;
  width: 100%;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  border-radius: 3px;
  padding: 0 5px 5px 5px;
  box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.preview-box.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.preview-box .details {
  padding: 13px 15px 13px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.details .title {
  display: flex;
  font-size: 18px;
  font-weight: 400;
}

.details .title p {
  font-weight: 500;
  margin-left: 5px;
}

.details .icon {
  color: rgb(106, 24, 188);
  font-size: 22px;
  cursor: pointer;
}

.preview-box .image-box {
  width: 100%;
  display: flex;
}

.image-box img {
  width: 100%;
  max-height: 500px;
  object-fit: contain;
  border-radius: 0 0 3px 3px;
}

.shadow {
  position: fixed;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  z-index: 2;
  display: none;
  background: rgba(0, 0, 0, 0.4);
}

.shadow.show {
  display: block;
}

.preview-nav {
  display: flex;
  justify-content: space-between;
  padding: 10px;
}

.preview-nav button {
  padding: 8px 16px;
  background-color: rgb(106, 24, 188);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.preview-nav button:hover {
  background-color: rgb(106, 24, 188);
}

.preview-nav button:disabled {
  opacity: 0.5;
  cursor: default;
  background-color: rgb(106, 24, 188);
}

.preview-nav button i {
  margin: 0 5px;
}

.image-count {
  font-size: 16px;
  margin-right: 10px;
}

.fullscreen-mode {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  background-color: black;
  display: flex;
  justify-content: center;
  align-items: center;
}

.fullscreen-mode img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
}

.items span:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.gallery .image img,
.preview-box img {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.preview-box {
  transition: transform 0.3s ease, opacity 0.3s ease, backdrop-filter 0.3s ease;
}

.items span,
.gallery .image,
.preview-nav button,
.details .icon {
  cursor: pointer;
}

.gallery .image img.loading {
  filter: blur(5px);
  opacity: 0.7;
}

.preview-box {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.gallery .image:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  transition: opacity 0.3s ease;
}

.gallery .image:hover:before {
  opacity: 1;
}

.preview-box .image-box img {
  border-radius: 5px;
}

.items span.active {
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.shadow {
  transition: background-color 0.3s ease;
}

.dark-mode {
  background-color: #121212;
  color: #f5f5f5;
}

.dark-mode .gallery .image span img {
  filter: brightness(90%);
}

.dark-mode-toggle {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: rgb(225, 44, 44);
  color: rgb(224, 224, 224);
  border: none;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s ease;
}

.dark-mode-toggle:hover {
  background: #666;
}

.dark-mode {
  background: #121212;
  color: #ffffff;
}
.dark-mode nav {
  background: rgba(255, 255, 255, 0.1);
}

.dark-mode .dark-mode-toggle {
  background: white;
  color: black;
}

.dark-mode .dark-mode-toggle:hover {
  background: #ccc;
}


/* Default: Responsive Grid for All Screens */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  padding: 10px;
}

@media (max-width: 768px) {
  .wrapper nav {
    position: relative;
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px;
  }

  .items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }
  .search-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 5px;
  }

  #searchBox {
    flex: 1;
    font-size: 14px;
    padding: 6px;
    height: 32px;
    border-radius: 5px;
  }

  .dark-mode-toggle {
    padding: 6px 10px;
    font-size: 14px;
    height: 32px;
    border-radius: 5px;
    white-space: nowrap;
    margin-left: 8px; 
  }
}


@media (min-width: 769px) and (max-width: 1024px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }

  .wrapper nav {
    position: relative;
    display: flex;
    justify-content: space-between;
    padding: 15px;
  }
}

@media (min-width: 1025px) {
  .gallery {
    grid-template-columns: repeat(4, 1fr);
  }
}
