/**
 * CategoryGrid Portlet - Frontend Styles
 * 
 * Komponenten:
 * 1. Filter Header (Titel + Untertitel)
 * 2. Filter Bar (Grid mit Buttons)
 * 3. Category Panels (Produkt-Grids)
 */

/* ===========================================
   CSS CUSTOM PROPERTIES (Theme-fähig)
   =========================================== */
.category-filter-portlet {
  --cfp-primary: #2d727c;
  --cfp-primary-hover: #2d727c;
  --cfp-text: #334155;
  --cfp-text-muted: #64748b;
  --cfp-bg-light: #f8fafc;
  --cfp-bg-lighter: #f1f5f9;
  --cfp-border: #e2e8f0;
  --cfp-border-hover: #94a3b8;
  --cfp-radius: 8px;
  --cfp-transition: 0.2s ease;
}

/* ===========================================
   1. FILTER HEADER
   =========================================== */
.category-filter-portlet .category-filter-header {
  text-align: center;
  margin-bottom: 2rem;
}

.category-filter-portlet .category-filter-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: inherit;
}

.category-filter-portlet .category-filter-subtitle {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cfp-text-muted);
  margin-bottom: 0;
}

/* ===========================================
   2. FILTER BAR (CSS Grid mit auto-fill)
   =========================================== */
.category-filter-portlet .category-filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding: 1.5rem;
  background: linear-gradient(180deg, var(--cfp-bg-light) 0%, var(--cfp-bg-lighter) 100%);
  border-radius: var(--cfp-radius);
}

/* Gemeinsame Button-Styles (DRY) */
.category-filter-portlet .category-filter-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  /* Bild immer oben */
  padding: 1rem;
  padding-top: 1.25rem;
  background: #fff;
  border: 2px solid var(--cfp-border);
  border-radius: var(--cfp-radius);
  cursor: pointer;
  transition: border-color var(--cfp-transition), box-shadow var(--cfp-transition);
  min-height: 140px;
  text-decoration: none;
  color: inherit;
}

.category-filter-portlet .category-filter-btn:hover {
  border-color: var(--cfp-border-hover);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.category-filter-portlet .category-filter-btn.active {
  border-color: var(--cfp-primary);
  box-shadow: 0 2px 12px rgba(13, 148, 136, 0.2);
}

/* Reset-Button (etwas schmaler) */
.category-filter-portlet .category-filter-reset {
  max-width: 120px;
}

/* Reset Icon Box */
.category-filter-portlet .filter-reset-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: var(--cfp-bg-lighter);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.category-filter-portlet .filter-reset-icon svg {
  width: 28px;
  height: 28px;
  color: var(--cfp-text-muted);
}

.category-filter-portlet .category-filter-reset.active .filter-label {
  color: var(--cfp-primary);
  font-weight: 600;
}

/* Kategorie-Bilder */
.category-filter-portlet .filter-img-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.category-filter-portlet .filter-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* Button Label */
.category-filter-portlet .filter-label {
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.3;
  color: var(--cfp-text);
}

/* ===========================================
   3. CATEGORY PANELS
   =========================================== */
.category-filter-portlet .category-panel {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--cfp-border);
}

.category-filter-portlet .category-panel:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.category-filter-portlet .category-panel.is-hidden {
  display: none;
}

/* Panel Header */
.category-filter-portlet .category-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 3px solid var(--cfp-primary);
}

.category-filter-portlet .category-panel-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.category-filter-portlet .category-panel-link {
  color: inherit;
  text-decoration: none;
  transition: color var(--cfp-transition);
}

.category-filter-portlet .category-panel-link:hover {
  color: var(--cfp-primary);
}

.category-filter-portlet .category-panel-count {
  font-size: 0.875rem;
  color: var(--cfp-text-muted);
}

/* Panel Footer */
.category-filter-portlet .category-panel-footer {
  text-align: center;
  margin-top: 1.5rem;
}

.category-filter-portlet .category-show-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--cfp-primary);
  border-color: var(--cfp-primary);
}

.category-filter-portlet .category-show-all-btn:hover {
  background: var(--cfp-primary);
  border-color: var(--cfp-primary);
  color: #fff;
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 991.98px) {
  .category-filter-portlet .category-filter-bar {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .category-filter-portlet .category-filter-btn {
    min-height: 120px;
    padding: 0.75rem;
    padding-top: 1rem;
  }

  .category-filter-portlet .filter-img-wrapper {
    width: 70px;
    height: 70px;
  }

  .category-filter-portlet .filter-reset-icon {
    width: 70px;
    height: 70px;
  }
}

@media (max-width: 767.98px) {
  .category-filter-portlet .category-filter-bar {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.75rem;
    padding: 1rem;
  }

  .category-filter-portlet .category-filter-btn {
    min-height: 100px;
    padding: 0.5rem;
    padding-top: 0.75rem;
  }

  .category-filter-portlet .filter-img-wrapper {
    width: 50px;
    height: 50px;
  }

  .category-filter-portlet .filter-reset-icon {
    width: 50px;
    height: 50px;
  }

  .category-filter-portlet .filter-reset-icon svg {
    width: 22px;
    height: 22px;
  }

  .category-filter-portlet .filter-label {
    font-size: 0.7rem;
  }

  .category-filter-portlet .category-filter-title {
    font-size: 1.5rem;
  }

  .category-filter-portlet .category-panel-title {
    font-size: 1.25rem;
  }

  .category-filter-portlet .category-panel-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===========================================
   OPC PREVIEW STYLES
   =========================================== */
.opc-CategoryGrid--preview {
  padding: 1.5rem;
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 8px;
}

.opc-CategoryGrid--preview .preview-header {
  text-align: center;
  margin-bottom: 1rem;
}

.opc-CategoryGrid--preview .preview-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.opc-CategoryGrid--preview .preview-subtitle {
  font-size: 0.75rem;
  color: #6c757d;
}

.opc-CategoryGrid--preview .preview-filter-bar {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.opc-CategoryGrid--preview .preview-filter-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  min-width: 70px;
  font-size: 0.7rem;
}

.opc-CategoryGrid--preview .preview-img-placeholder {
  width: 40px;
  height: 40px;
  background: #e9ecef;
  border-radius: 4px;
  margin-bottom: 0.25rem;
}

.opc-CategoryGrid--preview .preview-products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.opc-CategoryGrid--preview .preview-product-card {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 0.5rem;
}

.opc-CategoryGrid--preview .preview-product-img {
  height: 40px;
  background: #e9ecef;
  border-radius: 2px;
  margin-bottom: 0.25rem;
}

.opc-CategoryGrid--preview .preview-product-title {
  height: 8px;
  background: #e9ecef;
  border-radius: 2px;
  margin-bottom: 0.25rem;
}

.opc-CategoryGrid--preview .preview-product-price {
  height: 8px;
  width: 50%;
  background: #dee2e6;
  border-radius: 2px;
}

.opc-CategoryGrid--preview .preview-info {
  text-align: center;
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed #dee2e6;
}