/**
 * Gazette Theme Facet Styling
 */

/* Facet Block Container */
.block-facets {
  background: #fff;
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.9rem;
  border: 1px solid rgba(0,0,0,0.04);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 10px 28px rgba(9, 148, 125, 0.035);
}

.block-facets:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(9, 148, 125, 0.08);
}

/* Card layout: header, body, footer */
.block-facets {
  display: flex;
  flex-direction: column;
}

.block-facets h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.block-facets .block-facets-controls {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.block-facets-toggle {
  background: transparent;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  font-size: 0.95rem;
}

.block-facets-reset {
  background: rgba(9,148,125,0.08);
  border: 1px solid rgba(9,148,125,0.18);
  color: var(--color-accent, #09947d);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.block-facets__footer {
  margin-top: 0.6rem;
  padding: 0.55rem 0.5rem;
  font-size: 0.85rem;
  color: #465c57;
  border-top: 3px double rgba(9,148,125,0.12);
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  background: linear-gradient(180deg, rgba(9,148,125,0.02), rgba(255,255,255,0));
}

/* Collapsed state hides the body/list */
.block-facets.collapsed .item-list,
.block-facets.collapsed .facets-widget-links,
.block-facets.collapsed .item-list > ul {
  display: none;
}

/* Facet Block Title */
.block-facets h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.6rem 0;
  padding: 0.35rem 0.5rem;
  color: #0f3f35;
  text-transform: none;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(9,148,125,0.12), rgba(9,148,125,0.03));
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.6);
}

/* Facet List */
.block-facets .facets-widget-links,
.block-facets .item-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.block-facets .item-list > ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Facet Items */
.facet-item {
  margin-bottom: 0.5rem;
}

.facet-item > a,
.facet-item > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.4rem;
  color: #495057;
  text-decoration: none;
  border-radius: 3px;
  transition: background 0.15s ease, color 0.15s ease;
  font-size: 0.92rem;
  background: transparent;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.facet-item > a:hover {
  background: rgba(9,148,125,0.06);
  color: var(--color-accent, #09947d);
}

.facet-item.is-active > a,
.facet-item.is-active > span {
  background: var(--color-accent, #09947d);
  color: #fff;
  font-weight: 600;
}

/* Facet Count Badge */
.facet-item__count {
  display: inline-block;
  min-width: 20px;
  padding: 0.15rem 0.4rem;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  margin-left: 0.45rem;
}

.facet-item.is-active .facet-item__count {
  background: rgba(255, 255, 255, 0.3);
}

/* Facet Value Text */
.facet-item__value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 0.6rem;
}

/* Ensure the count stays fixed to the right and doesn't wrap */
.facet-item__count,
.facet-item__value {
  white-space: nowrap;
}

/* Show More/Less */
.facets-soft-limit-link {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.35rem 0.7rem;
  color: var(--color-accent, #09947d);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid rgba(9,148,125,0.12);
  border-radius: 4px;
  transition: background 0.15s ease, color 0.15s ease;
}

.facets-soft-limit-link:hover {
  background: var(--color-primary, #1a73e8);
  color: #fff;
}

/* Empty Facets */
.facet--empty {
  color: #6c757d;
  font-style: italic;
  padding: 0.75rem;
}

/* Responsive Adjustments */
@media (max-width: 991px) {
  .block-facets {
    margin-bottom: 1rem;
    padding: 1rem;
  }
  
  .block-facets h2 {
    font-size: 1rem;
  }
}

/* Sidebar Styling */
aside[role="complementary"] {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding-right: 0.25rem;
  padding-left: 0.25rem;
}

/* Tighter spacing for small screens so the sidebar doesn't feel too heavy */
@media (max-width: 767px) {
  aside[role="complementary"] {
    position: relative;
    max-height: none;
    top: 0;
    padding-right: 0;
  }
  .block-facets {
    padding: 0.6rem;
  }
}

/* Subtle divider between stacked facet blocks for clearer grouping */
.block-facets + .block-facets {
  margin-top: 0.5rem;
}

/* Make sure headings and items align nicely inside the sidebar */
aside[role="complementary"] .block-facets h2 {
  font-size: 0.98rem;
  margin-bottom: 0.45rem;
}

aside[role="complementary"] .facet-item > a,
aside[role="complementary"] .facet-item > span {
  padding: 0.28rem 0.35rem;
}

/* Header icon inside block title */
.block-facets .block-header-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 1.05rem;
  color: #fff; /* ensure icon is white */
  background: var(--color-accent, #09947d);
  box-shadow: 0 6px 18px rgba(9,148,125,0.16);
}

/* Per-item small icon */
.item-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:20px;
  margin-right:0.5rem;
  font-size:0.95rem;
}

/* Allow an inline style color on icon containers */
.facet-item .item-icon[style] {
  border-radius: 6px;
  padding: 2px;
}

/* Scrollbar Styling for Sidebar */
aside[role="complementary"]::-webkit-scrollbar {
  width: 6px;
}

aside[role="complementary"]::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

aside[role="complementary"]::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

aside[role="complementary"]::-webkit-scrollbar-thumb:hover {
  background: #999;
}
