/* ==========================================================================
   UNTERRO - PRODUCT ARCHIVE / COLLECTION PAGES STYLES
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Collection Header & Breadcrumbs
   -------------------------------------------------------------------------- */
.collection-header {
  padding-top: 92px; /* Offset for desktop floating header */
  padding-bottom: 0;
  background-color: var(--color-bg-primary); /* Matching luxury light layout */
}

@media (max-width: 1023px) {
  .collection-header {
    padding-top: 68px; /* Offset for mobile floating header */
  }
}

.collection-breadcrumbs {
  font-family: var(--font-family-sans); /* Matching single product page font */
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--color-text-light);
  text-transform: uppercase;
  padding: 20px 0 20px; /* Matching single product page breadcrumbs padding */
}

.breadcrumb-link {
  color: var(--color-text-light);
  text-decoration: none;
  transition: color 0.3s ease;
}

.breadcrumb-link:hover {
  color: #AD622F; /* Accent color */
}

.breadcrumb-separator {
  margin: 0 8px;
  color: var(--color-text-light);
}

.breadcrumb-current {
  color: var(--color-text-primary);
}

/* --------------------------------------------------------------------------
   2. Main Grid Layout Columns
   -------------------------------------------------------------------------- */
.collection-container {
  padding-top: 20px;
  padding-bottom: 80px;
  background-color: var(--color-bg-primary);
  min-height: 60vh;
}

.collection-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 60px;
  align-items: start;
}

/* --------------------------------------------------------------------------
   3. Sidebar Filters Section
   -------------------------------------------------------------------------- */
.collection-sidebar {
  position: sticky;
  top: 95px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background-color: transparent;
  z-index: 10;
  padding-right: 14px;
  padding-bottom: 80px; /* Ensures all bottom items and price brackets can be fully scrolled into view */
  scrollbar-width: thin;
  scrollbar-color: rgba(173, 98, 47, 0.35) transparent;
}

/* Custom luxury scrollbar for filters sidebar on WebKit */
.collection-sidebar::-webkit-scrollbar {
  width: 4px;
}

.collection-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.collection-sidebar::-webkit-scrollbar-thumb {
  background: rgba(173, 98, 47, 0.25);
  border-radius: 4px;
  transition: background var(--transition-fast);
}

.collection-sidebar::-webkit-scrollbar-thumb:hover {
  background: #AD622F;
}

/* Filter Sections grouping (Accordion style, collapsed by default) */
.filter-section {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 14px;
  margin-bottom: 14px;
  transition: padding-bottom 0.25s ease, margin-bottom 0.25s ease;
}

.filter-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.filter-section.is-open {
  padding-bottom: 24px;
  margin-bottom: 24px;
}

.filter-section__title {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--color-text-primary);
  margin-bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
  transition: color 0.25s ease, margin-bottom 0.25s ease;
}

.filter-section__title:hover {
  color: #AD622F;
}

.filter-section.is-open .filter-section__title {
  margin-bottom: 16px;
}

/* Accordion + / - toggle icon */
.filter-section__toggle-icon {
  position: relative;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-text-secondary);
  transition: color 0.25s ease;
}

.filter-section__toggle-icon::before,
.filter-section__toggle-icon::after {
  content: "";
  position: absolute;
  background-color: currentColor;
  border-radius: 1px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

/* Horizontal bar: stays visible in both + and - */
.filter-section__toggle-icon::before {
  width: 11px;
  height: 1.5px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Vertical bar: visible in +, rotates 90deg and fades out in - */
.filter-section__toggle-icon::after {
  width: 1.5px;
  height: 11px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.filter-section__title:hover .filter-section__toggle-icon {
  color: #AD622F;
}

/* Transformed into '-' when open */
.filter-section.is-open .filter-section__toggle-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
  opacity: 0;
}

/* Content: Hidden by default, smooth reveal when is-open */
.filter-section .filter-section__content {
  display: none;
}

.filter-section.is-open .filter-section__content {
  display: block;
  animation: filterContentFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Lists and fields */
.filter-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--color-text-secondary);
  transition: color 0.3s ease;
  user-select: none;
}

.filter-label:hover {
  color: var(--color-text-primary);
}

/* Custom Minimalist Checkboxes / Radio styles */
.filter-input-radio {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.filter-custom-radio {
  height: 16px;
  width: 16px;
  background-color: transparent;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  margin-right: 12px;
  display: inline-block;
  position: relative;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-label:hover .filter-custom-radio {
  border-color: var(--color-text-light);
}

.filter-input-radio:checked ~ .filter-custom-radio {
  border-color: #AD622F;
  background-color: #AD622F;
}

.filter-input-radio:checked ~ .filter-custom-radio::after {
  content: "";
  position: absolute;
  display: block;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.filter-text {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.filter-count {
  color: var(--color-text-light);
  font-size: 11px;
  font-weight: 500;
  margin-left: 6px;
}

.filter-input-radio:checked ~ .filter-text {
  color: #AD622F;
  font-weight: 500;
}

/* Mobile Header elements hidden on desktop */
.collection-sidebar__mobile-header,
.collection-sidebar-overlay,
.mobile-filter-trigger-wrapper {
  display: none;
}

/* --------------------------------------------------------------------------
   4. Products Cards Grid Block
   -------------------------------------------------------------------------- */
.collection-content-area {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 30px;
}

/* Keep product cards generous and consistent on all desktop widths. */
@media (min-width: 1024px) {
  .collection-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* --------------------------------------------------------------------------
   5. Reusable Premium Product Card
   -------------------------------------------------------------------------- */
.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: #ffffff; /* Solid white card container */
  border: 1px solid rgba(0, 0, 0, 0.03); /* Subtle outline */
  border-radius: 12px; /* Curved card language */
  overflow: hidden;
  text-decoration: none;
  transition: all var(--transition-smooth);
}

.product-card:hover {
  border-color: rgba(173, 98, 47, 0.4); /* Copper-rose highlight */
  transform: translateY(-8px); /* Elevates card */
  box-shadow: 
    0 24px 48px -12px rgba(173, 98, 47, 0.25), 
    0 8px 20px -6px rgba(173, 98, 47, 0.1); /* Ambient copper-rose glow */
}

.product-card__image-link {
  display: block;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  margin-bottom: 0; /* Flush with content */
  background-color: var(--color-bg-secondary);
  border-bottom: 1px solid rgba(0, 0, 0, 0.02); /* Separate image and text section */
}

.product-card__image-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover .product-card__image {
  transform: scale(1.03); /* Subtle zoom matching case study cards */
}

/* Placeholder for products without thumbnails */
.product-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-bg-tertiary);
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--color-text-light);
  text-transform: uppercase;
}

/* Dynamic Featured Badge */
.product-card__badge {
  position: absolute;
  top: 15px;
  left: 15px;
  background-color: #AD622F; /* Accent color */
  color: #ffffff;
  font-family: 'Montserrat', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.15em;
  padding: 4px 10px;
  border-radius: 3px;
  z-index: 5;
  text-transform: uppercase;
}

/* Card details styling */
.product-card__info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px; /* Padding inside white container */
  background-color: #ffffff;
  flex-grow: 1;
}

.product-card__text-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.product-card__title {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 13.5px;
  font-weight: 600; /* Snug heavy weight */
  letter-spacing: 0.1em;
  line-height: 1.35;
  text-transform: uppercase;
}

.product-card__title-link {
  color: var(--color-text-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.product-card:hover .product-card__title-link {
  color: var(--color-accent); /* Title turns copper-rose on hover */
}

.product-card__materials {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #AD622F;
  line-height: 1.35;
  letter-spacing: 0.02em;
}

.product-card__price {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: 0.05em;
}

/* CTA Arrow animation */
.product-card__cta {
  color: var(--color-text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
  margin-top: 2px;
}

.product-card__arrow {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), stroke var(--transition-fast);
}

.product-card:hover .product-card__cta {
  color: var(--color-accent);
}

.product-card:hover .product-card__arrow {
  transform: translateX(4px);
  stroke: var(--color-accent);
}

/* --------------------------------------------------------------------------
   6. Collection Pagination Element
   -------------------------------------------------------------------------- */
.collection-pagination {
  margin-top: 0;
  border-top: 1px solid var(--color-border);
  padding-top: 30px;
  display: flex;
  justify-content: center;
}

.collection-pagination ul {
  display: flex;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
  align-items: center;
}

.collection-pagination a,
.collection-pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: 4px;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
}

.collection-pagination a:hover {
  color: var(--color-text-primary);
  background-color: var(--color-bg-secondary);
  border-color: var(--color-border);
}

.collection-pagination span.current {
  color: var(--color-text-inverse);
  background-color: #AD622F;
  border-color: #AD622F;
}

/* Prev/Next textual links override */
.collection-pagination .prev,
.collection-pagination .next {
  letter-spacing: 0.1em;
  font-size: 10px;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   7. Empty Search State
   -------------------------------------------------------------------------- */
.collection-empty {
  text-align: center;
  padding: 100px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  background-color: var(--color-bg-secondary);
  border-radius: 12px;
  border: 1px dashed var(--color-border);
}

.collection-empty__title {
  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--color-text-primary);
  margin: 0;
  text-transform: uppercase;
}

.collection-empty__text {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  color: var(--color-text-secondary);
  max-width: 400px;
  line-height: 1.6;
  margin: 0 0 10px;
}

.collection-empty__btn {
  text-decoration: none;
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   8. Responsive Layout Adapting & Drawer (BEM Structured)
   -------------------------------------------------------------------------- */
@media (max-width: 1023px) {
  
  .collection-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .collection-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Display Mobile Open Filter Trigger */
  .mobile-filter-trigger-wrapper {
    display: block;
    margin-bottom: 20px;
  }

  .mobile-filter-btn {
    width: 100%;
    background-color: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.15em;
    padding: 16px 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
  }

  .mobile-filter-btn:hover {
    background-color: var(--color-bg-tertiary);
    border-color: var(--color-border);
  }

  /* Backdrop overlay on mobile */
  .collection-sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(28, 26, 23, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .collection-sidebar-overlay.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Transform Sidebar into full-screen slide-in mobile drawer */
  .collection-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: -100% !important; /* Default fully off-screen */
    right: auto !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 420px !important;
    height: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100% !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    background-color: #ffffff !important;
    z-index: 99999 !important;
    padding: 28px 24px 60px 24px !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-shadow: 10px 0 30px rgba(28, 26, 23, 0.15);
    transition: left 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  /* Drawer Active class toggled by JS */
  .collection-sidebar.is-active {
    left: 0 !important;
  }

  /* Show Drawer header controls on mobile */
  .collection-sidebar__mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 16px;
  }

  .collection-sidebar__mobile-header h3 {
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
    letter-spacing: 0.1em;
    margin: 0;
    text-transform: uppercase;
  }

  .collection-sidebar__mobile-close {
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    transition: color 0.2s ease, transform 0.2s ease;
  }

  .collection-sidebar__mobile-close:hover {
    color: #AD622F;
    transform: scale(1.1);
  }
}

@media (max-width: 767px) {
  .collection-sidebar {
    max-width: 100% !important; /* Truly 100% full screen on mobile devices */
    width: 100% !important;
    padding: 24px 20px 60px 20px !important;
  }
}

@media (max-width: 599px) {
  .collection-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .product-card__image-link {
    aspect-ratio: 16 / 10; /* Better aspect ratio on portrait screens */
  }
}

/* --------------------------------------------------------------------------
   9. Large-Screen Refinements
   Floating header clearance and catalogue type scale.
   -------------------------------------------------------------------------- */
@media (min-width: 1440px) {
  .collection-header {
    padding-top: 112px;
    padding-bottom: 0;
  }

  .collection-container {
    padding-top: 28px;
    padding-bottom: 100px;
  }

  .collection-layout {
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 72px;
  }

  .collection-sidebar {
    top: 120px;
    max-height: calc(100vh - 180px);
    padding-bottom: 80px;
  }

  .collection-breadcrumbs {
    padding-bottom: 28px; /* Matching single product page */
  }

  .collection-breadcrumbs,
  .filter-count,
  .product-card__price {
    font-size: 13px;
  }

  .filter-section__title {
    font-size: 14px;
    margin-bottom: 0;
  }

  .filter-section.is-open .filter-section__title {
    margin-bottom: 24px;
  }

  .filter-label {
    font-size: 15px;
  }

  .filter-list {
    gap: 15px;
  }

  .product-card__image-link {
    margin-bottom: 22px;
  }

  .product-card__text-group {
    gap: 4px;
  }

  .product-card__title {
    font-size: 15px;
  }

  .product-card__materials {
    font-size: 12.5px;
  }
}

@media (min-width: 1920px) {
  .collection-header {
    padding-top: 132px;
    padding-bottom: 0;
  }

  .collection-container {
    padding-top: 32px;
    padding-bottom: 120px;
  }

  .collection-layout {
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 88px;
  }

  .collection-sidebar {
    top: 140px;
    max-height: calc(100vh - 200px);
    padding-bottom: 90px;
  }

  .collection-breadcrumbs {
    padding-bottom: 32px; /* Matching single product page */
  }

  .collection-breadcrumbs,
  .filter-count,
  .product-card__price {
    font-size: 15px;
  }

  .filter-section__title {
    font-size: 16px;
  }

  .filter-label {
    font-size: 17px;
  }

  .product-card__text-group {
    gap: 5px;
  }

  .product-card__title {
    font-size: 17px;
  }

  .product-card__materials {
    font-size: 14px;
  }

  .product-card__badge {
    font-size: 11px;
    padding: 5px 12px;
  }
}

/* --------------------------------------------------------------------------
   10. Compact / Laptop Viewport Heights
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) and (max-height: 800px) {
  .collection-sidebar {
    top: 80px;
    max-height: calc(100vh - 130px);
    padding-bottom: 70px;
  }
}
