/* Global Reset */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: #f8f9f6;
  color: #000;
}

/* Topbar */
.topbar {
  background: white;
  padding: 1.2rem 1.5rem 0.5rem;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.topbar h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
}

.topbar p {
  margin: 0;
  color: #555;
  font-size: 0.9rem;
}

.sort-bar {
  margin-top: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.top-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin: 1.2rem auto 0 auto;
  max-width: 700px;
  width: 100%;
}

.sort-bar select {
  padding: 0.4rem 1rem;
  border-radius: 8px;
  border: 1px solid #aaa;
}

/* Category */
.categories {
  display: flex;
  overflow-x: auto;
  gap: 0.1rem;
  padding: 0.8rem 1rem;
  background: #ffffff00;
  justify-content: start;
  scrollbar-width: none;
}

.categories::-webkit-scrollbar {
  display: none;
}

.category-icon {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 10px;
  
  background: #f2f2f200;
  min-width: 80px;
  transition: background 0.2s ease;
}

.category-icon:hover {
  background: #e0e0e0;
}

.category-icon span {
  font-size: 0.75rem;
  margin-top: 0.2rem;
}

/* Search Bar */
.search-wrapper {
  width: 40%;
  padding: 0.5rem 1rem;
  justify-content: center;
  min-width: 220px;
}

.search-wrapper input {
  width: 100%;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  border-radius: 12px;
  border: 1px solid #ccc;
 
  background-size: 1.1rem 1.1rem;
}

/* Product Grid */
.product-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding: 1rem;
  gap: 1rem;
  margin-bottom: 80px;
}

/* Product Card */
.product {
  position: relative;
  width: 250px;
  height: 300px;
  border-radius: 20px;
  overflow: hidden;
  background: #f9f9f9;
  cursor: pointer;
  transition: transform 0.2s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

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

.product img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Bottom Blur Overlay */
.product-info-overlay {
  position: absolute;
  bottom: 0;
  border-radius: 10px;
  margin: 10px;
  width: calc(100% - 20px);
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.product-info-overlay h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #393939;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.product-info-overlay h4 {
  margin: 0;
  font-size: 0.90rem;
  color: #50b27c;
}

.product-info-overlay p {
  margin: 0;
  font-size: 0.75rem;
  color: #444;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  background: rgba(255,255,255,0.85);
  border-top: 1px solid #eee;
  padding: 0.7rem 0.5rem;
  box-shadow: 0 8px 32px 0 rgba(60,60,100,0.18), 0 -2px 8px 0 rgba(60,60,100,0.10);
  z-index: 1000;
  border-radius: 18px;
  transition: box-shadow 0.3s cubic-bezier(0.23, 1, 0.32, 1), background 0.3s, left 0.3s, right 0.3s, bottom 0.3s, width 0.3s;
  backdrop-filter: blur(12px);
  margin: 0 auto;
  max-width: 480px;
  width: 90%;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  bottom: 32px;
}

.bottom-nav button {
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  padding: 0.5rem;
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.bottom-nav button:hover {
  background: #f3f2fa;
  box-shadow: 0 2px 8px 0 rgba(60,60,100,0.10);
  transform: translateY(-4px) scale(1.08);
}

.bottom-nav img {
  width: 30px;
  height: 30px;
  transition: filter 0.2s;
}

.bottom-nav button:hover img {
  filter: brightness(0.85) saturate(1.2);
}

/* Spinner Loader */
.loader-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.7);
  z-index: 2000;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #eee;
  border-top: 4px solid #000;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Mobile */
@media (max-width: 600px) {
  .product {
    width: 45%;
    height: 200px;
  }

  .topbar h1 {
    font-size: 1.4rem;
  }

  .product-info-overlay h3 {
    font-size: 0.9rem;
  }

  .product-info-overlay h4 {
    font-size: 0.8rem;
  }

  .product-info-overlay p {
    font-size: 0.7rem;
  }

  .bottom-nav img {
    width: 30px;
    height: 30px;
  }

  .bottom-nav {
    width: 100%;
    max-width: 100%;
    left: 0;
    right: 0;
    border-radius: 10px 10px 0 0;
    bottom: 0;
    margin: 0;
    transform: none;
  }
  
  .top-controls {
    flex-direction: column;
    gap: 0.7rem;
    max-width: 100%;
    width: 100%;
    margin: 0.7rem 0 0 0;
  }
  .search-wrapper {
    width: 95%;
    padding: 0.5rem 0.5rem;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    justify-content: center;
  }
}

@media (min-width: 601px) {
  .categories {
    justify-content: center;
    margin: 0 auto 1.2rem auto;
    max-width: 1000px;
  }
}

/* Hide mobile search on desktop, show on mobile */
.search-mobile { display: none; }
.search-desktop { display: block; }

@media (max-width: 600px) {
  .search-mobile { display: block; }
  .search-desktop { display: none; }
}
