/* Comprimir Imagen — cmp-studio.css v2.0.0
   Tablero de lote sobre el design system studio (style.css, idéntico a
   Quitar Fondo / Imagen Studio). Mesa grande + controles en sidebar-right. */

.hidden {
  display: none !important;
}

/* ── Mesa de lote: scroll natural, tarjetas del mismo tamaño ── */
.stage-container.cmp-stage {
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px;
  align-items: unset;
  justify-content: unset;
}

.cmp-batch {
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* Sin tope de ancho: el tablero llena toda la mesa de trabajo,
     las tarjetas se reparten en más columnas en vez de dejar vacío. */
  max-width: none;
  margin: 0;
  width: 100%;
}

/* ── Tablero: cuadrícula / lista ── */
.cmp-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.cmp-batch.view-list .cmp-board {
  grid-template-columns: 1fr;
}

/* ── Tarjeta fotográfica vertical ── */
.cmp-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(143, 108, 199, 0.35);
  transition: border-color 0.15s ease, transform 0.15s ease;
  min-width: 0;
}

.cmp-card:hover {
  border-color: var(--brand-light);
  transform: translateY(-2px);
}

.cmp-card.is-working {
  border-color: rgba(245, 158, 11, 0.5);
}

.cmp-card.is-error {
  border-color: rgba(239, 68, 68, 0.5);
}

/* Preview grande con insignia de ahorro incrustada */
.cmp-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background:
    linear-gradient(45deg, #14121c 25%, transparent 25%),
    linear-gradient(-45deg, #14121c 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #14121c 75%),
    linear-gradient(-45deg, transparent 75%, #14121c 75%),
    #0a0a0f;
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border: 1px solid var(--border-subtle);
}

.cmp-preview .cmp-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cmp-savebadge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  color: #34d399;
  background: rgba(0, 0, 0, 0.68);
  border: 1px solid rgba(52, 211, 153, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.cmp-savebadge.pending {
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.55);
}

.cmp-savebadge.err {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.55);
}

.cmp-veil {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.cmp-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Vista lista: fila compacta horizontal */
.cmp-batch.view-list .cmp-card {
  flex-direction: row;
  align-items: center;
}

.cmp-batch.view-list .cmp-card:hover {
  transform: none;
}

.cmp-batch.view-list .cmp-preview {
  width: 64px;
  height: 64px;
  aspect-ratio: auto;
  flex-shrink: 0;
}

.cmp-batch.view-list .cmp-body {
  flex: 1;
}

.cmp-batch.view-list .cmp-savebadge {
  top: 3px;
  right: 3px;
  font-size: 0.6rem;
  padding: 1px 6px;
}

.cmp-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmp-sizes {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.cmp-sizes .to {
  color: var(--text-dim);
  margin: 0 2px;
}

.cmp-save {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #34d399;
}

.cmp-save.pending {
  color: var(--warning);
}

.cmp-save.err {
  color: var(--danger);
}

.cmp-row-btns {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.cmp-mini-btn {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.cmp-mini-btn:hover:not(:disabled) {
  border-color: var(--brand-light);
  background: rgba(85, 55, 142, 0.16);
  color: #fff;
}

.cmp-mini-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cmp-mini-btn.danger {
  flex: 0 0 auto;
  padding: 6px 10px;
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
}

.cmp-mini-btn.danger:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: var(--danger);
  color: #fff;
}

/* ── Estado vacío del tablero ── */
.cmp-board-empty {
  text-align: center;
  padding: 30px 16px;
  color: var(--text-muted);
  font-size: 0.84rem;
  border: 1px dashed rgba(189, 160, 226, 0.35);
  border-radius: 14px;
  background: rgba(85, 55, 142, 0.05);
}

/* ── Botón gigante flotante: añadir más fotos (siempre visible al hacer scroll) ── */
.cmp-fab {
  position: sticky;
  bottom: 14px;
  align-self: flex-end;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 15px 32px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1rem;
  color: #ffffff;
  background: linear-gradient(180deg, #6c46b5 0%, #472d75 100%);
  border: 1px solid rgba(189, 160, 226, 0.65);
  box-shadow:
    0 14px 36px -6px rgba(139, 92, 246, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.cmp-fab:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 18px 44px -6px rgba(139, 92, 246, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.cmp-fab:active {
  transform: scale(0.97);
}

/* ── Nota de privacidad ── */
.cmp-note {
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-dim);
  margin: 0;
}

.cmp-note strong {
  color: var(--text-secondary);
}

/* ── Nota del motor ── */
.cmp-enginenote {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  line-height: 1.5;
  color: var(--text-dim);
}

/* ── Overlay global de progreso ── */
.avif-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 10, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.avif-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  max-width: 330px;
  width: calc(100% - 48px);
  padding: 1.4rem 1.5rem 1.25rem;
  text-align: center;
  background: var(--bg-surface-elevated, #0f0e16);
  border: 1px solid rgba(143, 108, 199, 0.45);
  border-radius: 16px;
  box-shadow: 0 20px 55px -12px rgba(0, 0, 0, 0.85), 0 0 28px -8px rgba(85, 55, 142, 0.5);
}

.avif-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(189, 160, 226, 0.2);
  border-top-color: #bda0e2;
  animation: avifspin 0.8s linear infinite;
}

@keyframes avifspin {
  to {
    transform: rotate(360deg);
  }
}

.avif-overlay-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  margin: 0;
}

.avif-overlay-sub {
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.5;
}

.avif-progress-track {
  width: 100%;
  height: 8px;
  margin-top: 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.avif-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #55378e, #bda0e2);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.7);
  transition: width 0.25s ease;
}

.avif-progress-text {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: var(--brand-lighter, #bda0e2);
  font-weight: 600;
}

.avif-progress-count {
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  color: var(--text-dim, #94a3b8);
}

.avif-overlay-min {
  margin-top: 0.3rem;
  background: transparent;
  border: none;
  color: var(--text-dim, #94a3b8);
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  text-decoration: underline;
  cursor: pointer;
}

.avif-overlay-min:hover {
  color: #fff;
}

/* ── Utilidades panel ── */
.studio-select {
  width: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

.studio-select:focus {
  border-color: var(--brand-light);
}

.sidebar-right-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Responsive ── */
@media (max-width: 1023px) {
  .stage-container.cmp-stage {
    max-height: none;
    padding: 12px;
  }
}

@media (max-width: 640px) {
  .cmp-board {
    grid-template-columns: 1fr 1fr;
  }

  .cmp-batch.view-list .cmp-board {
    grid-template-columns: 1fr;
  }
}
