/* ========== GLOBAL ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  background: #f5f7fa;
}

/* ========== HEADER ========== */
.main-header {
  background: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-wrap {
  max-width: 1200px;
  margin: auto;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo img {
  height: 40px;
}

.nav {
  display: flex;
  gap: 20px;
}

.nav-link {
  text-decoration: none;
  color: #333;
  font-weight: 500;
}

.header-icons {
  display: flex;
  gap: 15px;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  position: relative;
}

.cart-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: red;
  color: white;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 50%;
}

.hamburger-btn {
  display: none;
  font-size: 22px;
  background: none;
  border: none;
  cursor: pointer;
}

/* ========== SEARCH SECTION ========== */
.search-section {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
}

.search-container {
  max-width: 600px;
  margin: 0 auto 30px auto;
}

#searchInput {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid #ccc;
  outline: none;
  transition: 0.3s;
}

#searchInput:focus {
  border-color: #007bff;
  box-shadow: 0 0 8px rgba(0,123,255,0.2);
}

/* ========== PRODUCT GRID ========== */
.results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

/* Tablet */
@media (min-width: 768px) {
  .results-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Desktop */
@media (min-width: 1200px) {
  .results-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ========== PRODUCT CARD ========== */
.product-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transition: 0.3s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-5px);
}

.product-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  cursor: pointer;
}

.product-info {
  padding: 12px;
  flex: 1;
}

.product-info h4 {
  font-size: 14px;
  margin-bottom: 6px;
  cursor: pointer;
}

.product-info p {
  font-weight: bold;
  margin-bottom: 10px;
}

.add-cart-btn {
  padding: 8px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.3s;
}

.add-cart-btn:hover {
  background: #0056b3;
}

.no-results {
  text-align: center;
  font-size: 18px;
  margin-top: 40px;
  color: #777;
}

/* ========== MOBILE NAV ========== */
@media (max-width: 767px) {
  /* Hide the main header on mobile and make the search bar sticky */
  .main-header {
    display: none;
  }

  .search-section {
    margin: 0; /* mobile full width */
    padding: 8px 12px;
    position: sticky;
    top: 0;
    z-index: 1100;
    background: #f5f7fa;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  }

  .search-container {
    max-width: none;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .search-input-wrap {
    flex: 1;
  }

  .mobile-back-btn,
  .mobile-search-icon {
    background: none;
    border: none;
    font-size: 18px;
    padding: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #searchInput {
    width: 100%;
    padding: 10px 12px;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid #ccc;
    outline: none;
  }

  .hamburger-btn {
    display: block;
  }

  .nav {
    display: none;
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    flex-direction: column;
    background: white;
    padding: 20px;
  }

  .nav.active {
    display: flex;
  }
}

/* ========== TABLET: Show search buttons with proper alignment ========== */
@media (min-width: 768px) and (max-width: 991px) {
  .search-container {
    max-width: 600px;
    margin: 0 auto 30px auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .search-input-wrap {
    flex: 1;
  }

  .mobile-back-btn,
  .mobile-search-icon {
    background: none;
    border: none;
    font-size: 18px;
    padding: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #333;
    transition: 0.2s;
  }

  .mobile-back-btn:hover,
  .mobile-search-icon:hover {
    color: #007bff;
  }

  #searchInput {
    padding: 14px;
    font-size: 16px;
  }
}

/* ========== DESKTOP: Hide search buttons completely ========== */
@media (min-width: 992px) {
  .mobile-back-btn,
  .mobile-search-icon {
    display: none;
  }
}