.trim-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(3,4,5,0.8);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.trim-modal.on { display: flex; }
.trim-card {
  width: min(960px, 100%);
  background: rgba(13,16,20,0.9);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--line); border-radius: 22px;
  padding: 22px; box-shadow: var(--shadow);
}
.trim-card header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.trim-card h3 { margin: 0; font-size: 16px; text-transform: uppercase; }
.trim-close {
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 20px; line-height: 1; padding: 0;
}
.trim-stage {
  position: relative; width: 100%; height: 160px;
  background: #0b0d0f; border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; user-select: none;
  cursor: text;              /* como en un editor de audio: se pincha y se pinta */
}
.trim-canvas { display: block; width: 100%; height: 100%; }
.trim-mask {
  position: absolute; top: 0; bottom: 0;
  background: rgba(3,4,5,0.7);
  pointer-events: none;
}
.trim-mask-l { left: 0; width: 0; }
.trim-mask-r { right: 0; width: 0; }
.trim-handle {
  position: absolute; top: 0; bottom: 0; width: 14px; border-radius: 7px;
  background: var(--acid);
  cursor: ew-resize;
  transform: translateX(-50%);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.4);
  z-index: 3;
}
.trim-handle::before {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 2px; height: 32px; background: rgba(0,0,0,0.5);
  transform: translate(-50%, -50%);
}
/* cabezal de reproducción, con su cabecita arriba para verlo de lejos */
.trim-playhead {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--cyan); pointer-events: none;
  left: 0; box-shadow: 0 0 8px var(--cyan);
}
.trim-playhead::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 8px solid var(--cyan);
}

/* atajos de teclado, a la vista debajo de los tiempos */
.trim-keys {
  display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 14px;
  font-size: 11px; color: var(--muted); align-items: center;
}
.trim-keys em { font-style: normal; opacity: .7; }
.trim-keys kbd {
  display: inline-block; min-width: 20px; padding: 2px 7px; margin-right: 4px;
  border: 1px solid rgba(255,255,255,.2); border-bottom-width: 2px; border-radius: 6px;
  background: rgba(255,255,255,.06); color: var(--text);
  font-family: inherit; font-size: 10.5px; font-weight: 800; text-align: center;
}
.trim-times {
  display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px;
  margin: 12px 0; color: var(--muted);
  align-items: center;
}
.trim-times strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* El dato que importa: cuánto va a durar la demo. Grande y en ácido, a la
   derecha, sumando en vivo mientras se pintan o estiran las zonas. */
.trim-total {
  margin-left: auto; text-align: right;
  display: flex; flex-direction: column; align-items: flex-end;
  line-height: 1.15;
}
.trim-total-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--muted);
}
.trim-total .trim-t-result {
  font-size: 34px; font-weight: 900; color: var(--acid);
  font-variant-numeric: tabular-nums; letter-spacing: 0.5px;
  text-shadow: 0 0 18px rgba(217,255,0,0.35);
}
.trim-total-note { font-size: 10px; color: var(--muted); }
/* sin zonas pintadas la demo sería el tema entero: el número se apaga */
.trim-total.is-vacio .trim-t-result { color: var(--muted); text-shadow: none; }
@media (max-width: 620px) {
  .trim-total { margin-left: 0; width: 100%; align-items: flex-start; text-align: left; }
  .trim-total .trim-t-result { font-size: 28px; }
}
.trim-actions {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px;
}
.trim-actions button { padding: 9px 14px; }
.trim-status { margin: 10px 0 0; min-height: 16px; }

/* Zonas pintadas sobre la onda: son los trozos que SE CONSERVAN, de ahí el
   ácido (antes marcaban lo que se tiraba y por eso iban en rojo). */
.trim-cuts { position: absolute; inset: 0; pointer-events: none; }
.trim-cut {
  position: absolute; top: 0; bottom: 0;
  background: rgba(217,255,0,0.14);
  border-left: 2px solid var(--acid);
  border-right: 2px solid var(--acid);
  box-shadow: inset 0 0 0 1px rgba(217,255,0,0.18);
  pointer-events: auto;
}
/* la zona que está sonando en bucle se distingue en cian, como el cabezal */
.trim-cut.is-loop {
  background: rgba(0,215,255,0.18);
  border-left-color: var(--cyan);
  border-right-color: var(--cyan);
  box-shadow: inset 0 0 22px rgba(0,215,255,0.22);
}
.trim-cut.is-loop .trim-cut-handle { background: var(--cyan); }
.trim-loop.is-on {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan) inset;
}
.trim-cut-body {
  position: absolute; inset: 0;
  cursor: grab;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.trim-cut-body:active { cursor: grabbing; }
.trim-cut-label {
  background: rgba(0,0,0,0.55); padding: 2px 6px; border-radius: 3px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* pista visual del gesto: el bucle vive en la mitad de abajo de la zona */
.trim-cut-loop {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  font-size: 13px; opacity: .38; pointer-events: none;
  filter: grayscale(1);
}
.trim-cut:hover .trim-cut-loop { opacity: .8; }
.trim-cut.is-loop .trim-cut-loop { opacity: 1; filter: none; }
.trim-cut-handle {
  position: absolute; top: 0; bottom: 0; width: 8px;
  background: var(--acid); cursor: ew-resize; z-index: 4;
}
.trim-cut-handle.l { left: 0; transform: translateX(-50%); }
.trim-cut-handle.r { right: 0; transform: translateX(50%); }
.trim-cut-x {
  position: absolute; top: 4px; right: 4px; z-index: 5;
  width: 22px; height: 22px; padding: 0; line-height: 1;
  border: 1px solid rgba(255,255,255,0.4); border-radius: 50%;
  background: rgba(0,0,0,0.6); color: #fff;
  font-size: 14px; cursor: pointer;
}
.trim-cut-x:hover { background: var(--red); border-color: var(--red); }

/* Public product page — extra image gallery + preview playlist */
.extra-media .public-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px; margin-top: 8px;
}
.public-gallery-item {
  display: block; aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: 8px; border: 1px solid var(--line);
  transition: transform 200ms;
}
.public-gallery-item:hover { transform: translateY(-2px); }
.public-gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Public tracklist styles live in public.css — no duplication here. */

/* Multi-image gallery in admin product editor */
.img-gallery .img-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}
.img-thumb {
  position: relative; aspect-ratio: 1 / 1;
  border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.4);
}
.img-thumb.primary { border-color: var(--acid); box-shadow: 0 0 0 2px rgba(217,255,0,0.25); }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-thumb .img-badge {
  position: absolute; top: 4px; left: 4px;
  background: var(--acid); color: #000;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 900;
}
.img-thumb .img-x, .img-thumb .img-pri {
  position: absolute; width: 22px; height: 22px; padding: 0;
  border-radius: 50%; border: 1px solid rgba(255,255,255,0.4);
  font-size: 12px; line-height: 1; cursor: pointer;
  background: rgba(0,0,0,0.7); color: #fff;
}
.img-thumb .img-x { top: 4px; right: 4px; }
.img-thumb .img-x:hover { background: var(--red); border-color: var(--red); }
.img-thumb .img-pri { bottom: 4px; right: 4px; }
.img-thumb .img-pri:hover { background: var(--acid); color: #000; border-color: var(--acid); }
.img-thumb .img-mv {
  position: absolute; bottom: 4px; width: 22px; height: 22px; padding: 0;
  border: 1px solid rgba(255,255,255,0.4); border-radius: 50%;
  background: rgba(0,0,0,0.7); color: #fff;
  font-size: 11px; line-height: 1; cursor: pointer;
}
.img-thumb .img-mv-l { left: 4px; }
.img-thumb .img-mv-r { left: 30px; }
.img-thumb .img-mv:hover { background: var(--cyan); color: #000; border-color: var(--cyan); }
.img-thumb.dragging { opacity: 0.4; }
.img-thumb.drag-over { outline: 2px dashed var(--acid); outline-offset: -2px; }

.img-add-dz {
  border-radius: 6px; padding: 14px; min-height: 60px;
}

/* Multi-preview / playlist editor (admin product editor)
   Every track renders in the EXACT same card — same border, same padding,
   same background, same layout. The "principal" track is identified ONLY by
   a small text badge inside .preview-row. No structural difference. */
.preview-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.preview-item {
  border: 1px solid var(--line); border-radius: 6px; padding: 10px;
  background: rgba(255,255,255,0.03);
}
.preview-row { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.prev-name {
  flex: 1; font-weight: 700; font-size: 13px; color: var(--text);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prev-badge {
  background: var(--acid); color: #000; font-size: 10px;
  padding: 2px 8px; border-radius: 999px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.4px; flex-shrink: 0;
}
.prev-toggle {
  flex: 0 0 auto; padding: 4px 10px; font-size: 16px; line-height: 1;
  font-weight: 700;
}
/* Custom compact audio player — replaces the native <audio controls> which
   in Safari blows up to a hero box (with embedded MP3 cover art shown as
   background) for tracks whose file has an ID3 album image. */
.prev-player {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; margin-top: 4px;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 40px; box-sizing: border-box;
  /* el player va SIEMPRE en su propia línea, debajo del nombre: así el nombre
     nunca se entrecorta, ni en escritorio ni en móvil (petición de Pablo) */
  flex: 1 1 100%; min-width: 0; order: 10;
}
.preview-item { flex-wrap: wrap; }
/* la onda del audio: gris lo que queda, ácido lo ya reproducido; se pincha
   (o arrastra) para saltar a ese punto, como en el recortador */
.prev-player .prev-wave {
  flex: 1; min-width: 0; height: 28px; display: block;
  cursor: pointer; touch-action: none;
}
.prev-player.is-playing { border-color: rgba(217,255,0,0.45); }
/* flechas ↑↓ para ordenar los temas: el orden de la lista manda en toda la
   web (la 1ª suena por defecto). Bien gordas para pulsarlas con el dedo. */
.prev-mv {
  min-width: 42px; min-height: 38px; padding: 6px 0;
  font-size: 17px; line-height: 1; font-weight: 900;
}
.prev-mv[disabled] { opacity: .25; cursor: default; pointer-events: none; }
.prev-player .prev-play {
  flex: 0 0 auto; width: 28px; height: 28px;
  border-radius: 50%; border: 0;
  background: var(--acid); color: #000;
  font-size: 12px; line-height: 1;
  cursor: pointer; font-weight: 900;
  display: inline-flex; align-items: center; justify-content: center;
}
.prev-player .prev-play:hover { transform: scale(1.06); }
.prev-player .prev-scrub {
  flex: 1; min-width: 0; appearance: none; -webkit-appearance: none;
  height: 4px; background: rgba(255,255,255,0.12); border-radius: 2px;
  outline: none; padding: 0; margin: 0;
  background-image: linear-gradient(90deg, var(--acid) 0, var(--acid) var(--prog,0%), transparent var(--prog,0%));
  background-repeat: no-repeat;
}
.prev-player .prev-scrub::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--acid); border: 2px solid #000; cursor: pointer;
}
.prev-player .prev-scrub::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--acid); border: 2px solid #000; cursor: pointer; border-color: #000;
}
.prev-player .prev-time {
  flex: 0 0 auto; font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums; min-width: 78px; text-align: right;
}
.prev-audio-hidden { display: none !important; }

/* Small action popover (kebab menu). Desktop only — mobile uses preview-modal */
.action-pop {
  z-index: 80;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  min-width: 180px; max-width: 240px;
}
.action-pop-item {
  background: transparent; border: 0; color: var(--text);
  padding: 8px 10px; font-size: 13px; text-align: left;
  cursor: pointer; border-radius: 4px;
  font-family: inherit;
}
.action-pop-item:hover { background: rgba(255,255,255,0.06); }
.action-pop-item.danger { color: #ffb7c0; }
.action-pop-item.danger:hover { background: rgba(231,47,68,0.12); }
.preview-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.preview-actions button { padding: 6px 10px; font-size: 12px; }
.preview-add-dz { padding: 12px; }
@keyframes prevMoved { 0%,100%{background:transparent} 50%{background:rgba(217,255,0,0.08)} }
.preview-item.prev-moved { animation: prevMoved 400ms ease; }

/* Mobile per-track action modal */
.preview-modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  display: none; align-items: flex-end; justify-content: center; padding: 0;
}
.preview-modal.on { display: flex; }
.preview-modal-card {
  width: 100%; max-width: 520px;
  background: var(--panel-strong); border-top: 1px solid var(--acid);
  border-radius: 14px 14px 0 0;
  padding: 16px 16px 22px;
  box-shadow: var(--shadow);
}
.preview-modal-card header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.preview-modal-card .pmt-title { font-size: 15px; }
.preview-modal-card .pmt-close {
  background: transparent; border: 0; color: var(--muted);
  font-size: 24px; cursor: pointer; line-height: 1;
}
.preview-modal-card .pmt-actions {
  display: flex; flex-direction: column; gap: 8px;
}
.preview-modal-card .pmt-actions button {
  width: 100%; padding: 12px; font-size: 14px; text-align: left;
}

/* Mientras ffmpeg recorta: barra indeterminada arriba de la tarjeta, para que
   se vea que está trabajando y no parezca colgado. */
.trim-card.is-busy { position: relative; }
.trim-card.is-busy::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, transparent, var(--acid), transparent);
  background-size: 45% 100%; background-repeat: no-repeat;
  animation: trimBusy 1.1s linear infinite;
}
@keyframes trimBusy { from { background-position: -45% 0; } to { background-position: 145% 0; } }
@media (prefers-reduced-motion: reduce) { .trim-card.is-busy::after { animation: none; background: var(--acid); } }
