/* 
 * File: web/themes/custom/websdt_theme_master/components/pages/catalog-page/catalog-page.css
 * Logic: Mobile-First Catalog Layout with Grid Flattening.
 */

.wsdt-catalog-page {
  padding-bottom: var(--space-lg);
  padding-inline: 0;
  margin-inline: 0;
  width: 100%;
  max-width: 100%;
}

.wsdt-has-admin-toolbar .wsdt-catalog-action-bar {
  top: calc(var(--admin-toolbar-height) + var(--header-height) * 0.7);
}

/* Action Bar (Sticky, Filters & Sort) */
.wsdt-catalog-action-bar {
  position: -webkit-sticky;
  position: sticky;
  top: calc(var(--header-height) * 0.7);
  z-index: 50;
  background-color: var(--bg-gray-lighter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border-bottom: var(--border-width-sm) solid var(--border-light);
  gap: var(--space-md);
  transition: top var(--transition-base);
}

@media all and (max-width: 767px) {
  .wsdt-catalog-action-bar {
    position: -webkit-sticky;
    position: sticky;
    top: calc(var(--header-height) * 0.7);
    z-index: 50;
    flex-direction: row;
    flex-wrap: nowrap; /* Keep filter icon and sort on same line */
    align-items: flex-start;
    padding: var(--space-md);
    gap: var(--space-sm);
    background-color: var(--bg-gray-lighter);
    box-shadow: var(--shadow-sm);
    border-bottom: var(--border-width-sm) solid var(--border-light);
  }

  .wsdt-catalog-action-bar__left {
    width: auto;
    flex-shrink: 0;
  }

  .wsdt-catalog-action-bar__right {
    flex: 1;
    min-width: 0; /* Prevents overflow */
  }

  .wsdt-filter-trigger {
    width: calc(var(--unit-base) * 10);
    height: calc(var(--unit-base) * 10);
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--base-white);
    border: var(--border-width-sm) solid var(--border-light);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
  }

  .wsdt-catalog-sort {
    width: 100%;
  }

  .wsdt-catalog-sort .views-exposed-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
  }

  .wsdt-catalog-sort select {
    width: 100%;
    height: calc(var(--unit-base) * 10);
    padding-inline: var(--space-sm);
    font-size: 13px;
    background-color: var(--base-white);
  }

  .wsdt-catalog-sort .form-actions {
    display: flex !important;
    margin-top: 4px;
  }

  .wsdt-catalog-sort .form-actions input[id*="edit-reset"] {
    width: 100%;
    height: calc(var(--unit-base) * 8);
    padding: 0 var(--space-sm);
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    background-color: var(--base-white);
    border: var(--border-width-sm) solid var(--border-light);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    text-decoration: none;
    color: var(--text-body);
    display: block !important;
  }

  .wsdt-catalog-sort .form-actions input[id*="edit-submit"] {
    display: none !important;
  }
}

.wsdt-catalog-action-bar__left,
.wsdt-catalog-action-bar__right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.wsdt-catalog-category-description {
  margin-bottom: var(--space-lg);
  padding: 0 var(--space-md);
  color: var(--text-body);
  line-height: var(--line-height-prose);
  font-size: clamp(0.9rem, 4vw, 1rem);
}

.wsdt-filter-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  background: transparent;
  border: var(--border-width-sm) solid transparent;
  padding: var(--space-xs) var(--space-sm);
  cursor: pointer;
  color: var(--text-main);
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.wsdt-filter-label {
  display: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-xs);
}

@media all and (min-width: 768px) {
  .wsdt-filter-label {
    display: inline-block;
  }
}

.wsdt-filter-trigger:hover {
  color: var(--color-secondary);
  border-color: var(--border-light);
  background-color: var(--base-white);
}

.wsdt-filter-trigger svg {
  width: var(--icon-size-faq);
  height: var(--icon-size-faq);
}

/* --- Views Exposed Form (Sort & Items per page) --- */
.wsdt-catalog-sort .views-exposed-form {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.wsdt-catalog-sort .form-item {
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.wsdt-catalog-sort label {
  display: none;
}

.wsdt-catalog-sort select {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-sm);
  background-color: var(--base-white);
  border: var(--border-width-sm) solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-width: 180px;
  transition: var(--transition-fast);
}

.wsdt-catalog-sort select:focus {
  border-color: var(--color-secondary);
  outline: none;
  box-shadow: var(--shadow-focus);
}

.wsdt-catalog-sort .form-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.wsdt-catalog-sort .form-actions input[id*="edit-submit"] {
  display: none;
}

.wsdt-catalog-sort .form-actions input[id*="edit-reset"] {
  background-color: transparent;
  color: var(--text-body);
  border: none;
  text-decoration: underline;
  font-size: var(--font-size-sm);
  cursor: pointer;
  padding: 0;
  transition: color var(--transition-fast);
}

.wsdt-catalog-sort .form-actions input[id*="edit-reset"]:hover {
  color: var(--color-secondary);
}

@media all and (min-width: 768px) {
  .wsdt-catalog-sort .form-actions {
    display: flex;
  }
}

/* --- Facets (Drawer Content) --- */
.wsdt-catalog-layout {
  display: block;
  width: 100%;
}

/* Flattening the View wrappers so the Grid hits the .views-row directly */
.wsdt-product-grid,
.wsdt-catalog-results-wrapper,
.wsdt-product-grid .view-content {
  display: contents; /* Makes the wrapper "invisible" to the layout engine */
}

/* The actual Grid Container */
.wsdt-catalog-content {
  display: grid;
  gap: var(--spacing-card);
  grid-template-columns: 1fr; /* Mobile: 1 column */
  width: 100%;
}

/* Tablet (min-width: 768px) */
@media all and (min-width: 768px) {
  .wsdt-catalog-content {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop (min-width: 1024px) */
@media all and (min-width: 1024px) {
  .wsdt-catalog-content {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--grid-gap);
  }
}

/* Διασφάλιση ότι το κάθε row πιάνει το σωστό ύψος */
.views-row {
  display: flex;
  height: 100%;
}
/* --- Facets & BEF Drawer Content --- */
.wsdt-facets-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.wsdt-facet-item {
  border-bottom: var(--border-width-sm) solid var(--border-light);
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
}

.wsdt-facet-item:last-child {
  border-bottom: none;
}

.wsdt-facet-title {
  font-family: var(--h-font-family);
  font-size: 13px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.wsdt-facet-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* --- Επαναφορά Layout Checkboxes (BEF) --- */
.bef-checkboxes {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Το Wrapper κάθε item */
.js-form-item.form-type-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0;
}

/* Το κουτάκι (input) */
.js-form-item.form-type-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  border: var(--border-width-sm) solid var(--border-light);
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}

/* Το κείμενο (label) */
.js-form-item.form-type-checkbox label {
  margin-bottom: 0;
  cursor: pointer;
  font-weight: 400;
  font-size: var(--font-size-base);
  color: var(--text-body);
  transition: color var(--transition-fast);
  display: flex;
  justify-content: space-between;
  flex: 1;
  align-items: center;
}

/* Hover & Active States */
.js-form-item.form-type-checkbox:hover label {
  color: var(--color-secondary);
}

/* Styling για το κείμενο και το count μέσα στο label */
.js-form-item.form-type-checkbox label span:last-child {
  font-size: var(--font-size-sm);
  opacity: 0.6;
  background: var(--bg-gray-lighter);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
