/*
 * Hidro-Logic Widget CSS — Bombas Pump
 * Sistema de diseño: variables Bricks + tokens propios del proyecto
 *
 * Pegar en: Bricks → Settings → Custom Code → CSS
 * O en: WordPress Admin → Apariencia → CSS Adicional
 */

/* ── Variables locales mapeadas al sistema de diseño ────────────────────── */
.hl-widget,
[data-hl] {
  --hl-primary:     var(--primary, #1470B8);
  --hl-secondary:   var(--secondary, #1D1D1B);
  --hl-gray:        var(--gray, #95958D);
  --hl-border:      var(--light-gray, #F1F1F1);
  --hl-white:       var(--white, #FFFFFF);
  --hl-success:     #1a7a3c;
  --hl-success-bg:  #eaf4ee;
  --hl-radius:      5px;
  --hl-font:        inherit;
  --hl-text-s:      var(--text-s, 1.28rem);
  --hl-text-m:      var(--text-m, 1.6rem);
  --hl-p-xs:        var(--p-xs, 1.02rem);
  --hl-p-s:         var(--p-s, 1.28rem);
  --hl-p-m:         var(--p-m, 1.6rem);
}

/* ══════════════════════════════════════════════════════════════════════════
   WIDGET CONTENEDOR
══════════════════════════════════════════════════════════════════════════ */

.hl-widget {
  font-family: var(--hl-font);
  color: var(--hl-secondary);
  width: 100%;
}

/* ── Layout: formulario izquierda / resultados derecha ──────────────────── */
.hl-widget {
  display: grid;
  grid-template-columns: 360px 1fr;
  grid-template-rows: auto auto;
  gap: var(--hl-p-m);
  align-items: start;
}

.hl-widget__form       { grid-column: 1; grid-row: 1 / 3; }
.hl-widget__mensaje    { grid-column: 2; grid-row: 1; }
.hl-widget__resultados { grid-column: 2; grid-row: 2; }

/* ── Responsive: apilado en móvil ───────────────────────────────────────── */
@media (max-width: 768px) {
  .hl-widget {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .hl-widget__form,
  .hl-widget__mensaje,
  .hl-widget__resultados { grid-column: 1; grid-row: auto; }
}

/* ══════════════════════════════════════════════════════════════════════════
   FORMULARIO
══════════════════════════════════════════════════════════════════════════ */

.hl-widget__form {
  background: var(--hl-white);
  border: 1px solid var(--hl-border);
  border-radius: var(--hl-radius);
  padding: var(--hl-p-m);
  display: flex;
  flex-direction: column;
  gap: var(--hl-p-s);
}

/* Campos */
.hl-form__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hl-form__field label {
  font-size: var(--hl-text-s);
  font-weight: 500;
  color: var(--hl-secondary);
}

.hl-form__field input[type="number"],
.hl-form__field input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--hl-border);
  border-radius: var(--hl-radius);
  padding: var(--hl-p-xs) var(--hl-p-s);
  font-size: var(--hl-text-m);
  font-family: var(--hl-font);
  color: var(--hl-secondary);
  background: var(--hl-white);
  transition: border-color 0.2s;
  -moz-appearance: textfield;
}

.hl-form__field input[type="number"]::-webkit-outer-spin-button,
.hl-form__field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.hl-form__field input:focus {
  outline: none;
  border-color: var(--hl-primary);
}

/* Campo frase */
.hl-widget__frase label {
  font-size: var(--hl-text-s);
  font-weight: 500;
  color: var(--hl-secondary);
  display: block;
  margin-bottom: 6px;
}

.hl-frase {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--hl-border);
  border-radius: var(--hl-radius);
  padding: var(--hl-p-xs) var(--hl-p-s);
  font-size: var(--hl-text-m);
  font-family: var(--hl-font);
  color: var(--hl-secondary);
  background: var(--hl-white);
  transition: border-color 0.2s;
}

.hl-frase:focus { outline: none; border-color: var(--hl-primary); }

/* Separador entre frase y campos numéricos */
.hl-widget__params {
  display: flex;
  flex-direction: column;
  gap: var(--hl-p-s);
}

/* Botón calcular */
.hl-btn-calcular {
  width: 100%;
  padding: var(--hl-p-s) var(--hl-p-m);
  background: var(--hl-primary);
  color: var(--hl-white);
  border: none;
  border-radius: var(--hl-radius);
  font-size: var(--hl-text-m);
  font-family: var(--hl-font);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: var(--hl-p-xs);
}

.hl-btn-calcular:hover   { filter: brightness(1.1); }
.hl-btn-calcular:active  { transform: scale(0.98); }
.hl-btn-calcular:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ══════════════════════════════════════════════════════════════════════════
   MENSAJES DE ESTADO
══════════════════════════════════════════════════════════════════════════ */

.hl-widget__mensaje {
  font-size: var(--hl-text-s);
  padding: var(--hl-p-xs) var(--hl-p-s);
  border-radius: var(--hl-radius);
  min-height: 0;
  transition: all 0.2s;
}

.hl-widget__mensaje:empty { display: none; }

.hl-mensaje--cargando {
  color: var(--hl-gray);
  background: transparent;
}

.hl-mensaje--ok {
  color: var(--hl-success);
  background: var(--hl-success-bg);
  border: 1px solid #b7dfc4;
}

.hl-mensaje--warn {
  color: #7a5a00;
  background: #fffbe6;
  border: 1px solid #ffe566;
}

.hl-mensaje--error {
  color: #8b1a1a;
  background: #fdf0f0;
  border: 1px solid #f5c0c0;
}

/* ══════════════════════════════════════════════════════════════════════════
   RESULTADOS — GRID DE CARDS
══════════════════════════════════════════════════════════════════════════ */

.hl-widget__resultados { width: 100%; }

.hl-cards {
  display: flex;
  flex-direction: column;
  gap: var(--hl-p-s);
}

/* ══════════════════════════════════════════════════════════════════════════
   CARD DE RESULTADO
══════════════════════════════════════════════════════════════════════════ */

.hl-card {
  background: var(--hl-white);
  border: 1px solid var(--hl-border);
  border-radius: var(--hl-radius);
  overflow: hidden;
  display: grid;
  grid-template-columns: 160px 1fr;
  grid-template-rows: auto 1fr auto;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.hl-card:hover {
  border-color: var(--hl-primary);
  box-shadow: 0 2px 12px rgba(20, 112, 184, 0.08);
}

/* Primera card: mejor ajuste */
.hl-card--best {
  border-color: var(--hl-success);
  border-width: 2px;
}

.hl-card--best:hover {
  border-color: var(--hl-success);
  box-shadow: 0 2px 12px rgba(26, 122, 60, 0.1);
}

/* Badge "Mejor ajuste" */
.hl-badge--best {
  grid-column: 1 / -1;
  background: var(--hl-success);
  color: var(--hl-white);
  font-size: var(--text-2xs, 0.82rem);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px var(--hl-p-s);
  display: block;
}

/* Imagen / placeholder */
.hl-card__img {
  grid-column: 1;
  grid-row: 2;
  width: 100%;
  height: 100%;
  min-height: 160px;
  object-fit: contain;
  padding: var(--hl-p-s);
  background: #f8f9fa;
  border-right: 1px solid var(--hl-border);
  box-sizing: border-box;
  display: block;
}

.hl-card__img--placeholder {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  background: #f8f9fa;
  border-right: 1px solid var(--hl-border);
}

.hl-card__img--placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.25;
}

/* Cuerpo */
.hl-card__body {
  grid-column: 2;
  grid-row: 2;
  padding: var(--hl-p-s) var(--hl-p-m);
  display: flex;
  flex-direction: column;
  gap: var(--hl-p-xs);
}

.hl-card__name {
  font-size: var(--hl-text-m);
  font-weight: 700;
  color: var(--hl-secondary);
  margin: 0;
  line-height: 1.2;
}

.hl-card__desc {
  font-size: var(--hl-text-s);
  color: var(--hl-gray);
  margin: 0;
  line-height: 1.4;
}

/* Specs en lista horizontal */
.hl-card__specs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--hl-p-xs) var(--hl-p-m);
}

.hl-card__specs li {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hl-label {
  font-size: var(--text-2xs, 0.82rem);
  color: var(--hl-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hl-value {
  font-size: var(--hl-text-s);
  font-weight: 500;
  color: var(--hl-secondary);
}

.hl-value--margin { color: var(--hl-success); }

/* Footer con CTA */
.hl-card__footer {
  grid-column: 1 / -1;
  grid-row: 3;
  padding: var(--hl-p-xs) var(--hl-p-m);
  border-top: 1px solid var(--hl-border);
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.hl-card__footer {
  grid-column: 1 / -1;
  padding: var(--hl-p-xs) var(--hl-p-m);
  border-top: 1px solid var(--hl-border);
  display: flex;
  gap: var(--hl-p-xs);
  align-items: center;
  justify-content: flex-end;
}

.hl-card__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none !important;
  padding: var(--hl-p-xs) var(--hl-p-s);
  border-radius: var(--hl-radius);
  font-size: var(--hl-text-s);
  font-weight: 500;
  font-family: var(--hl-font);
  transition: all 0.3s;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

/* Botón primario — Añadir al carrito */
.hl-card__btn--primary {
  background: var(--hl-primary);
  color: var(--hl-white) !important;
  flex: 1;
  justify-content: center;
}

.hl-card__btn--primary:hover { filter: brightness(1.1); }

/* Botón secundario — Ver producto */
.hl-card__btn--secondary {
  background: transparent;
  color: var(--hl-secondary) !important;
  border: 1px solid var(--hl-border);
  flex-shrink: 0;
}

.hl-card__btn--secondary:hover {
  border-color: var(--hl-primary);
  color: var(--hl-primary) !important;
}

/* ── Sin resultados ─────────────────────────────────────────────────────── */
.hl-no-results {
  background: #fffbe6;
  border: 1px solid #ffe566;
  border-radius: var(--hl-radius);
  padding: var(--hl-p-m);
  font-size: var(--hl-text-s);
  color: var(--hl-secondary);
}

/* ── Error ──────────────────────────────────────────────────────────────── */
.hl-error {
  background: #fdf0f0;
  border: 1px solid #f5c0c0;
  border-radius: var(--hl-radius);
  padding: var(--hl-p-m);
  font-size: var(--hl-text-s);
  color: #8b1a1a;
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE CARDS
══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  .hl-card {
    grid-template-columns: 90px 1fr;
  }
  .hl-card__img,
  .hl-card__img--placeholder {
    min-height: 90px;
  }
  .hl-card__specs {
    flex-direction: column;
    gap: 6px;
  }
}
