/* styles.css — Estilos propios del visor ClipCache, sin frameworks. */

:root {
  --fondo: #f4f5f7;
  --texto: #1c2333;
  --acento: #1d4ed8;
  --borde: #d4d9e3;
  --fila-alterna: #eef1f6;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--fondo);
  color: var(--texto);
}

.cabecera {
  background: var(--acento);
  color: #ffffff;
  padding: 1.5rem;
}

.cabecera h1 {
  margin: 0;
}

.subtitulo {
  margin: 0.25rem 0 0;
}

main {
  padding: 1rem;
  max-width: 72rem;
  margin: 0 auto;
}

.filtros {
  background: #ffffff;
  border: 1px solid var(--borde);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.fila-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.fila-filtros label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 12rem;
  flex: 1;
}

select,
input[type="search"] {
  padding: 0.5rem;
  border: 1px solid var(--borde);
  border-radius: 0.375rem;
}

button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--acento);
  border-radius: 0.375rem;
  background: var(--acento);
  color: #ffffff;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button:focus-visible {
  outline: 2px solid var(--texto);
  outline-offset: 2px;
}

.btn-copiar {
  min-width: 44px;
  min-height: 44px;
  padding: 0.625rem 1rem;
  font-weight: 600;
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--texto);
  color: #ffffff;
  text-align: left;
  padding: 0.6rem;
}

tbody td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--borde);
}

tbody tr:nth-child(even) {
  background: var(--fila-alterna);
}

/* Las filas con color propio del clip respetan su color de texto para legibilidad. */
#tabla-clips tbody tr[style] {
  background-clip: padding-box;
}

#tabla-clips tbody tr[style] .btn-copiar {
  color: inherit;
  border-color: currentColor;
  background: transparent;
}

#tabla-clips td.texto {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 32rem;
}

.paginacion {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
}

/* Los selectores de nivel generados reutilizan la apariencia de .fila-filtros. */
#filtros-niveles:empty {
  display: none;
}

#estado-clips:empty,
#estado-grupos:empty {
  display: none;
}

@media (max-width: 640px) {
  .fila-filtros {
    flex-direction: column;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
