/* ── Piensos Frontend CSS ──────────────────────────────────────── */

/* Wrap general */
.wpp-front-wrap { font-family: inherit; max-width: 1100px; margin: 0 auto; }

/* ── Filtros ─────────────────────────────────────────────────── */
.wpp-front-filtros { margin-bottom: 20px; }
.wpp-front-search-row {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  background: #f8f9fa; border: 1px solid #dee2e6;
  border-radius: 8px; padding: 14px 16px;
}
.wpp-front-search-box {
  position: relative; flex: 1; min-width: 200px;
}
.wpp-front-search-box svg {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%); width: 16px; height: 16px; color: #888;
}
.wpp-front-search-box input {
  width: 100%; padding: 8px 12px 8px 34px;
  border: 1px solid #ced4da; border-radius: 6px; font-size: 14px;
}
.wpp-front-select {
  padding: 8px 12px; border: 1px solid #ced4da;
  border-radius: 6px; font-size: 13px; min-width: 160px;
}
.wpp-btn-buscar {
  padding: 8px 20px; background: #2271b1; color: #fff;
  border: none; border-radius: 6px; font-size: 13px;
  cursor: pointer; font-weight: 500;
}
.wpp-btn-buscar:hover { background: #135e96; }
.wpp-btn-limpiar {
  font-size: 12px; color: #888; text-decoration: none; padding: 4px 8px;
}
.wpp-btn-limpiar:hover { color: #c0392b; }

/* Contador */
.wpp-front-contador {
  font-size: 13px; color: #666; margin: 0 0 12px;
}

/* ── Tabla ───────────────────────────────────────────────────── */
.wpp-front-tabla-wrapper { overflow-x: auto; }
.wpp-front-tabla {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: #fff; border-radius: 8px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.wpp-front-tabla thead th {
  background: #1d2327; color: #fff;
  padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.wpp-front-tabla tbody tr { border-bottom: 1px solid #f0f0f0; transition: background .1s; }
.wpp-front-tabla tbody tr:hover { background: #f8f9fa; }
.wpp-front-tabla td { padding: 9px 12px; vertical-align: middle; }
.wpp-tc { text-align: center !important; }

/* Colores de fila por calidad */
.wpp-row-bueno td:first-child { border-left: 3px solid #27ae60; }
.wpp-row-medio td:first-child { border-left: 3px solid #f39c12; }
.wpp-row-malo  td:first-child { border-left: 3px solid #e74c3c; }

.wpp-front-nombre strong { color: #1d2327; }
.wpp-front-nombre small  { color: #888; font-size: 11px; }
.wpp-front-prot  { font-weight: 700; color: #c0392b; }
.wpp-front-seln  { font-weight: 600; color: #7f8c8d; }

/* Flags en tabla */
.wpp-fl-malo   { color: #e74c3c; font-weight: 700; font-size: 14px; }
.wpp-fl-bien   { color: #27ae60; font-weight: 700; font-size: 14px; }
.wpp-fl-si     { color: #2980b9; font-weight: 700; font-size: 14px; }
.wpp-fl-neutro { color: #ccc; }

/* Botón ficha */
.wpp-btn-ficha {
  display: inline-block; padding: 4px 12px;
  background: #2271b1; color: #fff !important; text-decoration: none;
  border-radius: 4px; font-size: 12px; font-weight: 500;
  transition: background .15s;
}
.wpp-btn-ficha:hover { background: #135e96; }

/* Leyenda */
.wpp-front-leyenda {
  font-size: 11px; color: #888; margin: 8px 0 0; line-height: 1.8;
}

/* Paginación */
.wpp-front-paginacion {
  display: flex; gap: 6px; margin-top: 20px; flex-wrap: wrap;
}
.wpp-front-paginacion a {
  padding: 6px 12px; border: 1px solid #dee2e6; border-radius: 6px;
  text-decoration: none; font-size: 13px; color: #2271b1;
  transition: all .15s;
}
.wpp-front-paginacion a:hover,
.wpp-front-paginacion a.wpp-pag-act {
  background: #2271b1; color: #fff; border-color: #2271b1;
}

/* Vacío */
.wpp-front-vacio {
  text-align: center; padding: 40px 20px;
  background: #f8f9fa; border-radius: 8px; color: #666;
}

/* Error */
.wpp-error { color: #c0392b; font-style: italic; }

/* ── FICHA INDIVIDUAL ────────────────────────────────────────── */
.wpp-ficha-wrap {
  background: #fff; border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,.1); overflow: hidden;
}

/* Cabecera ficha */
.wpp-ficha-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; padding: 24px 28px;
  background: linear-gradient(135deg, #1d2327 0%, #2c3e50 100%);
  color: #fff; flex-wrap: wrap;
}
.wpp-ficha-titulo h2 { margin: 0 0 4px; font-size: 22px; color: #fff; }
.wpp-ficha-fab  { margin: 0 0 4px; color: rgba(255,255,255,.7); font-size: 14px; }
.wpp-ficha-desc { margin: 0; color: rgba(255,255,255,.6); font-size: 13px; }

/* Score */
.wpp-ficha-score {
  text-align: center; padding: 14px 20px;
  border-radius: 8px; min-width: 120px;
}
.wpp-score-alto  { background: #27ae60; }
.wpp-score-medio { background: #f39c12; }
.wpp-score-bajo  { background: #e74c3c; }
.wpp-score-estrellas { font-size: 20px; color: #fff; letter-spacing: 2px; }
.wpp-score-num   { font-size: 28px; font-weight: 800; color: #fff; line-height: 1; margin: 4px 0; }
.wpp-score-label { font-size: 11px; color: rgba(255,255,255,.8); }

/* Secciones ficha */
.wpp-ficha-seccion { padding: 22px 28px; border-bottom: 1px solid #f0f0f0; }
.wpp-ficha-seccion:last-child { border-bottom: none; }
.wpp-ficha-seccion h3 { margin: 0 0 16px; font-size: 15px; color: #1d2327; }

/* Garantía analítica en ficha */
.wpp-ficha-ga {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px;
}
.wpp-ga-item {
  background: #f8f9fa; border-radius: 8px;
  padding: 12px 14px; border: 1px solid #e9ecef;
}
.wpp-ga-seln { background: #fff8e1; border-color: #ffc107; }
.wpp-ga-em   { background: #e3f2fd; border-color: #90caf9; }
.wpp-ga-label { display: block; font-size: 11px; color: #888; margin-bottom: 4px; }
.wpp-ga-val   { display: block; font-size: 20px; font-weight: 700; color: #1d2327; }

/* Flags en ficha */
.wpp-ficha-flags {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media(max-width: 600px) { .wpp-ficha-flags { grid-template-columns: 1fr; } }

.wpp-flag-ficha {
  border-radius: 8px; padding: 12px 14px; border: 1px solid;
}
.wpp-flag-f-ok     { background: #f0faf4; border-color: #b7dfca; }
.wpp-flag-f-alerta { background: #fff5f5; border-color: #f5c6c6; }
.wpp-flag-f-neutro { background: #f8f9fa; border-color: #dee2e6; }

.wpp-flag-f-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
}
.wpp-flag-f-header strong { font-size: 13px; }
.wpp-flag-f-val {
  font-size: 12px; font-weight: 700; padding: 2px 8px;
  border-radius: 20px; white-space: nowrap;
}
.wpp-flag-f-ok .wpp-flag-f-val     { background: #d4edda; color: #155724; }
.wpp-flag-f-alerta .wpp-flag-f-val { background: #f8d7da; color: #721c24; }
.wpp-flag-f-neutro .wpp-flag-f-val { background: #e9ecef; color: #6c757d; }
.wpp-flag-f-desc { font-size: 12px; color: #666; margin: 0; line-height: 1.4; }

/* Composición */
.wpp-ficha-composicion {
  font-size: 13px; line-height: 1.7; color: #444;
  background: #f8f9fa; border-radius: 6px; padding: 14px 16px;
  border-left: 3px solid #2271b1;
}

/* Nota legal */
.wpp-ficha-nota {
  font-size: 11px; color: #aaa; padding: 16px 28px;
  background: #f8f9fa; margin: 0; font-style: italic;
}
