* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  font-family: 'Arial', sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f8f9fa;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
}

/* Paleta de colores basada en el logo PMS */
:root {
  --pms-red: #e30613;
  --pms-blue: #012677;
  --pms-green: #12a19a;
  --pms-dark: #2c2c31;
  --pms-light: #f8f9fa;
  --pms-white: #ffffff;
  --pms-gray: #6c757d;
  --brand-primary: #0F2857;
}

/* Header con logo */
.header {
  background: linear-gradient(2deg, var(--pms-blue), #005bc5);
  color: white;
  padding: 1rem 0;
  position: fixed;
  width: 100%;
  max-width: 100vw;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow-x: hidden;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  width: 100%;
  box-sizing: border-box;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  width: 50px;
  height: 50px;
  background: var(--pms-white);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--pms-red);
  font-size: 1.2rem;
}

.header-info h1 {
  font-size: 1.5rem;
  margin-bottom: 0.2rem;
}

.header-info p {
  font-size: 0.9rem;
  opacity: 0.9;
}

.cart-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cart-counter {
  background: var(--pms-green);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 25px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
  position: relative;
}

.cart-counter:hover {
  background: var(--pms-red);
}

.cart-count {
  background: var(--pms-red);
  color: white;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  position: absolute;
  top: -10px;
  right: -10px;
}

/*ÁREA DE CATEGORIAS*/
/* Layout principal - SIDEBAR COMPACTO */
.main-content {
  max-width: 1400px;
  margin: 90px auto 0;
  padding: 1rem;
  display: grid;
  grid-template-columns: 200px 1fr 280px;
  gap: 1.5rem;
  width: 100%;
  box-sizing: border-box;
}

/* SIDEBAR CATEGORÍAS - DISEÑO ULTRA COMPACTO */
.categories-sidebar {
  background: white;
  border-radius: 12px;
  padding: 0.8rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  height: fit-content;
  position: sticky;
  top: 120px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  width: 200px;
  box-sizing: border-box;
}

.categories-title {
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
  color: var(--pms-dark);
  text-align: center;
  border-bottom: 1px solid var(--pms-light);
  padding-bottom: 0.5rem;
  font-weight: 600;
}

.category-item {
  display: flex;
  align-items: center;
  padding: 0.8rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
  margin-bottom: 0.5rem;
  gap: 0.8rem;
}

.category-item:hover {
  background: var(--pms-light);
  border-color: var(--pms-blue);
  transform: translateX(2px);
}

.category-item.active {
  background: var(--pms-blue);
  color: white;
  border-color: var(--pms-blue);
  box-shadow: 0 2px 6px rgba(0, 102, 204, 0.3);
}

.category-icon {
  width: 45px;
  height: 45px;
  min-width: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pms-light);
  border-radius: 10px;
  flex-shrink: 0;
}

.category-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.category-icon i {
  font-size: 1.4rem;
  color: var(--pms-blue);
}

.category-info {
  flex: 1;
  min-width: 0;
}

.category-info h3 {
  font-size: 0.8rem;
  margin: 0;
  font-weight: 500;
  line-height: 1.3;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
  hyphens: none;
}

.category-info p {
  display: none;
}

/* Área de productos */
.products-area {
  background: white;
  border-radius: 15px;
  padding: 2rem;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.products-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--pms-light);
}

.products-header h2 {
  color: var(--pms-dark);
  font-size: 1.8rem;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--pms-light);
  padding: 0.5rem 1rem;
  border-radius: 25px;
  border: 2px solid transparent;
  transition: border-color 0.3s;
}

.search-box:focus-within {
  border-color: var(--pms-blue);
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  padding: 0.5rem;
  font-size: 1rem;
  width: 250px;
}

/* Grid de productos - 3 COLUMNAS FIJAS */
.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  width: 100%;
  box-sizing: border-box;
}

.product-card {
  background: white;
  border: 2px solid var(--pms-light);
  border-radius: 15px;
  padding: 1.5rem;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.product-card:hover {
  border-color: var(--pms-blue);
  box-shadow: 0 5px 20px rgba(1, 38, 119, 0.2);
  transform: translateY(-2px);
}

.product-image {
  width: 100%;
  height: 200px;
  background: var(--pms-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  overflow: hidden;
  position: relative;
}

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

.placeholder-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 3rem;
  color: var(--pms-gray);
  opacity: 0.5;
}

.image-zoom-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 102, 204, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 10px;
  color: white;
  font-size: 2rem;
}

.product-code {
  background: var(--pms-light);
  color: var(--pms-gray);
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
  font-size: 0.8rem;
  margin-bottom: 0.8rem;
  display: inline-block;
  font-weight: 500;
}

.product-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
  color: var(--pms-dark);
  line-height: 1.3;
  min-height: 2.6rem;
}

.product-stock {
  color: var(--pms-green);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.product-stock.low {
  color: var(--pms-red);
}

.product-price {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--pms-blue);
  margin-bottom: 1.5rem;
}

.product-actions {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: auto;
}

.quantity-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--pms-light);
  border-radius: 8px;
  overflow: hidden;
  max-width: 150px;
  margin: 0 auto;
}

.quantity-btn {
  background: var(--pms-light);
  border: none;
  padding: 0.6rem;
  cursor: pointer;
  transition: background 0.3s;
  color: var(--pms-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
}

.quantity-btn:hover {
  background: var(--pms-blue);
  color: white;
}

.quantity-input {
  border: none;
  text-align: center;
  width: 60px;
  padding: 0.6rem;
  font-size: 1rem;
  background: white;
}

.add-to-cart {
  background: var(--pms-green);
  color: white;
  border: none;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s;
  font-size: 0.95rem;
}

.add-to-cart:hover {
  background: var(--pms-blue);
}

.add-to-cart:disabled {
  background: var(--pms-gray);
  cursor: not-allowed;
}

/* Carrito lateral */
.cart-sidebar {
  background: white;
  border-radius: 15px;
  padding: 1.5rem;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  height: fit-content;
  position: sticky;
  top: 120px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.cart-title {
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
  color: var(--pms-dark);
  text-align: center;
  border-bottom: 2px solid var(--pms-light);
  padding-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.cart-items {
  margin-bottom: 1.5rem;
}

.cart-item {
  border: 1px solid var(--pms-light);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
  position: relative;
}

.cart-item h4 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--pms-dark);
  line-height: 1.3;
  padding-right: 30px;
}

.cart-item-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.cart-item-price {
  font-weight: bold;
  color: var(--pms-blue);
}

.cart-item-quantity {
  background: var(--pms-light);
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  font-size: 0.8rem;
}

.remove-item {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--pms-red);
  color: white;
  border: none;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.remove-item:hover {
  background: #b91c1c;
}

.cart-summary {
  border-top: 2px solid var(--pms-light);
  padding-top: 1rem;
  margin-top: 1rem;
}

.cart-total {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--pms-blue);
  text-align: center;
  margin-bottom: 1.5rem;
}

.checkout-btn {
  width: 100%;
  background: var(--pms-green);
  color: white;
  border: none;
  padding: 1rem;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}

.checkout-btn:hover {
  background: var(--pms-blue);
}

.checkout-btn:disabled {
  background: var(--pms-gray);
  cursor: not-allowed;
}

.empty-cart {
  text-align: center;
  color: var(--pms-gray);
  padding: 2rem;
}

.empty-cart i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* ===== NAV unificada (mismo look que el index) ===== */
.main-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.main-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: .45rem .9rem;
  border-radius: 999px;
  opacity: .95;
  transition: background .2s, opacity .2s;
}

.main-nav a:hover {
  opacity: 1;
  background: rgba(255, 255, 255, .12);
}

.main-nav a.active {
  background: rgba(255, 255, 255, .22);
}

/* Ajuste de alturas para alinear con index (72px aprox) */
.header {
  padding: .5rem 0;
}

.header-content {
  min-height: 72px;
}

/* ====== HEADER UNIFICADO (ARMADOR) ====== */
.site-header {
  background: var(--pms-blue);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100vw;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
  overflow-x: hidden;
}

/* ==== Ajuste de espaciado en el header ==== */
.site-header .header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
  height: 72px;
  width: 100%;
  box-sizing: border-box;
}

.header-left nav {
  display: flex;
  gap: 2rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: #fff;
  color: var(--pms-red);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
}

.header-info h1,
.header-info p {
  margin: 0;
  line-height: 1.1;
  color: #fff;
}

.header-info h1 {
  font-size: 1.25rem;
  font-weight: 800;
}

.header-info p {
  font-size: .85rem;
  opacity: .9;
}

/* nav */
.main-nav {
  gap: 10px;
}

.main-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: .45rem .9rem;
  border-radius: 999px;
  opacity: .95;
  transition: background .2s, opacity .2s;
}

.main-nav a:hover {
  opacity: 1;
  background: rgba(255, 255, 255, .12);
}

.main-nav a.active {
  background: rgba(255, 255, 255, .22);
}

/* acciones derecha */
.header-actions a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  opacity: .95;
  padding: .35rem .6rem;
  border-radius: 10px;
  transition: background .2s, opacity .2s;
}

.header-actions a:hover {
  opacity: 1;
  background: rgba(255, 255, 255, .12);
}

/* contador carrito acorde al header */
.cart-counter {
  background: rgba(255, 255, 255, .18);
  color: #fff;
  padding: .45rem .8rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: .4rem;
  position: relative;
}

.cart-counter:hover {
  background: rgba(255, 255, 255, .28);
}

.cart-count {
  background: #ff3b30;
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 800;
  position: absolute;
  top: -6px;
  right: -6px;
}

/* empuje del contenido por header fijo */
.main-content {
  margin-top: 90px;
}

/* Animaciones */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(50px) scale(0.9);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Efecto de resaltado para producto seleccionado */
@keyframes flash-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(1, 38, 119, 0.45);
  }

  100% {
    box-shadow: 0 0 0 16px rgba(1, 38, 119, 0);
  }
}

.product-card.highlight-card {
  outline: 3px solid var(--pms-blue);
  animation: flash-ring 1.2s ease-out 2;
}

/* ========================================
   RESPONSIVE DESIGN - OPTIMIZADO MÓVILES
   ======================================== */

/* TABLETS Y PANTALLAS MEDIANAS (1200px) */
@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .categories-sidebar {
    width: 100%;
    position: static;
    max-height: none;
    padding: 0.8rem;
  }

  #categoriesList {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.3rem;
  }

  .category-item {
    justify-content: center;
    text-align: center;
    flex-direction: column;
    padding: 0.5rem 0.3rem;
  }


  .category-info h3 {
    font-size: 0.6rem;
    white-space: normal;
    text-overflow: initial;
    overflow: visible;
    text-align: center;
  }

  .cart-sidebar {
    position: static;
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .categories-sidebar {
    padding: 1rem;
  }

  #categoriesList {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
  }

  .category-item {
    flex: 0 0 auto;
    min-width: 80px;
  }
}

/* TABLETS MEDIAS (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
  }

  #categoriesList {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* MÓVILES GRANDES Y TABLETS PEQUEÑAS (768px) */
@media (max-width: 768px) {

  /* LAYOUT GENERAL */
  body {
    overflow-x: hidden;
  }

  .main-content {
    padding: 0.75rem 1.5rem;
    margin-top: 100px;
    gap: 0.75rem;
    max-width: 100%;
    overflow-x: hidden;
  }

  .header-content {
    padding: 0 1.5rem;
    gap: .5rem;
  }

  /* HEADER MÓVIL */
  .site-header .header-content {
    height: 64px;
    padding: 0 1.5rem;
    gap: .5rem;
  }

  .logo-icon {
    width: 40px;
    height: 40px;
    font-size: .95rem;
  }

  .header-info h1 {
    font-size: 1.05rem;
  }

  .header-info p {
    font-size: .8rem;
  }

  .main-nav a {
    padding: .35rem .7rem;
    font-weight: 700;
  }

  /* CATEGORÍAS MÓVIL - 3 COLUMNAS */
  .categories-sidebar {
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    width: 100%;
    box-sizing: border-box;
  }

  .categories-sidebar::-webkit-scrollbar {
    height: 4px;
  }

  .categories-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
  }

  .categories-sidebar::-webkit-scrollbar-thumb {
    background: var(--pms-blue);
    border-radius: 10px;
  }

  .categories-title {
    font-size: 1rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
  }

  #categoriesList {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .category-item {
    padding: 0.6rem 0.3rem;
    border-radius: 8px;
    min-height: 75px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }


  .category-info h3 {
    font-size: 0.65rem;
    line-height: 1.2;
    text-align: center;
    word-break: break-word;
  }

  /* ÁREA DE PRODUCTOS */
  .products-area {
    padding: 1.5rem;
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .products-header {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
  }

  .products-header h2 {
    font-size: 1.3rem;
  }

  .search-box {
    width: 100%;
    margin: 0;
  }

  .search-box input {
    width: 100%;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
  }

  /* GRID DE PRODUCTOS - 3 COLUMNAS EN MÓVIL */
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
  }

  /* TARJETAS DE PRODUCTO COMPACTAS */
  .product-card {
    padding: 0.6rem;
    border-radius: 10px;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
  }

  .product-image {
    height: 105px;
    margin-bottom: 0.5rem;
    border-radius: 8px;
  }

  .product-code {
    font-size: 0.6rem;
    padding: 0.25rem 0.4rem;
    margin-bottom: 0.4rem;
  }

  .product-card h3 {
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
    min-height: auto;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .product-stock {
    font-size: 0.65rem;
    margin-bottom: 0.5rem;
  }

  .product-price {
    font-size: 1rem;
    margin-bottom: 0.6rem;
    font-weight: 800;
  }

  /* ACCIONES DE PRODUCTO */
  .product-actions {
    gap: 0.5rem;
  }

  .quantity-selector {
    height: 32px;
  }

  .quantity-btn {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
    padding: 0;
    min-height: 44px;
    /* Touch target */
  }

  .quantity-input {
    width: 40px;
    font-size: 0.8rem;
    padding: 0.3rem;
  }

  .add-to-cart {
    padding: 0.5rem 0.6rem;
    font-size: 0.7rem;
    border-radius: 8px;
    min-height: 44px;
    /* Touch target */
  }

  .add-to-cart i {
    font-size: 0.75rem;
  }

  /* CARRITO LATERAL */
  .cart-sidebar {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .cart-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
  }

  .cart-item {
    padding: 0.7rem;
    margin-bottom: 0.6rem;
  }

  .cart-item h4 {
    font-size: 0.8rem;
  }

  .cart-item-price {
    font-size: 0.85rem;
  }
}

/* MÓVILES PEQUEÑOS - Ajustes finos para pantallas más chicas */
@media (max-width: 400px) {
  .main-content {
    padding: 0.5rem 1.25rem;
  }

  .products-area {
    padding: 1.25rem;
  }

  .categories-sidebar {
    padding: 0.75rem 1.25rem;
  }

  .products-grid {
    gap: 0.5rem;
  }

  .product-card {
    padding: 0.5rem;
  }

  .product-image {
    height: 90px;
  }

  .product-card h3 {
    font-size: 0.65rem;
  }

  .product-price {
    font-size: 0.9rem;
  }

  .category-item {
    min-height: 70px;
    padding: 0.5rem 0.2rem;
  }


  .category-info h3 {
    font-size: 0.6rem;
  }
}

/* SMARTPHONES MODERNOS ESTÁNDAR (iPhone 11/12/13/14/15, Samsung Galaxy, etc) */
@media (min-width: 375px) and (max-width: 430px) {
  .main-content {
    padding: 0.75rem 1.5rem;
  }

  .products-area {
    padding: 1.5rem;
  }

  .categories-sidebar {
    padding: 0.75rem 1.5rem;
  }
}

/* MEJORAS DE RENDIMIENTO Y UX */
.product-card,
.category-item {
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}

/* Touch targets más grandes para móvil */
@media (max-width: 768px) {

  .quantity-btn,
  .add-to-cart,
  .category-item {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
}

/* ====== FIX popup "Datos del Cliente" en móviles ====== */
@media (max-width: 480px) {
  /* El overlay sin padding y estirado */
  #formOverlay {
    padding: 0 !important;
    align-items: stretch !important; /* que el popup use todo el alto */
  }

  /* El contenedor del formulario (es el primer div dentro del overlay) */
  #formOverlay > div {
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;      /* que no se recorte */
    border-radius: 0 !important;      /* full screen */
    padding: 16px !important;
    overflow-y: auto !important;
  }

  /* Títulos y botón cerrar algo más chicos */
  #formOverlay h2 { font-size: 1.1rem !important; }
  #formOverlay button[onclick="closeCustomerForm()"] {
    width: 36px !important; height: 36px !important; font-size: 1rem !important;
  }

  /* Inputs cómodos sin ocupar de más */
  #formOverlay input, #formOverlay textarea {
    font-size: 16px !important; /* evita zoom raro en iOS */
    padding: 10px !important;
  }

  /* Forzar a 1 columna los bloques que vienen en 2 col inline */
  #formOverlay #customerForm [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Forzar a 1 columna el grid de métodos de pago (auto-fit…) */
  #formOverlay #customerForm [style*="repeat(auto-fit"] {
    grid-template-columns: 1fr !important;
  }

  /* Tarjetas de opciones más compactas */
  #formOverlay .delivery-option, 
  #formOverlay .payment-option {
    padding: 12px !important;
  }
}

/* Un ajuste cómodo para tablets chicas */
@media (min-width: 481px) and (max-width: 768px) {
  #formOverlay > div {
    max-width: 520px !important;
    max-height: 96vh !important;
  }
  #formOverlay #customerForm [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}
/* ====== FIN FIX popup "Datos del Cliente" en móviles ====== */
/* ====== FIX popup "Datos del Cliente" en móviles ====== */
@media (max-width: 480px) {

  /* El overlay sin padding y estirado */
  #formOverlay {
    padding: 0 !important;
    align-items: stretch !important;
    /* que el popup use todo el alto */
  }

  /* El contenedor del formulario (es el primer div dentro del overlay) */
  #formOverlay>div {
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;
    /* que no se recorte */
    border-radius: 0 !important;
    /* full screen */
    padding: 16px !important;
    overflow-y: auto !important;
  }

  /* Títulos y botón cerrar algo más chicos */
  #formOverlay h2 {
    font-size: 1.1rem !important;
  }

  #formOverlay button[onclick="closeCustomerForm()"] {
    width: 36px !important;
    height: 36px !important;
    font-size: 1rem !important;
  }

  /* Inputs cómodos sin ocupar de más */
  #formOverlay input,
  #formOverlay textarea {
    font-size: 16px !important;
    /* evita zoom raro en iOS */
    padding: 10px !important;
  }

  /* Forzar a 1 columna los bloques que vienen en 2 col inline */
  #formOverlay #customerForm [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Forzar a 1 columna el grid de métodos de pago (auto-fit…) */
  #formOverlay #customerForm [style*="repeat(auto-fit"] {
    grid-template-columns: 1fr !important;
  }

  /* Tarjetas de opciones más compactas */
  #formOverlay .delivery-option,
  #formOverlay .payment-option {
    padding: 12px !important;
  }
}

/* Un ajuste cómodo para tablets chicas */
@media (min-width: 481px) and (max-width: 768px) {
  #formOverlay>div {
    max-width: 520px !important;
    max-height: 96vh !important;
  }

  #formOverlay #customerForm [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}
/* === Ocultar selector de cantidad SOLO en móviles === */
@media (max-width: 768px) {

  .product-card .quantity-wrapper,
  .product-card .quantity-selector {
    display: none !important;
    visibility: hidden !important;
  }

  .product-card .add-to-cart {
    margin-top: 0 !important;
    width: 100%;
  }
}

/* Mantener el selector visible en el carrito (siempre) */
.cart,
.cart-list,
.cart-items {
  /* contenedores posibles del carrito */
}

.cart .quantity-wrapper,
.cart-list .quantity-wrapper,
.cart-items .quantity-wrapper {
  display: flex !important;
  visibility: visible !important;
}

@media (max-width: 480px) {
  .categories-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 4px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .category-item {
    flex: 0 0 120px;
    /* ancho del ítem */
    scroll-snap-align: center;
    text-align: center;
    padding: 12px;
    border-radius: 12px;
    white-space: normal;
  }

  /* opcional: ocultar barra de scroll */
  .categories-grid::-webkit-scrollbar {
    display: none;
  }
}