/* ══════════════════════════════════════════════════════════════
   WPMix — CSS v3.1
   Order: Mezcla → Barra → Búsqueda → Catálogo
   ══════════════════════════════════════════════════════════════ */

:root {
  --p:        #7C5CFF;
  --p-hover:  #6A4CFF;
  --p-light:  #EDE8FF;
  --p-soft:   #A89BFF;
  --p-glow:   rgba(124,92,255,.22);
  --cyan:     #3ED7C4;
  --bg:       #F6F7FB;
  --bg2:      #EEEEF5;
  --white:    #FFFFFF;
  --border:   #E2E4EF;
  --border2:  #CDD0E3;
  --text:     #18182E;
  --text2:    #4A4A68;
  --muted:    #8888A8;
  --success:  #7C5CFF;
  --error:    #FF4D72;
  --r:        12px;
  --r-sm:     8px;
  --r-xs:     5px;
  --tr:       0.16s ease;
  --shadow:   0 2px 12px rgba(0,0,0,.07);
  --shadow-md:0 4px 20px rgba(0,0,0,.10);
  --shadow-lg:0 8px 32px rgba(0,0,0,.13);
  --sp: 16px;   /* standard inner padding */
  --sp-sm: 10px; /* small inner padding */
}

/* ── Reset ──────────────────────────────────────────────────── */
/* Reset: solo box-sizing y margin. NO padding en * porque sobreescribe las clases */
#wmx-root, #wmx-root * {
  box-sizing: border-box;
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

#wmx-root {
  display: flex; flex-direction: column; gap: 14px;
  color: var(--text);
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  overflow-x: hidden;
}

/* Every direct block child takes full width */
#wmx-root > * {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

/* ══ ① MEZCLA ════════════════════════════════════════════════ */
#wmx-mix {
  background: #E8F8F8;
  border: 1px solid #A8E0DF;
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

#wmx-mix-hdr {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #E8F8F8 0%, #D4F0F0 100%);
}
#wmx-mix-title-row { display: flex; flex-direction: column; gap: 2px; min-width: 90px; }
#wmx-mix-label { font-size: 15px; font-weight: 800; color: var(--text); }
#wmx-mix-count { font-size: 11px; color: var(--muted); }

#wmx-wave {
  flex: 1; max-width: 100%; height: 52px;
  border-radius: var(--r-sm);
  background: transparent;
  overflow: hidden;
}

/* Mix tracks area */
#wmx-mix-tracks {
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px 20px;
  background: var(--white);
}

.wmx-track-group { width: 100%; }
.wmx-track-group-lbl {
  font-size: 10px; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 7px; margin-bottom: 8px;
}
.wmx-track-max {
  font-size: 9px; font-weight: 500; color: #bbb;
  background: var(--bg2); border-radius: 10px; padding: 1px 6px;
  letter-spacing: 0; text-transform: none;
}

.wmx-track-slots { display: flex; gap: 10px; flex-wrap: wrap; }

/* Slot base */
.wmx-slot {
  border-radius: var(--r-sm);
  transition: all var(--tr);
  flex: 1; min-width: 140px;
}
.wmx-slot-empty {
  height: 48px;
  border: 2px dashed var(--border2);
  display: flex; align-items: center; justify-content: center;
  cursor: default;
  background: var(--bg);
}
.wmx-slot-empty span { font-size: 12px; color: var(--muted); }

/* Slot relleno */
.wmx-slot-filled {
  border: 1.5px solid var(--border);
  background: var(--white);
  display: flex; flex-direction: column;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.wmx-slot-filled.playing {
  border-color: var(--p);
  box-shadow: 0 0 0 2px var(--p-glow), 0 2px 10px rgba(124,92,255,.15);
}

.wmx-slot-head {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 14px 4px 16px;
}

/* No type badge needed anymore */
.wmx-slot-type { display: none; }

.wmx-slot-name {
  flex: 1; min-width: 0;
  font-size: 11px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.wmx-eq-bars {
  display: flex; align-items: flex-end; gap: 2px;
  height: 14px; width: 14px; flex-shrink: 0;
}
.wmx-eq-bars span {
  display: block; width: 3px; height: 3px;
  border-radius: 1.5px; background: var(--border2);
}
.wmx-slot-filled.playing .wmx-eq-bars span { background: var(--p); }
.wmx-slot-filled.playing .wmx-eq-bars span:nth-child(1) { animation: wmx-eq .8s ease-in-out infinite 0s; }
.wmx-slot-filled.playing .wmx-eq-bars span:nth-child(2) { animation: wmx-eq .8s ease-in-out infinite .18s; }
.wmx-slot-filled.playing .wmx-eq-bars span:nth-child(3) { animation: wmx-eq .8s ease-in-out infinite .35s; }
.wmx-slot-filled:not(.playing) .wmx-eq-bars span { animation: none !important; height: 3px; background: var(--border2); }
@keyframes wmx-eq { 0%,100%{height:3px} 50%{height:13px} }

.wmx-slot-rm {
  background: none; border: 1px solid var(--border); cursor: pointer;
  color: var(--muted); font-size: 15px; line-height: 1;
  flex-shrink: 0; padding: 0;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--tr);
}
.wmx-slot-rm:hover { color: var(--error); border-color: var(--error); background: #fff0f3; }

/* Fila volumen: VOL | slider | % | ⚙ | × */
.wmx-slot-vol-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 14px 12px 16px;
}
.wmx-vol-lbl {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--p); flex-shrink: 0; width: 22px;
}
.wmx-vol-slider {
  flex: 1; min-width: 0; height: 4px;
  -webkit-appearance: none; appearance: none;
  border-radius: 4px; background: var(--bg2); cursor: pointer; outline: none;
}
.wmx-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--p); cursor: pointer;
  box-shadow: 0 0 6px var(--p-glow);
}
.wmx-vol-slider::-moz-range-thumb {
  width: 16px; height: 16px; border: none;
  border-radius: 50%; background: var(--p); cursor: pointer;
}
.wmx-vol-val {
  font-size: 10px; color: var(--text2); font-weight: 600;
  min-width: 28px; text-align: right; flex-shrink: 0;
}
.wmx-slot-expand {
  background: none; border: 1px solid var(--border); cursor: pointer;
  color: var(--muted); padding: 0;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all var(--tr);
}
.wmx-slot-expand:hover { color: var(--p); background: var(--p-light); border-color: var(--p-soft); }
.wmx-slot-filled.expanded .wmx-slot-expand { color: var(--p); background: var(--p-light); border-color: var(--p); }

/* Controles colapsables */
.wmx-slot-body {
  display: none;
  padding: 12px 14px 16px 16px;
  border-top: 1px solid var(--border);
  flex-direction: column; gap: 8px;
  background: #FAFBFF;
}
.wmx-slot-filled.expanded .wmx-slot-body { display: flex; }

.wmx-ctrl { display: flex; align-items: center; gap: 8px; }
.wmx-ctrl-lbl {
  font-size: 9px; font-weight: 700; letter-spacing: 0;
  text-transform: uppercase; color: var(--muted);
  width: 52px; flex-shrink: 0; white-space: nowrap;
}
.wmx-ctrl input[type="range"] {
  flex: 1; min-width: 0; height: 3px;
  -webkit-appearance: none; appearance: none;
  border-radius: 3px; background: var(--bg2); cursor: pointer; outline: none;
}
.wmx-ctrl input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px;
  border-radius: 50%; background: var(--p); cursor: pointer;
}
.wmx-ctrl input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border: none;
  border-radius: 50%; background: var(--p);
}
.wmx-ctrl-val { font-size: 10px; color: var(--muted); min-width: 30px; text-align: right; flex-shrink: 0; }
.wmx-ctrl-sep {
  font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding-top: 4px; border-top: 1px solid var(--border); margin-top: 2px;
}
.wmx-tog-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wmx-tog-row span { font-size: 11px; color: var(--text2); }
.wmx-toggle { position: relative; width: 32px; height: 18px; flex-shrink: 0; cursor: pointer; }
.wmx-toggle input { opacity:0; width:0; height:0; }
.wmx-toggle > span {
  position: absolute; inset: 0; background: var(--border2); border-radius: 18px;
  transition: background var(--tr);
}
.wmx-toggle > span::before {
  content:''; position: absolute; width: 12px; height: 12px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform var(--tr);
}
.wmx-toggle input:checked + span { background: var(--p); }
.wmx-toggle input:checked + span::before { transform: translateX(14px); }
.wmx-freq-hint { font-size: 10px; color: var(--muted); font-style: italic; margin-top: -3px; }

/* All SVGs inside the bar use currentColor */
#wmx-bar svg { fill: currentColor; display: block; flex-shrink: 0; }
#wmx-mix svg { fill: currentColor; display: block; flex-shrink: 0; }
#wmx-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px; height: 64px;
  background: #E8F8F8;
  border: 1px solid #A8E0DF;
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  position: relative;
}

.wmx-play-btn {
  width: 46px; height: 46px; border-radius: 50%;
  border: none; background: var(--p); color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 14px var(--p-glow);
  transition: background var(--tr), transform var(--tr);
}
.wmx-play-btn:hover:not(:disabled) { background: var(--p-hover); transform: scale(1.06); }
.wmx-play-btn:disabled { opacity:.4; cursor:not-allowed; box-shadow:none; }

#wmx-bar-eq {
  display: flex; align-items: flex-end; gap: 3px; height: 20px;
  opacity: 0; transition: opacity .3s;
}
#wmx-bar.playing #wmx-bar-eq { opacity: 1; }
#wmx-bar-eq span { display: block; width: 4px; height: 4px; border-radius: 2px; background: var(--p-soft); }
#wmx-bar.playing #wmx-bar-eq span:nth-child(1) { animation: wmx-eq .75s ease-in-out infinite 0s; }
#wmx-bar.playing #wmx-bar-eq span:nth-child(2) { animation: wmx-eq .75s ease-in-out infinite .15s; }
#wmx-bar.playing #wmx-bar-eq span:nth-child(3) { animation: wmx-eq .75s ease-in-out infinite .3s; }
#wmx-bar.playing #wmx-bar-eq span:nth-child(4) { animation: wmx-eq .75s ease-in-out infinite .1s; }
#wmx-bar.playing #wmx-bar-eq span:nth-child(5) { animation: wmx-eq .75s ease-in-out infinite .25s; }

.wmx-bar-ctrl {
  display: flex; align-items: center; gap: 7px; color: var(--muted);
}
.wmx-bar-ctrl input[type="range"] {
  width: 80px; height: 3px;
  -webkit-appearance: none; appearance: none;
  border-radius: 3px; background: var(--bg2); cursor: pointer; outline: none;
}
.wmx-bar-ctrl input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: var(--p); cursor: pointer;
}
/* ── Popup wrap (volume + timer) ── */
.wmx-popup-wrap { position: relative; }
.wmx-popup {
  position: absolute; bottom: calc(100% + 8px); right: 0;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-sm); box-shadow: var(--shadow-md);
  padding: 10px 12px; z-index: 9999;
  animation: wmx-fadein .12s ease both;
}
/* Volume popup: horizontal slider */
.wmx-popup #wmx-vol {
  width: 120px; display: block; height: 4px;
  -webkit-appearance: none; appearance: none;
  border-radius: 4px; background: var(--bg2); cursor: pointer; outline: none;
}
.wmx-popup #wmx-vol::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--p); cursor: pointer;
  box-shadow: 0 0 6px var(--p-glow);
}
.wmx-popup #wmx-vol::-moz-range-thumb {
  width: 16px; height: 16px; border: none;
  border-radius: 50%; background: var(--p); cursor: pointer;
}
/* Timer popup: vertical list of options */
.wmx-timer-popup {
  padding: 6px; min-width: 110px; right: 0;
}
.wmx-timer-opt {
  display: block; width: 100%;
  padding: 7px 12px; text-align: left;
  background: none; border: none; border-radius: 6px;
  font-size: 13px; color: var(--text2); cursor: pointer;
  transition: background var(--tr), color var(--tr);
}
.wmx-timer-opt:hover { background: var(--p-light); color: var(--p); }
.wmx-timer-opt.active { color: var(--p); font-weight: 700; background: var(--p-light); }
/* Timer badge */
.wmx-timer-btn { position: relative; }
.wmx-timer-btn #wmx-timer-cd {
  position: absolute; top: -6px; right: -6px;
  font-size: 9px; font-weight: 800; color: #fff;
  background: var(--p); border-radius: 8px;
  padding: 1px 4px; font-variant-numeric: tabular-nums;
  line-height: 1.4; white-space: nowrap; display: none;
}
.wmx-timer-btn.active #wmx-timer-cd { display: block; }
.wmx-timer-btn.active { border-color: var(--p); color: var(--p); }
.wmx-vol-btn.active   { border-color: var(--p); color: var(--p); }
.wmx-bar-spacer { flex: 1; }
.wmx-icon-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--white); color: var(--muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all var(--tr);
}
.wmx-icon-btn svg { fill: currentColor; display: block; }
.wmx-icon-btn:hover:not(:disabled) { border-color: var(--p-soft); color: var(--p); background: var(--p-light); }
.wmx-icon-btn:disabled { opacity:.35; cursor:not-allowed; }
.wmx-icon-btn.active { border-color: var(--p); color: var(--p); background: var(--p-light); }

/* Panel avanzado — popup above the bar */
#wmx-adv-panel[hidden] { display: none; }
#wmx-adv-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  z-index: 9999;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 20px;
  box-shadow: var(--shadow-md);
  min-width: 260px;
  animation: wmx-fadein .12s ease both;
}
.wmx-adv-title { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.wmx-adv-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.wmx-adv-row:last-child { border-bottom: none; }
.wmx-adv-row > label:first-child { flex: 1; font-size: 12px; color: var(--text2); }
.wmx-adv-row input[type="range"] {
  width: 80px; height: 3px;
  -webkit-appearance: none; appearance: none;
  border-radius: 3px; background: var(--bg2); cursor: pointer; outline: none;
}
.wmx-adv-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px;
  border-radius: 50%; background: var(--p);
}
.wmx-adv-row span { font-size: 11px; color: var(--muted); min-width: 26px; }
.wmx-adv-note {
  font-size: 11px; color: var(--muted); background: var(--bg);
  border-radius: var(--r-sm); padding: 8px 10px; margin-top: 6px; line-height: 1.5;
}

/* ══ ③ BÚSQUEDA ═════════════════════════════════════════════ */
#wmx-search-bar {
  display: flex; align-items: center; gap: 12px;
}
#wmx-search-wrap { position: relative; flex: 1; }
#wmx-search-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted); pointer-events: none;
}
#wmx-search {
  width: 100%; padding: 13px 38px 13px 40px;
  border: 1px solid var(--border); border-radius: var(--r);
  font-size: 14px; background: var(--white); color: var(--text); outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
  box-shadow: var(--shadow);
}
#wmx-search:focus { border-color: var(--p); box-shadow: 0 0 0 3px var(--p-glow); }
#wmx-search::placeholder { color: var(--muted); }
#wmx-search-clear {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 14px; padding: 2px; transition: color var(--tr);
}
#wmx-search-clear:hover { color: var(--text); }
#wmx-search-info { font-size: 12px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

/* ══ ④ CATÁLOGO ═════════════════════════════════════════════ */
#wmx-app {
  display: grid; grid-template-columns: 210px 1fr;
  border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden;            /* clip rounded corners */
  background: var(--bg);
  height: 68vh; min-height: 480px;  /* fixed height — no page scroll */
  box-shadow: var(--shadow-md);
  isolation: isolate;
}

/* Sidebar */
#wmx-sidebar {
  background: var(--white); border-right: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden;
  min-height: 0; /* essential for flex/grid child to scroll */
  scrollbar-width: thin; scrollbar-color: var(--border2) transparent;
}
#wmx-sidebar::-webkit-scrollbar { width: 4px; }
#wmx-sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
#wmx-tree { padding: 10px 0 20px; }

.wmx-tree-all {
  display: flex; align-items: center; width: 100%;
  padding: 11px 16px;
  background: #F8F7FF;
  border: none; border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text); cursor: pointer; text-align: left;
  transition: background var(--tr), color var(--tr);
}
.wmx-tree-all:hover { background: var(--p-light); }
.wmx-tree-all.active { background: var(--p-light); color: var(--p); }

.wmx-tree-group { border-bottom: 1px solid var(--border); }
.wmx-tree-group-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 11px 16px;
  background: #F8F7FF;
  border: none; cursor: pointer; text-align: left;
  transition: background var(--tr);
  position: sticky; top: 0; z-index: 2;
  border-bottom: 1px solid var(--border);
}
.wmx-tree-group-btn:hover { background: var(--p-light); }
.wmx-group-label { font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--text); }
.wmx-group-label { font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--text); }
.wmx-caret-icon { font-size: 11px; color: var(--p); font-weight: 700; flex-shrink: 0; line-height: 1; }

.wmx-tree-children { display: none; padding: 2px 0 6px; }
.wmx-tree-group.open .wmx-tree-children { display: block; }
.wmx-tree-child {
  display: block; width: 100%; padding: 8px 16px 8px 26px;
  background: none; border: none; cursor: pointer;
  font-size: 12px; color: var(--text2); text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color var(--tr), background var(--tr);
}
.wmx-tree-child:hover { color: var(--p); background: rgba(124,92,255,.05); }
.wmx-tree-child.active { color: var(--p); font-weight: 600; background: var(--p-light); border-right: 3px solid var(--p); }

.wmx-loading { padding: 20px 16px; font-size: 12px; color: var(--muted); }

/* Catálogo principal */
#wmx-catalog { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
#wmx-catalog-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--white); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
#wmx-cat-title { font-size: 14px; font-weight: 700; color: var(--text); }
#wmx-cat-count  { font-size: 12px; color: var(--muted); }

#wmx-grid {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 230px;   /* fixed row height — enough for 2 tag rows */
  gap: 12px;
  align-content: start;
  scrollbar-width: thin; scrollbar-color: var(--border2) transparent;
}
#wmx-grid::-webkit-scrollbar { width: 4px; }
#wmx-grid::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ── Tarjeta de sonido ───────────────────────── */
.wmx-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  display: flex; flex-direction: column; gap: 7px;
  /* Height controlled by grid-auto-rows — no height:100% needed */
  overflow: hidden;
  transition: box-shadow var(--tr), border-color var(--tr), transform var(--tr);
  animation: wmx-fadein .2s ease both;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.wmx-card:hover {
  border-color: var(--p-soft);
  box-shadow: 0 6px 22px rgba(124,92,255,.13);
  transform: translateY(-2px);
}
.wmx-card.in-mix {
  border-color: var(--p);
  background: linear-gradient(135deg, #fff 0%, #FAF8FF 100%);
  box-shadow: 0 0 0 2px var(--p-glow);
}
@keyframes wmx-fadein { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }

/* card-desc fills remaining space */

.wmx-card-name {
  font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.wmx-card-desc {
  font-size: 11px; color: var(--text2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  flex: 1; /* pushes tags+foot down */
}
.wmx-card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.wmx-tag {
  font-size: 10px; padding: 3px 8px;
  background: var(--p-light); color: var(--p);
  border-radius: 20px; white-space: nowrap;
  border: 1px solid rgba(124,92,255,.15);
}

/* Fila inferior: preview + añadir */
.wmx-card-foot {
  display: flex; align-items: stretch; gap: 8px;
  margin-top: auto; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.wmx-prev-btn {
  width: 40px; height: 40px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border2);
  background: var(--white); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); flex-shrink: 0;
  transition: all var(--tr);
}
.wmx-prev-btn:hover, .wmx-prev-btn.playing {
  border-color: var(--p); color: var(--p); background: var(--p-light);
}
.wmx-prev-btn svg,
.wmx-prev-btn svg path,
button.wmx-prev-btn svg {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  fill: currentColor !important;
  width: 16px !important;
  height: 16px !important;
  pointer-events: none;
}

.wmx-add-btn {
  flex: 1; height: 44px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--p);
  background: var(--white); color: var(--p);
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: all var(--tr); text-align: center;
  display: flex; align-items: center; justify-content: center;
}
.wmx-add-btn:hover:not(:disabled) { background: var(--p); color: #fff; }
.wmx-add-btn.added { background: #6A4CFF; border-color: #6A4CFF; color: #fff; cursor: default; }
.wmx-add-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Skeleton */
.wmx-skel {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px;
  display: flex; flex-direction: column; gap: 9px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.wmx-sk {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--border) 50%, var(--bg2) 75%);
  background-size: 200% 100%; border-radius: 5px;
  animation: wmx-shimmer 1.3s ease infinite;
}
.wmx-sk-h { height: 13px; } .wmx-sk-s { height: 10px; }
@keyframes wmx-shimmer { 0%{background-position:-200% 0} 100%{background-position:200% 0} }

.wmx-empty {
  grid-column: 1/-1; text-align: center;
  padding: 40px 16px; font-size: 13px; color: var(--muted);
}

/* Paginación */
#wmx-pages {
  display: flex; align-items: center; justify-content: center;
  gap: 5px; padding: 14px 16px;
  border-top: 1px solid var(--border); background: var(--white); flex-shrink: 0; flex-wrap: wrap;
}
.wmx-pg {
  min-width: 34px; height: 34px; padding: 0 7px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--white); color: var(--text2);
  font-size: 12px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--tr);
}
.wmx-pg:hover:not(:disabled):not(.active) { border-color: var(--p-soft); color: var(--p); }
.wmx-pg.active { background: var(--p); border-color: var(--p); color: #fff; }
.wmx-pg:disabled { opacity:.3; cursor:not-allowed; }
.wmx-pg-dots { font-size: 12px; color: var(--muted); padding: 0 2px; }

/* ══ MODAL ══════════════════════════════════════════════════ */
#wmx-modal[hidden] { display: none; }
#wmx-modal {
  position: fixed; inset: 0;
  background: rgba(20,20,40,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 99999; padding: 20px;
}
#wmx-modal-box {
  background: var(--white); border-radius: 14px; padding: 28px;
  width: 100%; max-width: 420px; position: relative;
  box-shadow: var(--shadow-lg); animation: wmx-modal-in .2s ease;
}
@keyframes wmx-modal-in { from{opacity:0;transform:scale(.95)} to{opacity:1;transform:none} }
#wmx-modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--muted); transition: color var(--tr);
}
#wmx-modal-close:hover { color: var(--text); }
.wmx-modal-title { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 16px; }
.wmx-modal-field { margin-bottom: 12px; }
.wmx-modal-lbl { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 5px; }
.wmx-modal-input {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 13px; outline: none; color: var(--text); transition: border-color var(--tr);
}
.wmx-modal-input:focus { border-color: var(--p); }
.wmx-modal-url {
  padding: 10px 13px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: 12px; color: var(--text2);
  word-break: break-all; user-select: all;
}
.wmx-modal-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.wmx-btn-p {
  padding: 10px 20px; border-radius: var(--r-sm); border: none;
  background: var(--p); color: #fff;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background var(--tr); text-decoration: none; display: inline-flex; align-items: center;
}
.wmx-btn-p:hover { background: var(--p-hover); }
.wmx-btn-g {
  padding: 10px 20px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--white); color: var(--text2);
  font-size: 13px; font-weight: 700; cursor: pointer; transition: all var(--tr);
}
.wmx-btn-g:hover { border-color: var(--p-soft); color: var(--p); }
.wmx-spinner {
  width: 24px; height: 24px; border: 2px solid var(--border);
  border-top-color: var(--p); border-radius: 50%;
  animation: wmx-spin .7s linear infinite; margin: 0 auto;
}
@keyframes wmx-spin { to{transform:rotate(360deg)} }
#wmx-mixes-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 340px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--border2) transparent;
  width: 100%;
}
#wmx-mixes-list::-webkit-scrollbar { width: 4px; }
#wmx-mixes-list::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
.wmx-mix-item {
  display: flex; align-items: center;
  padding: 12px 14px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-sm); gap: 10px;
  width: 100%; min-height: 58px;
  transition: border-color var(--tr);
}
.wmx-mix-item:hover { border-color: var(--p-soft); }
.wmx-mix-item-info {
  display: flex; flex-direction: column; gap: 3px;
  min-width: 0; flex: 1; text-align: left; overflow: hidden;
}
.wmx-mix-item-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wmx-mix-item-date { font-size: 11px; color: var(--muted); white-space: nowrap; }
.wmx-mix-item-btns {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.wmx-btn-sm {
  padding: 0; font-size: 12px; font-weight: 700;
  width: 80px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.wmx-btn-del {
  all: unset;
  width: 36px; height: 36px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--muted); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all var(--tr);
  box-sizing: border-box;
}
.wmx-btn-del:hover { border-color: var(--error); color: var(--error); background: rgba(255,77,114,.07); }

/* ══ TOAST ══════════════════════════════════════════════════ */
#wmx-toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.92);
  background: #E8F8F8;
  color: #18182E;
  font-size: 13px; font-weight: 600;
  padding: 12px 24px; border-radius: 12px;
  border: 1px solid #A8E0DF;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100000;
  white-space: nowrap;
  max-width: min(320px, 90vw);
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
}
#wmx-toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#wmx-toast.ok  { background: #E8F8F8; color: #18182E; border-color: #A8E0DF; }
#wmx-toast.err { background: #FFF0F3; color: #c0143c; border-color: #FFB3C1;
  white-space: normal; max-width: min(500px, 92vw); font-size: 11px;
  word-break: break-all; text-align: left; pointer-events: auto; }

/* ══ MOBILE ═════════════════════════════════════════════════ */
@media (max-width: 820px) {
  #wmx-app { grid-template-columns: 175px 1fr; }
  #wmx-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 600px) {
  /* Full width, no overflow */
  #wmx-root { gap: 10px; }

  /* Catálogo: 1 columna */
  #wmx-app {
    grid-template-columns: 1fr;
    height: auto; min-height: 0;
    border-radius: var(--r-sm);
  }
  #wmx-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 170px;
    overflow-y: auto;
  }
  #wmx-grid {
    /* 1 sola tarjeta por fila en móvil, altura automática */
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    gap: 10px; padding: 12px;
    max-height: 60vh;
    overflow-y: auto;
  }

  /* Tarjetas: no cortar */
  .wmx-card { border-radius: var(--r-sm); }

  /* ── Barra compacta en 2 filas ── */
  #wmx-bar {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 14px;
    gap: 8px;
    row-gap: 8px;
  }
  /* Una sola fila: Play · EQ · Vol(popup) · Timer(popup) · 4 iconos */
  .wmx-play-btn           { order: 1; flex-shrink: 0; width: 38px; height: 38px; }
  #wmx-bar-eq             { order: 2; flex-shrink: 0; }
  .wmx-bar-spacer         { display: none; }
  .wmx-popup-wrap         { order: 3; flex-shrink: 0; }
  .wmx-icon-btn           { order: 4; width: 32px; height: 32px; padding: 0; flex-shrink: 0; }
  /* Popups abren hacia arriba */
  .wmx-popup              { bottom: calc(100% + 10px); right: 0; }
  .wmx-popup #wmx-vol     { width: 100px; }

  /* ── Slots ── */
  .wmx-track-slots        { flex-direction: column; gap: 8px; }
  .wmx-slot               { min-width: unset; width: 100%; }
  .wmx-slot-vol-row       { padding: 4px 14px 12px 16px; gap: 10px; }
  .wmx-vol-val            { display: none; }
  .wmx-slot-rm,
  .wmx-slot-expand        { width: 40px; height: 40px; font-size: 18px; }

  /* Botones tarjeta */
  .wmx-add-btn, .wmx-prev-btn { height: 46px; }
  .wmx-add-btn            { font-size: 14px; }

  /* Mix */
  #wmx-mix-hdr            { flex-wrap: wrap; }
  #wmx-wave               { max-width: 100%; order: 3; }
  #wmx-mix-tracks         { padding: 14px; }
  #wmx-mix                { border-radius: var(--r-sm); }
  #wmx-bar                { border-radius: var(--r-sm); }
  #wmx-search-bar         { flex-direction: column; align-items: stretch; gap: 6px; }
  #wmx-search-info        { text-align: right; }
}

@media (max-width: 420px) {
  #wmx-mix-tracks { padding: 12px; }
  .wmx-track-group-lbl { font-size: 9px; }
}

/* ══ MOBILE FIXES ════════════════════════════════════════════ */
@media (max-width: 600px) {
  /* Romper el max-width del tema WordPress para usar todo el ancho */
  #wmx-root {
    max-width: 100vw !important;
    width: 100vw !important;
    position: relative;
    left: 50%;
    margin-left: -50vw;
    box-sizing: border-box;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* Sidebar más alto — ver más categorías */
  #wmx-sidebar { max-height: 260px !important; }

  /* Grid: 1 columna, altura auto, sin clipping */
  #wmx-grid {
    grid-template-columns: 1fr !important;
    grid-auto-rows: auto !important;
    max-height: 65vh !important;
    padding: 12px !important;
  }

  /* Tarjetas: sin clipping, sin animación (visible inmediatamente) */
  .wmx-card {
    overflow: visible !important;
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    height: auto !important;
  }
}

/* Force preview button SVG always visible regardless of theme */
.wmx-prev-btn { color: var(--text2) !important; }
.wmx-prev-btn svg,
.wmx-prev-btn svg *  {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  fill: currentColor !important;
}

/* ══ BOTÓN PREVIEW — diseño propio desde cero, aislado del tema ══ */
button.wmx-snd-play {
  all: unset !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  border-radius: 8px !important;
  background-color: #ffffff !important;
  color: #7C5CFF !important;
  font-size: 16px !important;
  font-family: system-ui, sans-serif !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  border: 1.5px solid #7C5CFF !important;
  outline: none !important;
  line-height: 1 !important;
  text-align: center !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
  transition: background-color 0.15s ease, color 0.15s ease !important;
}
button.wmx-snd-play:hover,
button.wmx-snd-play.playing {
  background-color: #7C5CFF !important;
  color: #ffffff !important;
}

/* ── Download button ─────────────────────────────────────────────────── */
.wmx-dl-btn {
  all: unset !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  border-radius: 8px !important;
  background-color: #ffffff !important;
  color: #7C5CFF !important;
  border: 1.5px solid #7C5CFF !important;
  font-size: 16px !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  text-decoration: none !important;
  transition: background-color .15s ease, color .15s ease !important;
}
.wmx-dl-btn:hover {
  background-color: #7C5CFF !important;
  color: #ffffff !important;
}

/* ── Featured mixes sidebar button ──────────────────────────────────────────── */
.wmx-tree-featured {
  display: flex; align-items: center; justify-content: flex-start; gap: 6px;
  width: 100%; padding: 11px 16px;
  background: #F8F7FF;
  border: none; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  cursor: pointer; text-align: left;
  font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text);
  transition: background var(--tr), color var(--tr);
}
.wmx-tree-featured:hover { background: var(--p-light); }
.wmx-tree-featured.active { background: var(--p-light); color: var(--p); }
.wmx-tree-sep {
  height: 0;
  margin: 0;
}

/* ── Featured mix cards ──────────────────────────────────────────────────────── */
.wmx-fmix-card {
  border: 1.5px solid rgba(124,92,255,.22) !important;
  background: linear-gradient(145deg, var(--white) 70%, rgba(124,92,255,.04)) !important;
  position: relative;
  overflow: hidden;
  /* Fixed height so all mix cards align — same mechanism as the main catalog */
  height: 100%;
  min-height: 200px;
  display: flex !important;
  flex-direction: column !important;
}
.wmx-fmix-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, #7C5CFF, #3E6BFF, #3ED7C4);
  opacity: .7;
}
.wmx-fmix-emoji {
  font-size: 26px; line-height: 1;
  margin-bottom: 6px;
}
.wmx-fmix-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
/* Reuse standard wmx-add-btn look */
.wmx-fmix-load-btn {
  width: 100%;
  height: 44px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--p);
  background: var(--white);
  color: var(--p);
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: all var(--tr);
  display: flex; align-items: center; justify-content: center;
}
.wmx-fmix-load-btn:hover:not([disabled]) {
  background: var(--p);
  color: #fff;
}
.wmx-fmix-load-btn.added,
.wmx-fmix-load-btn[disabled] {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  cursor: default;
}
.wmx-featured-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 20px 0;
  grid-column: 1/-1;
}
.wmx-featured-empty code {
  background: var(--bg2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}

/* ── Featured card — header row (emoji + title inline) ──────────────────────── */
.wmx-fmix-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}
.wmx-fmix-header .wmx-fmix-emoji {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  margin-bottom: 0;   /* reset the old standalone value */
}
.wmx-fmix-header .wmx-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
/* Override old standalone emoji rule when inside header */
.wmx-fmix-card .wmx-fmix-emoji {
  font-size: 18px;
  margin-bottom: 0;
}
.wmx-fmix-desc {
  font-size: 11.5px;
  color: var(--muted2, var(--muted));
  line-height: 1.4;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wmx-fmix-tags {
  margin-bottom: 4px;
}

/* ── Sticky play bar on mobile ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  #wmx-bar {
    position: fixed !important;
    bottom: 20px;
    left: 12px;
    right: 12px;
    width: auto !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,.18), 0 0 0 1px var(--border) !important;
    z-index: 9999;
    /* Glassmorphism touch */
    background: rgba(232,248,248,.97) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  /* Add bottom padding to #wmx-root so content isn't hidden behind the fixed bar */
  #wmx-root {
    padding-bottom: 110px !important;
  }
}
