:root {
  --primary-color: #bf52c8;
  --primary-soft: #f7ecfb;
  --bg-body: #f5f5f5;
  --header-height: 80px;
  --text-color: #222;
  --border-radius-card: 10px;
  --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

body.tienda-body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-body);
  color: var(--text-color);
  margin: 0;
}

/* Barra superior sticky ocupando todo el ancho */
.tienda-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border-bottom: 1px solid #f0f0f0;
}

.tienda-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tienda-header-left,
.tienda-header-center,
.tienda-header-right {
  flex: 1;
}

/* Centro siempre centrado */
.tienda-header-center {
  display: flex;
  justify-content: center;
}

/* Derecha alineada a la derecha */
.tienda-header-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
}

/* Izquierda al inicio */
.tienda-header-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Versión desktop/móvil de bloques de usuario */
.user-block-mobile {
  display: none;
}
.user-block-desktop {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tienda-search-form .search-group {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.categoria-select {
  border-radius: 999px;
  border: 1px solid #ddd;
  padding: 8px 12px;
  font-size: 0.85rem;
  min-width: 140px;
  background-color: #fafafa;
}

.search-input-wrapper {
  flex: 1;
}

.search-input-wrapper .search-input {
  width: 100%;
  padding-left: 32px;
  border-radius: 999px;
  border: 1px solid #ddd;
  font-size: 0.9rem;
}

.btn-buscar {
  border-radius: 999px;
  background: var(--primary-color);
  color: #fff;
  padding: 8px 14px;
  border: none;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tienda-search-form .search-field {
  position: relative;
}

.categoria-select,
.orden-select,
.search-input {
  border-radius: 999px;
  border: 1px solid #ddd;
  padding: 8px 12px;
  font-size: 0.9rem;
  min-width: 140px;
}

.search-input-wrapper {
  flex: 1;
}

.search-input-wrapper .search-input {
  width: 100%;
  padding-left: 32px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: #999;
}

.btn-buscar {
  border-radius: 999px;
  background: var(--primary-color);
  color: #fff;
  padding: 8px 16px;
  border: none;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-buscar:hover {
  opacity: 0.9;
}

/* Usuario + carrito */

.user-block {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

.user-block i {
  color: var(--primary-color);
}

.cart-block .cart-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--primary-soft);
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.9rem;
}

.cart-link .cart-count {
  margin-left: 6px;
  font-weight: 600;
}

/* MAIN */

.tienda-main {
  max-width: 1200px;
  margin: 16px auto 40px;
  padding: 0 16px;
}

.tienda-summary {
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #555;
}

.tienda-products-grid .no-results {
  text-align: center;
  padding: 40px 0;
  color: #777;
}

/* GRID PRODUCTOS */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.product-card {
  background: #fff;
  border-radius: var(--border-radius-card);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.product-image-wrapper {
  position: relative;
  overflow: hidden;
}

.product-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.product-card:hover .product-image {
  transform: scale(1.03);
}

.btn-view-details {
  position: absolute;
  left: 8px;
  bottom: 8px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 6px 10px;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.product-body {
  padding: 10px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.product-meta,
.product-points,
.product-stock {
  margin: 0;
  font-size: 0.8rem;
  color: #666;
}

.product-price {
  margin: 2px 0;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.price-old {
  text-decoration: line-through;
  color: #999;
  font-size: 0.8rem;
}

.price-new {
  font-weight: 700;
}

.badge-descuento {
  background: #ff4d4f;
  color: #fff;
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 2px 6px;
}

.stock-out {
  color: #cc0000;
}

/* MODAL PRODUCTO */

.product-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.product-modal-backdrop.is-visible {
  display: flex;
}

.product-modal {
  border: 2px solid #00dd1c;
  background: #fff;
  max-width: 820px;
  width: 100%;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  position: relative;
  padding: 16px;
  top: -10%;
}

.product-modal-content {
  display: grid;
  grid-template-columns: 1.1fr 1.2fr;
  gap: 16px;
}

.product-modal-image img {
  width: 100%;
  border-radius: 10px;
  object-fit: cover;
}

.product-modal-details h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

.modal-price {
  font-weight: 600;
  margin-top: 6px;
}

.modal-points {
  font-size: 0.9rem;
  margin-top: 4px;
}

.quantity-control {
  margin-top: 12px;
  font-size: 0.9rem;
}

.quantity-input {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #ddd;
  overflow: hidden;
  margin-top: 4px;
}

.quantity-input input {
  width: 60px;
  border: none;
  text-align: center;
  font-size: 0.9rem;
  padding: 6px 0;
}

.quantity-input .qty-btn {
  background: #f7f7f7;
  border: none;
  padding: 6px 10px;
  font-size: 1rem;
  cursor: pointer;
}

.btn-add-cart {
  margin-top: 16px;
  background: var(--primary-color);
  color: #fff;
  border-radius: 999px;
  border: none;
  padding: 8px 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.modal-close {
  position: absolute;
  right: 8px;
  top: 8px;
  border: none;
  background: transparent;
  font-size: 1rem;
}

/* CARRITO */

.carrito-main {
  max-width: 1100px;
}

.carrito-section h1 {
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.carrito-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  margin-top: 16px;
}

.carrito-item-card {
  background: #fff;
  border-radius: var(--border-radius-card);
  box-shadow: var(--shadow-soft);
  display: flex;
  padding: 10px;
  gap: 10px;
  margin-bottom: 10px;
}

.carrito-item-img img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 10px;
}

.carrito-item-body h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.carrito-item-precio,
.carrito-item-puntos,
.carrito-item-subtotal {
  margin: 2px 0;
  font-size: 0.85rem;
}

.carrito-item-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.carrito-resumen {
  background: #fff;
  border-radius: var(--border-radius-card);
  box-shadow: var(--shadow-soft);
  padding: 14px;
  font-size: 0.9rem;
}

.btn-continuar {
  margin-top: 12px;
  width: 100%;
  border-radius: 999px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 8px 16px;
}

/* MODALES CHECKOUT (CONTINUAR) */

.checkout-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 110;
}

.checkout-modal-backdrop.is-visible {
  display: flex;
}

.checkout-modal {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  position: relative;
}

/* Responsivo */

@media (max-width: 900px) {
  .tienda-header {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-bottom: 14px;
  }
  .tienda-header-left {
    order: 2;
  }
  .tienda-header-center {
    order: 1;
  }
  .tienda-header-right {
    order: 3;
    justify-content: space-between;
  }

  .product-modal-content {
    grid-template-columns: 1fr;
  }

  .carrito-layout {
    grid-template-columns: 1fr;
  }
}

/* NAV CATEGORÍAS ESTILO MARKETPLACE */

.nav-categorias {
  background: #fff;
  border-bottom: 1px solid #eee;
}

.nav-categorias-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6px 16px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
}

.nav-cat-link {
  white-space: nowrap;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: #555;
  text-decoration: none;
}

.nav-cat-link:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.nav-cat-link.active {
  background: var(--primary-color);
  color: #fff;
}

/* HOME / HERO */

.home-main {
  max-width: 1200px;
  margin-top: 12px;
}

.home-hero {
  display: grid;
  grid-template-columns: 1.4fr 1.1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.home-hero-left h1 {
  font-size: 1.8rem;
  line-height: 1.2;
  margin-bottom: 8px;
}

.home-hero-left h1 span {
  color: var(--primary-color);
}

.home-hero-left p {
  font-size: 0.95rem;
  color: #555;
  max-width: 420px;
}

.home-hero-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-hero-primary {
  background: var(--primary-color);
  color: #fff;
  border-radius: 999px;
  padding: 8px 18px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-hero-secondary {
  background: #fff;
  color: var(--primary-color);
  border-radius: 999px;
  padding: 8px 18px;
  border: 1px solid var(--primary-color);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.home-hero-right .hero-banner {
  background: linear-gradient(135deg, #bf52c8, #f767b8);
  border-radius: 16px;
  color: #fff;
  padding: 18px;
  position: relative;
  overflow: hidden;
  min-height: 160px;
}

.hero-badge {
  background: rgba(255, 255, 255, 0.15);
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  margin-bottom: 8px;
}

.hero-text h2 {
  margin: 0;
  font-size: 1.6rem;
}

.hero-mini {
  margin-top: 10px;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* CATEGORÍAS DESTACADAS */

.home-categorias-destacadas h2 {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.home-cats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.home-cat-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: #333;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-cat-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
}

.home-cat-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.home-cat-cta {
  font-size: 0.8rem;
  color: var(--primary-color);
}

/* SECCIONES HOME */

.home-section {
  margin-top: 20px;
}

.home-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.home-section-header h2 {
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.link-ver-mas {
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--primary-color);
}

/* HOME CARDS */

.home-card .home-card-actions {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-sm.btn-outline {
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  font-size: 0.8rem;
  text-decoration: none;
}

.btn-wishlist-icon {
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ddd;
  text-decoration: none;
  color: #999;
  font-size: 0.9rem;
}

.btn-wishlist-icon.active,
.btn-wishlist-icon:hover {
  background: var(--primary-soft);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.badge-descuento.corner {
  position: absolute;
  right: 6px;
  top: 6px;
}

/* DETALLE PRODUCTO */

.producto-main {
  max-width: 1100px;
}

.producto-detalle {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr;
  gap: 18px;
}

.producto-detalle-img-main img {
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
}

.producto-detalle-right h1 {
  margin-top: 0;
  font-size: 1.4rem;
}

.producto-detalle-precio {
  margin-top: 6px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.producto-detalle-precio .label {
  font-size: 0.9rem;
  color: #555;
}

.producto-detalle-descripcion h2 {
  font-size: 0.95rem;
  margin-top: 14px;
  margin-bottom: 4px;
}

.producto-detalle-actions {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn.btn-wishlist {
  border-radius: 999px;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  background: #fff;
  padding: 6px 12px;
  font-size: 0.85rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* FOOTER */

.tienda-footer {
  background: #fff;
  border-top: 1px solid #eee;
  margin-top: 30px;
}

.tienda-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 16px;
  font-size: 0.85rem;
}

.tienda-footer-inner h4,
.tienda-footer-inner h5 {
  margin-top: 0;
  margin-bottom: 4px;
}

.tienda-footer-inner ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tienda-footer-inner li {
  margin-bottom: 4px;
}

.tienda-footer-inner a {
  text-decoration: none;
  color: #555;
  font-size: 0.85rem;
}

.tienda-footer-bottom {
  text-align: center;
  padding: 8px 0;
  font-size: 0.8rem;
  border-top: 1px solid #eee;
}

/* RESPONSIVE HOME / DETALLE */

@media (max-width: 900px) {
  .home-hero {
    grid-template-columns: 1fr;
  }
  .producto-detalle {
    grid-template-columns: 1fr;
  }
}

/* --- SELECT2 PERSONALIZADO PARA CATEGORÍAS --- */

.categoria-select {
  /* Select original, Select2 lo reemplaza visualmente */
  visibility: hidden; /* opcional, Select2 dibuja su propio control */
  height: 0;
  padding: 0;
  margin: 0;
}

.select2-container {
  font-size: 0.85rem;
}

.select2-container--default .select2-selection--single {
  border-radius: 999px;
  border: 1px solid #ddd;
  height: 34px;
  padding: 3px 10px;
  display: flex;
  align-items: center;
  background-color: #fafafa;
}

.select2-container--default
  .select2-selection--single
  .select2-selection__rendered {
  color: #333;
  line-height: 26px;
}

.select2-container--default
  .select2-selection--single
  .select2-selection__arrow {
  height: 100%;
  right: 10px;
}

.select2-dropdown {
  border-radius: 10px;
  border: 1px solid #ddd;
}

.select2-container--default
  .select2-results__option--highlighted.select2-results__option--selectable {
  background-color: var(--primary-color);
}

/* --- BOTÓN VER DETALLES CON ICONO CARRITO --- */

.btn-view-details {
  position: absolute;
  left: 8px;
  bottom: 8px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-color);
  padding: 6px 12px;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn-view-details i {
  color: var(--primary-color);
  font-size: 1.1rem;
}

.btn-view-details:hover {
  background: var(--primary-color);
  color: #fff;
}

.btn-view-details:hover i {
  color: #fff;
}

/* ============================
   RESPONSIVE HEADER – MOBILE
   ============================ */
@media (max-width: 768px) {
  .tienda-header-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 6px 8px;
    gap: 6px;
  }

  .tienda-header-left,
  .tienda-header-center,
  .tienda-header-right {
    max-width: 100%;
  }

  /* Orden en móvil: logo, usuario/carrito, filtros */
  .tienda-header-center {
    order: 1;
    justify-content: center;
    margin-bottom: 2px;
  }

  .tienda-header-right {
    order: 2;
    justify-content: space-between;
    padding: 0 4px;
    gap: 10px;
  }

  .tienda-header-left {
    order: 3;
    width: 100%;
  }

  .tienda-logo {
    max-height: 38px;
  }
}

/* ============================
   RESPONSIVE MODAL – MOBILE
   ============================ */
@media (max-width: 768px) {
  .product-modal-backdrop {
    align-items: flex-end; /* hace que suba desde abajo tipo "sheet" */
  }

  .product-modal {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 16px 16px 0 0;
    padding: 10px 12px 14px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .product-modal-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .product-modal-image img {
    max-height: 220px;
    object-fit: contain;
    border-radius: 10px;
  }

  .product-modal-details h2 {
    font-size: 1rem;
    margin-bottom: 4px;
  }

  .product-modal-details p {
    font-size: 0.85rem;
  }

  .modal-price {
    font-size: 0.95rem;
    margin-top: 4px;
  }

  .modal-points {
    font-size: 0.85rem;
  }

  .quantity-control {
    margin-top: 10px;
  }

  .quantity-input input {
    width: 55px;
    font-size: 0.9rem;
  }

  .btn-add-cart {
    width: 100%;
    justify-content: center;
    margin-top: 12px;
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  .modal-close {
    top: 6px;
    right: 8px;
    font-size: 1rem;
  }
}

/* === CORRECCIÓN: MODAL CENTRADO TAMBIÉN EN MÓVIL === */
@media (max-width: 768px) {
  .product-modal-backdrop {
    align-items: center !important;
    justify-content: center !important;
  }

  .product-modal {
    width: 100%;
    max-width: 480px; /* puedes subir o bajar este valor */
    margin: 0 12px;
    border-radius: 16px; /* igual que en desktop */
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* ============== BOTÓN CARGAR MÁS ============== */

.tienda-load-more {
  margin-top: 16px;
  text-align: center;
}

.btn-load-more {
  border-radius: 999px;
  background: var(--primary-color, #bf52c8);
  color: #fff;
  border: none;
  padding: 8px 18px;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.btn-load-more i {
  font-size: 1rem;
}

.btn-load-more:hover {
  background: #a43cab;
}

/* En mobile que ocupe todo el ancho */
@media (max-width: 768px) {
  .btn-load-more {
    width: 100%;
    justify-content: center;
  }
}

:root {
  --primary-color: #bf52c8;
  --success-color: #00dd1c;
}

/* Carrito con punto verde cuando hay productos */
.cart-block .cart-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cart-status-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--success-color);
  border: 2px solid #fff;
}

/* Que el número se vea un poco más fuerte */
.cart-count {
  font-weight: 600;
}

/* Stock disponible en verde */
.product-stock {
  color: var(--success-color);
}

.product-stock i {
  color: inherit;
}

/* Puntos BP con acento verde en el ícono */
.product-points i {
  color: var(--success-color);
}

/* Descuento en verde tipo “badge” */
.badge-descuento {
  background-color: var(--success-color);
  color: #fff;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.75rem;
}

/* Ancho general del contenido (desktop) */
.tienda-main {
  max-width: 1320px; /* más ancho que un container clásico */
  margin: 0 auto;
  padding: 16px 24px 32px;
}

/* Que la sección de productos aproveche más el ancho */
.tienda-products-grid {
  margin-top: 12px;
}

/* En pantallas grandes, que el grid respire bien */
@media (min-width: 1200px) {
  .tienda-main {
    max-width: 1400px;
    padding-inline: 32px;
  }
}

/* Desktop: select de categorías un poco más ancho */
@media (min-width: 992px) {
  .tienda-header-left .search-field:first-child {
    min-width: 220px;
    max-width: 260px;
  }

  .tienda-header-left .select2-container {
    min-width: 220px;
  }
}

/* Mobile: que ocupe todo el ancho, como ya venimos manejando */
@media (max-width: 768px) {
  .tienda-header-left .select2-container {
    width: 100% !important;
    min-width: 0;
  }
}

.categoria-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.categoria-option-icon {
  color: var(--primary-color);
  font-size: 0.9rem;
}

/* ============================
   HEADER MÓVIL TIPO APP
   ============================ */
@media (max-width: 768px) {
  .tienda-header-inner {
    position: relative;
    flex-direction: column;
    align-items: stretch;
    padding: 8px 12px;
    gap: 6px;
  }

  /* Top bar: logo centrado */
  .tienda-header-center {
    order: 1;
    justify-content: center;
  }

  .tienda-logo {
    max-height: 36px;
  }

  /* Carrito flotando arriba a la derecha */
  .tienda-header-right {
    order: 1; /* mismo “nivel” visual que el logo */
  }

  .cart-block {
    position: absolute;
    top: 8px;
    right: 12px;
  }

  .cart-block .cart-link {
    padding: 4px 8px;
  }

  /* Ocultamos la versión desktop del bloque de usuario */
  .user-block-desktop {
    display: none;
  }

  /* Mostramos la versión móvil (debajo del buscador) */
  .user-block-mobile {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    background: #f8f8f8;
  }

  .user-block-mobile a {
    font-weight: 500;
  }

  /* Bloque de filtros: ocupa todo el ancho y parece "card" */
  .tienda-header-left {
    order: 3;
    width: 100%;
  }

  .tienda-search-form {
    width: 100%;
  }

  .tienda-search-form .search-group {
    width: 100%;
    flex-wrap: wrap;
    row-gap: 6px;
    background: #ffffff;
    border-radius: 10px;
    padding: 6px 8px 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  }

  .tienda-search-form .search-field {
    width: 100%;
  }

  .select2-container {
    width: 100% !important;
  }

  .search-input-wrapper .search-input {
    width: 100%;
    font-size: 0.85rem;
    padding: 7px 10px 7px 30px;
  }

  .btn-buscar {
    width: 100%;
    justify-content: center;
    padding: 7px 10px;
    font-size: 0.85rem;
  }
}

/* Desktop: ocultar forzado el bloque de usuario móvil */
@media (min-width: 769px) {
  .user-block-mobile {
    display: none !important;
  }

  .user-block-desktop {
    display: flex !important;
    align-items: center;
    gap: 8px;
  }
}

/* Marco del logo: recorta arriba/abajo */
.tienda-logo-link {
  display: flex;
  align-items: center;
  justify-content: center;

  /* altura visible del logo (ajusta a gusto) */
  height: 60px;

  overflow: hidden; /* recorta lo que sobresale */
}

/* Imagen del logo: un poco más alta que el marco */
.tienda-logo {
  display: block;
  height: 120px; /* más grande que 60px para que se “meta” el centro */
  max-height: none; /* anulamos el max-height anterior */
  transform: translate(-5px); /* X e Y en una sola línea */
}

/* AJUSTES FINOS PARA MÓVIL */
@media (max-width: 768px) {
  /* Header más compacto arriba y abajo */
  .tienda-header-inner {
    padding-top: 4px;
    padding-bottom: 4px;
    gap: 2px; /* casi sin separación vertical entre logo y filtros */
  }

  /* Logo a la izquierda y sin margen extra abajo */
  .tienda-header-center {
    order: 1;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 0; /* quitamos espacio debajo del logo */
  }

  .tienda-logo-link {
    justify-content: flex-start;
    height: 56px; /* un poco más alto */
  }

  .tienda-logo {
    height: 80px; /* logo más grande en cel */
    max-height: none;
    transform: translate(-5px, -5px); /* súbelo un poco para recortar blancos */
  }

  /* Bloque de filtros pegado al logo */
  .tienda-header-left {
    order: 2;
    width: 100%;
    margin-top: 0;
  }

  .tienda-search-form {
    margin-top: 0;
  }

  .tienda-search-form .search-group {
    margin-top: 0;
    padding-top: 4px;
    padding-bottom: 6px;
  }

  /* Bloque de usuario móvil pegado al buscador */
  .user-block-mobile {
    margin-top: 4px;
  }

  /* Carrito más grande en móvil */
  .cart-block .cart-link {
    padding: 4px 10px;
  }

  .cart-block .cart-link i.fa-cart-shopping {
    font-size: 1rem; /* icono más grande en cel */
  }

  .cart-status-dot {
    top: -1px;
    right: -1px;
  }
}

.product-card {
  border: 1px solid rgba(191, 82, 200, 0.25); /* #BF52C8 */
  border-radius: 10px;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  transition: box-shadow 0.15s ease, transform 0.15s ease,
    border-color 0.15s ease;
}

.product-card:hover {
  border-color: #bf52c8;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
  transform: translateY(-2px);
}

.product-code {
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 4px;
}

.product-code i {
  color: #9ca3af;
}

.whatsapp-float {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: #25d366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  z-index: 90;
  text-decoration: none;
}

.whatsapp-float i {
  font-size: 1.8rem;
}

.whatsapp-float:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
  .whatsapp-float {
    right: 12px;
    bottom: 12px;
    width: 48px;
    height: 48px;
  }

  .whatsapp-float i {
    font-size: 1.6rem;
  }
}

.user-block {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-social-links {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}

.user-social-links .social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  text-decoration: none;
  font-size: 0.9rem;
}

.user-social-links .social-icon.youtube {
  color: #ff0000;
}

.user-social-links .social-icon.facebook {
  color: #1877f2;
}

.user-social-links .social-icon:hover {
  background: #e5e7eb;
}

.tienda-footer {
  margin-top: 40px;
  background: #111827;
  color: #e5e7eb;
  padding: 32px 16px 16px;
  font-size: 0.9rem;
}

.tienda-footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.tienda-footer h4 {
  font-size: 1rem;
  margin-bottom: 10px;
  color: #f9fafb;
}

.tienda-footer p {
  margin: 4px 0;
}

.footer-tag {
  font-size: 0.75rem;
  background: rgba(191, 82, 200, 0.15);
  color: #bf52c8;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 4px;
}

.footer-address {
  margin-top: 8px;
  font-size: 0.85rem;
  color: #9ca3af;
}

.tienda-footer a {
  color: #e5e7eb;
  text-decoration: none;
}

.tienda-footer a:hover {
  color: #bf52c8;
}

.tienda-footer ul {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
}

.tienda-footer li {
  margin: 3px 0;
}

.footer-slogan {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #fbbf24;
}

.footer-join p {
  margin-bottom: 6px;
}

.tienda-footer-bottom {
  max-width: 1400px;
  margin: 12px auto 0;
  border-top: 1px solid #1f2937;
  padding-top: 8px;
  text-align: center;
  font-size: 0.8rem;
  color: #9ca3af;
}

/* Responsive footer */
@media (max-width: 1024px) {
  .tienda-footer-inner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .tienda-footer-inner {
    grid-template-columns: 1fr;
  }
}

/* ===== Ajustes específicos para pantallas pequeñas ===== */
@media (max-width: 768px) {
  /* Hacemos que el header se comporte como columna en móvil */
  .tienda-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 6px 10px;
    gap: 4px;
  }

  /* Logo CENTRADO en móvil */
  .tienda-header-center {
    order: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0;
  }

  .tienda-logo-link {
    justify-content: center;
    height: 56px;
  }

  .tienda-logo {
    height: 100px;
    max-height: none;
    transform: translate(-5px, -2px); /* recorta un poco el blanco superior */
  }

  /* Carrito arriba a la derecha (como barrita de app) */
  .tienda-header-right {
    order: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    position: absolute;
    top: 8px;
    right: 10px;
  }

  /* El bloque de filtros + buscador debajo del logo */
  .tienda-header-left {
    order: 2;
    width: 100%;
    margin-top: 0;
  }

  .tienda-search-form {
    width: 100%;
    margin-top: 0;
  }

  .tienda-search-form .search-group {
    width: 100%;
    margin-top: 0;
    background: #ffffff;
    border-radius: 10px;
    padding: 6px 8px 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  }

  /* Mostrar SOLO el bloque móvil de usuario y centrarlo */
  .user-block-desktop {
    display: none !important;
  }

  .user-block-mobile {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 4px;
    padding: 6px 8px;
    border-radius: 8px;
    background: #f9fafb;
    text-align: center;
  }

  .user-block-mobile .user-social-links {
    margin-right: 0;
    margin-bottom: 2px;
  }
}

/* Texto más ordenado y profesional en el footer */
.footer-column p,
.footer-column li {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Justificado donde tiene sentido */
.footer-address,
.footer-join-text,
.footer-slogan {
  text-align: justify;
}

/* Contacto: mejor alineado a la izquierda */
.footer-contact p {
  text-align: left;
}

/* Títulos con icono destacado */
.tienda-footer h4 {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tienda-footer h4 i {
  color: #bf52c8;
  font-size: 1rem;
}

/* Íconos dentro de textos */
.footer-column p i,
.footer-column li i {
  margin-right: 6px;
  color: #9ca3af;
}

/* Lista con iconos alineados */
.footer-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
}

.footer-list li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  text-align: justify;
}

.footer-list li i {
  margin-top: 3px;
  min-width: 14px;
}

/* Slogan */
.footer-slogan {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #fbbf24;
}

.footer-slogan i {
  margin-right: 6px;
  color: #00dd1c; /* metemos el verde de la marca aquí */
}

/* Textos de afíliate */
.footer-join-text {
  margin-bottom: 6px;
}

/* Correcciones responsivas si hace falta */
@media (max-width: 640px) {
  .footer-column {
    text-align: left;
  }

  .footer-list li {
    text-align: left;
  }
}

/* Contenedor del botón Cargar más */
.tienda-load-more {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

/* Botón Cargar más productos */
.btn-load-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 999px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;

  /* Colores de marca: lila + verde */
  background: linear-gradient(90deg, #bf52c8, #00dd1c);
  color: #ffffff;

  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn-load-more i {
  font-size: 1.1rem;
}

.btn-load-more:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  filter: brightness(1.03);
}

.btn-load-more:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

@media (max-width: 640px) {
  .btn-load-more {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
    font-size: 0.95rem;
  }
}

/* Animación suave para productos recién cargados */
@keyframes fadeInUpCard {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* El primer producto nuevo (con id="load-more-anchor") */
#load-more-anchor {
  animation: fadeInUpCard 0.35s ease-out both;
}

/* Todos los productos que vienen después también se animan */
#load-more-anchor ~ .product-card {
  animation: fadeInUpCard 0.35s ease-out both;
}

/* 🔁 Corrección final: logo a la IZQUIERDA en móvil */
@media (max-width: 768px) {
  /* Header en columna pero con logo alineado a la izquierda */
  .tienda-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 6px 10px;
    gap: 4px;
    position: relative;
  }

  /* Logo a la izquierda */
  .tienda-header-center {
    order: 1;
    display: flex;
    justify-content: flex-start; /* <-- aquí la corrección */
    align-items: center;
    margin-bottom: 0;
  }

  .tienda-logo-link {
    justify-content: flex-start; /* logo pegado a la izquierda */
    height: 56px;
  }

  .tienda-logo {
    height: 90px;
    max-height: none;
    transform: translate(-5px, -5px);
  }

  /* Carrito sigue arriba a la derecha */
  .tienda-header-right {
    order: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    position: absolute;
    top: 8px;
    right: 10px;
  }

  /* Filtros y buscador debajo del logo, ocupando todo el ancho */
  .tienda-header-left {
    order: 2;
    width: 100%;
    margin-top: 0;
  }

  .tienda-search-form {
    width: 100%;
    margin-top: 0;
  }

  .tienda-search-form .search-group {
    width: 100%;
    margin-top: 0;
    background: #ffffff;
    border-radius: 10px;
    padding: 6px 8px 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  }
}

.product-modal-content {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.5fr);
  gap: 16px;
}

.product-modal-image img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  object-fit: contain;
  background: #f9fafb;
}

/* Detalles más limpios */
.product-modal-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-description {
  font-size: 0.9rem;
  color: #6b7280;
  text-align: justify;
}

/* Bloque de precios */
.modal-pricing-block {
  border-radius: 10px;
  background: #f9fafb;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.modal-price-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.modal-price-line .label {
  color: #4b5563;
}

.modal-price-line .value {
  font-weight: 600;
  color: #111827;
}

.modal-price-total {
  border-top: 1px dashed #d1d5db;
  padding-top: 6px;
  margin-top: 4px;
}

/* Puntos y características */
.modal-points {
  font-size: 0.9rem;
  color: #4b5563;
}

.modal-points i {
  color: #00dd1c;
}

.modal-features-block h3 {
  font-size: 0.95rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-features-block h3 i {
  color: #bf52c8;
}

.modal-features-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.modal-features-list li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: #4b5563;
}

.modal-features-list li i {
  color: #00dd1c;
  margin-top: 3px;
}

/* Formulario del carrito en el modal */
.modal-cart-form {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Centrar el botón Agregar al carrito */
.modal-cart-form .btn-add-cart {
  align-self: center;
  margin-top: 4px;
  padding: 8px 24px;
}

/* Layout del modal en escritorio (2 columnas) */
.product-modal-content {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.5fr);
  gap: 16px;
}

/* Responsive: en celular la imagen arriba y detalle abajo */
@media (max-width: 768px) {
  .product-modal {
    width: 94%;
    max-width: 480px;
  }

  .product-modal-content {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
  }

  .product-modal-image {
    order: 1;
  }

  .product-modal-details {
    order: 2;
  }

  .product-modal-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    background: #f9fafb;
  }
}

/* ====== CARDS DEL MODAL ====== */
.modal-block {
  border: 1px solid rgba(0, 0, 0, 0.06); /* borde ligero */
  border-radius: 12px;
  padding: 10px 12px;
  background: #ffffff;
  margin-bottom: 10px;
}

/* Borde ligeramente con color de marca para que resalte */
.modal-block-main {
  border-color: rgba(191, 82, 200, 0.25); /* lila suave */
}

.modal-block-pricing {
  border-color: rgba(0, 221, 28, 0.25); /* verde suave */
}

.modal-block-extra {
  border-color: rgba(148, 163, 184, 0.4); /* gris/azul suave */
}

/* Título del producto */
.modal-block-main h2 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

/* Código del producto */
.modal-product-code {
  font-size: 0.9rem;
  color: #6b7280;
  margin-bottom: 6px;
}

.modal-product-code i {
  margin-right: 4px;
  color: #9ca3af;
}

/* Descripción justificada */
.modal-description {
  font-size: 0.9rem;
  color: #4b5563;
  text-align: justify;
}

/* Ajustes visuales de la sección de precios dentro del card */
.modal-pricing-block {
  border-radius: 10px;
  background: #f9fafb;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.modal-price-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.modal-price-col {
  flex: 1 1 100%;
}

@media (min-width: 640px) {
  .modal-price-col {
    flex: 1 1 33%;
  }
}

.modal-price-line .label {
  color: #4b5563;
  display: block;
}

.modal-price-line .value {
  font-weight: 600;
  color: #111827;
}

.modal-price-total {
  border-top: 1px dashed #d1d5db;
  padding-top: 6px;
  margin-top: 4px;
}

/* Bloque inferior: puntos + características + cantidad */
.modal-points {
  font-size: 0.9rem;
  color: #4b5563;
  margin-bottom: 8px;
}

.modal-points i {
  color: #00dd1c;
  margin-right: 4px;
}

/* Características */
.modal-features-block h3 {
  font-size: 0.95rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-features-block h3 i {
  color: #bf52c8;
}

.modal-features-list {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
}

.modal-features-list li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: #4b5563;
}

.modal-features-list li i {
  color: #00dd1c;
  margin-top: 3px;
}

/* Formulario del carrito dentro del bloque inferior */
.modal-cart-form {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* CENTRAR la sección de cantidad */
.modal-block-extra .quantity-control {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-block-extra .quantity-control label {
  margin-bottom: 4px;
}

.modal-block-extra .quantity-input {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Botón agregar al carrito centrado */
.modal-cart-form .btn-add-cart {
  align-self: center;
  margin-top: 4px;
  padding: 8px 24px;
}

/* Bloque de precios del modal */
.modal-pricing-block {
  border-radius: 10px;
  background: #f9fafb;
  padding: 8px 10px;
  font-size: 0.9rem;
}

/* Contenedor general: simplemente apila las líneas */
.modal-price-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

/* Cada línea: label a la izquierda, valor a la derecha */
.modal-price-col {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Total: mismo estilo que las demás líneas, pero separado visualmente */
.modal-price-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed #d1d5db;
  padding-top: 6px;
  margin-top: 4px;
}

/* Estilo de texto */
.modal-price-line .label {
  color: #4b5563;
}

.modal-price-line .value {
  font-weight: 600;
  color: #111827;
}

/* Backdrop del modal: transición de opacidad */
.product-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease-out, visibility 0.22s ease-out;
  z-index: 999;
}

/* Cuando está visible (clase que activas en JS) */
.product-modal-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

/* El contenedor del modal con animación */
.product-modal {
  position: relative;
  background: #ffffff;
  border: 2px solid #00dd1c; /* borde verde de la empresa */
  border-radius: 14px;
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  overflow: auto;
  margin: 0 auto;
  opacity: 0;
  transform: scale(0.96);
  transition: transform 0.22s ease-out, opacity 0.22s ease-out;
}

/* Cuando el backdrop está visible, el modal hace fade + zoom */
.product-modal-backdrop.is-visible .product-modal {
  opacity: 1;
  transform: scale(1);
}

/* Ajuste para pantallas pequeñas */
@media (max-width: 768px) {
  .product-modal {
    width: 94%;
    max-width: 480px;
    max-height: 90vh;
    /* sigue centrado por el flex del backdrop */
  }
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: #ffffff;
  color: #4b5563;
  cursor: pointer;

  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
  transition: background-color 0.15s ease, color 0.15s ease,
    transform 0.15s ease, box-shadow 0.15s ease;
}

.modal-close i {
  font-size: 0.9rem;
}

.modal-close:hover {
  background: #f3e8ff; /* lila muy suave */
  color: #bf52c8;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.22);
}

.modal-close:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}

/* La fila extra debajo del header principal */
.tienda-header-sub {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 2fr);
  align-items: center;
  gap: 8px;
}

/* Columnas de la fila 2 */
.tienda-header-sub-left {
  display: flex;
  align-items: center;
}

.tienda-header-sub-center {
  /* por ahora vacío, solo mantiene la estructura */
}

.tienda-header-sub-right {
  display: flex;
  justify-content: flex-end;
}

/* Botones de orden ya los definimos antes, pero por si acaso: */
.search-sort-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-sort {
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: #ffffff;
  color: #4b5563;
  border-radius: 999px;
  font-size: 0.8rem;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease, transform 0.15s ease;
}

.btn-sort i {
  font-size: 0.95rem;
}

.btn-sort:hover {
  background: #f3e8ff;
  color: #bf52c8;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
  transform: translateY(-1px);
}

.btn-sort:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Responsive: en móviles, la fila 2 se apila */
@media (max-width: 768px) {
  .tienda-header-sub {
    grid-template-columns: 1fr;
    row-gap: 6px;
  }

  .tienda-header-sub-right {
    justify-content: flex-start;
  }
}

.tienda-header-sub {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Fila 2 del header: que la columna izquierda (categorías) tenga más espacio */
.tienda-header-sub-left {
  flex: 1 1 360px; /* se expande más hacia la izquierda */
  max-width: 420px;
}

/* Asegurar que el select "llene" ese espacio */
.tienda-header-sub-left .categoria-select {
  width: 100%;
}

/* Select2: ajustar ancho visible del combo */
.tienda-header-sub-left .select2-container {
  width: 100% !important;
  min-width: 260px;
}

@media (max-width: 768px) {
  .tienda-header-sub-left {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .tienda-header-sub-left .select2-container {
    min-width: 0;
    width: 100% !important;
  }
}

/* Botones de orden (precio / BP) */
.btn-sort {
  border: 1px solid rgba(191, 82, 200, 0.55); /* borde lila suave */
  background: #ffffff;
  color: #4b5563;
  border-radius: 999px;
  font-size: 0.8rem;
  padding: 4px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease, transform 0.15s ease;
}

/* Icono con acento lila */
.btn-sort i {
  font-size: 0.95rem;
  color: #bf52c8;
}

/* Hover: resaltar con un “halo” lila */
.btn-sort:hover {
  background: rgba(191, 82, 200, 0.08);
  color: #bf52c8;
  box-shadow: 0 1px 4px rgba(191, 82, 200, 0.35);
  transform: translateY(-1px);
}

/* Active/click */
.btn-sort:active {
  transform: translateY(0);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

@media (max-width: 768px) {
  /* Aseguramos que el header sea el contenedor relativo del carrito */
  .tienda-header {
    position: relative;
  }

  .tienda-header-inner {
    flex-direction: column;
    align-items: stretch;
    padding-top: 6px;
    padding-bottom: 6px;
    gap: 4px;
  }

  /* Logo en la parte superior (ya lo tienes a la izquierda, lo respetamos) */
  .tienda-header-center {
    order: 1;
    display: flex;
    align-items: center;
  }

  /* ✅ Solo el carrito flota arriba a la derecha */
  .cart-block {
    position: absolute;
    top: 12px;
    right: 10px;
  }

  /* ⬇ El contenedor donde está el saludo DEJA de ser absoluto
       y baja a una nueva fila, centrado */
  .tienda-header-right {
    position: static; /* quitamos absolute en móvil */
    order: 1; /* va después del buscador */
    width: 100%;
    justify-content: center;
    margin-top: 4px;
  }
}

/* ===== Segundo header (categorías + orden) en móvil ===== */
@media (max-width: 768px) {
  /* El contenedor del segundo header */
  .tienda-header-sub {
    display: flex;
    flex-direction: column; /* apilar: arriba categorías, abajo botones */
    align-items: stretch;
    max-width: 95%;
    padding: 4px 12px 6px; /* 🔼 lo “sube” un poco, menos espacio vertical */
    gap: 6px;
  }

  /* Categorías: 100% de ancho, primera fila */
  .tienda-header-sub-left {
    width: 100%;
  }

  .tienda-header-sub-left .select2-container {
    width: 100% !important;
    min-width: 0;
  }

  /* Contenedor de los botones de orden: segunda fila, 100% */
  .tienda-header-sub-right {
    width: 100%;
    justify-content: center;
  }

  .search-sort-group {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  /* Cada botón ocupa el 50% y se ve parejito */
  .search-sort-group .btn-sort {
    flex: 1 1 50%;
    justify-content: center;
    text-align: center;
  }
}

.modal-pricing-table {
  width: 100%;
  display: grid;
  row-gap: 0.35rem;
}

.mpr-row {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr; /* etiqueta / unitario / total */
  align-items: center;
  font-size: 0.9rem;
}

.mpr-header {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.7;
}

.mpr-row:not(.mpr-header) {
  padding: 0.25rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mpr-col-label {
  font-weight: 500;
}

.mpr-col-unit,
.mpr-col-total {
  font-variant-numeric: tabular-nums;
}

.text-end {
  text-align: right;
}

.currency {
  font-size: 0.7em;
  opacity: 0.8;
  margin-left: 2px;
}

/* === GRID DE PRODUCTOS EN CELULARES: 2 COLUMNAS === */
@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px; /* opcional: un poco menos de espacio entre cards */
  }

  .product-image {
    height: 180px; /* opcional: ajusta altura de la imagen para que no queden tan altas */
    object-fit: cover;
  }
}

/* === AJUSTE DE TIPOGRAFÍA PARA CELULARES === */
@media (max-width: 768px) {
  /* Tamaño base un poco más chico */
  body.tienda-body {
    font-size: 14px;
  }

  /* TITULOS Y TEXTOS EN LAS CARDS */
  .product-title {
    font-size: 0.8rem;
  }

  .product-code,
  .product-meta,
  .product-points,
  .product-stock {
    font-size: 0.75rem;
  }

  .product-price-row .price-value {
    font-size: 0.85rem;
  }

  /* Botón dentro de la imagen */
  .btn-view-details {
    font-size: 0.75rem;
    padding: 4px 8px;
  }

  /* Header / filtros un poco más compactos */
  .search-input {
    font-size: 0.85rem;
  }

  .btn-buscar,
  .btn-sort {
    font-size: 0.8rem;
    padding: 6px 10px;
  }

  /* Modal: textos más pequeños */
  .product-modal-details h2 {
    font-size: 0.95rem;
  }

  .modal-description,
  .modal-points,
  .modal-features-list li {
    font-size: 0.85rem;
  }

  .modal-cart-form .btn-add-cart {
    font-size: 0.9rem;
  }
}

/* Bloque de usuario (header superior) */
.user-block {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted, #4b5563);
  flex-wrap: wrap;
}

.user-block i.bi {
  font-size: 1.3rem;
  color: var(--primary-color, #bf52c8);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.user-info strong {
  font-weight: 600;
  color: var(--text-color, #111827);
}

.user-guest-text a {
  color: var(--primary-color, #bf52c8);
  font-weight: 500;
  text-decoration: none;
}

.user-guest-text a:hover {
  text-decoration: underline;
}

/* Form de logout */
.logout-form {
  margin: 0;
}

/* Botón de cerrar sesión */
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.75);
  background: #ffffff;
  color: #374151;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;

  transition: background-color 0.15s ease, color 0.15s ease,
    border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-logout i {
  font-size: 0.9rem;
}

/* Hover suave, sin “saltos” */
.btn-logout:hover {
  background: #f3e8ff;
  border-color: var(--primary-color, #bf52c8);
  color: var(--primary-color, #bf52c8);
  box-shadow: 0 3px 10px rgba(191, 82, 200, 0.25);
}

/* Focus accesible */
.btn-logout:focus {
  outline: 2px solid var(--primary-color, #bf52c8);
  outline-offset: 2px;
}

/* Responsive en pantallas pequeñas */
@media (max-width: 640px) {
  .user-block {
    justify-content: space-between;
    font-size: 0.8rem;
  }

  .btn-logout span {
    display: none; /* Solo ícono en móviles */
  }

  .btn-logout {
    padding: 6px 8px;
  }
}

.user-block .btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: #ffffff;
  color: #0f172a;
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, box-shadow 0.15s ease,
    transform 0.12s ease, color 0.15s ease, border-color 0.15s ease;
}

.user-block .btn-logout:hover {
  background: #f9fafb;
  border-color: #bf52c8;
  color: #7c3aed;
  box-shadow: 0 4px 14px rgba(148, 163, 184, 0.4);
  transform: translateY(-0.5px);
}

/* Hacer que la imagen sea clickeable sin perder funcionalidad */
.product-image-link {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.product-image-link:hover img {
  transform: scale(1.05);
}

.product-image-wrapper {
  position: relative;
  overflow: hidden;
}

.product-image {
  transition: transform 0.3s ease;
}

/* =========================
   MODAL - FIX MOBILE POSITION
   ========================= */

/* Backdrop ocupa toda la pantalla y permite scroll si el contenido es alto */
.product-modal-backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh; /* mejor que 100vh en móvil */
  background: rgba(0, 0, 0, 0.55);
  z-index: 9999;

  display: none; /* visible solo con .is-visible */
  align-items: center;
  justify-content: center;

  padding: calc(12px + env(safe-area-inset-top)) 12px
    calc(12px + env(safe-area-inset-bottom));
  overflow: auto; /* si el modal es alto, que scrollee el backdrop */
  -webkit-overflow-scrolling: touch;
}

.product-modal-backdrop.is-visible {
  display: flex;
}

/* El modal NO debe tener top/transform raros; que se ajuste a pantalla */
.product-modal {
  width: min(980px, 100%);
  max-height: calc(
    100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
  );
  overflow: auto; /* scroll interno */
  border-radius: 14px;
  position: relative;
  margin: auto;

  /* si tu CSS anterior usa translateY, esto lo neutraliza */
  transform: none !important;
  top: auto !important;
}

/* En pantallas pequeñas, mejor anclarlo arriba con padding para que no “salte” */
@media (max-width: 576px) {
  .product-modal-backdrop {
    align-items: flex-start; /* evita que quede cortado arriba */
  }

  .product-modal {
    max-height: calc(
      100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
    );
  }

  /* si tu layout interno es 2 columnas, en móvil conviene 1 columna */
  .product-modal-content {
    flex-direction: column;
  }

  .product-modal-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
  }
}

/* Bloquea scroll del body cuando abres el modal (tú ya agregas .modal-open) */
body.modal-open {
  overflow: hidden;
  touch-action: none;
}
