/* Preloader */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  align-items: center;      /* vertical centering */
  justify-content: center;  /* horizontal centering */
  z-index: 9999;
  overflow: hidden;         /* ensure canvas stays behind */
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#preloader.fade-out {
  opacity: 0;
  visibility: hidden;
}

/* Matrix canvas behind the text */
#preloader canvas#preloaderMatrix {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0; /* behind the text */
}

/* Loader text */
.loader-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 2rem;
  color: #ffffff;
  text-shadow: 0 0 15px #ffffff, 0 0 30px #ffffff;
  animation: glow 1.5s infinite alternate;
  position: relative;
  z-index: 1; /* above the canvas */
  text-align: center;
}

/* Glow animation */
@keyframes glow {
  from {
    opacity: 0.5;
    text-shadow: 0 0 10px #ffffff, 0 0 20px #ffffff;
  }
  to {
    opacity: 1;
    text-shadow: 0 0 20px #ffffff, 0 0 40px #00ff00, 0 0 60px #ffffff;
  }
}

/* Base */
body {
  background: #000;
  color: #fff;
}

header {
  text-align: center;
  padding: 2rem 1rem;
}

h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

#searchBox {
  padding: 10px 15px;
  border-radius: 8px;
  border: 1px solid #00ff00;          /* match button border */
  background: rgba(0,255,0,0.2);       /* match button background */
  color: #fff;
  width: 80%;
  max-width: 400px;
  font-size: 1rem;
  outline: none;
  transition: 0.3s;                    /* smooth hover transition */
}

#searchBox::placeholder {
  color: rgba(255,255,255,0.7);
}

/* Hover effect like buttons */
#searchBox:hover,
#searchBox:focus {
  background: rgba(0,255,0,0.4);       /* same hover as buttons */
  border-color: #00ff00;
}

/* Grid layout */
.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  padding: 2rem;
  max-width: 1200px;
  margin: auto;
}

.card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  text-align: center;
  padding: 1rem;
  transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 0 15px rgba(0,255,0,0.4);
}

/* Adjust spacing in cards */
.card img {
  width: 100%;
  height: 330px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 0.3rem; /* smaller gap between image and title */
}

.card h3 {
  font-size: 1.1rem;
  color: #00ff00;
  margin-top: 0.3rem;     /* close to image */
  margin-bottom: 0.3rem;  /* close to description */
}

.card p {
  font-size: 0.9rem;
  color: #fff;
  margin-top: 0.3rem;
  margin-bottom: 1.2rem;  /* make description slightly farther from button */
}

/* Unified Green Button Styles */
button.btn,
button#homebtn,
.category-buttons .category-btn,
.pagination button,
.download-btn {
  background: rgba(0,255,0,0.2);
  border: 1px solid #00ff00;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  text-decoration: none;
  transition: 0.3s;
}

button.btn:hover,
button#homebtn:hover,
.category-buttons .category-btn:hover,
.pagination button:hover,
.download-btn:hover {
  background: rgba(0,255,0,0.4);
  transform: scale(1.05);
}

/* Active category button */
.category-buttons .category-btn.active {
  background: rgba(0,255,0,0.2);
  border-color: #00ff00;
  color: #fff;
}

/* Pagination info */
#pageInfo {
  font-size: 1rem;
}

/* Social Icons */
.social-icons {
  text-align: center;
  margin-bottom: 1rem;
}

.social-icons img {
  width: 40px;
  height: 40px;
  margin: 0 10px;  
  transition: transform 0.3s;
}

.social-icons img:hover {
  transform: scale(1.1);
}

/* Footer */
footer {
  text-align: center;
  padding: 1rem;
  color: white;
  font-size: 0.9rem;
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
  .grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 992px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

  .category-buttons {
    gap: 16px;
    margin-bottom: 2.5rem;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.5rem;
  }

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

  .card img {
    height: auto;
  }

  /* Fix mobile category buttons spacing */
  .category-buttons {
    flex-direction: column; /* stack vertically */
    align-items: center;    /* center horizontally */
    margin-bottom: 3rem;    /* space below buttons */
  }

  .category-buttons .category-btn {
    width: 80%;
    max-width: 250px;
    margin: 10px 0;         /* vertical spacing between buttons */
  }
}
