/* Full browse-and-compare filter UI for /cities: dropdowns, sort, advanced
   category sliders, timezone filter, reset, and the ratings legend. Ported from
   the original homepage explorer; operates on the static .city-card grid. */

.city-browse { max-width: 1200px; margin: 0 auto; padding: 2rem 1.25rem 0; }

/* --- FILTER BAR --- */
.filter-bar { background-color: var(--color-white); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: var(--space-5); margin-bottom: var(--space-5); }
.filter-row { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: flex-end; }
.filter-group { flex: 1; min-width: 150px; }
.filter-label { display: block; font-size: var(--text-sm); font-weight: var(--font-medium); color: var(--color-charcoal); margin-bottom: var(--space-2); }
.filter-select { width: 100%; padding: var(--space-2) var(--space-3); font-size: var(--text-base); color: var(--color-charcoal); background-color: var(--color-sand); border: 1px solid var(--color-sand-dark); border-radius: var(--radius-md); cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%233D3833' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.filter-select:focus { outline: none; border-color: var(--color-terracotta); box-shadow: 0 0 0 3px rgba(196, 112, 75, 0.15); }
input.filter-input { width: 100%; padding: var(--space-2) var(--space-3); font-size: var(--text-base); color: var(--color-charcoal); background-color: var(--color-sand); border: 1px solid var(--color-sand-dark); border-radius: var(--radius-md); padding-left: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6560' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 10px center; }
.filter-input:focus { outline: none; border-color: var(--color-terracotta); box-shadow: 0 0 0 3px rgba(196, 112, 75, 0.15); }
.filter-input::placeholder { color: var(--color-stone); }

/* --- ADVANCED FILTERS BUTTON --- */
.advanced-filters-btn { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); font-size: var(--text-base); font-weight: var(--font-medium); color: var(--color-charcoal); background-color: var(--color-sand); border: 1px solid var(--color-sand-dark); border-radius: var(--radius-md); cursor: pointer; transition: all 0.2s ease; white-space: nowrap; }
.advanced-filters-btn:hover { background-color: var(--color-sand-dark); }
.advanced-filters-btn.active { background-color: var(--color-terracotta); color: var(--color-white); border-color: var(--color-terracotta); }
.advanced-filters-btn .filter-icon { flex-shrink: 0; }
.advanced-filters-btn .chevron-icon { flex-shrink: 0; transition: transform 0.2s ease; }
.advanced-filters-btn.active .chevron-icon { transform: rotate(180deg); }
.filter-badge { display: none; background-color: var(--color-terracotta); color: var(--color-white); font-size: var(--text-xs); font-weight: var(--font-semibold); padding: 2px 6px; border-radius: 999px; min-width: 18px; text-align: center; }
.advanced-filters-btn.active .filter-badge { background-color: var(--color-white); color: var(--color-terracotta); }
.filter-badge.visible { display: inline-block; }

/* --- SLIDERS PANEL --- */
.sliders-panel { display: none; margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--color-sand-dark); animation: slideDown 0.3s ease; }
.sliders-panel.open { display: block; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.sliders-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4) var(--space-6); }
.slider-group { display: flex; flex-direction: column; gap: var(--space-2); }
.slider-header { display: flex; justify-content: space-between; align-items: center; }
.slider-label { font-size: var(--text-sm); font-weight: var(--font-medium); color: var(--color-charcoal); }
.slider-value { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--color-terracotta); background-color: rgba(196, 112, 75, 0.1); padding: 2px 8px; border-radius: var(--radius-sm); min-width: 28px; text-align: center; }

/* --- DUAL RANGE SLIDER --- */
.dual-range { position: relative; height: 20px; display: flex; align-items: center; }
.slider-track { position: absolute; width: 100%; height: 6px; background: var(--color-sand-dark); border-radius: 3px; pointer-events: none; }
.slider-range { position: absolute; height: 6px; background: var(--color-terracotta); border-radius: 3px; pointer-events: none; }
.filter-slider { -webkit-appearance: none; appearance: none; position: absolute; width: 100%; height: 6px; background: transparent; outline: none; cursor: pointer; pointer-events: none; }
.filter-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; background: var(--color-terracotta); border-radius: 50%; cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); pointer-events: auto; position: relative; z-index: 2; }
.filter-slider::-webkit-slider-thumb:hover { transform: scale(1.1); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25); }
.filter-slider::-moz-range-thumb { width: 20px; height: 20px; background: var(--color-terracotta); border: none; border-radius: 50%; cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); pointer-events: auto; position: relative; z-index: 2; }
.filter-slider::-moz-range-thumb:hover { transform: scale(1.1); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25); }
.filter-slider-min { z-index: 1; }
.filter-slider-max { z-index: 2; }
/* keyboard focus visibility on the range thumbs (a11y) */
.filter-slider:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--color-ink); outline-offset: 2px; }
.filter-slider:focus-visible::-moz-range-thumb { outline: 3px solid var(--color-ink); outline-offset: 2px; }

/* --- TIMEZONE FILTER (signed-in only) --- */
.slider-group-timezone { grid-column: 1 / -1; background: linear-gradient(135deg, var(--color-sand) 0%, rgba(255,255,255,0.5) 100%); border-radius: var(--radius-md); padding: var(--space-4); margin-top: var(--space-2); border: 1px dashed var(--color-sand-dark); }
.slider-group-timezone .slider-label { color: var(--color-terracotta); }
.timezone-filter-content { display: none; }
.timezone-filter-content.active { display: block; }
.timezone-filter-locked { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-stone); padding: var(--space-2) 0; }
.timezone-filter-locked.hidden { display: none; }
.timezone-filter-locked svg { color: var(--color-sand-dark); flex-shrink: 0; }
.timezone-filter-locked a { color: var(--color-terracotta); font-weight: var(--font-medium); text-decoration: none; }
.timezone-filter-locked a:hover { text-decoration: underline; }

/* --- RESET --- */
.reset-filters-btn { margin-top: var(--space-5); padding: var(--space-2) var(--space-4); font-size: var(--text-sm); font-weight: var(--font-medium); color: var(--color-stone); background-color: transparent; border: 1px solid var(--color-sand-dark); border-radius: var(--radius-md); cursor: pointer; transition: all 0.2s ease; }
.reset-filters-btn:hover { color: var(--color-charcoal); border-color: var(--color-stone); background-color: var(--color-sand); }

/* --- RESULTS INFO --- */
.results-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); flex-wrap: wrap; gap: var(--space-3); }
.results-count { font-size: var(--text-base); color: var(--color-stone); }
.results-count strong { color: var(--color-ink); }

/* --- RATINGS LEGEND --- */
.ratings-legend { background-color: var(--color-white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-bottom: var(--space-5); overflow: hidden; }
.legend-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: var(--space-4) var(--space-5); background: none; border: none; cursor: pointer; font-size: var(--text-sm); font-weight: var(--font-medium); color: var(--color-charcoal); transition: background-color 0.2s ease; }
.legend-toggle:hover { background-color: var(--color-sand); }
.legend-toggle-text { display: flex; align-items: center; gap: var(--space-2); }
.legend-toggle svg { transition: transform 0.2s ease; }
.legend-toggle.active svg { transform: rotate(180deg); }
.legend-content { display: none; padding: 0 var(--space-5) var(--space-5); animation: slideDown 0.3s ease; }
.legend-content.open { display: block; }
.legend-intro { font-size: var(--text-sm); color: var(--color-stone); margin-bottom: var(--space-4); line-height: var(--leading-relaxed); }
.legend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-3); }
.legend-item { display: flex; gap: var(--space-3); padding: var(--space-3); background-color: var(--color-sand); border-radius: var(--radius-md); }
.legend-item-icon { flex-shrink: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background-color: var(--color-terracotta); color: white; border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: var(--font-semibold); }
.legend-item-content { flex: 1; min-width: 0; }
.legend-item-title { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--color-ink); margin-bottom: 2px; }
.legend-item-desc { font-size: var(--text-xs); color: var(--color-stone); line-height: 1.4; }
.legend-score-scale { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--color-sand-dark); }
.legend-scale-title { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--color-charcoal); margin-bottom: var(--space-3); }
.legend-scale-items { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.legend-scale-item { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--color-stone); }
.legend-scale-dot { width: 12px; height: 12px; border-radius: 50%; }
.legend-scale-dot.excellent { background: #4ade80; }
.legend-scale-dot.good { background: #facc15; }
.legend-scale-dot.average { background: #fb923c; }
.legend-scale-dot.below { background: #f87171; }

/* --- EMPTY STATE --- */
.city-dir-empty { text-align: center; color: var(--color-stone); padding: 3.5rem 1rem; }
.city-dir-empty .linklike { background: none; border: 0; padding: 0; color: var(--color-terracotta); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }

@media (max-width: 767px) {
  .filter-group { min-width: 100%; }
  .sliders-grid { grid-template-columns: 1fr; }
}
