/* Catálogo de la página de inicio (ep-sync-products) */
:root {
  --ep-marca: #1b1b76;
  --ep-marca-suave: #e9e9f6;
  --ep-acento: #ca2b28;
  --ep-texto: #1f2430;
  --ep-texto-2: #5b6170;
  --ep-borde: #dfe1e8;
  --ep-fondo: #ffffff;
  --ep-fondo-2: #f4f5f8;
  --ep-radio: 10px;
  --ep-cabecera: 20px; /* margen al saltar a una sección (súbelo si la cabecera es fija) */
}

/* ---------- selector de provincia ---------- */
.ep-prov { max-width: 300px; }
.ep-prov .select-wrapper { position: relative; display: block; width: 100%; margin: 0; }
.ep-prov .categoria-producto {
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 46px; padding: 8px 34px 9px 34px !important;
  border: 1px solid #ced4da; border-radius: 7px !important;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%235b6170' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 12px center;
  font-size: 16px; color: var(--ep-texto); cursor: pointer;
}
.ep-prov .categoria-producto:focus-visible { outline: 2px solid var(--ep-marca); outline-offset: 2px; }
.ep-prov.is-ocupado .categoria-producto { opacity: .6; cursor: progress; }
.ep-prov.is-ocupado .select-icon { animation: ep-latido .9s ease-in-out infinite; }
.ep-modal__prov:disabled { cursor: progress; opacity: .6; }
.ep-prov .select-icon { position: absolute; top: 50%; left: 12px; transform: translateY(-45%); color: var(--ep-texto-2); pointer-events: none; line-height: 0; }

/* ---------- barra "Productos para entregar en ..." ---------- */
.ep-catalogo__barra {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  margin: 0 0 20px; padding: 12px 16px;
  background: var(--ep-marca-suave); border-radius: var(--ep-radio); color: var(--ep-texto);
}
.ep-catalogo__barra[hidden] { display: none; }
.ep-catalogo__envio strong { color: var(--ep-marca); }
.ep-catalogo__cambiar {
  background: none !important; border: 0; padding: 4px 0 !important;
  color: var(--ep-marca) !important; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

/* ---------- lista de etiquetas ---------- */
.etiquetas-productos { padding: 0; }
/* En escritorio la lista acompaña al scroll (sticky sobre el widget de Elementor que la contiene). */
@media (min-width: 922px) {
  .elementor-widget-shortcode:has(.etiquetas-productos) { position: sticky; top: var(--ep-cabecera); z-index: 2; }
  .elementor-widget-shortcode:has(.etiquetas-productos) .ep-etiquetas { max-height: min(var(--ep-etiquetas-alto, 500px), calc(100vh - 40px)); }
}
.ep-etiquetas {
  display: flex; flex-direction: column; gap: 4px;
  max-height: var(--ep-etiquetas-alto, 500px); overflow-y: auto; overscroll-behavior: contain;
  padding: 8px; border: 1px solid var(--ep-borde); border-radius: var(--ep-radio); background: var(--ep-fondo);
  line-height: 1.3;
}
show-panel .ep-etiquetas { max-height: calc(100vh - 140px); border: 0; padding: 4px 0; }
.ep-etiquetas .etiqueta {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; background: var(--ep-fondo-2);
  color: var(--ep-texto); text-decoration: none; cursor: pointer;
  transition: background-color .15s, color .15s;
}
.ep-etiquetas .etiqueta:hover { background: var(--ep-marca-suave); color: var(--ep-texto); }
.ep-etiquetas .etiqueta:focus-visible { outline: 2px solid var(--ep-marca); outline-offset: 1px; }
.ep-etiquetas .etiqueta.is-activa { background: var(--ep-marca); color: #fff; }
.ep-etiquetas .etiqueta-contador {
  flex: none; min-width: 26px; padding: 2px 8px; border-radius: 999px;
  background: var(--ep-marca); color: #fff; font-size: 12px; text-align: center; font-variant-numeric: tabular-nums;
}
.ep-etiquetas .etiqueta.is-activa .etiqueta-contador { background: #fff; color: var(--ep-marca); }

/* ---------- secciones de productos ---------- */
.contenedor-etiqueta { margin-bottom: 40px; scroll-margin-top: var(--ep-cabecera); }
.contenedor-etiqueta > h4 { display: flex; align-items: baseline; gap: 10px; margin: 0 0 14px; }
.contenedor-etiqueta .ep-total { font-size: 13px; font-weight: 500; color: var(--ep-texto-2); font-variant-numeric: tabular-nums; }
.contenedor-etiqueta ul.products { margin-bottom: 0 !important; }
.contenedor-etiqueta ul.products li.product { position: relative; } /* la etiqueta de oferta se ancla a su tarjeta */
@media (max-width: 576px) { .contenedor-etiqueta > h4 { margin-left: 10px; } }

.cargar-mas-container { display: flex; justify-content: center; margin-top: 18px; }
.btn-cargar-mas {
  padding: 11px 26px !important; border: 1px solid var(--ep-marca) !important; border-radius: 999px !important;
  background: #fff !important; color: var(--ep-marca) !important; font-weight: 600; cursor: pointer;
  transition: background-color .15s, color .15s;
}
.btn-cargar-mas:hover:not(:disabled) { background: var(--ep-marca) !important; color: #fff !important; }
.btn-cargar-mas:disabled { opacity: .6; cursor: progress; }

/* esqueleto mientras carga */
.ep-skeleton { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ep-skeleton span {
  display: block; height: 300px; border-radius: 6px;
  background: linear-gradient(90deg, #eceef3 0%, #f7f8fa 50%, #eceef3 100%) 0 0 / 200% 100%;
  animation: ep-brillo 1.3s ease-in-out infinite;
}
.ep-skeleton--grande span { height: 340px; }
@media (max-width: 921px) { .ep-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ep-skeleton span:nth-child(n+3) { display: none; } }
@keyframes ep-brillo { to { background-position: -200% 0; } }

.ep-cargando { width: 28px; height: 28px; margin: 16px auto; border: 3px solid var(--ep-borde); border-top-color: var(--ep-marca); border-radius: 50%; animation: ep-giro .8s linear infinite; }
@keyframes ep-giro { to { transform: rotate(360deg); } }

.ep-error, .ep-vacio { padding: 18px; border-radius: var(--ep-radio); background: var(--ep-fondo-2); color: var(--ep-texto-2); text-align: center; }
.ep-error { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }

/* ---------- botones ---------- */
.ep-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 20px !important; border: 1px solid var(--ep-marca) !important; border-radius: 8px !important;
  background: var(--ep-marca) !important; color: #fff !important; font-weight: 600; line-height: 1.2; cursor: pointer;
}
.ep-btn:hover { filter: brightness(1.12); }
.ep-btn--sec { background: #fff !important; color: var(--ep-marca) !important; }
.ep-btn:focus-visible, .btn-cargar-mas:focus-visible, .ep-modal button:focus-visible { outline: 2px solid var(--ep-marca); outline-offset: 2px; }

/* ---------- modal ---------- */
.ep-modal { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ep-modal[hidden] { display: none; }
.ep-modal__fondo { position: absolute; inset: 0; background: rgba(15, 18, 40, .55); }
.ep-modal__caja {
  position: relative; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 28px 24px 24px; border-radius: 14px; background: #fff; color: var(--ep-texto);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25); animation: ep-entrar .18s ease-out;
}
.ep-modal__caja h2 { margin: 0 0 8px; padding-right: 28px; font-size: 22px; line-height: 1.25; text-wrap: balance; }
.ep-modal__caja p { margin: 0 0 18px; color: var(--ep-texto-2); }
.ep-modal__x {
  position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; padding: 0 !important;
  border: 0; border-radius: 50%; background: var(--ep-fondo-2) !important; color: var(--ep-texto) !important; font-size: 22px; line-height: 1; cursor: pointer;
}
.ep-modal__x[hidden] { display: none; }
.ep-modal__provincias { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ep-modal__prov {
  min-height: 46px; padding: 10px 12px !important; border: 1px solid var(--ep-borde) !important; border-radius: 8px !important;
  background: #fff !important; color: var(--ep-texto) !important; font-weight: 500; text-align: left; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.ep-modal__prov:hover { border-color: var(--ep-marca) !important; background: var(--ep-marca-suave) !important; }
.ep-modal__prov.is-activa { border-color: var(--ep-marca) !important; background: var(--ep-marca) !important; color: #fff !important; }
.ep-modal__acciones { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
html.ep-modal-abierto, html.ep-modal-abierto body { overflow: hidden; }
@keyframes ep-entrar { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 480px) {
  .ep-modal { align-items: flex-end; padding: 0; }
  .ep-modal__caja { max-width: none; border-radius: 16px 16px 0 0; max-height: 88vh; padding: 24px 16px 20px; }
  .ep-modal__provincias { grid-template-columns: 1fr 1fr; }
  .ep-modal__acciones .ep-btn { flex: 1 1 100%; }
}

/* ---------- aviso flotante ---------- */
.ep-aviso {
  position: fixed; left: 50%; bottom: 90px; z-index: 100001; max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 10px; background: #1f2430; color: #fff; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.ep-aviso.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- buscador ---------- */
.ep-buscar { position: relative; margin: 0; }
.ep-buscar .busqueda-input-container { display: flex; }
.ep-buscar .busqueda-input {
  flex: 1 1 auto; min-width: 0; width: 100%;
  border: 2px solid var(--ep-marca) !important; border-right: 0 !important; border-radius: 7px 0 0 7px !important;
  padding: 12px 16px !important; font-size: 16px;
}
.ep-buscar .busqueda-input::-webkit-search-cancel-button { cursor: pointer; }
.ep-buscar__btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 52px; padding: 0 !important;
  border: 0; border-radius: 0 7px 7px 0 !important; background: var(--ep-marca) !important; color: #fff !important; cursor: pointer;
}
.ep-buscar.is-buscando .ep-buscar__btn svg { animation: ep-latido 0.9s ease-in-out infinite; }
@keyframes ep-latido { 50% { opacity: .35; } }
.ep-buscar__resultados {
  position: absolute; z-index: 9999; top: calc(100% + 6px); left: 0; right: 0; min-width: 300px;
  max-height: min(70vh, 520px); overflow-y: auto; overscroll-behavior: contain;
  background: #fff; border: 1px solid var(--ep-borde); border-radius: var(--ep-radio); box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
}
.ep-buscar__resultados[hidden] { display: none; }
show-panel .ep-buscar__resultados { position: static; min-width: 0; max-height: none; margin-top: 10px; box-shadow: none; }
.ep-buscar__resultados ul { list-style: none; margin: 0; padding: 6px; }
.ep-buscar__resultados li { margin: 0; }
.ep-buscar__resultados li a {
  display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 8px; color: var(--ep-texto); text-decoration: none;
}
.ep-buscar__resultados li a:hover, .ep-buscar__resultados li a:focus { background: var(--ep-fondo-2); outline: none; }
.ep-buscar__resultados img { flex: none; width: 56px; height: 56px; object-fit: contain; border-radius: 6px; background: var(--ep-fondo-2); }
.ep-buscar__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ep-buscar__nombre { font-size: 14px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ep-buscar__precio { font-size: 14px; font-weight: 600; color: var(--ep-marca); }
.ep-buscar__info { margin: 0; padding: 14px 16px; color: var(--ep-texto-2); font-size: 14px; }
.ep-buscar__info a { color: var(--ep-marca); font-weight: 600; }
.ep-buscar__todos {
  display: block; padding: 12px 16px; border-top: 1px solid var(--ep-borde);
  color: var(--ep-marca); font-weight: 600; text-align: center; text-decoration: none;
}
.ep-buscar__todos:hover, .ep-buscar__todos:focus { background: var(--ep-fondo-2); }

/* ---------- botón de carrito de las tarjetas ---------- */
.ajax-add-to-cart.is-ok { background-color: #2e7d32 !important; }
.ajax-add-to-cart[disabled] { opacity: .7; cursor: progress; }

@media (prefers-reduced-motion: reduce) {
  .ep-skeleton span, .ep-cargando, .ep-modal__caja, .ep-buscar.is-buscando .ep-buscar__btn svg { animation: none; }
  .ep-aviso { transition: none; }
}
