/* ZihWeb Directory - listado de negocios (colocar en lib/directory.css)
   Prefijo .zwd- para no chocar con Bootstrap 3. Hereda el color de texto y el fondo del sitio:
   funciona igual en plantillas claras u oscuras. */

.zwd-list, .zwd-profile, .zwd-pager {
  --zwd-line: rgba(127, 127, 127, .3);
  --zwd-soft: rgba(127, 127, 127, .07);
  --zwd-accent: #d97706;
  --zwd-radius: 14px;
}
.zwd-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
  padding: 0;
}

/* ---------- Tarjeta ---------- */
.zwd-card {
  position: relative;               /* el enlace del nombre cubre toda la tarjeta */
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--zwd-line);
  border-radius: var(--zwd-radius);
  background: var(--zwd-soft);
  transition: box-shadow .15s ease;
}
.zwd-card:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .14); }
@media (prefers-reduced-motion: no-preference) {
  .zwd-card { transition: box-shadow .15s ease, transform .15s ease; }
  .zwd-card:hover { transform: translateY(-2px); }
}
.zwd-card[data-premium="1"],
.zwd-card[data-premium="2"],
.zwd-card[data-premium="3"],
.zwd-card[data-premium="4"],
.zwd-card[data-premium="5"] { border-top: 3px solid var(--zwd-accent); }

/* ---------- Logo / inicial ---------- */
.zwd-card .zwd-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: rgba(127, 127, 127, .12);
  text-decoration: none;
}
.zwd-logo img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
}
.zwd-logo--empty {
  background: hsl(var(--h, 200) 42% 30%);   /* un color estable por negocio; texto blanco con contraste AA */
  color: #fff;
}
.zwd-logo--empty span {
  font-size: 3.25rem;
  font-weight: 300;
  line-height: 1;
}

/* ---------- Cuerpo ---------- */
.zwd-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: .5rem;
  padding: .9rem 1rem;
}
.zwd-card .zwd-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.zwd-name a::after {                /* tarjeta completa clicable */
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
}
/* g.css define .ndn { font-size: 1.3em; font-weight: bold }: aquí el tamaño lo manda el título */
.zwd-card .ndn { font-size: inherit; font-weight: inherit; }
/* g.css ya no fuerza a { text-decoration: none !important }: el nombre se subraya al pasar el cursor */
.zwd-name a:hover { text-decoration: underline; text-underline-offset: .15em; }

.zwd-badge {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 999px;
  background: #b45309;              /* blanco sobre #b45309: contraste 5:1 */
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1.4;
  vertical-align: middle;
}
.zwd-badge--upd { background: #0b6a8f; }

.zwd-card .zwd-where {
  display: flex;
  gap: .4rem;
  margin: 0;
  font-size: .9rem;
  opacity: .85;
}
.zwd-i {
  flex: none;
  width: 1em;
  height: 1em;
  margin-top: .2em;
  fill: currentColor;
}

/* Etiquetas de categoría: chips con contorno (sustituyen el .label azul de Bootstrap) */
.zwd-tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.zwd-tags:empty, .zwd-meta:empty { display: none; }
.zwd-tags .label {
  display: inline-block;
  padding: .2rem .65rem;
  border: 1px solid var(--zwd-line);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: .78rem;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
}
.zwd-tags .label:hover { border-color: currentColor; }
.zwd-tags .glyphicon { display: none; }

.zwd-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .9rem;
  font-size: .9rem;
}

/* Lo interactivo va por encima del enlace que cubre la tarjeta */
.zwd-tags, .zwd-meta, .zwd-foot, .zwd-admin, .zwd-where a { position: relative; z-index: 1; }

/* ---------- Pie ---------- */
.zwd-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .55rem 1rem;
  border-top: 1px solid var(--zwd-line);
  font-size: .85rem;
}
.zwd-stats { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; opacity: .85; }
.zwd-views { display: inline-flex; align-items: center; gap: .3rem; }
.zwd-views .zwd-i { margin-top: 0; }
.zwd-short { margin-left: auto; opacity: .75; }

.zwd-admin {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .75rem;
  padding: .5rem 1rem;
  border-top: 1px dashed var(--zwd-line);
  font-size: .8rem;
}

/* ---------- Banner publicitario: ocupa todo el ancho de la cuadrícula ---------- */
.zwd-banner { grid-column: 1 / -1; text-align: center; }

/* ---------- Accesibilidad ---------- */
.zwd-card a:focus-visible {
  outline: 3px solid var(--g-accent, #0b6fd6);
  outline-offset: 2px;
  border-radius: 4px;
}
.zwd-card:focus-within { box-shadow: 0 0 0 2px var(--g-accent, #0b6fd6); }

/* ============================================================
   Paginación  (nav.zwd-pager)
   ============================================================ */
.zwd-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1rem;
  margin: 1.5rem 0;
}
.zwd-pager .zwd-pager-info { margin: 0; font-size: .85rem; opacity: .8; }
.zwd-pager ul { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.zwd-pager li { margin: 0; padding: 0; }
.zwd-pager a, .zwd-pager [aria-current] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 .65rem;
  border: 1px solid var(--zwd-line);
  border-radius: 10px;
  color: inherit;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.zwd-pager a:hover { border-color: currentColor; background: var(--zwd-soft); }
.zwd-pager a:focus-visible { outline: 3px solid var(--g-accent, #0b6fd6); outline-offset: 2px; }
.zwd-pager [aria-current="page"] {
  border-color: var(--g-accent, #0b6fd6);
  background: var(--g-accent, #0b6fd6);   /* acento del tema (g.css); fallback azul: blanco encima 4.9:1 */
  color: #fff;
  font-weight: 700;
}
.zwd-pager .zwd-gap { display: flex; align-items: center; padding: 0 .25rem; opacity: .6; }

/* ============================================================
   Ficha del negocio  (section.zwd-profile)
   ============================================================ */
.zwd-profile .zwd-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  margin: 0 0 1.25rem;
}
.zwd-hero-logo {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 9.5rem;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--zwd-line);
  border-radius: var(--zwd-radius);
  background: rgba(127, 127, 127, .08);
}
.zwd-hero-logo img { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; }
.zwd-hero-main { flex: 1; min-width: 14rem; }
.zwd-profile .zwd-title {
  margin: 0 0 .6rem;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.zwd-facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; margin: 0 0 1.5rem; }
@media (min-width: 48rem) {
  .zwd-facts { grid-template-columns: minmax(0, 2fr) minmax(12rem, 1fr); align-items: start; }
}
.zwd-profile .zwd-dl { margin: 0; border-top: 1px solid var(--zwd-line); }
.zwd-profile .zwd-row {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: .75rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--zwd-line);
}
.zwd-profile .zwd-row dt { margin: 0; font-size: .9rem; font-weight: 400; opacity: .75; }
.zwd-profile .zwd-row dd { margin: 0; overflow-wrap: anywhere; }
.zwd-profile .zwd-row .form-group { margin-bottom: .25rem; }
@media (max-width: 30rem) {
  .zwd-profile .zwd-row { grid-template-columns: minmax(0, 1fr); gap: .15rem; }
}

.zwd-side {
  padding: 1rem;
  border: 1px solid var(--zwd-line);
  border-radius: var(--zwd-radius);
  background: var(--zwd-soft);
  text-align: center;
}
.zwd-side p { margin: .5rem 0 0; }
.zwd-qr { display: flex; justify-content: center; min-height: 160px; }
.zwd-qr img, .zwd-qr canvas { max-width: 100%; height: auto; }

.zwd-profile .zwd-admin { margin: 0 0 1.5rem; border: 1px dashed var(--zwd-line); border-radius: 10px; }

/* ---------- Store (directory_tienda.php) ---------- */
.zwt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));   /* 3 por fila; minmax(0,..) evita que un título largo ensanche la columna */
  gap: 1.25rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}
@media (max-width: 35.9rem) {              /* teléfonos: 3 columnas quedarían de ~110px */
  .zwt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
}
.zwt-card {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: .75rem .75rem 1rem;
  text-align: center;
  background: #fff;
  border: 1px solid var(--g-line);
  border-radius: 12px;
  transition: transform .25s var(--g-ease), box-shadow .25s var(--g-ease), border-color .25s;
}
@media (hover: hover) {
  .zwt-card:hover { transform: translateY(-3px); border-color: var(--g-accent); box-shadow: 0 12px 28px rgba(0, 0, 0, .1); }
}
.zwt-link { display: flex; flex: 1; flex-direction: column; gap: .5rem; color: var(--g-ink); }
.zwt-link:hover, .zwt-link:focus-visible { color: var(--g-ink); }
.zwt-link:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; border-radius: 8px; }
.zwt-img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #f0f0f0; }
.zwt-noimg { background: linear-gradient(135deg, #f0f0f0, #e2e2e2); }
.zwt-title {
  display: -webkit-box;
  min-height: 2.6em; /* two lines, so prices align across a row */
  margin: 0;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.zwt-price { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: .1rem .5rem; }
.zwt-now { font-size: 1.15em; font-weight: 700; }
.zwt-cur, .zwt-was { font-size: .85em; color: var(--g-faint); }
.zwt-add { align-self: stretch; }

/* WhatsApp order button (cards and product page). White on #157347 is 5.4:1. */
.zwt-wa { background: #157347; border-color: #146c43; color: #fff; font-weight: 600; }
.zwt-wa:hover, .zwt-wa:focus-visible { background: #0f5c37; border-color: #0d4f2f; color: #fff; text-decoration: none; }
.zwt-wa:focus-visible { outline: 3px solid var(--g-accent, #0b6fd6); outline-offset: 2px; }

.zwt-media { margin: 0 0 1rem; }
.zwt-media img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 12px; }
.zwt-meta { margin: 0 0 1rem; }
.zwt-price-lg { float: right; margin: 0 0 1rem 1rem; text-align: right; }
.zwt-price-lg .zwt-price { justify-content: flex-end; }
.zwt-price-lg .zwt-now { font-size: 2rem; }
.zwt-buy { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; clear: both; margin: 1rem 0; }
.zwt-qty { width: 5.5rem; }
.zwt-seller { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--g-line); }
.zwt-seller-logo { padding-top: 2rem; }
.zwt-comments { clear: both; margin-top: 2rem; }
.zwt-related { margin-top: 2.5rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}