/* =========================================================
   PAGE WRAPPER
========================================================= */
.main-wrapper {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

/* Mobile: edge-to-edge content */
@media (max-width: 480px) {
  .main-wrapper {
    padding-left: 0;
    padding-right: 0;
  }
}

/* =========================================================
   PAGE HEADER / TOOLBAR
========================================================= */
.page-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

#top-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Center search on small screens */
@media (max-width: 768px) {
  #top-controls {
    width: 100%;
    justify-content: center;
  }
}

.page-title {
  font-size: 1.9rem;
  font-weight: 800;
  margin: 0;
}

/* =========================================================
   SEARCH BAR
========================================================= */
.search-wrapper {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  position: relative;
}

.search-wrapper input {
  width: 100%;
  padding: 12px 44px 12px 18px;
  border-radius: 40px;
  border: 1.6px solid #ccc;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.25s ease-in-out;
  background: #fff;
}

.search-wrapper input:focus {
  border-color: #3c82ff;
  box-shadow: 0 0 0 3px rgba(60,130,255,.25);
}

.search-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
}

/* Dark mode */
.dark .search-wrapper input,
[data-theme="dark"] .search-wrapper input {
  background: #121826;
  border-color: #444;
  color: #e9e9e9;
}

.dark .search-btn,
[data-theme="dark"] .search-btn {
  color: #aaa;
}

/* Mobile search */
@media (max-width: 480px) {
  .search-wrapper input {
    font-size: 0.85rem;
    padding: 11px 40px 11px 16px;
  }
}

/* =========================================================
   CATEGORY BANNER
========================================================= */
.cat-banner {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  min-height: 90px;
  background-position: center;
  background-size: cover;
  display: flex;
  align-items: center;
}

.cat-banner .overlay {
  padding: 28px;
  width: 100%;
  background: linear-gradient(180deg, rgba(0,0,0,.28), rgba(0,0,0,.06));
  color: #fff;
}

@media (max-width: 480px) {
  .cat-banner {
    min-height: 54px;
    border-radius: 8px;
    margin: 0 6px 10px;
  }
  .cat-banner .overlay {
    padding: 12px;
  }
}

/* =========================================================
   PRODUCTS GRID
========================================================= */
.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease forwards;
}

/* Tablet */
@media (max-width: 992px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile */
@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 0;
  }
}

/* =========================================================
   PRODUCT CARD
========================================================= */
.product-card {
  background: var(--card-bg);
  color: var(--text);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 16px var(--card-shadow);
  transition: transform .25s ease, box-shadow .25s ease;
}

.product-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}

@media (max-width: 480px) {
  .product-card {
    border-radius: 10px;
  }
}

/* =========================================================
   IMAGE
========================================================= */
.card-img-wrap {
  height: 200px;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

@media (max-width: 480px) {
  .card-img-wrap {
    height: 140px;
  }
}

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

.product-img-link {
  display: block;     
  width: 100%;
  height: 100%;
}

.card-img-wrap:hover img {
  transform: scale(1.05);
  transition: transform 0.5s ease;
}

/* =========================================================
   PRICE CHIP & RIBBON
========================================================= */
.price-chip {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(12,0,0,.7);
  padding: 5px 9px;
  border-radius: 10px;
  color: #fff;
  font-weight: 700;
  font-size: .75rem;
  animation: pulse 2s infinite;
}

@media (max-width: 480px) {
  .price-chip {
    font-size: .65rem;
    padding: 4px 7px;
  }
}

.ribbon {
  position: absolute;
  top: 6px;
  left: 8px;
  background: #500038;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .65rem;
  color: #fff;
}

/* =========================================================
   CARD BODY
========================================================= */
.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 480px) {
  .card-body {
    padding: 10px;
  }
}

.product-title a {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

@media (max-width: 480px) {
  .product-title a {
    font-size: .85rem;
  }
}

.product-desc {
  font-size: .9rem;
  color: var(--text-muted);
}

@media (max-width: 480px) {
  .product-desc {
    font-size: .72rem;
  }
}

/* =========================================================
   META & BADGES
========================================================= */
.product-meta {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: .75rem;
}

.in-stock { background:#e6fbf3; color:#0b7a4a; }
.out-stock { background:#fff5f5; color:#d03a3a; }

/* =========================================================
   BUTTONS
========================================================= */
.btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: .8rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}

@media (max-width: 480px) {
  .btn-detail {
    display: none;
  }

  .btn-primary {
    width: 60px;
    height: 25px;
    font-size: 8px;
  }
}

/* =========================================================
   PRODUCT SOCIAL
========================================================= */
.product-social {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: .75rem;
  padding-top: .5rem;
  border-top: 1px solid rgba(0,0,0,.05);
  gap: 8px;
}

.like-btn {
  min-width: 78px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .85rem;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  cursor: pointer;
}

@media (max-width: 480px) {
  .like-btn {
    min-width: 54px;
    padding: 3px 6px;
    font-size: .7rem;
  }
}

/* =========================================================
   ANIMATIONS
========================================================= */
@keyframes fadeInUp {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* =========================================================
   DARK MODE
========================================================= */
[data-theme="dark"] .product-card {
  background: #1a1a1a;
  color: #e0e0e0;
}

[data-theme="dark"] .product-desc {
  color: #cfcfcf;
}
