/**
 * Buscador de Farmacia ASODI — estilos
 * Todo va bajo .af para no chocar con Oxygen ni con el tema.
 * Paleta tomada del sitio en produccion (asodi.cl).
 * Autor: Pablo Hayvard
 */

.af {
  --af-verde: #1f9a4a;
  --af-verde-osc: #05431b;
  --af-verde-claro: #eaf6ee;
  --af-texto: #333333;
  --af-suave: #6b6b6b;
  --af-crema: #fbf4f1;
  --af-naranja: #dc5401;
  --af-borde: #e4e4e4;
  --af-blanco: #ffffff;
  --af-radio: 14px;
  --af-sombra: 0 1px 2px rgba(5, 67, 27, .06), 0 6px 18px rgba(5, 67, 27, .07);

  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--af-texto);
  font-size: 17px;              /* base alta: publico mayoritariamente adulto mayor */
  line-height: 1.5;
  max-width: 980px;
  margin: 0 auto;
  padding-bottom: 96px;         /* espacio para la barra flotante */
  box-sizing: border-box;
}
.af *, .af *::before, .af *::after { box-sizing: inherit; }

/* Cualquier display del tema (o de este mismo archivo, como .af-mas) le gana
   al [hidden] del navegador, y lo "oculto" se sigue viendo. */
.af [hidden] { display: none !important; }

.af-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- buscador ---------- */

.af-buscador {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  margin: 0 0 18px;
}

.af-campo {
  position: relative; flex: 1 1 320px; display: flex; align-items: center;
}

.af-lupa {
  position: absolute; left: 18px; width: 22px; height: 22px;
  fill: var(--af-verde); pointer-events: none;
}

.af-campo input[type="search"] {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  padding: 16px 46px 16px 52px;
  border: 2px solid var(--af-borde);
  border-radius: 999px;
  background: var(--af-blanco);
  color: var(--af-texto);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.af-campo input[type="search"]::-webkit-search-cancel-button { display: none; }
.af-campo input[type="search"]::placeholder { color: #9a9a9a; }
.af-campo input[type="search"]:focus {
  outline: none;
  border-color: var(--af-verde);
  box-shadow: 0 0 0 4px rgba(31, 154, 74, .16);
}

.af-limpiar {
  position: absolute; right: 12px;
  width: 30px; height: 30px; line-height: 1;
  font-size: 24px; color: var(--af-suave);
  background: transparent; border: 0; border-radius: 50%; cursor: pointer;
}
.af-limpiar:hover { background: var(--af-crema); color: var(--af-texto); }

.af-toggle {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: .95rem; color: var(--af-suave); cursor: pointer; user-select: none;
  padding: 6px 0;
}
.af-toggle input { width: 20px; height: 20px; accent-color: var(--af-verde); cursor: pointer; margin: 0; }

/* ---------- estado / contadores ---------- */

.af-estado {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: baseline; gap: 6px 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--af-borde); margin-bottom: 16px;
}
.af-cuenta { margin: 0; font-weight: 600; font-size: .95rem; color: var(--af-verde-osc); }
.af-actualizado { margin: 0; font-size: .85rem; color: var(--af-suave); }

.af-difuso {
  margin: 0 0 16px; padding: 12px 16px;
  background: #fff6ed; border-left: 4px solid var(--af-naranja);
  border-radius: 0 8px 8px 0; font-size: .92rem; color: #7a3200;
}

/* ---------- tarjetas ---------- */

.af-grid { display: grid; gap: 12px; }

.af-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "check main precio" ". acciones acciones";
  align-items: center;
  gap: 8px 16px;
  padding: 16px 20px;
  background: var(--af-blanco);
  border: 1px solid var(--af-borde);
  border-radius: var(--af-radio);
  box-shadow: var(--af-sombra);
  transition: border-color .15s, transform .15s;
}
.af-card:hover { border-color: #c8e3d1; }
.af-card--agotado { background: #fafafa; }
.af-card--agotado .af-card__nombre,
.af-card--agotado .af-precio { color: var(--af-suave); }

.af-check { grid-area: check; display: flex; align-items: center; cursor: pointer; }
.af-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.af-check__box {
  width: 24px; height: 24px; border: 2px solid #cfcfcf; border-radius: 7px;
  display: block; transition: all .15s; position: relative;
}
.af-check input:checked + .af-check__box {
  background: var(--af-verde); border-color: var(--af-verde);
}
.af-check input:checked + .af-check__box::after {
  content: ''; position: absolute; left: 7px; top: 3px;
  width: 5px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.af-check input:focus-visible + .af-check__box {
  box-shadow: 0 0 0 4px rgba(31, 154, 74, .25);
}

.af-card__main { grid-area: main; min-width: 0; }
.af-card__nombre {
  margin: 0 0 5px; font-size: 1.02rem; font-weight: 600; line-height: 1.35;
  color: var(--af-verde-osc);
}
.af-card__nombre mark { background: #fff3b0; color: inherit; padding: 0 1px; border-radius: 3px; }

.af-card__meta { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.af-cod { font-size: .82rem; color: var(--af-suave); }
.af-cod b { font-weight: 600; font-variant-numeric: tabular-nums; color: #555; }

.af-badge {
  display: inline-block; font-size: .76rem; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; letter-spacing: .01em;
}
.af-badge--si   { background: var(--af-verde-claro); color: #14712f; }
.af-badge--poco { background: #fff1e2; color: #a24000; }
.af-badge--no   { background: #f1f1f1; color: #757575; }

.af-card__precio { grid-area: precio; text-align: right; white-space: nowrap; }
.af-precio {
  display: block; font-size: 1.3rem; font-weight: 700; color: var(--af-verde-osc);
  font-variant-numeric: tabular-nums;
}
.af-precio__nota { display: block; font-size: .72rem; color: var(--af-suave); margin-top: 1px; }

.af-card__acciones { grid-area: acciones; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- botones ---------- */

.af-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px;                          /* objetivo tactil comodo */
  padding: 9px 18px;
  font: inherit; font-size: .9rem; font-weight: 600;
  border: 1.5px solid transparent; border-radius: 999px;
  text-decoration: none; cursor: pointer; transition: all .15s;
  white-space: nowrap;              /* nunca partir la etiqueta a media palabra */
}
.af-btn svg { width: 17px; height: 17px; fill: currentColor; flex: none; }
.af-btn--wa { background: var(--af-verde); color: #fff; }
.af-btn--wa:hover, .af-btn--wa:focus { background: #17803c; color: #fff; }
.af-btn--mail { background: #fff; color: var(--af-verde-osc); border-color: #cfe4d6; }
.af-btn--mail:hover, .af-btn--mail:focus { background: var(--af-verde-claro); border-color: var(--af-verde); }
.af-btn:focus-visible { outline: 3px solid rgba(31, 154, 74, .45); outline-offset: 2px; }

.af-mas {
  display: block; width: 100%; margin: 20px 0 0;
  padding: 14px; font: inherit; font-weight: 600; font-size: .95rem;
  color: var(--af-verde-osc); background: var(--af-crema);
  border: 1px solid var(--af-borde); border-radius: var(--af-radio); cursor: pointer;
}
.af-mas:hover { background: var(--af-verde-claro); border-color: #c8e3d1; }

/* ---------- vacio ---------- */

.af-vacio {
  text-align: center; padding: 44px 24px;
  background: var(--af-crema); border-radius: var(--af-radio);
}
.af-vacio__t { margin: 0 0 8px; font-size: 1.05rem; font-weight: 600; color: var(--af-verde-osc); }
.af-vacio__s { margin: 0 auto 22px; max-width: 46ch; font-size: .92rem; color: var(--af-suave); }
.af-vacio__a { margin: 0; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- legal ---------- */

.af-legal {
  margin: 32px 0 0; padding-top: 18px; border-top: 1px solid var(--af-borde);
  font-size: .8rem; line-height: 1.6; color: var(--af-suave);
}

/* ---------- barra de seleccion ---------- */

.af-barra {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 999;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px;
  width: calc(100% - 32px); max-width: 760px;
  padding: 12px 20px;
  background: var(--af-verde-osc); color: #fff;
  border-radius: 999px;
  box-shadow: 0 10px 34px rgba(5, 67, 27, .32);
}
.af-barra[hidden] { display: none; }
.af-barra__n { font-size: .92rem; font-weight: 600; flex: 1 1 auto; }
.af-barra__acc { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.af-barra .af-btn--mail { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .45); }
.af-barra .af-btn--mail:hover { background: rgba(255, 255, 255, .14); border-color: #fff; }
.af-barra__x {
  background: none; border: 0; color: rgba(255, 255, 255, .8);
  font: inherit; font-size: .85rem; text-decoration: underline;
  cursor: pointer; padding: 8px;
}
.af-barra__x:hover { color: #fff; }

/* ---------- movil ---------- */

@media (max-width: 720px) {
  .af { font-size: 16px; padding-bottom: 130px; }
  .af-buscador { gap: 10px; }
  .af-campo { flex: 1 1 100%; }

  .af-card {
    grid-template-columns: auto 1fr;
    grid-template-areas: "check main" ". precio" ". acciones";
    padding: 14px 16px; gap: 10px 12px;
  }
  .af-card__precio { text-align: left; }
  .af-precio { font-size: 1.22rem; }
  .af-card__acciones { width: 100%; }
  .af-btn { flex: 1 1 0; }

  .af-barra { border-radius: 18px; padding: 12px 16px; bottom: 12px; }
  .af-barra__n { flex: 1 1 100%; }
  .af-barra__acc { width: 100%; gap: 6px; }
  .af-barra__acc .af-btn { flex: 1 1 0; padding: 9px 10px; }
  .af-barra__x { flex: 0 0 auto; padding: 8px 4px; }

  /* En pantalla angosta el boton dice solo "WhatsApp". */
  .af-ancho { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .af * { transition: none !important; }
}
