@font-face {
  font-family: 'Lato';
  src: url('../fonts/Lato/Lato-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'Poppins';
  src: url('../fonts/Poppins/Poppins-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: light;
}

@font-face {
  font-family: 'Prata';
  src: url('../fonts/Prata/Prata-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}

/* === Base Layout === */
/* Global Reset & Base Styles */
* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

html,
body {
  height: 100%;
  font-family: 'Poppins', sans-serif;
  background: #fff;
  color: #333;

}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Back to Top Button */
#back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #B8A89F;
  color: #fff;
  border: none;
  cursor: pointer;
  z-index: 110;
  font-size: 1.2rem;
  display: none;
  /* hidden initially */
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

#back-to-top:hover {
  background-color: #9f928b;
}

/* === Catalog Layout === */
.catalog-layout {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 2rem;
  justify-content: center;
  align-items: start;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 55vh;
}

/* Sidebar filters */
.filters {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-radius: 12px;
  font-size: 0.95rem;
  position: sticky;
  top: 100px;
  margin-right: 50px;
}

/* Filter buttons */
.filter-btn {
  padding: 0.6rem 0.8rem;
  border: none;
  background: #f3f3f3;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 70%;
  text-align: left;
  color: #333 !important;
  -webkit-text-fill-color: #333 !important;
  text-decoration: none !important;
  font-family: 'Poppins', sans-serif;
}

.filter-btn.active,
.filter-btn:hover {
  background: #e5e2db;
  transform: scale(1.02);
}

/* Price filter section */
#price-filter {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

#price-filter div {
  margin-bottom: 0.5rem;
}

/* Base */
input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  /* only track visible */
  width: 80%;
}

/* Track */
input[type="range"]::-webkit-slider-runnable-track {
  background: #e5e2db;
  height: 6px;
  border-radius: 6px;
}

input[type="range"]::-moz-range-track {
  background: #e5e2db;
  height: 6px;
  border-radius: 6px;
}

input[type="range"]::-ms-track {
  background: #e5e2db;
  height: 6px;
  border-radius: 6px;
  border: none;
  color: transparent;
}

/* Thumb (Chrome, Safari, Edge) */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #b8b4ac;
  margin-top: -5px;
  /* adjust: half thumb height - half track height */
  cursor: pointer;
}

/* Thumb (Firefox) */
input[type="range"]::-moz-range-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #e5e2db;
  cursor: pointer;
}

/* Thumb (IE) */
input[type="range"]::-ms-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #e5e2db;
  cursor: pointer;
}

/* Search Container Flex */
.search-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  /* space between input and button */
  margin-bottom: 1rem;
  width: 100%;
  max-width: 400px;
  /* adjust as needed */
}

/* Input takes full space */
#product-search {
  flex: 1;
  /* takes all remaining space */
  padding: 0.6rem 0.8rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
  font-family: 'Poppins', sans-serif;
}

/* Clear Button */
#clear-search {
  padding: 0.6rem 0.8rem;
  border: 1px solid #ddd;
  background: #f3f3f3;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #333 !important;
  -webkit-text-fill-color: #333 !important;
}

#clear-search:hover {
  background: #e5e2db;
}

/* Catalog content */
.catalog-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* Product grid */
.products {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  /* 5 per row desktop */
  gap: 1.5rem;
  padding: 1rem 0;
  max-width: 1200px;
  width: 100%;
  justify-items: center;
}

/* Product cards */
.products .product,
.product-card {
  width: 100%;
  max-width: 280px;
  background: #fff;
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  transition: transform 0.2s ease;
}

.products .product:hover,
.product-card:hover {
  transform: translateY(-5px);
}

/* Product card image */
.product-card img {
  width: 100%;
  border-radius: 8px;
  object-fit: cover;
  margin-bottom: 1rem;
  height: 200px;
}

/* Product title */
.product-card h3 {
  font-size: 0.9rem;
  margin: 0.5rem 0;
  min-height: 3rem;
  text-align: center;
}

.product-colors {
  display: flex;
  gap: 5px;
  margin-top: 5px;
}

.color-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #ccc;
}

/* No products message */
.no-products {
  text-align: center;
  padding: 2rem;
  font-size: 1rem;
  color: #666;
}

/* Pagination */
.pagination {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.pagination button {
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  border-radius: 50%;
  background: #f3f3f3;
  cursor: pointer;
  transition: background 0.2s;
  color: #333 !important;
  -webkit-text-fill-color: #333 !important;
  text-decoration: none !important;
}

.pagination button:hover {
  background: #f0f0f0;
}

.pagination button.active {
  background: #B8A89F;
  color: #fff;
  border-color: #9f928b;
}

/* === Responsive Adjustments === */
@media (max-width: 4000px) {}

@media (max-width: 1800px) {
  .products {
    grid-template-columns: repeat(5, 1fr);
    gap: 1.2rem;
  }

  .products .product,
  .product-card {
    max-width: 220px;
  }

  .catalog-content {
    padding-right: 0px;
  }
}

@media (max-width: 1024px) {
  .products {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
  }

  .products .product,
  .product-card {
    max-width: 220px;
  }

  .catalog-content {
    padding-right: 0px;
  }
}

@media (max-width: 600px) {

  /* Stack layout vertically */
  .catalog-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem;
  }

  /* Filters: full width, top of the page */
  .filters {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin: 0;
    /* remove side margin */
    position: static;
    /* remove sticky */
    top: auto;
    /* remove sticky offset */
  }

  .filter-btn {
    width: auto;
    text-align: center;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  /* Search container: full width */
  .search-container {
    width: 100%;
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    /* keeps clear button in line */
  }

  #product-search {
    flex: 1;
  }

  /* Product grid: 2 per row */
  .products {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    justify-items: center;
    width: 100%;
  }

  .products .product,
  .product-card {
    max-width: 100%;
  }

  /* Pagination */
  .pagination {
    justify-content: center;
    gap: 0.5rem;
  }

  .pagination button {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  /* Base */
  input[type="range"] {
    width: 250px;
  }
  #price-filter div {
    text-align: center;
  }
}