@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #0f0f0f;
  color: white;
  font-family: 'Poppins', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrapper {
  flex: 1;
} 

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 28px;
  background-color: #141414;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: #ff6200;
  letter-spacing: 1px;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 12px;
  margin-left: 6px;
  align-items: center;
}

.nav-links a {
  color: #fff;
  margin: 0 10px;
  text-decoration: none;
  font-weight: 500;
  transition: 0.3s;
  white-space: nowrap;
}

.nav-links a:hover {
  color: #ff6200;
}

.search-bar {
  margin-left: auto;
  display:flex;
  align-items:center;
}

.search-bar input {
  padding: 8px 12px;
  border-radius: 25px;
  border: none;
  outline: none;
  background: #1e1e1e;
  color: #fff;
  width: 200px;
  max-width: 42vw;
  transition: width .18s ease;
}

/* keep auth links visible and compact */
.auth-links {
  margin-left: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.auth-links a {
  margin-left: 6px;
  color: #fff;
  text-decoration: none;
  transition: 0.3s;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
}

.auth-links .signup {
  background-color: #ff6200;
  padding: 7px 12px;
  border-radius: 20px;
  font-weight:600;
}

/* Categories */
.categories {
  display: flex;
  flex-wrap: nowrap; /* allow horizontal scroll on small screens */
  justify-content: flex-start;
  gap: 8px;
  padding: 12px 14px;
  background-color: #141414;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.categories::-webkit-scrollbar { height: 8px; }
.categories::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 8px; }

.categories button {
  background-color: #1e1e1e;
  color: white;
  border: none;
  margin: 0;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: 0.22s;
  flex: 0 0 auto; /* don't shrink; allow horizontal scrolling */
  font-size: 14px;
  white-space: nowrap;
}

.categories button:hover {
  background-color: #ff6200;
}

/* Game grid */
.game-grid {
  /* flexible card widths using minmax so it adapts to viewport */
  /* display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 18px;
  padding: 26px 22px;
  align-items: start; */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 180px));
    gap: 18px;
    justify-content: center; 
    padding: 26px 22px;
}

/* keep the --card-w var for backwards compatibility of styles */
:root { --card-w: 180px; --gap: 20px; }

.game-card {
  width: 100%;
  max-width: var(--card-w);
  margin: 0 auto;
  background-color: #1a1a1a;
  border-radius: 15px;
  overflow: hidden;
  transition: 0.3s;
  position: relative; /* for title overlay */
  display:flex;
  flex-direction:column;
}

.game-card a {
  display:block;
  color:inherit;
  text-decoration:none;
}

.game-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-bottom: 1px solid #222;
  display:block;
}

.game-card:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(255, 98, 0, 0.12);
}

/* Title overlay: hidden by default, revealed on hover or focus */
.game-title {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 10px;
  padding: 8px 10px;
  text-align: center;
  font-weight: 600;
  background: rgba(0,0,0,0.55);
  border-radius: 8px;
  color: #fff;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none; /* avoid interfering with hover */
}

.game-card:hover .game-title,
.game-card:focus-within .game-title,
.game-card:focus .game-title {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Login button */
.login-btn {
  background: #ff4757;
  color: #fff;
  padding: 10px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  position: fixed;
  top: 18px;
  right: 18px;
  font-weight: 600;
  transition: 0.18s;
  z-index: 1100;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.login-btn:hover {
  background: #e84118;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  padding-top: 120px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
}
.modal-content {
  background: white;
  margin: auto;
  padding: 20px;
  border-radius: 12px;
  width: 320px;
  text-align: center;
}
.close {
  color: #aaa;
  float: right;
  font-size: 22px;
  cursor: pointer;
}
.login-options button {
  background: #1e90ff;
  color: white;
  border: none;
  margin: 8px;
  padding: 10px 15px;
  border-radius: 8px;
  cursor: pointer;
  width: 80%;
}
.login-options button:hover {
  background: #0c6cd4;
}

/* ==== FOOTER ==== */
.footer {
  background: #111;
  color: #ddd;
  padding: 32px 16px;
  margin-top: 40px;
  text-align: center;
  border-top: 1px solid #222;
}

.footer-container {
  max-width: 1200px;
  margin: auto;
}

.footer-logo {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 12px;
}

.footer-links {
  margin: 10px 0 18px;
  display:flex;
  justify-content:center;
  gap:12px;
  flex-wrap:wrap;
}

.footer-links a {
  color: #bbb;
  margin: 0 8px;
  text-decoration: none;
  font-size: 14px;
  padding:6px 8px;
  border-radius:6px;
}

.footer-links a:hover {
  color: #fff;
  background: rgba(255,255,255,0.02);
}

.footer-copy {
  font-size: 13px;
  color: #777;
  margin-top: 8px;
}

/* =================
   RESPONSIVE RULES
   ================= */

/* Large tablets — reduce paddings and card scale */
@media (max-width: 1024px) {
  .navbar { padding: 12px 20px; }
  .search-bar input { width: 180px; max-width: 34vw; }
  .game-grid { gap: 16px; padding: 20px; }
  .game-card img { height: 140px; }
  .footer { padding: 28px 12px; }
}

/* Tablets / Small laptops */
@media (max-width: 820px) {
  .navbar { padding: 10px 16px; }
  .logo { font-size: 1.1rem; }
  .search-bar input { width: 160px; max-width: 36vw; }
  .auth-links a { padding: 6px 8px; font-size: 13px; }
  .game-grid { padding: 18px 16px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

/* Mobile phones */
@media (max-width: 600px) {
  /* Header: make layout compact */
  .navbar {
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
  }

  /* hide nav links on small screens to save space (functionality unchanged) */
  .nav-links {
    display: none;
  }

  /* search becomes smaller */
  .search-bar input {
    width: 120px;
    max-width: 55vw;
    padding: 7px 10px;
    font-size: 14px;
  }

  /* categories horizontally scrollable */
  .categories {
    padding: 10px 12px;
    gap: 8px;
  }
  .categories button {
    padding: 7px 12px;
    font-size: 13px;
  }

  /* grid: 2 columns preferred, cards fill available space */
  .game-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    padding: 14px 12px;
    
  }

  .game-card {
    max-width: none;
    border-radius: 12px;
  }

  .game-card img {
    height: 120px;
  }

  /* position login button so it doesn't hide other controls */
  .login-btn {
    top: 12px;
    right: 12px;
    padding: 8px 10px;
    font-size: 14px;
  }

  /* footer stacked */
  .footer {
    padding: 24px 12px;
    text-align: center;
  }
  .footer-logo { font-size: 20px; }
  .footer-links { gap: 10px; }
}

/* Very small phones (narrow) */
@media (max-width: 380px) {
  .search-bar input { width: 100px; max-width: 42vw; font-size:13px; padding:6px 8px; }
  .logo { font-size: 1rem; }
  .auth-links a { font-size: 13px; padding:6px 8px; }
  .game-card img { height: 110px; }
  .footer-logo { font-size: 18px; }
  .footer-copy { font-size: 12px; }
}

/* Accessibility: ensure focus states are visible on small screens */
.game-card:focus-within,
.game-card:focus {
  outline: 3px solid rgba(255,98,0,0.14);
  outline-offset: 4px;
}


/* === Resolve duplicate login: header visible on desktop, floating button visible on mobile === */

/* Default: show header auth, hide floating login button (desktop) */
.login-btn {
  display: none; /* hide floating button on larger screens */
}

/* On small screens: hide header auth-links and show floating button */
@media (max-width: 600px) {
  .auth-links {
    display: none !important;   /* hide header links on phones */
  }
  .login-btn {
    display: block !important;  /* show floating login button on phones */
  }
}

/* ===== Fix overlap: hide header auth on small screens & move floating login to bottom-right ===== */

/* Default: hide floating login button on desktop */
.login-btn {
  display: none; /* keep header auth-links visible on larger screens */
}

/* Mobile: hide header auth-links and use floating login button (bottom-right) */
@media (max-width: 600px) {
  /* hide header links (Login / Sign up) to avoid duplicates/overlap */
  .auth-links {
    display: none !important;
    pointer-events: none;
    opacity: 0;
    height: 0;
    overflow: hidden;
  }

  /* show floating login button, placed bottom-right */
  .login-btn {
    display: block !important;
    position: fixed;
    bottom: 18px;
    right: 14px;
    top: auto !important;    /* override any previous top value */
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 10px;
    z-index: 1200;           /* make sure it's above other elements */
    box-shadow: 0 8px 20px rgba(0,0,0,0.45);
    background: #ff4757;
  }

  /* ensure the search input has room and doesn't get clipped */
  .search-bar input {
    max-width: 55vw;
    width: auto;
    padding-right: 12px;
  }

  /* Make signup/link text smaller if still visible in other places */
  .auth-links a {
    font-size: 13px;
    padding: 6px 8px;
  }
}

/* Very small phones: slightly smaller floating button */
@media (max-width: 380px) {
  .login-btn {
    bottom: 12px;
    right: 10px;
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 8px;
  }
}


/* ===== Center header nav-links and categories (filters) ===== */

/* allow safe positioning of centered header nav */
.navbar {
  position: relative; /* used so .nav-links can be centered absolutely without disturbing layout */
}

/* center the top navigation links on larger screens */
.nav-links {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 50%;
  transform-origin: center;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 20px;
  white-space: nowrap;
}

/* ensure nav-links don't overlap logo/search by limiting width and clipping */
.nav-links {
  max-width: 60%;
  justify-content: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Center the category filter row */
.categories {
  justify-content: center !important; /* centers the pill buttons */
  padding: 12px 20px;
}

/* If the categories overflow, keep horizontal scrolling but keep them visually centered */
.categories[style] { justify-content: center; } /* fallback */

/* Small screens: revert header nav to normal flow (avoid overlap) */
@media (max-width: 820px) {
  .nav-links {
    position: static;
    transform: none;
    max-width: none;
    margin-left: 6px; /* original spacing */
  }
  .navbar { align-items: center; }
}

/* If you also want the categories to snap to center when there is extra space */
@media (min-width: 900px) {
  .categories {
    padding-left: 0;
    padding-right: 0;
    gap: 12px;
  }
}


/* ============================
   HAMBURGER MENU (MOBILE)
============================ */
/* HAMBURGER STYLE */
.hamburger {
  width: 28px;
  height: 22px;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
}

.hamburger span {
  height: 3px;
  width: 100%;
  background: #fff;
  border-radius: 3px;
}

/* Only show on mobile */
@media (max-width: 700px) {
  .hamburger { display: flex; }

  /* Hide desktop nav */
  .nav-links,
  .search-bar,
  .auth-links {
    display: none !important;
  }
}

/* MOBILE MENU OVERLAY */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: none;
  justify-content: flex-end;
  z-index: 2000;
}

/* SLIDE PANEL */
.mobile-menu-content {
  width: 260px;
  height: 100%;
  background: #141414;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  transform: translateX(100%);
  transition: 0.3s ease;
}

/* Close Button */
.mobile-close {
  font-size: 30px;
  color: #fff;
  cursor: pointer;
  align-self: flex-end;
}

/* Mobile search */
.mobile-search input {
  width: 100%;
  padding: 10px 14px;
  background: #1e1e1e;
  border-radius: 8px;
  border: none;
  color: #fff;
}

/* Mobile nav links */
.mobile-nav-links a {
  display: block;
  color: #fff;
  font-size: 16px;
  padding: 10px 0;
  text-decoration: none;
  border-bottom: 1px solid #222;
}

/* Auth buttons */
.mobile-auth a {
  display: block;
  background: #ff6200;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: center;
  margin-top: 8px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
.mobile-auth .login {
  background: #1e1e1e;
}
