/* =====================================================
   PRODUCTS PAGE — products.css
   Excellent Crackers — Modern Card Catalog
   ===================================================== */

/* Mega dropdown & drawer accordion CSS is in style.css (shared) */

/* ---- Discount Strip ---- */
.discount-strip {
  background: linear-gradient(90deg, var(--primary-dark), var(--primary));
  color: #fff; text-align: center;
  padding: 10px 20px; font-size: 0.85rem; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 6px;
}
.discount-strip i { color: var(--gold-light); }

/* ---- Category Banner ---- */
.cat-banner {
  position: relative; min-height: 180px;
  background: linear-gradient(135deg, #1a0505, #3d0000);
  background-size: cover; background-position: center;
  display: flex; align-items: center;
}
.cat-banner-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
}
.cat-banner-content {
  position: relative; z-index: 1;
  padding: 30px 40px; max-width: 900px;
}
.cat-banner-content h1 {
  font-size: 2rem; font-weight: 800; color: #fff;
  margin-bottom: 6px;
}
.cat-banner-content p { color: rgba(255,255,255,0.82); font-size: 0.95rem; margin: 0; }
.cat-banner-back {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 14px; color: var(--gold-light) !important;
  font-size: 0.82rem; font-weight: 600;
}
.cat-banner-back:hover { color: #fff !important; }

/* ---- Catalog Layout ---- */
.catalog-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px;
  align-items: start;
}

/* ---- Category Sidebar ---- */
.cat-sidebar {
  position: sticky; top: 90px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.07);
  border: 1px solid #f0e8d8;
  overflow: hidden; max-height: calc(100vh - 110px);
  display: flex; flex-direction: column;
}
.cat-sidebar-header {
  padding: 16px 18px; border-bottom: 1px solid #f0e8d8;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
}
.cat-sidebar-header h3 {
  font-size: 0.9rem; font-weight: 700; color: #fff;
  display: flex; align-items: center; gap: 8px; margin: 0;
}
.cat-sidebar-search {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid #f5ede0;
}
.cat-sidebar-search i { color: var(--text-light); font-size: 0.85rem; }
.cat-sidebar-search input {
  flex: 1; border: none; outline: none; font-size: 0.82rem;
  font-family: inherit; background: none; color: var(--text);
}
.cat-sidebar-list {
  overflow-y: auto; flex: 1;
  -webkit-overflow-scrolling: touch;
}
.cat-sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  font-size: 0.84rem; font-weight: 600;
  color: var(--text) !important;
  border-bottom: 1px solid #f9f3ea;
  transition: background 0.18s, border-left 0.18s;
  border-left: 3px solid transparent;
  -webkit-font-smoothing: antialiased;
}
.cat-sidebar-item:hover, .cat-sidebar-item.active {
  background: #fff5e6; color: var(--primary) !important;
  border-left-color: var(--primary);
}
.cat-sidebar-img {
  width: 32px; height: 32px; object-fit: cover;
  border-radius: 6px; border: 1px solid #f0e8d8; flex-shrink: 0;
}
.cat-sidebar-name { flex: 1; }
.cat-sidebar-count {
  background: #f0e8d8; color: var(--primary);
  font-size: 0.68rem; font-weight: 700;
  padding: 2px 7px; border-radius: 50px;
  min-width: 22px; text-align: center;
}
.cat-sidebar-item.active .cat-sidebar-count {
  background: var(--primary); color: #fff;
}

/* ---- Catalog Main ---- */
.catalog-main { min-width: 0; }

/* Toolbar */
.catalog-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.toolbar-search-wrap {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1.5px solid #e8d5b0;
  border-radius: 10px; padding: 9px 14px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}
.toolbar-search-wrap i { color: var(--text-light); }
.toolbar-search-wrap input {
  flex: 1; border: none; outline: none;
  font-family: inherit; font-size: 0.88rem; background: none;
}
.result-count { font-size: 0.75rem; color: var(--text-light); white-space: nowrap; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.mobile-cats-toggle {
  display: none; align-items: center; gap: 6px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 8px;
  padding: 9px 14px; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
}

/* Category Pills */
.cat-pills {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px;
}
.cat-pill {
  padding: 6px 14px; border-radius: 50px;
  border: 1.5px solid #e8d5b0;
  font-size: 0.78rem; font-weight: 600;
  color: var(--text) !important;
  background: #fff; transition: all 0.2s;
  white-space: nowrap;
}
.cat-pill:hover, .cat-pill.active {
  background: var(--primary); color: #fff !important;
  border-color: var(--primary);
}

/* Category Section Header */
.cat-section { margin-bottom: 36px; }
.cat-section-head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 2px solid #f0e8d8;
}
.cat-section-img {
  width: 48px; height: 48px; object-fit: cover;
  border-radius: 8px; border: 1px solid #f0e8d8; flex-shrink: 0;
}
.cat-section-head h2 { font-size: 1.15rem; font-weight: 800; color: var(--primary); margin: 0; }
.cat-section-head span { font-size: 0.78rem; color: var(--text-light); }
.scroll-top-cat {
  margin-left: auto; background: #f9f3ea; border: 1px solid #e8d5b0;
  color: var(--text-light); border-radius: 50px;
  padding: 5px 12px; font-size: 0.72rem; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; gap: 5px;
  transition: all 0.2s;
}
.scroll-top-cat:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* =====================================================
   PRODUCT CARD
   ===================================================== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.product-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  border: 1px solid #f0e8d8;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.22s, box-shadow 0.22s;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(139,0,0,0.14);
  border-color: var(--gold);
}
.product-card.out-of-stock { opacity: 0.75; }

/* Image */
.pc-img-wrap {
  position: relative; padding-top: 66%;
  overflow: hidden; background: #fafafa;
  flex-shrink: 0;
}
.pc-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s ease;
  cursor: pointer;
}
.product-card:hover .pc-img { transform: scale(1.06); }

/* Badge overlays */
.pc-badges {
  position: absolute; top: 8px; left: 8px;
  display: flex; flex-direction: column; gap: 4px; z-index: 2;
}
.pc-badge {
  font-size: 0.62rem; font-weight: 800; padding: 3px 8px;
  border-radius: 50px; letter-spacing: 0.3px;
  text-transform: uppercase;
}
.pc-badge.featured { background: var(--gold); color: #fff; }
.pc-badge.deal     { background: #dc2626; color: #fff; }
.pc-badge.discount { background: #15803d; color: #fff; }

.pc-out-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 800; color: #fff;
  letter-spacing: 1px; text-transform: uppercase;
}
.pc-low-stock {
  position: absolute; bottom: 8px; left: 0; right: 0;
  background: rgba(202,138,4,0.92); color: #fff;
  font-size: 0.65rem; font-weight: 700;
  text-align: center; padding: 4px 6px;
}

/* Body */
.pc-body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.pc-category { font-size: 0.68rem; font-weight: 700; color: var(--gold-dark); text-transform: uppercase; letter-spacing: 0.5px; }
.pc-name {
  font-size: 0.88rem; font-weight: 700; color: var(--text);
  line-height: 1.3; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.pc-contents { font-size: 0.7rem; color: var(--text-light); display: flex; align-items: center; gap: 5px; }
.pc-pricing {
  margin-top: auto; padding-top: 8px;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px;
}
.pc-mrp {
  font-size: 0.72rem; color: #aaa;
  text-decoration: line-through;
}
.pc-price { font-size: 1.1rem; font-weight: 800; color: var(--primary); }
.pc-save {
  font-size: 0.65rem; font-weight: 700;
  background: #dcfce7; color: #15803d;
  padding: 2px 8px; border-radius: 50px;
}

/* Footer / Cart Controls */
.pc-footer {
  padding: 10px 14px;
  border-top: 1px solid #f5ede0;
  display: flex; align-items: center; gap: 8px;
}
.pc-qty {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.pc-qty-btn {
  width: 34px; height: 34px; border-radius: 6px;
  background: transparent; border: 1.5px solid var(--primary);
  color: var(--primary); font-weight: 800; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.18s; line-height: 1;
  /* Touch-friendly: at least 44×44 visual + padding */
  min-width: 34px; min-height: 34px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.pc-qty-btn:hover, .pc-qty-btn:active { background: var(--primary); color: #fff; }
.pc-qty-input {
  width: 40px; height: 34px; border: 1.5px solid #e8d5b0;
  border-radius: 6px; text-align: center;
  font-size: 0.88rem; font-weight: 700;
  font-family: inherit; outline: none;
  -moz-appearance: textfield;
}
.pc-qty-input::-webkit-inner-spin-button,
.pc-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pc-add-btn {
  flex: 1; height: 36px; min-height: 36px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 8px;
  font-size: 0.78rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.pc-add-btn:hover, .pc-add-btn:active { background: var(--primary-light); }
.pc-out-btn {
  flex: 1; height: 36px;
  background: #f3f4f6; color: #9ca3af;
  border: none; border-radius: 8px;
  font-size: 0.78rem; font-weight: 600;
  cursor: not-allowed; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
/* Prevent text selection on tap */
.pc-footer { -webkit-tap-highlight-color: transparent; }

@media (max-width: 768px) {
  .pc-qty-btn { width: 38px; height: 38px; font-size: 1.2rem; }
  .pc-qty-input { width: 44px; height: 38px; font-size: 0.95rem; }
  .pc-add-btn { height: 40px; font-size: 0.82rem; }
}

/* No results */
.no-results {
  text-align: center; padding: 80px 20px; color: var(--text-light);
}
.no-results h3 { font-size: 1.2rem; color: var(--text); margin: 12px 0 6px; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1200px) {
  .products-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  .catalog-layout { grid-template-columns: 1fr; padding: 16px; }
  .cat-sidebar {
    position: static; max-height: 0; overflow: hidden;
    transition: max-height 0.35s ease; border-radius: 10px;
    margin-bottom: 0;
  }
  .cat-sidebar.mobile-open { max-height: 600px; margin-bottom: 16px; }
  .mobile-cats-toggle { display: flex; }
  .products-grid { grid-template-columns: repeat(3, 1fr); }
  .mega-panel { width: 440px; }
}

@media (max-width: 768px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-pills { display: none; }
  .mega-dropdown { display: none; }
  .cat-banner-content { padding: 20px 20px; }
  .cat-banner-content h1 { font-size: 1.4rem; }
}

@media (max-width: 480px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .pc-name { font-size: 0.8rem; }
  .pc-price { font-size: 0.95rem; }
  .catalog-layout { padding: 10px 10px; }
}

@media (max-width: 360px) {
  .products-grid { grid-template-columns: 1fr; }
}
