/* ========================================================
   COLLECTA ORGÁNICA - HOJA DE ESTILOS INSTITUCIONAL
   Paleta oficial y componentes UI responsivos
   ======================================================== */

:root {
  --negro: #1F1D1E;
  --verde: #829044;
  --blanco: #FFFFFF;
  --verde-claro: #eef1e6;
  --gris: #777777;
  --rojo: #d9534f;
  --dorado: #d97706;
}

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

body {
  font-family: 'Poppins', sans-serif;
  background: #f7f7f5;
  color: var(--negro);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* BANNER AVISO DE CONFIGURACIÓN API (DEMO MODE) */
.api-demo-banner {
  background: #fff8e1;
  color: #855302;
  border-bottom: 1px solid #ffe082;
  font-size: 12px;
  padding: 8px 16px;
  text-align: center;
  display: none;
  font-weight: 500;
  z-index: 102;
}
.api-demo-banner.visible {
  display: block;
}
.api-demo-banner code {
  background: rgba(0,0,0,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* BARRA DE ANUNCIOS SUPERIOR */
.top-bar-anuncio {
  background-color: var(--verde);
  color: var(--blanco);
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  z-index: 101;
}

.anuncio-texto {
  display: flex;
  align-items: center;
  gap: 8px;
}

.anuncio-texto .hoja-icon {
  font-size: 15px;
}

.btn-whatsapp-anuncio {
  background-color: #25D366;
  color: var(--blanco);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

.btn-whatsapp-anuncio:hover {
  background-color: #1eb857;
  transform: scale(1.03);
}

/* HEADER & BUSCADOR */
header {
  background: var(--negro);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 30px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  gap: 15px;
  flex-wrap: wrap;
}

.marca {
  display: flex;
  align-items: center;
  gap: 14px;
}

.marca img {
  height: 48px;
  object-fit: contain;
}

.marca span {
  color: var(--blanco);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 1px;
}

.contenedor-buscador {
  flex: 1;
  max-width: 400px;
  min-width: 200px;
}

.contenedor-buscador input {
  width: 100%;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid #444;
  background: #2a2829;
  color: var(--blanco);
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

.contenedor-buscador input::placeholder {
  color: #aaa;
}

.contenedor-buscador input:focus {
  border-color: var(--verde);
}

.carrito-btn {
  background: var(--verde);
  color: var(--blanco);
  border: none;
  border-radius: 30px;
  padding: 10px 20px;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  transition: 0.2s;
  position: relative;
}

.carrito-btn:hover {
  background: #98a955;
}

.badge {
  background: var(--negro);
  color: var(--blanco);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* FILTROS DE CATEGORÍA */
.filtros {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 25px 20px 5px;
}

.filtro-btn {
  background: var(--blanco);
  border: 2px solid var(--verde);
  color: var(--verde);
  padding: 8px 22px;
  border-radius: 25px;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s;
}

.filtro-btn.activo,
.filtro-btn:hover {
  background: var(--verde);
  color: var(--blanco);
}

/* GRID PRODUCTOS */
.productos {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 24px;
  width: 100%;
}

.card {
  background: var(--blanco);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.06);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.card-img {
  height: 160px;
  background: var(--verde-claro);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-img .placeholder {
  font-size: 40px;
}

/* INSIGNIA DE PUNTOS */
.burbuja-puntos {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(31, 29, 30, 0.85);
  backdrop-filter: blur(4px);
  color: #fbbf24;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 20px;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

/* BOTÓN DE VISTA PREVIA SOBRE LA IMAGEN */
.btn-vista-previa {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background-color: rgba(255, 255, 255, 0.95);
  color: var(--verde);
  padding: 8px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  border: none;
  z-index: 3;
}

.card-img:hover .btn-vista-previa {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.btn-vista-previa:hover {
  background-color: var(--verde);
  color: var(--blanco);
}

/* BURBUJA DE STOCK */
.burbuja-stock {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: var(--verde);
  color: var(--blanco);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.burbuja-stock.pocas-unidades {
  background-color: var(--rojo);
}

.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-cat {
  font-size: 11px;
  color: var(--verde);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.card-nombre {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.3;
}

.card-desc {
  font-size: 12px;
  color: var(--gris);
  margin-bottom: 10px;
  flex: 1;
  line-height: 1.4;
}

/* PRECIOS Y DESCUENTOS */
.card-precio-box {
  margin-bottom: 12px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.card-precio {
  font-size: 18px;
  font-weight: 700;
  color: var(--negro);
}

.card-precio-anterior {
  font-size: 13px;
  font-weight: 400;
  color: #a3a3a3;
  text-decoration: line-through;
}

.badge-descuento {
  background-color: #fee2e2;
  color: #dc2626;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
}

.card-precio small {
  font-size: 12px;
  font-weight: 400;
  color: var(--gris);
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-selector {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}

.qty-selector button {
  background: var(--verde-claro);
  border: none;
  width: 30px;
  height: 32px;
  cursor: pointer;
  font-size: 16px;
  color: var(--negro);
  transition: background 0.15s;
}

.qty-selector button:hover {
  background: #e2e8d5;
}

.qty-selector input {
  width: 34px;
  text-align: center;
  border: none;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  outline: none;
}

.add-btn {
  flex: 1;
  background: var(--negro);
  color: var(--blanco);
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.add-btn:hover {
  background: var(--verde);
}

/* CARRITO LATERAL (DRAWER) */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  z-index: 200;
}

.overlay.visible {
  display: block;
}

.carrito-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 92%;
  height: 100%;
  background: var(--blanco);
  z-index: 201;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -5px 0 25px rgba(0,0,0,0.2);
}

.carrito-panel.visible {
  right: 0;
}

.carrito-header {
  background: var(--negro);
  color: var(--blanco);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.carrito-header h3 {
  font-weight: 600;
}

.cerrar-btn {
  background: none;
  border: none;
  color: var(--blanco);
  font-size: 22px;
  cursor: pointer;
}

.carrito-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.item-carrito {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.item-info b {
  font-size: 14px;
  display: block;
}

.item-info span {
  font-size: 12px;
  color: var(--gris);
}

.item-acciones {
  display: flex;
  align-items: center;
  gap: 8px;
}

.item-acciones button {
  background: var(--verde-claro);
  border: none;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.quitar-btn {
  color: #b33;
  font-size: 12px;
  cursor: pointer;
  background: none;
  border: none;
  margin-left: 6px;
}

.carrito-vacio {
  text-align: center;
  color: var(--gris);
  margin-top: 40px;
  font-size: 14px;
}

.carrito-footer {
  padding: 20px;
  border-top: 1px solid #eee;
  background: #fafafa;
}

.alerta-minimo {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  text-align: center;
  font-weight: 500;
}

.alerta-minimo.incompleto {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

.alerta-minimo.completo {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.linea-desglose {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--gris);
  margin-bottom: 6px;
}

.total-linea {
  display: flex;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 700;
  margin-top: 10px;
  margin-bottom: 14px;
  border-top: 1px solid #ddd;
  padding-top: 10px;
}

.total-linea span:last-child {
  color: var(--verde);
}

.checkout-btn {
  width: 100%;
  background: var(--verde);
  color: var(--blanco);
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.checkout-btn:hover {
  background: #6d7a38;
}

.checkout-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* MODAL VISTA PREVIA DEL PRODUCTO */
.modal-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 400;
  padding: 20px;
}

.modal-preview-overlay.activo {
  opacity: 1;
  pointer-events: auto;
}

.modal-preview-contenido {
  background: #fff;
  width: 100%;
  max-width: 750px;
  border-radius: 20px;
  padding: 30px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-preview-overlay.activo .modal-preview-contenido {
  transform: scale(1);
}

.btn-cerrar-preview {
  position: absolute;
  top: 15px;
  right: 15px;
  background: #f0f0f0;
  border: none;
  font-size: 20px;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: background 0.2s;
  z-index: 10;
}

.btn-cerrar-preview:hover {
  background: #e0e0e0;
  color: #000;
}

.modal-preview-imagen {
  width: 100%;
  height: 100%;
  min-height: 250px;
  background: var(--verde-claro);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.modal-preview-imagen img {
  width: 100%;
  height: 100%;
  max-height: 320px;
  object-fit: cover;
}

.modal-preview-detalles {
  display: flex;
  flex-direction: column;
}

.pv-cat {
  font-size: 12px;
  color: var(--verde);
  font-weight: 600;
  text-transform: uppercase;
}

.pv-marca {
  font-size: 12px;
  color: var(--gris);
  margin-bottom: 4px;
}

.pv-titulo {
  font-size: 22px;
  font-weight: 700;
  color: var(--negro);
  margin-bottom: 2px;
  line-height: 1.2;
}

.pv-presentacion {
  font-size: 13px;
  color: var(--gris);
  margin-bottom: 10px;
}

.pv-precio-box {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.pv-precio {
  font-size: 22px;
  font-weight: 700;
  color: var(--verde);
}

.pv-descripcion-box h4 {
  font-size: 13px;
  color: var(--negro);
  margin-bottom: 4px;
}

.pv-descripcion-box p {
  font-size: 12px;
  color: #555;
  line-height: 1.4;
  margin-bottom: 12px;
}

.pv-beneficios {
  list-style: none;
  padding: 0;
  margin-bottom: 16px;
}

.pv-beneficios li {
  font-size: 12px;
  color: var(--verde);
  margin-bottom: 4px;
}

.pv-control-cantidad {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.pv-control-cantidad label {
  font-size: 13px;
  font-weight: 600;
}

/* MODAL CHECKOUT */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}

.modal-overlay.visible {
  display: flex;
}

.modal-box {
  background: var(--blanco);
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
}

.modal-box h2 {
  color: var(--negro);
  margin-bottom: 4px;
}

.modal-box .sub {
  color: var(--gris);
  font-size: 13px;
  margin-bottom: 20px;
}

.campo {
  margin-bottom: 14px;
}

.campo label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 5px;
}

.campo input,
.campo textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  transition: border-color 0.2s;
}

.campo input:focus,
.campo textarea:focus {
  outline: none;
  border-color: var(--verde);
}

.campo textarea {
  resize: vertical;
  min-height: 60px;
}

.modal-botones {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-cancelar {
  flex: 1;
  background: #eee;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  font-weight: 500;
}

.btn-confirmar {
  flex: 2;
  background: var(--negro);
  color: var(--blanco);
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-confirmar:hover {
  background: var(--verde);
}

.btn-confirmar:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.mensaje-exito {
  text-align: center;
  padding: 20px 0;
}

.mensaje-exito .icono {
  font-size: 50px;
  color: var(--verde);
  margin-bottom: 10px;
}

.mensaje-error {
  background: #fdeaea;
  color: #a33;
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}

/* NOTIFICACIÓN TOAST */
.notificacion-toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--negro);
  color: var(--blanco);
  border-left: 5px solid var(--verde);
  padding: 14px 24px;
  border-radius: 30px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  white-space: nowrap;
}

.notificacion-toast.mostrar {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* PIE DE PÁGINA DETALLADO */
.footer-contenedor {
  background-color: var(--negro);
  color: #d1d1d1;
  padding: 40px 20px 20px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  margin-top: auto;
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.footer-col h4 {
  color: var(--blanco);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--verde);
  display: inline-block;
  padding-bottom: 4px;
}

.footer-col p {
  line-height: 1.6;
  color: #bbb;
}

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

.footer-col ul li {
  margin-bottom: 8px;
  color: #bbb;
}

.btn-whatsapp-footer {
  display: inline-block;
  background-color: #25D366;
  color: var(--blanco);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 12px;
  margin-top: 10px;
  transition: background-color 0.2s, transform 0.2s;
}

.btn-whatsapp-footer:hover {
  background-color: #1eb857;
  transform: translateY(-2px);
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  border-top: 1px solid #333;
  padding-top: 20px;
  text-align: center;
  color: #888;
  font-size: 12px;
}

.footer-bottom p {
  margin-bottom: 4px;
}

/* RESPONSIVE DESIGN */
@media (max-width: 650px) {
  .top-bar-anuncio {
    flex-direction: column;
    text-align: center;
    gap: 6px;
    padding: 8px 12px;
  }
  header {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
  }
  .marca span {
    font-size: 16px;
  }
  .contenedor-buscador {
    max-width: 100%;
    order: 3;
  }
  .notificacion-toast {
    width: 90%;
    text-align: center;
    white-space: normal;
  }
  .modal-preview-contenido {
    grid-template-columns: 1fr;
    max-height: 90vh;
    overflow-y: auto;
  }
}
