:root {
  --primary-color: #2563eb;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --separator-color: #7d4d30;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

/* NUEVO: Header solo imagen */
.header-image {
  width: 100%;
  height: 300px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #e2e8f0;
  display: block;
}

/* NUEVO: Sección de título debajo del header */
.title-section {
  background: white;
  padding: 30px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.title-content h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.subtitle-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 15px 0;
  flex-wrap: wrap;
}

.subtitulo {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.social-links {
  display: flex;
  gap: 15px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  font-size: 1.3rem;
}

.social-link:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.social-link.facebook {
  background: #1877f2;
  color: white;
}

.social-link.instagram {
  background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
  color: white;
}

.fecha {
  font-size: 1rem;
  color: var(--text-secondary);
  text-transform: capitalize;
  margin-top: 10px;
}

/* Barra de búsqueda */
.search-container {
  margin: 0 20px 30px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.search-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-box label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.search-box input[type="search"] {
  width: 100%;
  padding: 12px 20px;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: white;
  transition: all 0.2s;
}

.search-box input[type="search"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-box input[type="search"]::placeholder {
  color: var(--text-secondary);
}

/* Custom Select (ComboBox) */
.custom-select {
  position: relative;
  width: 100%;
}

.select-selected {
  background-color: white;
  padding: 12px 20px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.select-selected:hover {
  border-color: var(--primary-color);
}

.custom-select.active .select-selected {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.select-arrow {
  transition: transform 0.2s;
  color: var(--text-secondary);
}

.custom-select.active .select-arrow {
  transform: rotate(180deg);
}

.select-items {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: white;
  border: 2px solid var(--primary-color);
  border-top: none;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  z-index: 99;
  display: none;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.select-items.active {
  display: block;
}

.select-search {
  width: 100%;
  padding: 10px 15px;
  border: none;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
  outline: none;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.select-search::placeholder {
  color: var(--text-secondary);
}

.select-option {
  padding: 12px 20px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s;
}

.select-option:hover {
  background-color: #f1f5f9;
}

.select-option[data-value=""] {
  font-weight: 600;
  color: var(--primary-color);
  border-bottom: 1px solid var(--border-color);
}

/* Categorías */
.categoria-section {
  margin: 0 20px 50px 20px;
}

.categoria-titulo {
  font-size: 1.8rem;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--separator-color);
}

/* Categoría destacados */
.categoria-section.destacados .categoria-titulo {
  color: #7d4d30;
  border-bottom-width: 4px;
}

/* Grid de productos */
.productos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.producto-card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.producto-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.producto-imagen {
  width: 100%;
  height: 200px;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ícono + tooltip de descripción del producto, al lado del nombre.
   Desktop: hover puro por CSS (gateado a mouse real). Touch: el mismo botón
   togglea .info-abierto por JS (ver toggleInfoProducto en precios.js) — un
   único mecanismo cubre los dos casos sin detectar tipo de dispositivo. */
.info-trigger {
  position: relative;
  display: inline-flex;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--secondary-color);
  font-size: 0.85em;
}

.info-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 220px;
  background: var(--text-primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
  z-index: 20;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .info-trigger:hover .info-tooltip {
    opacity: 1;
    visibility: visible;
  }
}

.info-trigger.info-abierto .info-tooltip {
  opacity: 1;
  visibility: visible;
}

.producto-imagen img {
  width: 100%;
  height: 100%;
  object-fit: scale-down;
}

.producto-info {
  padding: 15px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.producto-nombre {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.producto-precio {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* NUEVO: Botón flotante de WhatsApp */
.whatsapp-float {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.3s;
  z-index: 1000;
  animation: pulse 2s infinite;
}

.whatsapp-float:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Footer */
footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Estados */
.loading, .empty-state, .error-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.error-state {
  color: var(--danger-color);
}

.error-state .btn {
  margin-top: 20px;
}

/* Botones básicos */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  background: var(--primary-color);
  color: white;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  background: #1d4ed8;
}

/* Scrollbar personalizado */
.select-items::-webkit-scrollbar {
  width: 8px;
}

.select-items::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.select-items::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.select-items::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .header-image {
    height: 200px;
  }

  .title-content h1 {
    font-size: 2rem;
  }

  .subtitle-social {
    flex-direction: column;
    gap: 10px;
  }

  .search-container {
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 0 15px 25px 15px;
  }
  
  .productos-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
  }
  
  .categoria-titulo {
    font-size: 1.5rem;
  }

  .categoria-section {
    margin: 0 15px 40px 15px;
  }

  .select-items {
    max-height: 250px;
  }

  .whatsapp-float {
    bottom: 20px;
    right: 20px;
    width: 55px;
    height: 55px;
    font-size: 1.8rem;
  }
}

@media (max-width: 480px) {
  .header-image {
    height: 150px;
  }

  .title-content h1 {
    font-size: 1.75rem;
  }

  .subtitulo {
    font-size: 1rem;
  }

  .productos-grid {
    grid-template-columns: 1fr;
  }
}

/* Container del header */
.header-image-container {
  width: 100%;
  max-height: 300px;
  min-height: 150px;
  background-color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Imagen del header */
.header-image {
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: contain;
  display: block;
}

@media (max-width: 768px) {
  .header-image-container {
    max-height: 200px;
    min-height: 120px;
  }
  
  .header-image {
    max-height: 200px;
  }
}

@media (max-width: 480px) {
  .header-image-container {
    max-height: 150px;
    min-height: 100px;
  }
  
  .header-image {
    max-height: 150px;
  }
}
