/*
 * HM Foley.
 *
 * Vive dentro de Premiere, así que la superficie es la de Premiere: el mismo
 * gris de sus paneles, para que no parezca un agujero en la interfaz. Lo
 * propio de Foley va en tres cosas y solo en esas:
 *
 *   - un acento naranja, que marca lo que está sonando y la acción de meter
 *     un sonido en la timeline. Nada más lleva color;
 *   - las formas de onda, dibujadas a mano en vez de pegar la imagen del
 *     banco: así se leen todas igual y lo que ya ha sonado se pinta encima;
 *   - las duraciones en cifras tabulares, que en un banco de efectos son lo
 *     que se compara: 0,4 s contra 1,2 s.
 */
:root {
  --fondo:    #1e1e1f;
  --sup:      #252527;
  --sup-2:    #2d2d30;
  --sup-3:    #38383c;
  --linea:    #333336;
  --linea-2:  #444448;

  --texto:    #ececee;
  --texto-2:  #a8a8ae;
  --texto-3:  #7e7e85;

  --acento:   #ff8a3d;
  --acento-2: #ffa468;
  --acento-sup: rgba(255, 138, 61, .14);
  --onda:     #6d6d74;
  --ok:       #4fc27a;
  --mal:      #f2645c;

  --r: 6px;
  --sale: cubic-bezier(0.22, 1, 0.36, 1);
  --t: 140ms;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden;
  background: var(--fondo); color: var(--texto);
  font: 12px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
::selection { background: var(--acento); color: #1a1a1a; }
input, textarea { user-select: text; caret-color: var(--acento); }
::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-thumb { background: var(--sup-3); border: 2px solid var(--fondo); border-radius: 5px; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 1px; border-radius: 4px; }

.ico { width: 15px; height: 15px; flex: 0 0 auto; fill: none; stroke: currentColor;
       stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, p { margin: 0; }
code { font-family: var(--mono); font-size: 11px; }

/* ---------------------------------------------------------- controles --- */

button {
  font: inherit; color: var(--texto); cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: var(--r);
  transition: background var(--t) ease, border-color var(--t) ease, color var(--t) ease,
              transform 90ms var(--sale);
}
button:active:not(:disabled) { transform: scale(.96); }
button:disabled { opacity: .4; cursor: default; }

.primario {
  background: var(--acento); color: #1b1b1b; font-weight: 600;
  padding: 7px 14px;
}
.primario:hover:not(:disabled) { background: var(--acento-2); }
.secundario {
  background: var(--sup-2); border-color: var(--linea-2);
  padding: 6px 11px;
}
.secundario:hover:not(:disabled) { background: var(--sup-3); }
.peligro:hover:not(:disabled) { color: var(--mal); border-color: rgba(242, 100, 92, .5); }
.icono { width: 28px; height: 28px; display: grid; place-items: center; color: var(--texto-2); }
.icono:hover { background: var(--sup-2); color: var(--texto); }
.enlace {
  color: var(--texto-2); padding: 2px 0; display: inline-flex; align-items: center; gap: 5px;
  text-decoration: underline; text-decoration-color: var(--linea-2); text-underline-offset: 3px;
}
.enlace:hover { color: var(--texto); text-decoration-color: currentColor; }
.enlace .ico { width: 12px; height: 12px; }

.chip {
  padding: 3px 9px; border: 1px solid var(--linea); border-radius: 20px;
  color: var(--texto-2); font-size: 11.5px; white-space: nowrap;
}
.chip:hover { color: var(--texto); border-color: var(--linea-2); }
.chip[aria-pressed="true"] { background: var(--sup-3); color: var(--texto); border-color: var(--sup-3); }
.chip.ciclo { flex: 0 0 auto; }
.chip.ciclo.activo { color: var(--acento); border-color: rgba(255, 138, 61, .45); }

input[type=text], input[type=search], input[type=password], textarea {
  width: 100%; min-width: 0;
  background: var(--sup); border: 1px solid var(--linea-2); border-radius: var(--r);
  color: var(--texto); font: inherit; padding: 6px 9px;
  transition: border-color var(--t) ease, box-shadow var(--t) ease;
}
input:focus, textarea:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-sup); }
input::placeholder { color: var(--texto-3); }

/* ------------------------------------------------------------- armazón --- */

.app { display: flex; flex-direction: column; height: 100%; }

.cabeza {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 8px 6px 12px;
}
.marca { display: flex; align-items: center; gap: 6px; margin-right: auto; }
.marca .ico { color: var(--acento); }
.marca b { font-size: 13px; letter-spacing: -.01em; }

.bancos { display: flex; background: var(--sup); border: 1px solid var(--linea); border-radius: 7px; padding: 2px; }
.bancos button { padding: 3px 9px; border-radius: 5px; color: var(--texto-2); font-size: 11.5px; display: flex; align-items: center; }
.bancos button:hover { color: var(--texto); }
.bancos button[aria-selected="true"] { background: var(--sup-3); color: var(--texto); }
.bancos button[data-banco="favoritos"] .ico { width: 13px; height: 13px; }
.bancos button[data-banco="favoritos"][aria-selected="true"] .ico { fill: var(--acento); stroke: var(--acento); }

.buscador { padding: 2px 10px 6px; }
.campo-buscar {
  display: flex; align-items: center; gap: 7px;
  background: var(--sup); border: 1px solid var(--linea-2); border-radius: 7px;
  padding: 0 9px; height: 32px; color: var(--texto-3);
  transition: border-color var(--t) ease, box-shadow var(--t) ease;
}
.campo-buscar:focus-within { border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-sup); }
.campo-buscar input { border: 0; background: none; padding: 0; height: 100%; box-shadow: none; font-size: 12.5px; }
.campo-buscar input:focus { box-shadow: none; }
.campo-buscar input::-webkit-search-cancel-button { filter: invert(.7); }

.girando {
  width: 13px; height: 13px; border-radius: 50%;
  border: 1.5px solid var(--linea-2); border-top-color: var(--acento);
  animation: gira .7s linear infinite;
}
@keyframes gira { to { transform: rotate(360deg); } }

.filtros { display: flex; align-items: center; gap: 8px; padding: 0 10px 8px; border-bottom: 1px solid var(--linea); }
.chips { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.chips::-webkit-scrollbar { display: none; }
/* Si no caben, se desplazan: el fundido avisa de que hay más a la derecha. */
.chips { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent); padding-right: 14px; }

/* --------------------------------------------------------------- lista --- */

.lista { flex: 1; min-height: 0; overflow-y: auto; outline: none; }

/*
 * Una fila: escuchar a la izquierda, lo que es y cómo suena en el centro,
 * marcar e insertar a la derecha. La onda es la mitad de la información: se
 * ve si es un golpe seco, una cola larga o un ambiente plano sin escucharlo.
 */
.fila-son {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 2px 8px; align-items: center;
  padding: 7px 8px 7px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .035);
  cursor: default;
  transition: background var(--t) ease;
}
.fila-son:hover { background: rgba(255, 255, 255, .025); }
.fila-son.sel { background: var(--sup); }
.fila-son.sonando { background: var(--acento-sup); }

.b-play {
  grid-row: 1 / span 2; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; color: var(--texto-2); background: var(--sup-2);
}
.b-play .ico { width: 12px; height: 12px; }
.b-play:hover { color: var(--texto); background: var(--sup-3); }
.sonando .b-play { background: var(--acento); color: #1b1b1b; }

.linea1 { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.titulo { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.dur { font-family: var(--mono); font-size: 11px; color: var(--texto-2); font-variant-numeric: tabular-nums; }

.onda { position: relative; height: 24px; cursor: pointer; }
.onda canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.onda .sin-forma { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--linea-2); }

.meta { grid-column: 2; display: flex; gap: 6px; align-items: center; color: var(--texto-3); font-size: 11px; min-width: 0; }
.meta .autor { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lic { font-size: 10px; letter-spacing: .03em; padding: 0 5px; border-radius: 3px; border: 1px solid var(--linea-2); white-space: nowrap; }
.lic.libre { color: var(--ok); border-color: rgba(79, 194, 122, .35); }
.lic.nc { color: var(--mal); border-color: rgba(242, 100, 92, .4); }
.calidad { font-size: 10px; color: var(--texto-3); }

.acciones { grid-row: 1 / span 3; grid-column: 3; display: flex; flex-direction: column; gap: 2px; }
.acciones button { width: 28px; height: 26px; display: grid; place-items: center; color: var(--texto-3); }
.acciones button:hover { color: var(--texto); background: var(--sup-2); }
.b-fav.si .ico { fill: var(--acento); stroke: var(--acento); }
.b-poner { color: var(--texto-2) !important; }
.b-poner:hover { color: #1b1b1b !important; background: var(--acento) !important; }
.b-poner.bajando { color: var(--acento) !important; }
.b-poner.hecho { color: var(--ok) !important; }

/* La barra de progreso de la descarga, debajo de la onda. */
.progreso { grid-column: 2; height: 2px; background: var(--sup-3); border-radius: 1px; overflow: hidden; }
.progreso i { display: block; height: 100%; width: 0; background: var(--acento); transition: width 120ms linear; }

.mas { padding: 14px; text-align: center; color: var(--texto-3); }

/* ------------------------------------------------------ estados vacíos --- */

.vacio { padding: 34px 22px; text-align: center; color: var(--texto-2); }
.vacio h3 { font-size: 13px; color: var(--texto); margin-bottom: 6px; font-weight: 600; }
.vacio p { max-width: 34ch; margin: 0 auto; line-height: 1.55; }
.vacio .acciones-vacio { margin-top: 14px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.sugerencias { margin-top: 12px; display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }

/* ----------------------------------------------------------------- pie --- */

.pie {
  display: flex; align-items: center; gap: 8px; min-height: 30px;
  padding: 5px 10px; border-top: 1px solid var(--linea);
  color: var(--texto-3); font-size: 11px;
}
.estado { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.estado.mal { color: var(--mal); }
.estado.bien { color: var(--texto-2); }

.aviso {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: var(--sup-3); color: var(--texto); padding: 7px 12px; border-radius: 7px;
  box-shadow: 0 6px 20px -4px rgba(0, 0, 0, .6); font-size: 11.5px; white-space: nowrap;
  animation: asoma 200ms var(--sale);
}
@keyframes asoma { from { opacity: 0; transform: translate(-50%, 6px); } }

/* -------------------------------------------------------------- ajustes --- */

.hoja {
  position: fixed; inset: 0; z-index: 20; background: var(--fondo);
  display: flex; flex-direction: column;
  animation: entra 220ms var(--sale);
}
@keyframes entra { from { opacity: 0; transform: translateX(14px); } }
.hoja-cabeza { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 8px 14px; border-bottom: 1px solid var(--linea); }
.hoja-cabeza h2 { font-size: 13px; font-weight: 600; }
.hoja-cuerpo { flex: 1; overflow-y: auto; padding: 4px 14px 24px; }
.grupo { padding: 14px 0; border-bottom: 1px solid var(--linea); display: flex; flex-direction: column; gap: 9px; }
.grupo h3 { font-size: 12px; font-weight: 600; }
.nota { color: var(--texto-3); font-size: 11.5px; line-height: 1.55; }
.nota b, .pasos b { color: var(--texto-2); font-weight: 600; }
.pasos { margin: 0; padding-left: 18px; color: var(--texto-2); display: flex; flex-direction: column; gap: 6px; line-height: 1.5; }
.copiable { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.copiable code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; background: var(--sup); padding: 4px 7px; border-radius: 4px; color: var(--texto); user-select: text; }
.fila { display: flex; flex-direction: column; gap: 4px; color: var(--texto-2); font-size: 11.5px; }
.con-boton { display: flex; gap: 6px; }
.sesion { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sesion-estado { flex: 1; min-width: 0; color: var(--texto-3); display: flex; align-items: center; gap: 6px; }
.sesion-estado::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--texto-3); }
.sesion-estado.si { color: var(--texto-2); }
.sesion-estado.si::before { background: var(--ok); }
.datos { margin: 0; display: grid; gap: 4px; }
.datos div { display: grid; grid-template-columns: 90px 1fr; gap: 8px; }
.datos dt { color: var(--texto-3); }
.datos dd { margin: 0; font-family: var(--mono); font-size: 11px; color: var(--texto-2); overflow: hidden; text-overflow: ellipsis; }
.creditos-app { padding-top: 14px; color: var(--texto-3); font-size: 11px; line-height: 1.5; }

/* ------------------------------------------------------------- diálogo --- */

.dialogo {
  width: min(420px, calc(100vw - 24px)); padding: 16px;
  background: var(--sup); color: var(--texto); border: 1px solid var(--linea-2); border-radius: 10px;
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, .7);
}
.dialogo::backdrop { background: rgba(0, 0, 0, .5); }
.dialogo h2 { font-size: 13px; margin-bottom: 6px; }
.dialogo textarea { margin-top: 10px; font: 11px/1.5 var(--mono); resize: vertical; }
.dialogo menu { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; padding: 0; }
.hueco { flex: 1; }

/* ------------------------------------------------------------- activar --- */

.activar { height: 100%; display: grid; place-items: center; padding: 24px 20px; overflow-y: auto; }
.activar-in { width: 100%; max-width: 300px; text-align: center; animation: entra 260ms var(--sale); }
.marca-grande {
  width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 12px;
  display: grid; place-items: center; background: var(--acento); color: #1b1b1b;
}
.marca-grande .ico { width: 24px; height: 24px; stroke-width: 1.8; }
.activar h1 { font-size: 18px; letter-spacing: -.02em; }
.lema { color: var(--texto-3); margin-top: 3px; }
.activar h2 { font-size: 13px; margin-top: 26px; }
.act-texto { color: var(--texto-2); margin-top: 4px; line-height: 1.5; }
.act-form { display: flex; gap: 6px; margin-top: 14px; }
.act-form input { font: 11.5px var(--mono); text-align: center; letter-spacing: .03em; }
.act-eco { min-height: 1.5em; margin-top: 9px; font-size: 11.5px; color: var(--texto-2); }
.act-eco.mal { color: var(--mal); }
.act-eco.bien { color: var(--ok); }
.act-pie { margin-top: 18px; color: var(--texto-3); font-size: 11px; line-height: 1.55; }
.act-pie b { color: var(--texto-2); font-weight: 500; }
#act-comprar { margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; }
}
