/* ==========================================================================
   AIVA Voice Library (.vl / .vc)
   Filterable gallery of AI voice samples. Built on design tokens; reuses
   shared primitives (msp-container, sa-section, sa-head).
   ========================================================================== */

/* --- Toolbar / filters ---------------------------------------------------- */
.vl-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 22px 32px;
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 14px;
}
.vl-filter { display: flex; align-items: center; gap: 12px; }
.vl-filter__label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-muted);
}
.vl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.vl-chip {
  font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer;
  color: var(--text); background: color-mix(in srgb, var(--heading) 4%, transparent);
  border: 1px solid var(--hairline); border-radius: 999px; padding: 7px 14px;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.vl-chip:hover { border-color: var(--brand-green); }
.vl-chip.is-active {
  color: #fff; background: var(--brand-green); border-color: var(--brand-green);
}
.vl-count { margin-left: auto; font-size: 0.9rem; color: var(--text-muted); }
.vl-count strong { color: var(--heading); font-weight: 800; }
.vl-empty { text-align: center; color: var(--text-muted); padding: 3rem 0; font-size: 1rem; }
[data-theme="dark"] .vl-toolbar { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .vl-chip { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.09); }

/* --- Grid ----------------------------------------------------------------- */
.vl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px; margin-top: clamp(1.5rem, 3vw, 2rem);
}

/* --- Voice card ----------------------------------------------------------- */
.vc {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 14px; padding: 18px;
}
.vc[hidden] { display: none; }
[data-theme="dark"] .vc { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.08); }
.vc__tags { display: flex; gap: 8px; }
.vc__tag {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); background: color-mix(in srgb, var(--heading) 5%, transparent);
  border: 1px solid var(--hairline); border-radius: 999px; padding: 3px 10px;
}
.vc__tag--accent { color: var(--brand-cyan); border-color: color-mix(in srgb, var(--brand-cyan) 35%, transparent); background: color-mix(in srgb, var(--brand-cyan) 10%, transparent); }
[data-theme="dark"] .vc__tag { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); }

/* ID + copy */
.vc__id {
  font: inherit; cursor: pointer; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: color-mix(in srgb, var(--heading) 4%, transparent);
  border: 1px solid var(--hairline); border-radius: 10px; padding: 9px 12px;
  transition: border-color 0.15s ease;
}
.vc__id:hover { border-color: var(--brand-green); }
.vc__code {
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--heading);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 62%;
}
.vc__copy {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.74rem; font-weight: 600; color: var(--text-muted);
}
.vc__copy svg { width: 13px; height: 13px; }
.vc__id.is-copied .vc__copy { color: var(--brand-green); }
[data-theme="dark"] .vc__id { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.09); }

/* Player row */
.vc__player { display: flex; align-items: center; gap: 12px; margin-top: auto; }
.vc__play {
  flex-shrink: 0; cursor: pointer; width: 38px; height: 38px; border-radius: 50%;
  border: none; background: var(--brand-green);
  display: inline-flex; align-items: center; justify-content: center;
  transition: filter 0.15s ease;
}
.vc__play:hover { filter: brightness(1.08); }
.vc__ico--play {
  width: 0; height: 0;
  border-left: 12px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent;
  margin-left: 3px;
}
.vc__ico--pause { display: none; width: 12px; height: 13px; position: relative; }
.vc__ico--pause::before, .vc__ico--pause::after {
  content: ""; position: absolute; top: 0; width: 4px; height: 13px; background: #fff; border-radius: 1px;
}
.vc__ico--pause::before { left: 1px; }
.vc__ico--pause::after { right: 1px; }
.vc.is-playing .vc__ico--play { display: none; }
.vc.is-playing .vc__ico--pause { display: inline-block; }

.vc__bar {
  flex: 1; height: 5px; border-radius: 3px; overflow: hidden;
  background: color-mix(in srgb, var(--heading) 12%, transparent);
}
.vc__fill { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--brand-green), var(--brand-cyan)); }
[data-theme="dark"] .vc__bar { background: rgba(255,255,255,0.12); }
.vc__time { flex-shrink: 0; font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-muted); min-width: 34px; text-align: right; }
.vc__dl {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px; color: var(--text-muted);
  border: 1px solid var(--hairline); transition: color 0.15s ease, border-color 0.15s ease;
}
.vc__dl:hover { color: var(--brand-green); border-color: var(--brand-green); }
.vc__dl svg { width: 16px; height: 16px; }
[data-theme="dark"] .vc__dl { border-color: rgba(255,255,255,0.1); }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 700px) {
  .vl-toolbar { gap: 16px; }
  .vl-count { margin-left: 0; width: 100%; }
  .vl-grid { grid-template-columns: 1fr; }
}
