/* ============================================================
   PRODUCT PAGE — CLEAN FINAL STRUCTURE
   ============================================================ */

/* Wrapper */
.product-page {
  display: flex;
  background: #fff;
  min-height: 100vh;
}

/* ------------------------------------------------------------
   LEFT FILTER PANEL
------------------------------------------------------------ */
.filter-panel {
  width: 260px;
  flex-shrink: 0;
  background: #fafafa;
  border-right: 1px solid #ddd;
  padding: 20px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  scroll-behavior: smooth;
}

.filter-panel h3 {
  font-size: 16px;
  font-weight: 600;
  color: #c62828;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 18px;
  padding-bottom: 8px;
  border-bottom: 2px solid #c62828;
}

.filter-panel label.active {
  color: #c62828;
  font-weight: 600;
}

.filter-panel input[type="checkbox"]:hover {
  outline: 2px solid rgba(198, 40, 40, 0.4);
  border-radius: 3px;
}

/* Text on left, checkbox on right — same line */
.filter-panel label {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  column-gap: 8px;
  font-size: 15px;
  color: #444;
  cursor: pointer;
  margin-bottom: 6px;
}

/* Each category block */
.category-group {
  padding: 12px 0;
  border-bottom: 1px solid #e4e4e4;
  margin-bottom: 20px;
}

.category-group:last-of-type {
  border-bottom: none;
}

/* Category heading (Lockstitch, Overlock, etc.) */
.category-group h4 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: #c62828;
}

/* Category title + checkbox aligned, checkbox on the right */
.category-group h4 label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

/* Brand rows (JUKI, JACK, etc.) */
.filter-panel .category-group > label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  color: #333;
  padding: 3px 0;
  cursor: pointer;
}

.filter-panel .category-group > label:hover {
  color: #c62828;
}

/* Checkbox look + alignment */
.filter-panel input[type="checkbox"] {
  margin: 0;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: #c62828;
}

.clear-btn {
  width: 100%;
  padding: 12px 14px;
  margin-top: 20px;
  border: none;
  border-radius: 10px;
  background: #c62828;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.clear-btn:hover {
  background: #a31616;
}

/* Mobile Filter Controls */
.mobile-filter-controls {
  display: none;
  padding: 10px 20px;
  background: #fff;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 70px;
  z-index: 99;
}

#mobile-filter-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #c62828;
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  padding: 12px;
}

.filter-header-mobile {
  display: none;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

#close-filter-btn {
  background: transparent;
  border: none;
  font-size: 28px;
  color: #333;
  padding: 0;
  box-shadow: none;
}

/* Mobile: filter full width drawer */
@media (max-width: 900px) {
  .mobile-filter-controls {
    display: block;
  }

  .filter-panel {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px; /* Reduced for better 320px support */
    height: 100vh;
    z-index: 2000;
    background: #fff;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    transition: 0.4s ease;
    border-right: none;
    padding: 20px;
  }

  .filter-panel.active {
    left: 0;
  }

  .filter-header-mobile {
    display: flex;
  }

  .filter-panel h3 {
    margin: 0;
    border: none;
    padding: 0;
  }

  /* Overlay for filters */
  .filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    display: none;
  }

  .filter-overlay.active {
    display: block;
  }
}

/* ------------------------------------------------------------
   RIGHT CONTENT AREA (SCROLLABLE)
------------------------------------------------------------ */
.product-grid {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  height: 100vh;
}

/* Search bar */
.search-wrapper {
  max-width: 600px;
  margin-bottom: 25px;
  position: relative;
}

#productSearch {
  width: 100%;
  padding: 12px 18px;
  border-radius: 30px;
  border: 1px solid #ccc;
  outline: none;
  font-size: 15px;
}

#productSearch:focus {
  border-color: #c62828;
  box-shadow: 0 0 6px rgba(198, 40, 40, 0.3);
}

/* Autocomplete list */
#suggestionList {
  position: absolute;
  top: 108%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  max-height: 260px;
  overflow-y: auto;
  display: none;
  z-index: 9999;
}

#suggestionList li {
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid #f2f2f2;
}

#suggestionList li:hover {
  background: #f6f6f6;
}

/* ------------------------------------------------------------
   CATEGORY BLOCK
------------------------------------------------------------ */
.category-row {
  margin-bottom: 40px;
}

.category-title {
  font-size: 22px;
  font-weight: 600;
  color: #c62828;
  margin-bottom: 15px;
  border-bottom: 2px solid #c62828;
  display: inline-block;
  padding-bottom: 6px;
}

.row-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 25px;
}

/* ------------------------------------------------------------
   PRODUCT CARD
------------------------------------------------------------ */
.product-card {
  width: 100%;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transition: 0.25s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.15);
}

.product-card img {
  width: 100%;
  height: 170px;
  object-fit: contain;
  margin-bottom: 12px;
}

.product-card h4 {
  font-family: "Sora", sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #111;
  margin-bottom: 8px;
}

.product-card p {
  font-family: "Inter", sans-serif;
  font-size: 14px;
  color: #444;
  line-height: 1.55;
  margin-top: 4px;
}

/* ------------------------------------------------------------
   RESPONSIVE
------------------------------------------------------------ */
@media (max-width: 900px) {
  .product-page {
    flex-direction: column;
    height: auto;
  }

  .product-grid {
    padding: 20px 15px;
    height: auto;
  }

  .row-products {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
  }

  .product-card {
    width: 100%;
  }
}

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

/* h1/h2/p responsive sizing handled globally in common.css */

.top-search-container {
  padding: 18px 0;
  background: transparent;
}

.top-search-container .search-bar-container {
  max-width: 1100px;
  margin: 0 auto;
}

/* ============================================================
   CONTROLS SECTION (Search + Toggles)
   ============================================================ */
.controls-section {
  background: #fff;
  padding: 20px 40px;
  border-bottom: 1px solid #f0f0f0;
}

.controls-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 30px;
}

/* Search Wrapper overrides */
.search-wrapper {
  margin-bottom: 0 !important;
  flex: 1;
  max-width: 450px;
}

/* Ensure input looks clean and round */
#productSearch {
  border-radius: 50px;
  padding: 12px 24px;
  background: #fff;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  font-size: 14px;
  width: 100%;
}

#productSearch:focus {
  border-color: #c62828;
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.1);
}

/* Toggle Buttons */
.toggle-wrapper {
  display: flex;
  gap: 15px;
  flex-shrink: 0;
}

.toggle-btn {
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid #ddd;
  border-radius: 30px;
  background: #f5f5f5;
  color: #555;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Inter", sans-serif;
  white-space: nowrap;
}

.toggle-btn:hover {
  background: #e9e9e9;
}

.toggle-btn.active {
  background: #c62828;
  color: #fff;
  border-color: #c62828;
  box-shadow: 0 4px 10px rgba(198, 40, 40, 0.2);
  font-weight: 600;
}

/* Responsive */
@media (max-width: 700px) {
  .controls-wrapper {
    flex-direction: column !important;
    gap: 15px;
  }

  .search-wrapper {
    max-width: 100%;
    width: 100%;
  }

  .toggle-wrapper {
    width: 100%;
    justify-content: center;
  }

  .toggle-btn {
    flex: 1;
    text-align: center;
  }
}

/* SPL Machine Product Cards - 16:9 Aspect Ratio - 3 Per Row */
.spl-products-container {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 30px !important;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

#tab-spl .product-card {
  width: 100% !important;
  max-width: none !important;
}

#tab-spl .product-card .image-carousel {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  overflow: hidden;
  margin-bottom: 10px;
  border-radius: 8px;
}

#tab-spl .product-card .carousel-images {
  display: flex;
  transition: transform 0.4s ease-in-out;
  height: 100%;
}

#tab-spl .product-card .carousel-images img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  flex-shrink: 0;
  margin-bottom: 0 !important;
}

/* Responsive adjustments for SPL cards */
@media (max-width: 1200px) {
  .spl-products-container {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 768px) {
  .spl-products-container {
    grid-template-columns: 1fr !important;
  }
}

.spl-products-container .spl-image-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.spl-products-container .spl-image-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ============================================================
   IMAGE CAROUSEL FOR PRODUCT CARDS
   ============================================================ */

/* Carousel container */
.product-card .image-carousel {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  margin-bottom: 10px;
  border-radius: 8px;
}

/* Images wrapper - slides horizontally */
.product-card .carousel-images {
  display: flex;
  transition: transform 0.4s ease-in-out;
  height: 100%;
}

/* Individual image in carousel */
.product-card .carousel-images img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  flex-shrink: 0;
  margin-bottom: 0 !important;
}

/* Navigation dots container */
.product-card .carousel-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
}

/* Individual dot */
.product-card .carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
}

.product-card .carousel-dot:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: scale(1.2);
}

.product-card .carousel-dot.active {
  background: #c62828;
  border-color: #c62828;
  width: 20px;
  border-radius: 4px;
}

/* Arrow navigation (optional - hidden by default, shown on hover) */
.product-card .carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
  font-size: 16px;
  color: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.product-card:hover .carousel-arrow {
  opacity: 1;
}

.product-card .carousel-arrow:hover {
  background: #c62828;
  color: white;
}

.product-card .carousel-arrow.prev {
  left: 8px;
}

.product-card .carousel-arrow.next {
  right: 8px;
}

/* Responsive adjustments */
@media (max-width: 500px) {
  .product-card .carousel-arrow {
    opacity: 1;
    width: 25px;
    height: 25px;
    font-size: 14px;
  }
}
