/* === Responsive.css (Final Version) === */

/* Base Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Global Styles */
body {
  font-family: 'Poppins', sans-serif;
  line-height: 1.5;
  color: #222;
  /* Unified site background color */
  background-color: #2b3e51;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: auto;
}

/* Product grid utility used on pages */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4 columns on large screens */
  gap: 20px;
}

/* === HEADER === */
.site-header {
  background: #fff;
  border-bottom: 1px solid #ddd;
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
}

.logo-area img {
  height: 50px;
  transition: transform 0.3s ease;
}

.logo-area img:hover {
  transform: scale(1.05);
}

/* === NAVIGATION === */
nav ul {
  list-style: none;
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
  align-items: center;
}

nav ul li a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  transition: color 0.3s ease;
}

nav ul li a:hover {
  color: #0073e6;
}

/* === BUTTONS === */
button, .btn {
  background: #0073e6;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
}

button:hover, .btn:hover {
  background: #005bb5;
}

/* === TOGGLE MENU === */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 20px;
  cursor: pointer;
  z-index: 1100;
}

.menu-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background: #111;
  border-radius: 3px;
  transition: all 0.3s ease;
}

/* Animate when active */
.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translateY(8px);
}
.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translateY(-8px);
}

/* === MOBILE NAVIGATION === */
@media (max-width: 768px) {

  /* Show hamburger and hide regular nav by default on mobile */
  .menu-toggle {
    display: flex;
    position: relative;
    margin-left: 12px;
  }

  /* Strong mobile nav rules to override older styles */
  #main-nav ul {
    display: none !important; /* hide by default on mobile */
    position: fixed;
    top: 56px; /* position below the header to avoid overlap */
    right: -100%;
    width: 75%;
    height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    background: #000; /* mobile drawer is black */
    padding: 24px 16px;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.35);
    transition: right 0.35s ease, display 0.1s ease;
    z-index: 1200;
  }

  /* When .show is present, slide the menu in and display it */
  #main-nav ul.show {
    right: 0 !important;
    display: flex !important;
  }

  /* Mobile nav link layout & spacing */
  #main-nav ul li {
    margin: 6px 0;
    list-style: none;
  }

  #main-nav ul li a, #main-nav ul li button {
    display: block;
    padding: 12px 14px;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    background: transparent;
    text-align: left;
  }

  #main-nav ul li a:hover, #main-nav ul li button:hover {
    background: rgba(255,255,255,0.08);
  }

  /* Position hamburger over the header on mobile */
  .menu-toggle {
    position: absolute;
    right: 16px;
    top: 12px;
    background: transparent;
    border: none;
    z-index: 1300;
  }

  /* Ensure hamburger bars are visible and large enough on mobile */
  .menu-toggle span {
    background: #fff;
    height: 4px;
  }

  nav ul li {
    margin: 18px 0;
  }

  nav ul li a {
    font-size: 18px;
    color: #222;
  }

  /* When menu slides in use white links on dark background */
  #main-nav ul.show li a {
    color: #fff;
  }

  /* Make product grid stack on small screens */
  .product-grid {
    grid-template-columns: 1fr;
    padding: 0 16px;
  }

  /* mid-size (tablets): 2 columns */
  @media (min-width: 480px) and (max-width: 768px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); }
  }

  /* Show login/logout inline in the nav list for narrow screens */
  #nav-login, #nav-logout {
    display: block !important;
    text-align: center;
    width: 100%;
  }

  /* Optional overlay when menu is open */
  body.nav-open::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 900;
  }

  /* lock page scroll when nav open */
  body.nav-open {
    overflow: hidden;
  }
}

/* === PHONES === */
@media (max-width: 480px) {
  .logo-area img {
    height: 40px;
  }

  nav ul {
    width: 80%;
  }

  h1, h2 {
    font-size: 1.4rem;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .product-grid {
    gap: 12px;
  }
}
