/* ==========================================================================
 * spraki-filters.css — ONE filter bar for every browse page.
 *
 * /stories (lese) had its own, /listening (lytte) had a different one, and
 * they looked nothing alike. The values here are lese's, unchanged, so
 * /stories renders exactly as before; the .sp-* names are what new pages use.
 * A page that needs a variation overrides it in its own stylesheet, which
 * loads after this file — it does not fork the whole bar.
 *
 * Structure (see views/pages/lese_browse.ejs):
 *
 *   <div class="sp-filters">
 *     <div class="sp-filter-row"> …selects… </div>
 *     <button class="sp-search-btn">🔍</button>
 *     <button class="sp-chip-btn">…</button>
 *   </div>
 *   <div class="sp-search-expand"> …input… </div>
 *
 * On a phone the select row takes the full width and the selects share it,
 * the search collapses to its icon, and the chip buttons sit on the first
 * line — six stacked full-width controls is not a filter bar.
 * ========================================================================== */

.sp-filters,
.lese-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.sp-filter-row,
.lese-filter-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  flex: 1;
}

.sp-filter-select,
.lese-filter-select {
  padding: 10px 14px;
  border: 2px solid #e0dbd4;
  border-radius: 10px;
  font-size: 14px;
  font-family: "proxima-nova", sans-serif;
  background: #fff;
  color: var(--color-text-muted, #5f5238);
  cursor: pointer;
  min-width: 120px;
}
.sp-filter-select:focus,
.lese-filter-select:focus { border-color: #fbc24b; outline: none; }

/* Icon-sized toggle that reveals .sp-search-expand. */
.sp-search-btn,
.lese-search-btn {
  width: 40px;
  height: 40px;
  border: 2px solid #e0dbd4;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted, #5f5238);
  font-size: 15px;
  transition: all 0.2s;
  flex-shrink: 0;
}
.sp-search-btn:hover,
.lese-search-btn:hover { border-color: #fbc24b; color: #333; }
.sp-search-btn.active,
.lese-search-btn.active { border-color: #fbc24b; background: #fef9ee; color: #333; }

/* Text button alongside the filters (view toggle, back, shuffle). */
.sp-chip-btn,
.lese-view-toggle-btn {
  padding: 8px 16px;
  border: 2px solid #e0dbd4;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-family: "proxima-nova", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted, #5f5238);
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sp-chip-btn:hover,
.lese-view-toggle-btn:hover { border-color: #fbc24b; color: #333; }
.sp-chip-btn.active,
.lese-view-toggle-btn.active { border-color: #fbc24b; background: #fef9ee; color: #333; }
.sp-chip-btn i { font-size: 14px; }

.sp-search-expand,
.lese-search-expand {
  width: 100%;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease, margin 0.25s ease;
  margin-bottom: 0;
}
.sp-search-expand.open,
.lese-search-expand.open {
  max-height: 60px;
  margin-bottom: 12px;
}
.sp-search-expand .search-inner,
.lese-search-expand .search-inner { position: relative; }
.sp-search-expand .search-icon,
.lese-search-expand .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
  font-size: 14px;
  pointer-events: none;
}
.sp-search-expand input,
.lese-search-expand input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 2px solid #e0dbd4;
  border-radius: 10px;
  font-size: 15px;
  font-family: "proxima-nova", sans-serif;
  background: #fff;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.sp-search-expand input:focus,
.lese-search-expand input:focus { border-color: #fbc24b; outline: none; }

@media (max-width: 768px) {
  .sp-filters,
  .lese-filters { flex-wrap: wrap; gap: 8px; }
  .sp-filter-row,
  .lese-filter-row { flex: 1 1 100%; order: 2; gap: 8px; }
  /* Two per row, not four or five crushed into one: at phone width a shared
     row truncates every label to "Alle k…", which tells the learner nothing. */
  .sp-filter-select,
  .lese-filter-select {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    font-size: 13px;
    padding: 9px 10px;
  }
  .sp-search-btn,
  .lese-search-btn { order: 0; width: 38px; height: 38px; }
  /* Scoped to the bar's own children — an unscoped margin-left:auto also
     shoved chip buttons elsewhere on the page (e.g. "Vis flere") to the right. */
  .sp-filters > .sp-chip-btn,
  .lese-filters > .lese-view-toggle-btn {
    order: 1;
    margin-left: auto;
  }
  .sp-chip-btn,
  .lese-view-toggle-btn { font-size: 13px; padding: 8px 12px; }
}
