/* ubertex/public/assets/css/product.css */

/* Wrapper & Judul */
.product-section.product-table {
  padding: 80px 0;
  text-align: center;
}
.product-section.product-table .container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}
.product-section.product-table h2 {
  margin-bottom: 40px;
  color: var(--dark);
}

/* Layout Sidebar + Main */
.product-section.product-table .product-content {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}

/* Sidebar Tools */
.sidebar-tools .tool {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  margin-bottom: 24px;
  text-align: left;
}
.sidebar-tools h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
}

/* Search Tool */
.search-tool {
  position: relative;
}
.search-tool input {
  width: 100%;
  padding: 10px 40px 10px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.search-tool input:focus {
  outline: none;
  border-color: var(--primary);
}
.search-tool .search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
  font-size: 1.2rem;
}

/* Sort Tool */
.sort-tool .custom-select {
  position: relative;
}
.sort-tool select {
  width: 100%;
  padding: 10px 40px 10px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
  font-size: 0.95rem;
  appearance: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.sort-tool select:focus {
  outline: none;
  border-color: var(--primary);
}
.sort-tool .select-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #888;
}

/* Filter & Category Tools */
.filter-tool ul,
.category-tool ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.filter-tool li,
.category-tool li {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
}
.filter-tool li:last-child,
.category-tool li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.filter-tool input[type="checkbox"],
.category-tool input[type="checkbox"] {
  margin-right: 10px;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}
.filter-tool label,
.category-tool label {
  font-size: 0.95rem;
  color: #333;
  cursor: pointer;
}

/* Main Products Grid */
.products .product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: 20px;
  row-gap: 40px;
}

/* Product Cell & Link */
.product-cell {
  position: relative;
}
.product-cell a {
  text-decoration: none;
  color: inherit;
}

/* Overlay “x Colours Available” */
.hover-info {
  position: absolute;
  top: 5px;
  left: 0;
  width: 100%;
  padding: 8px 0;
  background: rgba(255,255,255,0.95);
  color: #333;
  font-size: 0.95rem;
  text-align: center;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 2;
}
.product-cell:hover .hover-info {
  opacity: 1;
}

/* Image Wrapper & Hover Swap */
.img-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 120%; /* aspect ratio 1:1.2 */
  overflow: hidden;
  border-radius: 12px;
  transition: box-shadow 0.3s;
}
.product-cell:hover .img-wrapper {
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}
.img-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: height 0.3s;
  transform-origin: bottom center;
}
.product-cell:hover .img-container {
  height: 83.3333%; /* square 1:1 */
}
.primary-img,
.secondary-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s;
  border-radius: 12px;
}
.secondary-img {
  opacity: 0;
}
.product-cell:hover .primary-img {
  opacity: 0;
}
.product-cell:hover .secondary-img {
  opacity: 1;
}

/* Product Name */
.cell-info {
  margin-top: 12px;
  font-weight: 600;
  font-size: 1.05rem;
  color: #222;
  text-align: left;
  padding: 0 8px;
}

/* Product Summary */
.cell-summary {
  margin-top: 4px;
  font-size: 0.9rem;
  color: rgba(0,0,0,0.6);
  font-weight: 400;
  text-align: left;
  padding: 0 8px;
  line-height: 1.3;
}

/* Pagination: base (desktop & mobile) */
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin: 32px 0 10px;
  font-family: inherit;
  flex-wrap: wrap; /* desktop can wrap if needed */
}
.pagination .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #222;
  min-width: 48px;
  text-align: center;
  transition: background .2s, color .2s;
  margin: 0; /* ensure no extra vertical spacing */
}
.pagination .page-link.active {
  background: #000;
  color: #fff;
  border-color: #000;
}
.pagination .page-link.prev,
.pagination .page-link.next {
  padding: 10px 14px;
}
.pagination .ellipsis {
  padding: 0 6px;
  font-size: 1.2rem;
  line-height: 1;
  color: #666;
}

/* Responsive Breakpoints */
@media (max-width: 1200px) {
  .product-content {
    grid-template-columns: 200px 1fr;
  }
  .products .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Mobile adjustments: Search trigger only, desktop UI untouched */
.mobile-bar {
  display: none;
}
@media (max-width: 960px) {
  .mobile-bar {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    padding: 0 0; /* full-width alignment with container */
  }

  .mobile-search-btn {
    width: 100%;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: background .2s, box-shadow .2s;
    box-sizing: border-box;
    max-width: none;
  }
  .mobile-search-btn:hover {
    background: #e9e9e9;
  }

  /* keep desktop product layout stackable */
  .product-section.product-table .product-content {
    display: block;
  }

  .sidebar-tools {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    max-width: 80%;
    height: 100%;
    background: #fff;
    padding: 20px;
    box-shadow: 2px 0 24px rgba(0,0,0,0.08);
    overflow-y: auto;
    transform: translateX(-110%);
    transition: transform .3s ease;
    z-index: 1000;
  }
  .sidebar-tools.mobile-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
  }
  .sidebar-backdrop.active {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 900;
  }

  .products .product-grid {
    grid-template-columns: repeat(1, 1fr);
  }

  /* Force pagination single row, no wrapping, with horizontal scroll if overflow */
  .pagination {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 4px 0;
  }
  .pagination .page-link {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}
@media (max-width: 768px) {
  .products .product-grid {
    grid-template-columns: repeat(1, 1fr);
  }
}
@media (max-width: 576px) {
  .products .product-grid {
    grid-template-columns: 1fr;
  }
}
