/* ========================================
   FILTERS - Search & filter bar management
   Loop filters, filter bar, tempo & key dropdowns
   ======================================== */

/* ========== LOOP FILTERS ========== */
.loop-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.filter-btn {
  padding: 10px 20px;
  border: none;
  background: #e8e8e8;
  color: #666;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease, background-color 0.3s ease, color 0.3s ease;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
}

/* Dark mode pour filter btn */
[data-theme="dark"] .filter-btn {
  background: #252525;
  border: none;
  color: var(--text-secondary);
}

.filter-btn:hover {
  background: #d8d8d8;
  color: #000;
  transform: translateY(-1px);
}

.filter-btn.active {
  background: #000;
  color: #FFF;
}

/* Dark mode pour filter btn hover et active */
[data-theme="dark"] .filter-btn:hover {
  background: #303030;
  color: var(--text-primary);
}

[data-theme="dark"] .filter-btn.active {
  background: var(--text-primary);
  color: var(--bg-primary);
}

/* ========== LOOPS & PAGE ALL PACKS — barre filtres minimaliste ========== */
/* Sons (#all-loops-content) + liste des packs (#all-packs-content) ; pas la barre dans pack-view */
.loops-filter-bar,
#all-packs-content .packs-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(1rem, 2.5vw, 2rem);
  padding: 0.35rem 0 1.25rem;
  margin-bottom: 8px;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  transition: background-color 0.3s ease;
  width: 100%;
  box-sizing: border-box;
  justify-content: flex-start;
}

.loops-filter-bar .filter-dropdown-btn,
#all-packs-content .packs-filter-bar .filter-dropdown-btn {
  gap: 0.35rem;
  padding: 4px 0;
  border-radius: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--fg-rest);
  background: transparent;
}

.loops-filter-bar .filter-dropdown-btn:hover,
#all-packs-content .packs-filter-bar .filter-dropdown-btn:hover {
  background: transparent;
  color: rgba(0, 0, 0, 0.88);
}

[data-theme="dark"] .loops-filter-bar .filter-dropdown-btn:hover,
[data-theme="dark"] #all-packs-content .packs-filter-bar .filter-dropdown-btn:hover {
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
}

.loops-filter-bar .filter-dropdown-btn.active,
.loops-filter-bar .filter-dropdown-btn.has-value,
#all-packs-content .packs-filter-bar .filter-dropdown-btn.active,
#all-packs-content .packs-filter-bar .filter-dropdown-btn.has-value {
  color: var(--text-primary, #111);
  background: transparent;
  font-weight: 600;
}

.loops-filter-bar .primary-filter .filter-dropdown-btn,
.loops-filter-bar .primary-filter .filter-dropdown-btn:hover,
#all-packs-content .packs-filter-bar .primary-filter .filter-dropdown-btn,
#all-packs-content .packs-filter-bar .primary-filter .filter-dropdown-btn:hover {
  background: transparent;
  padding: 4px 0;
  color: var(--fg-rest);
}

.loops-filter-bar .primary-filter .filter-dropdown-btn.has-value,
#all-packs-content .packs-filter-bar .primary-filter .filter-dropdown-btn.has-value {
  color: var(--text-primary, #111);
}

.loops-filter-bar .dropdown-arrow,
#all-packs-content .packs-filter-bar .dropdown-arrow {
  width: 10px;
  height: 10px;
  opacity: 0.55;
}

.loops-filter-bar .filter-dropdown.open .dropdown-arrow,
#all-packs-content .packs-filter-bar .filter-dropdown.open .dropdown-arrow {
  opacity: 0.85;
}

.loops-filter-bar .filter-search {
  position: relative;
  margin-left: auto;
  min-width: 140px;
  padding: 6px 0;
  padding-right: 4px;
  border-radius: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  gap: 6px;
}

[data-theme="dark"] .loops-filter-bar .filter-search {
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

.loops-filter-bar .filter-search:focus-within {
  background: transparent;
  border-bottom-color: rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .loops-filter-bar .filter-search:focus-within {
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.35);
}

.loops-filter-bar .filter-search svg {
  width: 14px;
  height: 14px;
  opacity: 0.45;
}

/* All Packs — même barre recherche / filet que Sounds (sélecteur explicite si besoin) */
#all-packs-content .packs-filter-bar .filter-search {
  position: relative;
  margin-left: auto;
  min-width: 140px;
  max-width: min(320px, 100%);
  padding: 6px 0;
  padding-right: 4px;
  border-radius: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  gap: 6px;
}

[data-theme="dark"] #all-packs-content .packs-filter-bar .filter-search {
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

#all-packs-content .packs-filter-bar .filter-search:focus-within {
  background: transparent;
  border-bottom-color: rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] #all-packs-content .packs-filter-bar .filter-search:focus-within {
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.35);
}

#all-packs-content .packs-filter-bar .filter-search svg {
  width: 14px;
  height: 14px;
  opacity: 0.45;
}

/* Creator — All Packs / All Loops : même recherche soulignée que Sounds & All Packs */
#creatorAllPacksView .creator-section-row .filter-search,
#creatorAllLoopsView .creator-section-row .filter-search {
  margin-left: auto;
  min-width: 140px;
  max-width: min(320px, 100%);
  padding: 6px 0;
  border-radius: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  gap: 6px;
}

[data-theme="dark"] #creatorAllPacksView .creator-section-row .filter-search,
[data-theme="dark"] #creatorAllLoopsView .creator-section-row .filter-search {
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

#creatorAllPacksView .creator-section-row .filter-search:focus-within,
#creatorAllLoopsView .creator-section-row .filter-search:focus-within {
  background: transparent;
  border-bottom-color: rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] #creatorAllPacksView .creator-section-row .filter-search:focus-within,
[data-theme="dark"] #creatorAllLoopsView .creator-section-row .filter-search:focus-within {
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.35);
}

#creatorAllPacksView .creator-section-row .filter-search svg,
#creatorAllLoopsView .creator-section-row .filter-search svg {
  width: 14px;
  height: 14px;
  opacity: 0.45;
}

/* Filter Dropdown Container */
.filter-dropdown {
  position: relative;
}

/* Filter Dropdown Button */
.filter-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  color: #666;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease, color 0.3s ease, background-color 0.3s ease;
  border-radius: 6px;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  text-transform: uppercase;
}

.filter-dropdown-btn:hover {
  color: #000;
  background: rgba(0, 0, 0, 0.05);
}

/* Dark mode pour filter dropdown btn */
[data-theme="dark"] .filter-dropdown-btn {
  color: var(--text-secondary);
}

[data-theme="dark"] .filter-dropdown-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.filter-dropdown-btn.active,
.filter-dropdown-btn.has-value {
  color: #c4a000;
  background: rgba(196, 160, 0, 0.1);
}

/* Primary filter (sort) - more prominent */
.primary-filter .filter-dropdown-btn {
  background: rgba(196, 160, 0, 0.15);
  color: #c4a000;
  padding: 8px 16px;
}

.primary-filter .filter-dropdown-btn:hover {
  background: rgba(196, 160, 0, 0.25);
}

.filter-icon {
  font-size: 14px;
}

.filter-label {
  white-space: nowrap;
}

.dropdown-arrow {
  width: 12px;
  height: 12px;
  transition: transform 0.2s ease;
}

.filter-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

/* Filter Dropdown Menu */
.filter-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 180px;
  max-height: 300px;
  overflow-y: auto;
  background: #f8f8f8;
  border: none;
  border-radius: 16px;
  box-shadow: none;
  z-index: 1000;
  display: none;
  padding: 6px;
}

[data-theme="dark"] .filter-dropdown-menu {
  background: #1a1a1a;
  border: none;
  box-shadow: none;
}

.filter-dropdown.open .filter-dropdown-menu {
  display: block;
  animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Filter Option */
.filter-option {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: #666;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.15s ease;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
}

.filter-option:hover {
  background: #e8e8e8;
  color: #000;
}

.filter-option.active {
  background: #d8d8d8;
  color: #c4a000;
}

[data-theme="dark"] .filter-option {
  color: #ccc;
}

[data-theme="dark"] .filter-option:hover {
  background: #252525;
  color: #fff;
}

[data-theme="dark"] .filter-option.active {
  background: #303030;
  color: #f0d000;
}

/* Submenu Title */
.filter-submenu-title {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.3s ease;
}

/* Dark mode pour filter submenu title */
[data-theme="dark"] .filter-submenu-title {
  color: var(--text-tertiary);
}

/* Filter Search */
.filter-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #e8e8e8;
  border-radius: 12px;
  margin-left: auto;
  min-width: 160px;
  border: none;
  transition: all 0.2s ease, background-color 0.3s ease;
}

/* Dark mode pour filter search */
[data-theme="dark"] .filter-search {
  background: #252525;
  border: none;
}

.filter-search:focus-within {
  background: #d8d8d8;
}

[data-theme="dark"] .filter-search:focus-within {
  background: #303030;
}

.filter-search svg {
  width: 16px;
  height: 16px;
  color: #999;
  flex-shrink: 0;
}

.filter-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #333;
  font-size: 13px;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  transition: color 0.3s ease;
}

/* Dark mode pour filter search input */
[data-theme="dark"] .filter-search input {
  color: var(--text-primary);
}

.filter-search input::placeholder {
  color: #999;
}

.filter-search-clear {
  flex-shrink: 0;
  padding: 0 2px;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: rgba(0, 0, 0, 0.42);
  font-size: 20px;
  line-height: 1;
  font-weight: 300;
  cursor: pointer;
  transition: color 0.15s ease;
}

/* [hidden] sinon display:flex du bouton annule le masquage natif */
.filter-search-clear[hidden] {
  display: none !important;
}

.filter-search-clear:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-search-clear:hover {
  color: #000;
}

[data-theme="dark"] .filter-search-clear {
  color: rgba(255, 255, 255, 0.45);
}

[data-theme="dark"] .filter-search-clear:hover {
  color: #fff;
}

.filter-menu-subtitle {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #555;
  margin: 10px 10px 4px;
  padding: 0;
}

[data-theme="dark"] .filter-menu-subtitle {
  color: rgba(255, 255, 255, 0.55);
}

/* Même décalage horizontal que .loops-filter-bar .filter-option (padding 9px 16px) */
.loops-filter-bar .filter-menu-subtitle,
#all-packs-content .packs-filter-bar .filter-menu-subtitle {
  margin: 10px 0 4px;
  padding: 0 16px;
}

/* ========== FILTER OPTION ROW (include + exclude btn) ========== */
.filter-option-row {
  display: flex;
  align-items: center;
}

.filter-option-row .filter-option {
  flex: 1;
}

.filter-exclude-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  margin-right: 4px;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: rgba(0, 0, 0, 0.3);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  opacity: 0;
}

.filter-option-row:hover .filter-exclude-btn {
  opacity: 1;
}

.filter-exclude-btn:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.filter-exclude-btn.active {
  opacity: 1;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.12);
}

[data-theme="dark"] .filter-exclude-btn {
  color: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .filter-exclude-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

[data-theme="dark"] .filter-exclude-btn.active {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

/* Active Filters Display — pastilles neutres (aligné barre Sounds) */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.active-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 12px;
  background: rgba(0, 0, 0, 0.035);
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-radius: 100px;
  color: rgba(0, 0, 0, 0.62);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  transition: border-color 0.15s ease, background 0.15s ease;
}

[data-theme="dark"] .active-filter-tag {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72);
}

.active-filter-tag.excluded {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.25);
  color: #dc2626;
}

[data-theme="dark"] .active-filter-tag.excluded {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.active-filter-tag .remove-filter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 2px;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  color: inherit;
  opacity: 0.65;
}

.active-filter-tag .remove-filter:hover {
  background: rgba(0, 0, 0, 0.06);
  opacity: 1;
}

[data-theme="dark"] .active-filter-tag .remove-filter:hover {
  background: rgba(255, 255, 255, 0.08);
}

.active-filter-tag .remove-filter svg {
  width: 11px;
  height: 11px;
  stroke-width: 2;
}

.clear-all-filters {
  padding: 5px 14px;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 100px;
  color: var(--fg-rest);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.clear-all-filters:hover {
  border-color: rgba(0, 0, 0, 0.22);
  color: rgba(0, 0, 0, 0.78);
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .clear-all-filters {
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--fg-hint);
}

[data-theme="dark"] .clear-all-filters:hover {
  border-color: rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.04);
}

/* Scrollbar for dropdown menus */
.filter-dropdown-menu::-webkit-scrollbar {
  width: 6px;
}

.filter-dropdown-menu::-webkit-scrollbar-track {
  background: transparent;
}

.filter-dropdown-menu::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.filter-dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: #999;
}

[data-theme="dark"] .filter-dropdown-menu::-webkit-scrollbar-thumb {
  background: #444;
}

[data-theme="dark"] .filter-dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ========== TEMPO DROPDOWN CUSTOM STYLES ========== */
.tempo-dropdown-menu {
  min-width: 380px;
  max-width: 380px;
  padding: 16px;
  max-height: none;
  overflow: visible;
  z-index: 1001;
  background: #f8f8f8;
  border: none;
  box-shadow: none;
}

[data-theme="dark"] .tempo-dropdown-menu {
  background: #1a1a1a;
}

/* Tabs */
.tempo-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border-radius: 12px;
  overflow: hidden;
  background: #e8e8e8;
  border: none;
  padding: 4px;
}

[data-theme="dark"] .tempo-tabs {
  background: #252525;
  border: none;
}

.tempo-tab {
  flex: 1;
  padding: 8px 14px;
  background: transparent;
  border: none;
  color: #666;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  border-radius: 8px;
}

.tempo-tab:hover {
  color: #000;
  background: #d8d8d8;
}

.tempo-tab.active {
  color: #fff;
  background: #000;
  box-shadow: none;
}

[data-theme="dark"] .tempo-tab {
  color: #999;
}

[data-theme="dark"] .tempo-tab:hover {
  color: #fff;
  background: #303030;
}

[data-theme="dark"] .tempo-tab.active {
  color: #1a1a1a;
  background: #fff;
}

/* Tab content */
.tempo-tab-content {
  animation: fadeInTempo 0.2s ease;
}

@keyframes fadeInTempo {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slider Section */
.tempo-slider-section {
  margin-bottom: 10px;
}

.tempo-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.tempo-slider-label {
  font-size: 13px;
  font-weight: 600;
  color: #000;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
}

[data-theme="dark"] .tempo-slider-label {
  color: #fff;
}

.tempo-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tempo-input {
  width: 55px;
  padding: 6px 8px;
  background: #e8e8e8;
  border: none;
  border-radius: 8px;
  color: #000;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  appearance: textfield;
  -moz-appearance: textfield;
}

[data-theme="dark"] .tempo-input {
  background: #252525;
  border: none;
  color: #fff;
}

/* Cache les flèches par défaut */
.tempo-input::-webkit-outer-spin-button,
.tempo-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.tempo-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.tempo-separator {
  color: #666;
  font-size: 13px;
  font-weight: 600;
}

/* Double Range Slider - amélioration pour éviter le chevauchement */
.tempo-slider-container {
  position: relative;
  height: 40px;
  margin-bottom: 8px;
  padding: 10px 0;
  z-index: 10;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.tempo-slider-track {
  position: absolute;
  top: 18px;
  width: 100%;
  height: 6px;
  background: #d8d8d8;
  border-radius: 3px;
  pointer-events: none;
}

[data-theme="dark"] .tempo-slider-track {
  background: #303030;
}

.tempo-slider-range {
  position: absolute;
  top: 18px;
  height: 6px;
  background: #000;
  border-radius: 3px;
  z-index: 1;
  pointer-events: none;
}

[data-theme="dark"] .tempo-slider-range {
  background: #fff;
}

.tempo-range-slider {
  position: absolute;
  width: 100%;
  height: 6px;
  top: 18px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  margin: 0;
  padding: 0;
  z-index: 20;
}

/* Handles plus gros et plus visibles */
.tempo-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #000;
  border: none;
  border-radius: 50%;
  cursor: grab;
  pointer-events: all;
  box-shadow: none;
  transition: all 0.15s ease;
  z-index: 30;
  position: relative;
}

.tempo-range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.tempo-range-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.tempo-range-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #000;
  border: none;
  border-radius: 50%;
  cursor: grab;
  pointer-events: all;
  box-shadow: none;
  transition: all 0.15s ease;
  z-index: 30;
}

.tempo-range-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
}

.tempo-range-slider::-moz-range-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

[data-theme="dark"] .tempo-range-slider::-webkit-slider-thumb {
  background: #fff;
}

[data-theme="dark"] .tempo-range-slider::-moz-range-thumb {
  background: #fff;
}

/* Z-index pour éviter les chevauchements */
.tempo-range-slider.tempo-max {
  z-index: 25;
}

.tempo-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #666;
  font-weight: 500;
  margin-top: 4px;
}

/* Suggestions */
.tempo-suggestions {
  margin-bottom: 10px;
}

.tempo-suggestions-title {
  font-size: 10px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.tempo-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.tempo-suggestion-btn {
  padding: 7px 10px;
  background: #e8e8e8;
  border: none;
  border-radius: 8px;
  color: #000;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  text-align: center;
}

.tempo-suggestion-btn:hover {
  background: #d8d8d8;
  transform: translateY(-1px);
}

[data-theme="dark"] .tempo-suggestion-btn {
  background: #252525;
  border: none;
  color: #fff;
}

[data-theme="dark"] .tempo-suggestion-btn:hover {
  background: #303030;
}

/* Exact Tab */
.tempo-exact-section {
  margin-bottom: 10px;
}

.tempo-exact-label {
  font-size: 13px;
  font-weight: 600;
  color: #000;
  margin-bottom: 8px;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
}

[data-theme="dark"] .tempo-exact-label {
  color: #fff;
}

.tempo-exact-input {
  width: 100%;
  padding: 12px 16px;
  background: #e8e8e8;
  border: none;
  border-radius: 10px;
  color: #000;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  margin-bottom: 6px;
  appearance: textfield;
  -moz-appearance: textfield;
}

[data-theme="dark"] .tempo-exact-input {
  background: #252525;
  border: none;
  color: #fff;
}

/* Cache les flèches par défaut */
.tempo-exact-input::-webkit-outer-spin-button,
.tempo-exact-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.tempo-exact-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tempo-exact-hint {
  font-size: 10px;
  color: #666;
  text-align: center;
  font-style: italic;
}

/* Checkbox Option - Custom Style */
.tempo-option {
  padding: 8px 0;
  position: relative;
}

/* Cache le checkbox natif */
.tempo-checkbox {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.tempo-checkbox-label {
  display: inline-flex;
  align-items: center;
  padding-left: 28px;
  cursor: pointer;
  font-size: 12px;
  color: #666;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  transition: color 0.2s ease;
  user-select: none;
  position: relative;
  line-height: 18px;
}

.tempo-checkbox-label:hover {
  color: #000;
}

[data-theme="dark"] .tempo-checkbox-label {
  color: #ccc;
}

[data-theme="dark"] .tempo-checkbox-label:hover {
  color: #fff;
}

/* Custom checkbox box */
.tempo-checkbox-label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  background: #e8e8e8;
  border: none;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.tempo-checkbox-label:hover::before {
  background: #d8d8d8;
}

[data-theme="dark"] .tempo-checkbox-label::before {
  background: #252525;
  border: none;
}

[data-theme="dark"] .tempo-checkbox-label:hover::before {
  background: #303030;
}

/* Checked state */
.tempo-checkbox:checked + .tempo-checkbox-label::before {
  background: #000;
  border: none;
}

[data-theme="dark"] .tempo-checkbox:checked + .tempo-checkbox-label::before {
  background: #fff;
}

/* Checkmark */
.tempo-checkbox:checked + .tempo-checkbox-label::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Actions */
.tempo-dropdown-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: none;
}

[data-theme="dark"] .tempo-dropdown-actions {
  border-top: none;
}

.tempo-action-clear {
  flex: 1;
  padding: 10px 16px;
  background: #e8e8e8;
  border: none;
  border-radius: 10px;
  color: #000;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  text-align: center;
}

.tempo-action-clear:hover {
  background: #d8d8d8;
}

[data-theme="dark"] .tempo-action-clear {
  background: #252525;
  border: none;
  color: #fff;
}

[data-theme="dark"] .tempo-action-clear:hover {
  background: #303030;
}

.tempo-action-apply {
  flex: 1;
  padding: 10px 16px;
  background: #000;
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  text-align: center;
}

.tempo-action-apply:hover {
  background: #333;
  transform: translateY(-1px);
}

.tempo-action-apply:active {
  transform: translateY(0);
}

[data-theme="dark"] .tempo-action-apply {
  background: #fff;
  color: #000;
}

[data-theme="dark"] .tempo-action-apply:hover {
  background: #e8e8e8;
}

/* ========== KEY DROPDOWN CUSTOM STYLES ========== */
.key-dropdown-menu {
  min-width: 380px;
  max-width: 380px;
  padding: 16px;
  max-height: none;
  background: #f8f8f8;
  border: none;
  box-shadow: none;
}

[data-theme="dark"] .key-dropdown-menu {
  background: #1a1a1a;
}

.key-dropdown-section {
  margin-bottom: 10px;
}

.key-dropdown-section:last-child {
  margin-bottom: 0;
}

/* Tabs */
.key-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border-radius: 12px;
  overflow: hidden;
  background: #e8e8e8;
  border: none;
  padding: 4px;
}

[data-theme="dark"] .key-tabs {
  background: #252525;
  border: none;
}

.key-tab {
  flex: 1;
  padding: 8px 14px;
  background: transparent;
  border: none;
  color: #666;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  border-radius: 8px;
}

.key-tab:hover {
  color: #000;
  background: #d8d8d8;
}

.key-tab.active {
  color: #fff;
  background: #000;
  box-shadow: none;
}

[data-theme="dark"] .key-tab {
  color: #999;
}

[data-theme="dark"] .key-tab:hover {
  color: #fff;
  background: #303030;
}

[data-theme="dark"] .key-tab.active {
  color: #1a1a1a;
  background: #fff;
}

/* Tab content */
.key-tab-content {
  animation: fadeInKey 0.2s ease;
}

@keyframes fadeInKey {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Notes grid - separated sharps and naturals */
.key-notes-grid {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: nowrap;
  justify-content: space-between;
}

.key-note-btn {
  flex: 1;
  padding: 10px 6px;
  background: #e8e8e8;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #000;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  text-align: center;
  min-width: 0;
}

.key-note-btn:hover {
  background: #d8d8d8;
}

.key-note-btn.active {
  background: #c4a000;
  color: #fff;
}

.key-note-sharp,
.key-note-flat {
  background: #d8d8d8;
}

[data-theme="dark"] .key-note-btn {
  background: #252525;
  border: none;
  color: #fff;
}

[data-theme="dark"] .key-note-btn:hover {
  background: #303030;
}

[data-theme="dark"] .key-note-btn.active {
  background: #f0d000;
  color: #000;
}

[data-theme="dark"] .key-note-sharp,
[data-theme="dark"] .key-note-flat {
  background: #303030;
}

/* Scale grid */
.key-scale-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.key-scale-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: #e8e8e8;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #000;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  text-align: center;
}

.key-scale-btn:hover {
  background: #d8d8d8;
}

.key-scale-btn.active {
  background: #c4a000;
  color: #fff;
}

[data-theme="dark"] .key-scale-btn {
  background: #252525;
  border: none;
  color: #fff;
}

[data-theme="dark"] .key-scale-btn:hover {
  background: #303030;
}

[data-theme="dark"] .key-scale-btn.active {
  background: #f0d000;
  color: #000;
}

/* Actions */
.key-dropdown-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: none;
}

[data-theme="dark"] .key-dropdown-actions {
  border-top: none;
}

.key-action-clear {
  flex: 1;
  padding: 10px 16px;
  background: #e8e8e8;
  border: none;
  border-radius: 10px;
  color: #000;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  text-align: center;
}

.key-action-clear:hover {
  background: #d8d8d8;
}

[data-theme="dark"] .key-action-clear {
  background: #252525;
  border: none;
  color: #fff;
}

[data-theme="dark"] .key-action-clear:hover {
  background: #303030;
}

.key-action-apply {
  flex: 1;
  padding: 10px 16px;
  background: #000;
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  text-align: center;
}

.key-action-apply:hover {
  background: #333;
  transform: translateY(-1px);
}

.key-action-apply:active {
  transform: translateY(0);
}

[data-theme="dark"] .key-action-apply {
  background: #fff;
  color: #000;
}

[data-theme="dark"] .key-action-apply:hover {
  background: #e8e8e8;
}

/* ========== LOOPS & ALL PACKS — panneaux dropdown (liste simple) ========== */
.loops-filter-bar .filter-dropdown-menu,
#all-packs-content .packs-filter-bar .filter-dropdown-menu {
  top: calc(100% + 6px);
  padding: 6px 0;
  min-width: 204px;
  max-height: min(340px, 72vh);
  border-radius: 2px;
  background: var(--bg-primary);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .loops-filter-bar .filter-dropdown-menu,
[data-theme="dark"] #all-packs-content .packs-filter-bar .filter-dropdown-menu {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 56px #282828;
}

.loops-filter-bar .filter-option,
#all-packs-content .packs-filter-bar .filter-option {
  padding: 9px 16px;
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: rgba(0, 0, 0, 0.52);
}

[data-theme="dark"] .loops-filter-bar .filter-option,
[data-theme="dark"] #all-packs-content .packs-filter-bar .filter-option {
  color: rgba(255, 255, 255, 0.52);
}

.loops-filter-bar .filter-option:hover,
#all-packs-content .packs-filter-bar .filter-option:hover {
  background: rgba(0, 0, 0, 0.04);
  color: rgba(0, 0, 0, 0.92);
}

[data-theme="dark"] .loops-filter-bar .filter-option:hover,
[data-theme="dark"] #all-packs-content .packs-filter-bar .filter-option:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.loops-filter-bar .filter-option.active,
#all-packs-content .packs-filter-bar .filter-option.active {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  font-weight: 600;
}

[data-theme="dark"] .loops-filter-bar .filter-option.active,
[data-theme="dark"] #all-packs-content .packs-filter-bar .filter-option.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* Tempo / BPM */
.loops-filter-bar .tempo-dropdown-menu {
  min-width: 320px;
  max-width: min(380px, calc(100vw - 32px));
  padding: 12px 14px 14px;
  border-radius: 2px;
  background: var(--bg-primary);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.08);
  /* Évite max-height du parent .filter-dropdown-menu + overflow visible = actions hors fond */
  max-height: none;
  overflow: visible;
}

[data-theme="dark"] .loops-filter-bar .tempo-dropdown-menu {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 56px #282828;
}

.loops-filter-bar .tempo-tabs {
  margin-bottom: 12px;
  padding: 0;
  gap: 0;
  background: transparent;
  border-radius: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  overflow: visible;
}

[data-theme="dark"] .loops-filter-bar .tempo-tabs {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.loops-filter-bar .tempo-tab {
  flex: 1;
  padding: 8px 6px 10px;
  border-radius: 0;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  background: transparent;
  box-shadow: none;
}

.loops-filter-bar .tempo-tab:hover {
  color: rgba(0, 0, 0, 0.75);
  background: transparent;
}

.loops-filter-bar .tempo-tab.active {
  color: var(--text-primary);
  background: transparent;
  box-shadow: inset 0 -2px 0 0 currentColor;
}

[data-theme="dark"] .loops-filter-bar .tempo-tab:hover {
  color: rgba(255, 255, 255, 0.82);
  background: transparent;
}

.loops-filter-bar .tempo-slider-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-hint);
}

.loops-filter-bar .tempo-input {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 2px;
  font-weight: 500;
}

[data-theme="dark"] .loops-filter-bar .tempo-input {
  border-color: rgba(255, 255, 255, 0.14);
}

.loops-filter-bar .tempo-input:focus {
  box-shadow: none;
  border-color: rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .loops-filter-bar .tempo-input:focus {
  border-color: rgba(255, 255, 255, 0.35);
}

.loops-filter-bar .tempo-slider-track {
  height: 4px;
  top: 19px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 2px;
}

[data-theme="dark"] .loops-filter-bar .tempo-slider-track {
  background: rgba(255, 255, 255, 0.12);
}

.loops-filter-bar .tempo-slider-range {
  height: 4px;
  top: 19px;
  border-radius: 2px;
}

.loops-filter-bar .tempo-range-slider {
  top: 19px;
  height: 4px;
}

.loops-filter-bar .tempo-range-slider::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  box-shadow: 0 0 0 2px var(--bg-primary);
}

.loops-filter-bar .tempo-range-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  box-shadow: 0 0 0 2px var(--bg-primary);
}

.loops-filter-bar .tempo-range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.08);
}

.loops-filter-bar .tempo-range-slider::-moz-range-thumb:hover {
  transform: scale(1.08);
}

.loops-filter-bar .tempo-suggestions-title {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--fg-subtle);
}

.loops-filter-bar .tempo-suggestion-btn {
  padding: 8px 8px;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  font-size: 11px;
  font-weight: 500;
  transform: none;
  color: rgba(0, 0, 0, 0.65);
}

.loops-filter-bar .tempo-suggestion-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  transform: none;
}

[data-theme="dark"] .loops-filter-bar .tempo-suggestion-btn {
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.65);
}

[data-theme="dark"] .loops-filter-bar .tempo-suggestion-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.loops-filter-bar .tempo-exact-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-hint);
}

.loops-filter-bar .tempo-exact-input {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 2px;
  font-weight: 500;
  padding: 10px 14px;
}

[data-theme="dark"] .loops-filter-bar .tempo-exact-input {
  border-color: rgba(255, 255, 255, 0.14);
}

.loops-filter-bar .tempo-exact-input:focus {
  box-shadow: none;
  border-color: rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .loops-filter-bar .tempo-exact-input:focus {
  border-color: rgba(255, 255, 255, 0.35);
}

.loops-filter-bar .tempo-checkbox-label::before {
  border-radius: 2px;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.loops-filter-bar .tempo-checkbox-label:hover::before {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .loops-filter-bar .tempo-checkbox-label::before {
  border-color: rgba(255, 255, 255, 0.22);
}

[data-theme="dark"] .loops-filter-bar .tempo-checkbox-label:hover::before {
  background: rgba(255, 255, 255, 0.05);
}

.loops-filter-bar .tempo-dropdown-actions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .loops-filter-bar .tempo-dropdown-actions {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.loops-filter-bar .tempo-action-clear {
  flex: 1;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 2px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.55);
}

.loops-filter-bar .tempo-action-clear:hover {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .loops-filter-bar .tempo-action-clear {
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.55);
}

[data-theme="dark"] .loops-filter-bar .tempo-action-clear:hover {
  background: rgba(255, 255, 255, 0.05);
}

.loops-filter-bar .tempo-action-apply {
  flex: 1;
  padding: 9px 12px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.loops-filter-bar .tempo-action-apply:hover {
  transform: none;
}

/* Key */
.loops-filter-bar .key-dropdown-menu {
  min-width: 320px;
  max-width: min(380px, calc(100vw - 32px));
  padding: 12px 14px 14px;
  border-radius: 2px;
  background: var(--bg-primary);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.08);
  max-height: none;
  overflow: visible;
}

[data-theme="dark"] .loops-filter-bar .key-dropdown-menu {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 56px #282828;
}

@media (max-height: 720px) {
  .loops-filter-bar .tempo-dropdown-menu,
  .loops-filter-bar .key-dropdown-menu {
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
  }
}

.loops-filter-bar .key-notes-grid {
  gap: 5px;
}

.loops-filter-bar .key-note-btn,
.loops-filter-bar .creator-key-note-btn {
  padding: 9px 4px;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.7);
}

.loops-filter-bar .key-note-btn:hover,
.loops-filter-bar .creator-key-note-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.loops-filter-bar .key-note-btn.active,
.loops-filter-bar .creator-key-note-btn.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
  font-weight: 600;
}

.loops-filter-bar .key-note-sharp,
.loops-filter-bar .key-note-flat,
.loops-filter-bar .creator-key-note-btn.key-note-sharp {
  background: transparent;
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .loops-filter-bar .key-note-btn,
[data-theme="dark"] .loops-filter-bar .creator-key-note-btn {
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.75);
}

[data-theme="dark"] .loops-filter-bar .key-note-btn:hover,
[data-theme="dark"] .loops-filter-bar .creator-key-note-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .loops-filter-bar .key-note-sharp,
[data-theme="dark"] .loops-filter-bar .key-note-flat,
[data-theme="dark"] .loops-filter-bar .creator-key-note-btn.key-note-sharp {
  border-color: rgba(255, 255, 255, 0.14);
}

.loops-filter-bar .key-scale-btn,
.loops-filter-bar .creator-key-scale-btn {
  padding: 10px 12px;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.65);
}

.loops-filter-bar .key-scale-btn:hover,
.loops-filter-bar .creator-key-scale-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.loops-filter-bar .key-scale-btn.active,
.loops-filter-bar .creator-key-scale-btn.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
  font-weight: 600;
}

[data-theme="dark"] .loops-filter-bar .key-scale-btn,
[data-theme="dark"] .loops-filter-bar .creator-key-scale-btn {
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.65);
}

[data-theme="dark"] .loops-filter-bar .key-scale-btn:hover,
[data-theme="dark"] .loops-filter-bar .creator-key-scale-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .loops-filter-bar .key-note-btn.active,
[data-theme="dark"] .loops-filter-bar .creator-key-note-btn.active,
[data-theme="dark"] .loops-filter-bar .key-scale-btn.active,
[data-theme="dark"] .loops-filter-bar .creator-key-scale-btn.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.loops-filter-bar .key-dropdown-actions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .loops-filter-bar .key-dropdown-actions {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.loops-filter-bar .key-action-clear {
  flex: 1;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 2px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.55);
}

.loops-filter-bar .key-action-clear:hover {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .loops-filter-bar .key-action-clear {
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.55);
}

[data-theme="dark"] .loops-filter-bar .key-action-clear:hover {
  background: rgba(255, 255, 255, 0.05);
}

.loops-filter-bar .key-action-apply {
  flex: 1;
  padding: 9px 12px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.loops-filter-bar .key-action-apply:hover {
  transform: none;
}
