/* ldm-styles.css — Mes Mundial de la Diabetes, Farmacias YZA
   Guía visual: mismos tokens que las landings de yza.mx
   Prefijo ldm- en todas las clases · Mobile-first · Break: 768px
*/

/* =====================================================
   VARIABLES — tokens YZA
   ===================================================== */
:root {
  /* Colores de marca YZA */
  --ldm-azul:          #005FC0;   /* YZA Medium Blue — principal     */
  --ldm-azul-med:      #004FA3;   /* hover / oscuro                  */
  --ldm-azul-claro:    #B7E3FF;   /* YZA Baby Blue                   */
  --ldm-blanco:        #ffffff;
  --ldm-gris-bg:       #F0F5FB;   /* fondo secciones — tinte azul    */
  --ldm-gris-card:     #EAF1F9;   /* fondo filas alternas            */
  --ldm-gris-borde:    #C2D4E8;   /* bordes — azul desaturado        */
  --ldm-texto:         #0D1A2E;   /* texto — azul casi negro         */
  --ldm-texto-muted:   #4A607A;   /* texto secundario — azul gris    */

  /* Escala de azules para tipos de promo */
  --ldm-azul-p1:       #001845;   /* precio especial — azul profundo */
  --ldm-azul-p2:       #005FC0;   /* lealtad — brand blue            */
  --ldm-azul-p3:       #2B85D4;   /* descuento PMP — azul medio      */
  --ldm-azul-p4:       #003F8A;   /* tarjeta apego — azul oscuro     */
  --ldm-azul-p5:       #7AAAC8;   /* sin promo — azul apagado        */

  /* Tipografía */
  --ldm-font:          'DM Sans', Arial, Helvetica, sans-serif;

  /* Espaciado (sistema 8 px) */
  --ldm-sp1:  8px;
  --ldm-sp2:  16px;
  --ldm-sp3:  24px;
  --ldm-sp4:  32px;
  --ldm-sp5:  40px;
  --ldm-sp6:  48px;

  /* Forma */
  --ldm-radius:   4px;
  --ldm-radius-sm: 2px;
  --ldm-radius-pill: 4px;

  /* Sombras */
  --ldm-shadow-sm: 0 1px 4px rgba(0,36,139,.08), 0 1px 2px rgba(0,0,0,.06);
  --ldm-shadow-md: 0 4px 16px rgba(0,36,139,.10);

  /* Transición */
  --ldm-t: 0.2s ease;
}

/* =====================================================
   RESET SCOPED
   ===================================================== */
.ldm-root *,
.ldm-root *::before,
.ldm-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.ldm-root {
  font-family: var(--ldm-font);
  color: var(--ldm-texto);
  background-color: var(--ldm-gris-bg);
  line-height: 1.55;
}

/* Accesibilidad: visually hidden */
.ldm-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Foco visible consistente con YZA */
.ldm-root *:focus-visible {
  outline: 2px solid var(--ldm-azul-med);
  outline-offset: 2px;
  border-radius: 0;
}

[hidden] { display: none !important; }

/* =====================================================
   CONTAINER
   ===================================================== */
.ldm-container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--ldm-sp2);
  padding-right: var(--ldm-sp2);
}

/* =====================================================
   BANNER
   Mobile  : aspect-ratio 1/1 (960×960 px)
   Desktop : aspect-ratio 2500/650
   ===================================================== */
.ldm-banner {
  width: 100%;
  aspect-ratio: 1 / 1;
  /* PLACEHOLDER: reemplaza con URL de imagen mobile (960×960 px) */
  background-image: url('https://image.farmaciasyza.mx/lib/fe2f117171640675761075/m/1/1a4020cb-b6aa-4b6a-84a2-0b34f7a2fb87.png');
  background-color: var(--ldm-azul-claro);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}

@media (min-width: 768px) {
  .ldm-banner {
    aspect-ratio: 2500 / 650;
    /* PLACEHOLDER: reemplaza con URL de imagen desktop (2500×650 px) */
    background-image: url('https://image.farmaciasyza.mx/lib/fe2f117171640675761075/m/1/aceba0ba-36bd-4cde-8f62-7486a4631ed5.png');
    background-position: center center;
  }
}

/* =====================================================
   CARRUSEL SECUNDARIO
   Imágenes 5209×1338 px · rotación automática · sin links
   ===================================================== */
.ldm-carrusel-section {
  background-color: var(--ldm-gris-bg);
  padding: var(--ldm-sp3) 0 var(--ldm-sp2);
}

.ldm-carrusel {
  position: relative;
  overflow: hidden;
  border-radius: var(--ldm-radius);
  box-shadow: var(--ldm-shadow-sm);
  background-color: var(--ldm-azul-claro);
  aspect-ratio: 5209 / 1338;
  touch-action: pan-y;
}

.ldm-carrusel-track {
  display: flex;
  height: 100%;
  transition: transform 0.6s ease;
  will-change: transform;
}

.ldm-carrusel-slide {
  flex: 0 0 100%;
  height: 100%;
}

.ldm-carrusel-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
}

.ldm-carrusel-flecha {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background-color: rgba(255,255,255,.85);
  color: var(--ldm-azul);
  box-shadow: var(--ldm-shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--ldm-t), color var(--ldm-t);
}

.ldm-carrusel-flecha:hover {
  background-color: var(--ldm-azul);
  color: var(--ldm-blanco);
}

.ldm-carrusel-flecha--prev { left: var(--ldm-sp1); }
.ldm-carrusel-flecha--next { right: var(--ldm-sp1); }

@media (max-width: 767px) {
  .ldm-carrusel-flecha { width: 28px; height: 28px; }
  .ldm-carrusel-flecha svg { width: 16px; height: 16px; }
  .ldm-carrusel-flecha--prev { left: 4px; }
  .ldm-carrusel-flecha--next { right: 4px; }
}

.ldm-carrusel-dots {
  display: flex;
  justify-content: center;
  gap: var(--ldm-sp1);
  margin-top: 12px;
}

.ldm-carrusel-dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background-color: var(--ldm-gris-borde);
  cursor: pointer;
  transition: background-color var(--ldm-t), width var(--ldm-t);
}

.ldm-carrusel-dot[aria-current="true"] {
  width: 24px;
  border-radius: 5px;
  background-color: var(--ldm-azul);
}

@media (prefers-reduced-motion: reduce) {
  .ldm-carrusel-track { transition: none; }
}

/* =====================================================
   BUSCADOR
   ===================================================== */
.ldm-buscador-section {
  background-color: var(--ldm-blanco);
  padding: var(--ldm-sp4) 0 var(--ldm-sp3);
  border-bottom: 1px solid var(--ldm-gris-borde);
}

/* Search input */
.ldm-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: var(--ldm-sp2);
}

.ldm-search-label {
  position: absolute;
  left: 0;
  pointer-events: none;
}

.ldm-search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ldm-azul);
  display: flex;
  pointer-events: none;
  z-index: 1;
}

.ldm-search-input {
  width: 100%;
  max-width: 580px;
  height: 44px;
  padding: 0 46px 0 46px;
  border: 1px solid var(--ldm-gris-borde);
  border-radius: var(--ldm-radius);
  font-family: var(--ldm-font);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ldm-texto);
  background-color: var(--ldm-blanco);
  transition: border-color var(--ldm-t), box-shadow var(--ldm-t);
  -webkit-appearance: none;
  appearance: none;
}

.ldm-search-input:focus {
  outline: none;
  border-color: var(--ldm-azul);
  box-shadow: 0 0 0 3px rgba(0,36,139,.12);
}

.ldm-search-input::placeholder {
  color: var(--ldm-texto-muted);
  font-weight: 400;
}

.ldm-search-input::-webkit-search-cancel-button { display: none; }

.ldm-search-clear {
  position: absolute;
  right: calc(100% - 580px + 14px);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--ldm-texto-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--ldm-t), background-color var(--ldm-t);
}

@media (max-width: 620px) {
  .ldm-search-clear { right: 10px; }
}

.ldm-search-clear:hover {
  color: var(--ldm-azul);
  background-color: var(--ldm-gris-bg);
}

/* =====================================================
   CHIPS / FILTROS
   ===================================================== */
.ldm-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ldm-sp1);
  margin-bottom: var(--ldm-sp2);
}

.ldm-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 12px;
  border-radius: 0;
  font-family: var(--ldm-font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--ldm-gris-borde);
  background-color: var(--ldm-blanco);
  color: var(--ldm-texto-muted);
  transition: background-color var(--ldm-t), color var(--ldm-t), border-color var(--ldm-t);
  white-space: nowrap;
}

.ldm-chip:hover {
  border-color: var(--ldm-azul);
  color: var(--ldm-azul);
  background-color: rgba(0,36,139,.04);
}

.ldm-chip[aria-pressed="true"] {
  background-color: var(--ldm-azul);
  border-color: var(--ldm-azul);
  color: var(--ldm-blanco);
}

.ldm-chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 700;
  color: inherit;
  opacity: .75;
}

/* =====================================================
   CONTADOR
   ===================================================== */
.ldm-contador {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ldm-texto-muted);
  min-height: 1.4em;
}

/* =====================================================
   RESULTADOS
   ===================================================== */
.ldm-resultados {
  padding: var(--ldm-sp3) 0 var(--ldm-sp6);
  background-color: var(--ldm-gris-bg);
}

/* =====================================================
   TABLA — DESKTOP
   ===================================================== */
.ldm-tabla-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 72vh;
  border-radius: var(--ldm-radius);
  box-shadow: var(--ldm-shadow-md);
  margin-top: var(--ldm-sp3);
}

.ldm-tabla {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--ldm-blanco);
  font-size: 0.9rem;
}

/* Sticky header */
.ldm-tabla-head {
  position: sticky;
  top: 0;
  z-index: 10;
}

.ldm-th {
  background-color: var(--ldm-azul);
  color: var(--ldm-blanco);
  font-family: var(--ldm-font);
  font-weight: 700;
  font-size: 0.8rem;
  text-align: left;
  padding: 13px var(--ldm-sp2);
  white-space: nowrap;
  letter-spacing: .02em;
}

.ldm-th:first-child { border-radius: 0; }
.ldm-th:last-child  { border-radius: 0; }

.ldm-th--codigo   { width: 148px; }
.ldm-th--producto { min-width: 220px; }
.ldm-th--promo    { min-width: 210px; }
.ldm-th--piezas   { width: 110px; }
.ldm-th--vigencia { width: 170px; }

.ldm-tabla-body tr {
  border-bottom: 1px solid var(--ldm-gris-borde);
  transition: background-color 0.1s;
}

.ldm-tabla-body tr:last-child { border-bottom: none; }

.ldm-tabla-body tr:nth-child(even) {
  background-color: var(--ldm-gris-card);
}

.ldm-tabla-body tr:hover {
  background-color: rgba(0,36,139,.05);
}

.ldm-td {
  padding: 11px var(--ldm-sp2);
  vertical-align: middle;
}

.ldm-td--codigo {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  color: var(--ldm-texto-muted);
  white-space: nowrap;
}

.ldm-td--producto {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--ldm-azul);
}

.ldm-td--vigencia {
  font-size: 0.82rem;
  color: var(--ldm-texto-muted);
  white-space: nowrap;
}

/* =====================================================
   BADGES DE PROMOCIÓN
   ===================================================== */
.ldm-promo-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.ldm-promo-badge {
  display: inline-block;
  padding: 0 0 0 9px;
  border: none;
  border-left: 3px solid;
  background: none;
  font-family: var(--ldm-font);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .01em;
}

.ldm-promo-badge--precio-especial {
  color: var(--ldm-azul-p1);
  border-left-color: var(--ldm-azul-p1);
}

.ldm-promo-badge--lealtad {
  color: var(--ldm-azul-p2);
  border-left-color: var(--ldm-azul-p2);
}

.ldm-promo-badge--descuento-pmp {
  color: var(--ldm-azul-p3);
  border-left-color: var(--ldm-azul-p3);
}

.ldm-promo-badge--tarjeta-apego {
  color: var(--ldm-azul-p4);
  border-left-color: var(--ldm-azul-p4);
}

.ldm-promo-badge--sin-promo {
  border-left: none;
  padding-left: 0;
  color: var(--ldm-azul-p5);
  font-weight: 400;
}

.ldm-promo-sep {
  font-size: 0.72rem;
  color: var(--ldm-texto-muted);
  font-weight: 400;
  padding-left: 12px;
  line-height: 1;
}

/* =====================================================
   BADGE PIEZAS GRATIS
   ===================================================== */
.ldm-piezas-badge {
  display: inline-block;
  font-family: var(--ldm-font);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ldm-azul);
  white-space: nowrap;
  padding: 0 0 0 9px;
  border-left: 3px solid var(--ldm-azul);
  background: none;
}

/* =====================================================
   HINT / TOOLTIP (tarjeta cuídate / apego)
   ===================================================== */
.ldm-hint-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.ldm-hint-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 1px 4px;
  color: var(--ldm-azul-med);
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  border-radius: var(--ldm-radius-sm);
  line-height: 1;
  font-family: var(--ldm-font);
  font-weight: 700;
  transition: color var(--ldm-t);
}

.ldm-hint-btn:hover { color: var(--ldm-azul); }

.ldm-hint-tooltip {
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--ldm-azul);
  color: var(--ldm-blanco);
  font-family: var(--ldm-font);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 0;
  white-space: normal;
  max-width: 200px;
  text-align: center;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--ldm-t);
  z-index: 200;
  box-shadow: var(--ldm-shadow-sm);
}

.ldm-hint-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--ldm-azul);
}

.ldm-hint-wrap:hover .ldm-hint-tooltip,
.ldm-hint-wrap:focus-within .ldm-hint-tooltip {
  opacity: 1;
}

/* =====================================================
   BOTÓN (estado vacío)
   ===================================================== */
.ldm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 var(--ldm-sp3);
  border-radius: 0;
  font-family: var(--ldm-font);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color var(--ldm-t), color var(--ldm-t), border-color var(--ldm-t);
}

.ldm-btn--outline {
  background-color: transparent;
  color: var(--ldm-azul);
  border-color: var(--ldm-azul);
}
.ldm-btn--outline:hover {
  background-color: var(--ldm-azul);
  color: var(--ldm-blanco);
}

/* =====================================================
   ESTADO VACÍO
   ===================================================== */
.ldm-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--ldm-sp2);
  padding: var(--ldm-sp6) var(--ldm-sp2);
  text-align: center;
}

.ldm-empty-icon {
  color: var(--ldm-gris-borde);
}

.ldm-empty-msg {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ldm-texto-muted);
}

/* =====================================================
   MOBILE — tarjetas (< 768 px)
   ===================================================== */
@media (max-width: 767px) {

  .ldm-buscador-section {
    padding: var(--ldm-sp3) 0 var(--ldm-sp2);
  }

  .ldm-search-input {
    max-width: 100%;
    font-size: 0.95rem;
  }

  .ldm-filtros { gap: 6px; }

  .ldm-chip {
    font-size: 0.78rem;
    height: 32px;
    padding: 0 11px;
  }

  /* Tabla → lista de tarjetas */
  .ldm-tabla-wrap {
    overflow-x: visible;
    overflow-y: visible;
    max-height: none;
    box-shadow: none;
    background: none;
    margin-top: var(--ldm-sp2);
  }

  .ldm-tabla,
  .ldm-tabla tbody,
  .ldm-tabla tr,
  .ldm-tabla td {
    display: block;
    width: 100%;
  }

  .ldm-tabla-head {
    display: none;
  }

  .ldm-tabla-body tr {
    background-color: var(--ldm-blanco) !important;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 8px;
    padding: var(--ldm-sp2);
    border: 1px solid var(--ldm-gris-borde);
    border-left: 3px solid var(--ldm-azul);
  }

  .ldm-tabla-body tr:hover {
    border-color: var(--ldm-azul);
    background-color: var(--ldm-blanco) !important;
  }

  .ldm-td {
    padding: 4px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--ldm-sp1);
    border: none;
  }

  .ldm-td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--ldm-texto-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    min-width: 90px;
    flex-shrink: 0;
    padding-top: 2px;
  }

  /* Código: pequeño, sutil */
  .ldm-td--codigo {
    font-size: 0.72rem;
    color: var(--ldm-texto-muted);
    padding-bottom: 2px;
  }

  .ldm-td--codigo::before { min-width: 70px; }

  /* Producto: nombre como título de la tarjeta */
  .ldm-td--producto {
    font-size: 0.95rem;
    padding-top: 2px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ldm-gris-borde);
    margin-bottom: 2px;
  }

  .ldm-td--producto::before { display: none; }

  .ldm-td--promo    { align-items: flex-start; }
  .ldm-td--vigencia { white-space: normal; }

  /* En mobile: oculta la fila "Piezas gratis" cuando no aplica */
  .ldm-td.ldm-td--sin-piezas { display: none; }
}
