/* ==========================================================================
   Customer Stories filters
   Underlined "select" style: a small label above each control, the control
   itself shows the current value + chevron on a bottom border (no button
   background/pill). Clicking opens a checklist panel below for multi-select.
   Progressive enhancement: injected/toggled by customers-filter.js.
   ========================================================================== */

.cs-filterbar {
  margin: 0 0 28px;
}

.cs-filterbar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e8e8e8;
}

.cs-filterbar-icon {
  color: #1E1E1E;
  flex: 0 0 auto;
}

.cs-filterbar-title {
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #1E1E1E;
  text-transform: uppercase;
}

.cs-filterbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  column-gap: 32px;
  row-gap: 20px;
}

.cs-filterbar-groups {
  display: flex;
  flex-wrap: wrap;
  column-gap: 30px;
  row-gap: 20px;
  flex: 1 1 auto;
}

.cs-filter-group {
  position: relative;
  min-width: 18%;
}

.cs-filter-group-label {
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #909599;
  margin-bottom: 6px;
}

.cs-filter-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-width: 160px;
  background: transparent;
  border: none;
  border-bottom: 1px solid #1E1E1E;
  padding: 0 0 8px;
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #1E1E1E;
  cursor: pointer;
}

.cs-filter-select:hover {
  border-bottom-color: #909599;
}

.cs-filter-select:focus-visible {
  outline: 2px solid #1E1E1E;
  outline-offset: 2px;
}

.cs-filter-select[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.cs-filter-select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-filter-group.is-active .cs-filter-select {
  border-bottom-color: #1E1E1E;
  border-bottom-width: 2px;
}

.cs-filter-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex: 0 0 auto;
}

.cs-filter-select[aria-expanded="true"] .cs-filter-chevron {
  transform: rotate(-135deg);
}

/* Dropdown checklist panel */
.cs-filter-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  max-width: min(280px, 86vw);
  max-height: 320px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #e8e8e8;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  padding: 8px;
}

.cs-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 14px;
  font-family: "DM Sans", sans-serif;
  color: #1E1E1E;
  cursor: pointer;
}

.cs-option:hover {
  background: #f5f5f7;
}

.cs-option input {
  width: 16px;
  height: 16px;
  accent-color: #1E1E1E;
  cursor: pointer;
  flex: 0 0 auto;
}

.cs-empty-note {
  margin: 6px 10px;
  font-size: 13px;
  color: #909599;
  font-family: "DM Sans", sans-serif;
}

/* Meta row: result count + clear */
.cs-filterbar-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.cs-result-count {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #444444;
  font-family: "DM Sans", sans-serif;
}

.cs-clear-btn {
  background: transparent;
  border: 1px solid #e8e8e8;
  border-radius: 24px;
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: "DM Sans", sans-serif;
  color: #1E1E1E;
  cursor: pointer;
  transition: all 0.25s ease;
}

.cs-clear-btn:hover {
  background: #1E1E1E;
  color: #ffffff;
  border-color: #1E1E1E;
}

.cs-clear-btn:focus-visible {
  outline: 2px solid #1E1E1E;
  outline-offset: 2px;
}

/* Card visibility toggled by filtering */
.cs-story.cs-hidden {
  display: none !important;
}

/* Equal-height cards: a card with more badges/title lines than its row
   neighbors no longer leaves a ragged bottom edge. The author/date
   footer stays pinned to the bottom of every card regardless of how
   much badge/title content sits above it. */
.cs-story {
  display: flex;
}

.cs-story .custom-card {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.cs-story .custom-card .custom-card-link {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.cs-story .custom-card .custom-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.cs-story .custom-card .custom-card-body .custom-card-author {
  margin-top: auto;
}

/* Empty state */
.cs-no-results {
  text-align: center;
  padding: 48px 16px;
}

.cs-no-results p {
  margin: 0 0 8px;
  font-family: "DM Sans", sans-serif;
  color: #1E1E1E;
}

.cs-no-results p:first-child {
  font-size: 20px;
  font-weight: 700;
}

.cs-no-results p:nth-child(2) {
  color: #909599;
}

.cs-no-results .cs-clear-btn {
  margin-top: 12px;
}

/* Mobile: full-width controls, no horizontal overflow */
@media (max-width: 575px) {
  .cs-filter-group {
    width: 100%;
    min-width: 0;
  }

  .cs-filter-panel {
    left: 0;
    right: 0;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  /* Result count + Clear All sit right under the FILTER BY title,
     above the filter row, on mobile only. */
  .cs-filterbar {
    display: flex;
    flex-direction: column;
  }

  .cs-filterbar-head {
    order: 0;
  }

  .cs-filterbar-meta {
    order: 1;
    margin-top: 0;
    margin-bottom: 16px;
  }

  .cs-filterbar-row {
    order: 2;
  }
}
