/* ==========================================================
   PN Tech - Catalog Filters, Sidebar & Search Component
   Palette: Warm Coffee (#3B281B), Signal Brown (#5A3D29),
            Sand Gold (#DCC28D / #c89b53), Cream Paper (#FAF7F2)
   ========================================================== */

/* 1. Layout Container: Proper Margins & Spacing */
.catalog-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  max-width: 1320px;
  width: min(1320px, 100% - 2.5rem);
  margin-inline: auto;
  margin-top: 0.5rem;
  margin-bottom: 3.5rem;
}

/* 2. Catalog Hero Header: Centered Title & Search (Optimized Vertical Spacing) */
.catalog-hero {
  padding: 1.1rem 1rem 0.5rem;
  background: transparent;
  margin-bottom: 0.4rem;
}

.catalog-hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.85rem;
  max-width: 780px;
  margin: 0 auto;
}

.catalog-hero-text h1 {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--ink, #241F21);
  margin: 0;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.catalog-hero-text p {
  margin: 0.25rem 0 0;
  color: var(--muted, #786B62);
  font-size: 0.92rem;
  line-height: 1.4;
}

/* 3. Search Bar - Matching Home Page Style Exactly (Image 1) */
.catalog-search-wrap {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  min-height: 54px;
  position: relative;
}

.hero-search-box.catalog-search-form {
  position: relative;
  background: #FFFFFF;
  border: 1.5px solid var(--line, #E8DFC8);
  border-radius: 999px;
  display: flex;
  align-items: center;
  padding: 0.4rem 0.5rem 0.4rem 1.4rem;
  box-shadow: 0 12px 30px rgba(59, 40, 27, 0.08);
  width: 100%;
  transition: all 0.25s ease;
}

.hero-search-box.catalog-search-form:focus-within {
  border-color: var(--board, #3B281B);
  box-shadow: 0 16px 36px rgba(59, 40, 27, 0.14);
}

/* =========================================================
   Floating Search Trigger Pill & Expandable Search Bar
   ========================================================= */

/* 1. Compact Floating Search Trigger Pill under PN Tech */
.floating-search-trigger {
  position: absolute !important;
  top: calc(100% + 7px) !important;
  left: 1.4rem !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 5px 12px !important;
  background: rgba(18, 12, 8, 0.88) !important;
  backdrop-filter: blur(24px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(200%) !important;
  border: 1.2px solid rgba(255, 255, 255, 0.22) !important;
  border-radius: 999px !important;
  color: #FFFFFF !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.2px !important;
  cursor: pointer !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  z-index: 1005 !important;
  pointer-events: auto !important;
  white-space: nowrap !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(-8px) scale(0.95) !important;
}

.floating-search-trigger.is-visible {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) scale(1) !important;
}

.floating-search-trigger:hover {
  background: rgba(43, 29, 20, 0.96) !important;
  border-color: rgba(212, 163, 115, 0.8) !important;
  color: #D4A373 !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45) !important;
  transform: translateY(1px) scale(1.02) !important;
}

.floating-search-trigger .trigger-chevron {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  display: inline-block !important;
}

.floating-search-trigger.is-open .trigger-chevron {
  transform: rotate(180deg) !important;
}

.floating-search-trigger.is-open {
  background: #3B281B !important;
  border-color: #D4A373 !important;
  color: #D4A373 !important;
  box-shadow: 0 0 16px rgba(212, 163, 115, 0.35) !important;
}

/* 2. Floating Search Bar - Hidden until trigger pill is clicked */
.hero-search-box.catalog-search-form.is-floating {
  position: fixed !important;
  top: 82px !important;
  left: 50% !important;
  transform: translateX(-50%) translateY(-12px) scale(0.96) !important;
  width: min(640px, calc(100vw - 2.5rem)) !important;
  max-width: 640px !important;
  z-index: 998 !important;
  background: rgba(255, 255, 255, 0.98) !important;
  backdrop-filter: blur(28px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(200%) !important;
  border: 1.5px solid rgba(212, 163, 115, 0.85) !important;
  box-shadow: 0 20px 50px rgba(43, 29, 20, 0.25), 0 4px 14px rgba(0, 0, 0, 0.08) !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1), transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.24s !important;
}

/* 3. When opened via trigger click */
.hero-search-box.catalog-search-form.is-floating.is-expanded {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateX(-50%) translateY(0) scale(1) !important;
}

.hero-search-box .hero-search-icon {
  color: #796658;
  display: flex;
  align-items: center;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.hero-search-box .hero-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.02rem;
  font-family: inherit;
  color: var(--ink, #241F21);
  background: transparent;
  min-width: 0;
}

.hero-search-box .hero-search-input::placeholder {
  color: #94a3b8;
  font-size: 0.95rem;
}

.hero-search-box .search-clear-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.3rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  line-height: 1;
  border-radius: 50%;
  margin-right: 0.4rem;
  transition: color 0.15s;
}

.hero-search-box .search-clear-btn:hover {
  color: #ef4444;
}

.hero-search-box .hero-search-action-btn {
  background: linear-gradient(135deg, #e0b070 0%, #c89b53 100%);
  color: #241a12;
  font-weight: 700;
  border: none;
  padding: 0.65rem 1.5rem;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(200, 155, 83, 0.28);
}

.hero-search-box .hero-search-action-btn:hover {
  background: linear-gradient(135deg, #e8ba7c 0%, #b88a42 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(200, 155, 83, 0.38);
}

/* ==========================================================
   4. Left Filter & Sort Sidebar (Glassmorphism & Brand Palette)
   ========================================================== */
.catalog-sidebar {
  width: 290px;
  flex-shrink: 0;
  position: relative;
  height: fit-content;
  max-height: none;
  overflow: visible;
  background: #FFFFFF;
  border: 1.5px solid var(--line, #E8DFC8);
  border-radius: 18px;
  box-shadow: 0 4px 20px rgba(59, 40, 27, 0.05);
  padding: 1.25rem;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 50;
  contain: content;
}

@media (min-width: 961px) and (min-height: 1050px) {
  .catalog-sidebar {
    position: sticky;
    top: 96px;
  }
}

/* Mobile Header */
.filter-card-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(232, 223, 200, 0.6);
}

.filter-main-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--board, #3B281B);
}

.filter-close-btn {
  background: none;
  border: none;
  padding: 0.4rem;
  color: #64748b;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.filter-close-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* Sidebar Products Count Banner (Moved to Sidebar) */
.sidebar-summary-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(250, 247, 242, 0.95);
  border: 1px solid var(--line, #E8DFC8);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.9rem;
}

.sidebar-summary-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--sand-light, #F5EEDB);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--board, #3B281B);
  flex-shrink: 0;
}

.sidebar-summary-info {
  display: flex;
  flex-direction: column;
}

.sidebar-summary-count {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--board, #3B281B);
  line-height: 1.2;
}

.sidebar-summary-label {
  font-size: 0.78rem;
  color: var(--muted, #786B62);
  font-weight: 600;
}

/* Clear All Filters Button (Warm Brand Styled) */
.btn-clear-filters {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: #FAF7F2;
  color: var(--board, #3B281B);
  border: 1.5px solid var(--line, #E8DFC8);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 1rem;
}

.btn-clear-filters:hover {
  background: var(--sand-light, #F5EEDB);
  border-color: var(--sand, #DCC28D);
  color: var(--ink, #241F21);
}

.btn-clear-filters:active {
  transform: scale(0.98);
}

/* Accordion Filter Group */
.filter-group {
  border-top: 1px solid rgba(232, 223, 200, 0.7);
  padding-top: 1rem;
  margin-top: 1rem;
}

.filter-group:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.filter-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0.25rem 0 0.65rem;
  color: var(--board, #3B281B);
  font-size: 1.02rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s ease;
}

.filter-group-header:hover {
  color: var(--signal, #5A3D29);
}

.filter-group-header .fg-chevron {
  transition: transform 0.25s ease;
  color: var(--muted, #786B62);
  flex-shrink: 0;
}

.filter-group.open .filter-group-header .fg-chevron {
  transform: rotate(180deg);
}

.filter-group:not(.open) .filter-group-body {
  display: none;
}

.filter-group-body {
  padding-top: 0.25rem;
  animation: fadeInGroup 0.2s ease;
}

@keyframes fadeInGroup {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Radio Items (Brand Coffee Brown Accent) */
.filter-radio-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  cursor: pointer;
  user-select: none;
  padding: 0.15rem 0;
  transition: color 0.15s ease;
}

.filter-radio-item:last-child {
  margin-bottom: 0;
}

.filter-radio-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.filter-radio-item .radio-mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.filter-radio-item:hover .radio-mark {
  border-color: #94a3b8;
}

.filter-radio-item input[type="radio"]:checked ~ .radio-mark {
  border-color: var(--board, #3B281B);
}

.filter-radio-item .radio-mark::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--board, #3B281B);
  opacity: 0;
  transform: scale(0);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.filter-radio-item input[type="radio"]:checked ~ .radio-mark::after {
  opacity: 1;
  transform: scale(1);
}

.filter-radio-item .filter-item-label {
  font-size: 0.93rem;
  color: var(--ink, #241F21);
  font-weight: 500;
  transition: color 0.15s;
}

.filter-radio-item input[type="radio"]:checked ~ .filter-item-label {
  font-weight: 700;
  color: var(--board, #3B281B);
}

/* Checkbox Items (Brand Coffee Brown Accent) */
.filter-check-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  cursor: pointer;
  user-select: none;
  padding: 0.2rem 0;
  transition: all 0.15s ease;
}

.filter-check-item:last-child {
  margin-bottom: 0;
}

.filter-check-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.filter-check-item .check-mark {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.filter-check-item:hover .check-mark {
  border-color: #94a3b8;
}

.filter-check-item input[type="checkbox"]:checked ~ .check-mark {
  border-color: var(--board, #3B281B);
  background: var(--board, #3B281B);
}

.filter-check-item .check-mark::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  margin-top: -2px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.filter-check-item input[type="checkbox"]:checked ~ .check-mark::after {
  transform: rotate(45deg) scale(1);
}

.filter-check-item .filter-item-name {
  font-size: 0.93rem;
  color: var(--ink, #241F21);
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-check-item input[type="checkbox"]:checked ~ .filter-item-name {
  color: var(--board, #3B281B);
  font-weight: 700;
}

.filter-check-item .filter-item-count {
  font-size: 0.78rem;
  color: var(--muted, #786B62);
  background: rgba(245, 238, 219, 0.6);
  border: 1px solid var(--line, #E8DFC8);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  margin-left: auto;
}

/* Price Range Inputs */
.price-inputs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.price-input-wrap {
  position: relative;
}

.price-input-wrap input {
  width: 100%;
  border: 1.5px solid var(--line, #E8DFC8);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-size: 0.9rem;
  color: var(--ink, #241F21);
  background: #ffffff;
  transition: all 0.2s ease;
  outline: none;
}

.price-input-wrap input:focus {
  border-color: var(--board, #3B281B);
  box-shadow: 0 0 0 3px rgba(59, 40, 27, 0.12);
}

.price-input-wrap input::placeholder {
  color: #94a3b8;
  font-size: 0.85rem;
}

/* Price Range Slider (Brand Coffee Accent) */
.price-slider-wrap {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

.slider-track-bg {
  position: absolute;
  width: 100%;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
}

.slider-track-fill {
  position: absolute;
  height: 4px;
  background: var(--board, #3B281B);
  border-radius: 2px;
  left: 0;
  width: 100%;
  pointer-events: none;
}

.price-slider-wrap input[type="range"] {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

.price-slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--board, #3B281B);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.price-slider-wrap input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 8px rgba(59, 40, 27, 0.35);
}

.price-slider-wrap input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--board, #3B281B);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

/* Category Filter Search */
.cat-filter-search {
  margin-bottom: 0.65rem;
}

.cat-filter-search input {
  width: 100%;
  border: 1px solid var(--line, #E8DFC8);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  font-size: 0.85rem;
  color: var(--ink, #241F21);
  background: rgba(255, 255, 255, 0.9);
  outline: none;
  transition: all 0.15s;
}

.cat-filter-search input:focus {
  border-color: var(--board, #3B281B);
  background: #ffffff;
}

.categories-list-wrap {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

/* ==========================================================
   5. Catalog Content (Right Area)
   ========================================================== */
.catalog-content {
  flex: 1;
  min-width: 0;
}

.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 0 1rem;
  margin-bottom: 1rem;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Mobile Toggle Filters Button */
.btn-toggle-filters {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: #ffffff;
  border: 1.5px solid var(--line, #E8DFC8);
  border-radius: 10px;
  padding: 0.5rem 0.95rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--board, #3B281B);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(59, 40, 27, 0.04);
}

.btn-toggle-filters:hover {
  border-color: var(--board, #3B281B);
  background: var(--sand-light, #F5EEDB);
}

.active-filter-badge {
  background: var(--board, #3B281B);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Active Filter Chips in the Toolbar (Warm Sand Palette) */
.active-chips-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--sand-light, #F5EEDB);
  border: 1px solid var(--sand, #DCC28D);
  color: var(--signal, #5A3D29);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
}

.active-chip button {
  background: none;
  border: none;
  color: var(--signal, #5A3D29);
  font-size: 1.05rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.active-chip button:hover {
  color: var(--board, #3B281B);
}

/* Backdrop for Mobile Drawer */
.filter-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(36, 31, 33, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100004 !important;
  opacity: 0;
  touch-action: none !important;
  overscroll-behavior: contain !important;
  transition: opacity 0.25s ease;
}

.filter-backdrop.active {
  display: block;
  opacity: 1;
}

/* ==========================================================
   Responsive Breakpoints
   ========================================================== */
@media (max-width: 960px) {
  .catalog-layout {
    flex-direction: column;
    gap: 1.5rem;
    width: min(1240px, 100% - 2.5rem);
  }

  .btn-toggle-filters {
    display: inline-flex;
  }

  /* Off-Canvas Drawer on Mobile */
  .catalog-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 330px !important;
    max-width: 88vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border-radius: 0 20px 20px 0 !important;
    transform: translateX(-105%) !important;
    z-index: 100005 !important;
    box-shadow: 10px 0 36px rgba(0, 0, 0, 0.28) !important;
    padding: 1.25rem 1.25rem 6.5rem !important;
    background: #FFFFFF !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
    contain: none !important;
  }

  .catalog-sidebar.drawer-open {
    transform: translateX(0) !important;
  }

  .filter-card-head {
    display: flex;
    position: sticky;
    top: -1.25rem;
    margin: -1.25rem -1.25rem 1rem -1.25rem;
    padding: 1rem 1.25rem 0.75rem;
    background: #FFFFFF;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }
}

@media (max-width: 768px) {
  .catalog-search-wrap {
    min-height: 48px;
  }

  .floating-search-trigger {
    left: 0.5rem !important;
    top: calc(100% + 4px) !important;
    padding: 3px 9px !important;
    font-size: 0.74rem !important;
    gap: 4px !important;
  }

  .hero-search-box.catalog-search-form.is-floating {
    top: 54px !important;
    width: calc(100vw - 1rem) !important;
    max-width: calc(100vw - 1rem) !important;
    padding: 0.28rem 0.35rem 0.28rem 0.85rem !important;
    box-shadow: 0 16px 36px rgba(43, 29, 20, 0.28) !important;
  }

  .hero-search-box.catalog-search-form.is-floating .hero-search-input {
    font-size: 0.92rem !important;
  }

  .hero-search-box.catalog-search-form.is-floating .hero-search-action-btn {
    padding: 0.45rem 0.9rem !important;
    font-size: 0.82rem !important;
  }
}

@media (max-width: 640px) {
  .catalog-hero-text h1 {
    font-size: 1.45rem;
  }

  .hero-search-box.catalog-search-form {
    padding: 0.35rem 0.45rem 0.35rem 1rem;
  }

  .hero-search-box .hero-search-action-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.88rem;
  }

  .catalog-layout {
    width: 100%;
    padding-inline: 1rem;
  }
}

/* ==========================================================
   Product Grid & Compact Cards (PN Tech 4-Columns Desktop)
   ========================================================== */
.catalog-content .grid,
.grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 0.85rem !important;
  padding-bottom: 2rem !important;
}

@media (max-width: 1100px) and (min-width: 768px) {
  .catalog-content .grid,
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.75rem !important;
  }
}

@media (max-width: 767px) {
  .catalog-content .grid,
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.65rem !important;
  }
}

/* Compact Product Card */
.card {
  position: relative !important;
  background: #FFFFFF !important;
  border: 1px solid var(--line, #E8DFC8) !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease !important;
  box-shadow: 0 2px 8px rgba(59, 40, 27, 0.04) !important;
  height: 100% !important;
  content-visibility: auto !important;
  contain-intrinsic-size: auto 340px !important;
  transform: translateZ(0) !important;
  -webkit-transform: translateZ(0) !important;
  backface-visibility: hidden !important;
  -webkit-backface-visibility: hidden !important;
}

.card:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 10px 22px -5px rgba(59, 40, 27, 0.12) !important;
  border-color: rgba(59, 40, 27, 0.28) !important;
}

.card.out {
  opacity: 0.88;
}

.card.out .thumb img {
  opacity: 0.45;
  filter: grayscale(40%);
}

.card-link {
  text-decoration: none !important;
  color: inherit !important;
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important;
}

/* Thumbnail */
.thumb {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 155px !important;
  padding: 0.75rem !important;
  background: #FFFFFF !important;
  border-bottom: 1px solid #F1F5F9 !important;
  overflow: hidden !important;
}

.thumb img {
  max-width: 100% !important;
  max-height: 135px !important;
  object-fit: contain !important;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  transform: translateZ(0) !important;
  -webkit-transform: translateZ(0) !important;
  backface-visibility: hidden !important;
}

.card:hover .thumb img {
  transform: scale(1.05) !important;
}

/* Stock Status Badge (Top Left over Image) */
.stock-badge {
  position: absolute !important;
  top: 8px !important;
  left: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 2.5px 7px !important;
  border-radius: 99px !important;
  font-size: 0.68rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em !important;
  z-index: 3 !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06) !important;
  pointer-events: none !important;
}

.stock-badge.in-stock {
  background: #f0fdf4 !important;
  color: #15803d !important;
  border: 1px solid #bbf7d0 !important;
}

.stock-badge .stock-dot {
  width: 5.5px !important;
  height: 5.5px !important;
  border-radius: 50% !important;
  background: #22c55e !important;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25) !important;
}

.stock-badge.out-of-stock {
  background: #fef2f2 !important;
  color: #b91c1c !important;
  border: 1px solid #fecaca !important;
}

.stock-badge.out-of-stock .stock-dot {
  width: 5.5px !important;
  height: 5.5px !important;
  border-radius: 50% !important;
  background: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25) !important;
}

/* Discount Badge */
.tag-discount {
  position: absolute !important;
  bottom: 8px !important;
  left: 8px !important;
  background: #ef4444 !important;
  color: #ffffff !important;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  padding: 2px 6px !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 5px rgba(239, 68, 68, 0.25) !important;
  z-index: 3 !important;
}

/* Favorite Button (Top Right over Image) */
.card-fav-btn {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  background: #FFFFFF !important;
  border: 1px solid rgba(232, 223, 200, 0.95) !important;
  color: #786B62 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  z-index: 5 !important;
  padding: 0 !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 2px 6px rgba(59, 40, 27, 0.08) !important;
  transform: translateZ(0) !important;
  -webkit-transform: translateZ(0) !important;
}

.card-fav-btn:hover {
  transform: scale(1.12) translateZ(0) !important;
  color: #e11d48 !important;
  border-color: rgba(225, 29, 72, 0.35) !important;
  background: #ffffff !important;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.2) !important;
}


.card-fav-btn.active {
  color: #e11d48 !important;
  border-color: rgba(225, 29, 72, 0.45) !important;
  background: #ffffff !important;
}

.card-fav-btn.active svg,
.card-fav-btn.active .heart-icon {
  fill: #e11d48 !important;
  stroke: #e11d48 !important;
  animation: favHeartPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

@keyframes favHeartPop {
  0% { transform: scale(0.7); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Product Name - Exactly 2 lines with adequate reserved space and ellipsis */
.p-name {
  padding: 0.5rem 0.65rem 0.25rem !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  line-height: 1.38 !important;
  height: 3.25rem !important;
  min-height: 3.25rem !important;
  max-height: 3.25rem !important;
  box-sizing: border-box !important;
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  line-clamp: 2 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  word-break: break-word !important;
  color: var(--ink, #241F21) !important;
  margin: 0 !important;
}

/* Card Bottom Info: Price & Quick Add */
.card-info-bottom {
  padding: 0.25rem 0.65rem 0.65rem !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.45rem !important;
  margin-top: auto !important;
}

/* Price Row: Both discounted and original prices aligned to the left */
.card-price-row {
  display: flex !important;
  align-items: baseline !important;
  justify-content: flex-start !important;
  gap: 0.55rem !important;
  flex-wrap: wrap !important;
}

.price-main {
  display: inline-flex !important;
  align-items: baseline !important;
  gap: 0.25rem !important;
}

.price-prefix {
  font-size: 0.72rem !important;
  font-weight: 500 !important;
  color: var(--muted, #786B62) !important;
}

/* Regular Price: Warm Honey / Amber Brown (#8B5E3C) */
.price-val {
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  color: #8B5E3C !important;
  letter-spacing: -0.01em !important;
  line-height: 1 !important;
}

/* Currency EGP in Soft Gray */
.price-curr,
.curr-sm {
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  color: #94A3B8 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.02em !important;
}

/* Sale Price: When discounted, display in prominent RED (#DC2626) */
.price-main.is-sale .price-val,
.card-price-row:has(.price-old) .price-val {
  color: #DC2626 !important;
}

.price-main.is-sale .price-curr,
.card-price-row:has(.price-old) .price-curr {
  color: #DC2626 !important;
}

/* Original Pre-Discount Price: Crossed out, aligned on the left alongside sale price */
.price-old {
  font-size: 0.76rem !important;
  font-weight: 500 !important;
  color: #94A3B8 !important;
  text-decoration: line-through !important;
  display: inline-flex !important;
  align-items: baseline !important;
  gap: 2px !important;
}

/* Quick Add to Cart Bar */
.card-quick-actions {
  display: flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  width: 100% !important;
}

.card-qty-stepper {
  display: inline-flex !important;
  align-items: center !important;
  border: 1px solid var(--line, #E8DFC8) !important;
  border-radius: 8px !important;
  background: #FAF7F2 !important;
  overflow: hidden !important;
  height: 30px !important;
  flex: 0 0 88px !important;
  transition: border-color 0.18s, box-shadow 0.18s !important;
}

.card-qty-stepper:focus-within {
  border-color: var(--board, #3B281B) !important;
  box-shadow: 0 0 0 2px rgba(59, 40, 27, 0.14) !important;
}

.card-qty-btn {
  width: 25px !important;
  height: 100% !important;
  background: none !important;
  border: none !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  color: var(--board, #3B281B) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background 0.15s !important;
  padding: 0 !important;
  user-select: none !important;
}

.card-qty-btn:hover {
  background: var(--sand-light, #F5EEDB) !important;
}

.card-qty-input {
  width: 38px !important;
  height: 100% !important;
  border: none !important;
  background: #ffffff !important;
  text-align: center !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  color: var(--ink, #241F21) !important;
  outline: none !important;
  padding: 0 !important;
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

.card-qty-input::-webkit-outer-spin-button,
.card-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

.card-quick-add-btn {
  flex: 1 !important;
  height: 30px !important;
  border: none !important;
  border-radius: 8px !important;
  background: var(--board, #3B281B) !important;
  color: #ffffff !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.3rem !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  padding: 0 0.5rem !important;
  box-shadow: 0 2px 6px rgba(59, 40, 27, 0.15) !important;
  white-space: nowrap !important;
}

.card-quick-add-btn:hover {
  background: var(--signal, #5A3D29) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 10px rgba(59, 40, 27, 0.22) !important;
}

.card-quick-add-btn:active {
  transform: scale(0.96) !important;
}

.card-quick-add-btn.added {
  background: #10b981 !important;
  color: #ffffff !important;
}

.card-quick-add-btn.out-btn {
  background: #e2e8f0 !important;
  color: #94a3b8 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
  transform: none !important;
}
