/* ═══════════════════════════════════════════════════════════
   VÒLIA COSMÉTICOS — products.css
   ═══════════════════════════════════════════════════════════ */

/* ─── TOP BAR ───────────────────────────────────────────────── */
.topbar {
  padding-block: 0.875rem;
  background: var(--white-color);
  width: 40%;
  margin: 100px auto 0px auto;
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.875rem;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
}

.topbar__label {
  font-size: 1.25rem;
  opacity: 0.55;
  white-space: nowrap;
  color: var(--primary-color);
}

/* Pill select shared style */
.select-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.pill-select {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-base);
  font-size: 0.85rem;
  font-weight: var(--fw-regular);
  color: var(--dark-color);
  opacity: 0.5;
  background: var(--white-color);
  border: 1.5px solid rgba(0,0,0,0.18);
  border-radius: 999px;
  padding: 0.4rem 2.4rem 0.4rem 1.1rem;
  cursor: pointer;
  min-width: 140px;
  outline: none;
  transition: border-color 0.2s;
}

.pill-select:focus,
.pill-select:hover {
  border-color: var(--primary-color);
}

.select-chevron {
  position: absolute;
  right: 0.75rem;
  width: 15px;
  height: 15px;
  pointer-events: none;
  stroke: var(--dark-color);
  opacity: 0.45;
}

/* Search */
.topbar__right { display: flex; align-items: center; }

.search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search-input {
  font-family: var(--font-base);
  font-size: 0.85rem;
  color: var(--dark-color);
  background: var(--white-color);
  border: 1.5px solid rgba(0,0,0,0.18);
  border-radius: 999px;
  padding: 0.4rem 1.1rem 0.4rem 1.1rem;
  padding-right: 2.4rem;
  min-width: 200px;
  outline: none;
  transition: border-color 0.2s;
}
.search-input::placeholder { opacity: 0.45; }
.search-input:focus,
.search-input:hover { border-color: var(--primary-color); }

/* remove native clear icon on webkit */
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-icon {
  position: absolute;
  right: 0.8rem;
  width: 15px;
  height: 15px;
  pointer-events: none;
  stroke: var(--dark-color);
  opacity: 0.4;
}

/* ─── LAYOUT ────────────────────────────────────────────────── */
.products-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  padding-block: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}

/* ─── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: calc(var(--nav-h, 72px) + 1rem);
}

.sidebar__filter-label {
  font-size: 1.5rem;
  font-weight: var(--fw-bold);
  color: var(--primary-color);
  margin-bottom: 1.5rem;
}

.sidebar__section-title {
  font-size: 1.23rem;
  font-weight: var(--fw-bold);
  color: var(--dark-color);
  opacity: 0.5;
  margin-bottom: 1.5rem;
}

.sidebar__list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-base);
  font-size: 1rem;
  font-weight: var(--fw-regular);
  color: var(--dark-color);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem 0;
  text-align: left;
  width: 100%;
  transition: color 0.18s;
  border-radius: 4px;
}

.sidebar__item:hover { color: var(--primary-color); }
.sidebar__item--active { color: var(--primary-color); font-weight: var(--fw-bold); }

/* Custom radio circle */
.sidebar__radio {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.25);
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.18s;
}

.sidebar__item--active .sidebar__radio {
  border-color: var(--primary-color);
}

.sidebar__item--active .sidebar__radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--primary-color);
}

/* ─── MAIN / TITLE ──────────────────────────────────────────── */
.products-main { min-width: 0; }

.products-title {
  font-size: 3rem;
  letter-spacing: 0.25rem;
  opacity: 0.6;
  font-weight: var(--fw-regular);
  color: var(--dark-color);
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
  text-align: center;
}

/* ─── STATES ────────────────────────────────────────────────── */
.loading-state,
.error-state,
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: clamp(3rem, 8vw, 6rem) 1rem;
  text-align: center;
  color: #aaa;
}

.error-state svg,
.empty-state svg {
  width: 48px;
  height: 48px;
  stroke: var(--primary-color);
  opacity: 0.5;
}

.error-state p,
.empty-state p {
  font-size: 0.95rem;
  max-width: 280px;
}

/* Spinner */
.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(160,158,216,0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── PRODUCTS GRID ─────────────────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.875rem, 2vw, 1.25rem);
}

/* ─── PRODUCT CARD ──────────────────────────────────────────── */
.product-card {
  border: 1.5px solid rgba(0,0,0,0.1);
  border-radius: 1rem;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.25s, border-color 0.25s, transform 0.2s;
  background: var(--white-color);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  box-shadow: 0 10px 28px rgba(160,158,216,0.2);
  border-color: var(--primary-color);
  transform: translateY(-3px);
}

.product-card__img-wrap {
  background: var(--white-color);
  display: flex;
  align-items: center;
  justify-content: center;
  /* padding: 1rem; */
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.product-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.35s;
}

.product-card:hover .product-card__img-wrap img {
  transform: scale(1.06);
}

/* Info area — primary color background */
.product-card__info {
  background: var(--primary-color);
  padding: 0.7rem 0.875rem 0.8rem;
  text-align: center;
  flex-shrink: 0;
}

.product-card__name {
  font-size: clamp(0.75rem, 1.1vw, 0.85rem);
  font-weight: var(--fw-bold);
  color: var(--white-color);
  line-height: 1.3;
  margin-bottom: 0.2rem;
  /* Truncate long names gracefully */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__price {
  font-size: clamp(0.8rem, 1.1vw, 0.9rem);
  font-weight: var(--fw-regular);
  color: var(--white-color);
  opacity: 0.92;
}

/* ─── PAGINATION ────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: clamp(2rem, 4vw, 3rem);
  flex-wrap: wrap;
}

.page-btn {
  font-family: var(--font-base);
  font-size: 0.9rem;
  font-weight: var(--fw-regular);
  color: var(--dark-color);
  background: none;
  border: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s;
}

.page-btn:hover:not(:disabled) {
  background: rgba(160,158,216,0.12);
  color: var(--primary-color);
}

.page-btn--active {
  background: var(--primary-color);
  color: var(--white-color);
  font-weight: var(--fw-bold);
}

.page-btn--active:hover {
  background: var(--primary-color) !important;
  color: var(--white-color) !important;
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 900px) {
  .topbar {
    width: 100%;
    margin-top: 50px;
  }

  .topbar__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
  }

  .topbar__label { font-size: 0.75rem;}

  #search-input { width: 60px; margin-left: 15px; }
  #sort-select { min-width: 60px; }

  .select-wrapper { width: auto; justify-content: flex-start; }
  .products-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .sidebar {
    position: static;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
  }

  .sidebar__list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .sidebar__item {
    border: 1.5px solid rgba(0,0,0,0.14);
    border-radius: 999px;
    padding: 0.3rem 0.875rem;
    width: auto;
    font-size: 0.8rem;
  }

  .sidebar__item--active {
    background: var(--primary-color);
    color: var(--white-color);
    border-color: var(--primary-color);
  }

  .sidebar__radio { display: none; }

  .sidebar__filter-label,
  .sidebar__section-title { display: none; }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }

}

/* Mobile */
@media (max-width: 560px) {
  .topbar__left { margin: 0; }
  .topbar__inner { justify-content: flex-start; }

  .pill-select { font-size: 0.75rem;}

  .search-input { min-width: 100px; margin-left: 40px; }
  .select-wrapper { width: 100px; min-width: 0; justify-content: flex-start; }

  .search-input::placeholder { color: transparent;}

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .product-card__info { padding: 0.6rem 0.5rem; }
}

@media (max-width: 360px) {
  .products-grid { grid-template-columns: 1fr; }
}