@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Inter:wght@400;600&display=swap');

:root {
  --green-900: #0b5c37;
  --green-700: #1f8a4b;
  --green-500: #3ecf8e;
  --green-100: #e9f7ef;
  --yellow-400: #ffcf4d;
  --dark-900: #0f1f1b;
  --gray-700: #4f5b57;
  --gray-200: #dde5e1;
  --white: #ffffff;
  --rounded: 18px;
  --shadow-soft: 0 20px 45px rgba(8, 51, 37, 0.14);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Poppins', 'Inter', sans-serif;
  background: linear-gradient(180deg, #f6fbf8 0%, #fdfdfc 100%);
  color: var(--dark-900);
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.center {
  text-align: center;
}

.section {
  padding: 60px 24px;
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.section h2 {
  font-size: clamp(1.8rem, 2.3vw, 2.6rem);
  margin-bottom: 10px;
}

.section p.lead {
  color: var(--gray-700);
  max-width: 680px;
  margin: 0 auto 40px auto;
}

.section .row,
.section form,
.section table,
.section .table-responsive,
.section .card {
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

/* ====== NAVBAR ====== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  padding: 18px 30px;
  box-shadow: 0 6px 30px rgba(15, 31, 27, 0.08);
}

/* Asegurar que el carrusel no se superponga con el navbar */
#productosCarousel {
  position: relative;
  z-index: 1;
}

/* Espaciado mejorado para el navbar */
.navbar-nav {
  gap: 12px !important;
  flex-wrap: nowrap;
}

.navbar-nav .nav-item {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

/* Espaciado adicional para el enlace del carrito con badge */
.navbar-nav .carrito-link {
  padding-right: 45px !important;
  margin-right: 4px;
}

/* Ajuste del badge del carrito para evitar superposición */
.navbar-nav .carrito-badge {
  position: absolute;
  top: -6px;
  right: 2px;
  font-size: 0.65rem !important;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Asegurar que los botones no se superpongan */
.navbar-nav .btn {
  white-space: nowrap;
  margin-left: 0;
}

.nav-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--green-900);
  letter-spacing: 0.4px;
}

.nav-menu {
  list-style: none;
  display: flex;
  gap: 18px;
  align-items: center;
  margin: 0;
}

.nav-menu li a {
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 500;
  color: var(--gray-700);
  transition: all 0.3s ease;
}

.nav-menu li a:hover,
.nav-menu li a:focus {
  background: var(--green-100);
  color: var(--green-900);
}

.badge {
  display: inline-block;
  background: var(--green-500);
  color: var(--dark-900);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 999px;
  margin-left: 8px;
  font-weight: 600;
}

/* ====== BOTONES ====== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(120deg, var(--green-700), var(--green-500));
  padding: 12px 26px;
  border-radius: 999px;
  color: var(--white);
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(31, 138, 75, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 30px rgba(31, 138, 75, 0.35);
}

.btn-outline {
  background: transparent;
  border: 1.8px solid var(--green-700);
  color: var(--green-900);
  box-shadow: none;
}

.btn-outline:hover {
  background: var(--green-100);
}

/* ====== HERO ====== */
.hero {
  position: relative;
  min-height: 70vh;
  display: grid;
  align-items: center;
  justify-items: center;
  text-align: center;
  padding: 100px 20px;
  color: var(--white);
}

/* Carrusel de productos destacados - Catálogo */
#productosCarousel {
  margin: 30px auto;
  position: relative;
  width: 100%;
  max-width: 1200px;
  z-index: 1;
  isolation: isolate; /* Crea un nuevo contexto de apilamiento */
}

#productosCarousel .carousel-inner {
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(11, 92, 55, 0.35), 0 10px 30px rgba(31, 138, 75, 0.2);
  border: 3px solid var(--green-500);
}

#productosCarousel .carousel-control-prev-icon,
#productosCarousel .carousel-control-next-icon {
  background-color: var(--green-700);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  border: 3px solid var(--white);
  box-shadow: 0 8px 20px rgba(11, 92, 55, 0.4);
  transition: all 0.3s ease;
  opacity: 0.9;
}

#productosCarousel .carousel-control-prev-icon:hover,
#productosCarousel .carousel-control-next-icon:hover {
  background-color: var(--green-500);
  transform: scale(1.1);
  box-shadow: 0 12px 30px rgba(31, 138, 75, 0.5);
  opacity: 1;
}

#productosCarousel .carousel-control-prev,
#productosCarousel .carousel-control-next {
  width: 8%;
  z-index: 5;
}

#productosCarousel .carousel-indicators {
  margin-bottom: 20px;
}

#productosCarousel .carousel-indicators button {
  background-color: var(--green-100);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--white);
  box-shadow: 0 4px 10px rgba(11, 92, 55, 0.3);
  transition: all 0.3s ease;
  opacity: 0.7;
}

#productosCarousel .carousel-indicators button:hover {
  background-color: var(--green-500);
  transform: scale(1.2);
  opacity: 1;
}

#productosCarousel .carousel-indicators button.active {
  background-color: var(--green-700);
  width: 20px;
  height: 20px;
  border: 4px solid var(--white);
  box-shadow: 0 6px 15px rgba(31, 138, 75, 0.5);
  opacity: 1;
}

#productosCarousel .carousel-caption {
  background: linear-gradient(to top, rgba(11, 92, 55, 0.85), rgba(31, 138, 75, 0.6), transparent);
  padding: 40px 30px 30px;
  border-radius: 0 0 24px 24px;
  bottom: 0;
  left: 0;
  right: 0;
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

#productosCarousel .carousel-caption h5 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--white);
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  margin: 0;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

@media (max-width: 768px) {
  #productosCarousel .carousel-caption h5 {
    font-size: 1.4rem;
  }
}

@media (max-width: 768px) {
  #productosCarousel .carousel-item img {
    height: 300px !important;
  }
}

.hero h1 {
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  margin-bottom: 12px;
  text-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.hero p {
  max-width: 620px;
  font-size: 1.1rem;
  margin-bottom: 30px;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

/* ====== FEATURE GRID ====== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--white);
  border-radius: var(--rounded);
  padding: 24px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(62, 207, 142, 0.1);
}

.feature-card span {
  font-size: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-top: 30px;
}

.stat-card {
  background: var(--white);
  padding: 24px;
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.stat-card h3 {
  margin: 0;
  font-size: 2rem;
  color: var(--green-700);
}

.stat-card p {
  margin: 6px 0 0;
  color: var(--gray-700);
}

/* ====== CATÁLOGO ====== */
.filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  padding: 10px 0 30px;
}

.filtros input,
.filtros select {
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--gray-200);
  min-width: 220px;
  font-family: inherit;
  background: var(--white);
  box-shadow: 0 10px 30px rgba(13, 84, 49, 0.09);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  padding: 10px 0 60px;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible;
  margin: 0;
  grid-auto-flow: row;
  grid-auto-rows: auto;
}

.product-card {
  background: var(--white);
  border-radius: var(--rounded);
  padding: 20px 12px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(11, 92, 55, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 420px;
  overflow: visible;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  position: relative;
  margin: 0;
  min-width: 0;
  grid-column: span 1;
}

.product-card .mb-2 {
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.product-card > * {
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.product-card p,
.product-card span,
.product-card div,
.product-card label {
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.product-card .mb-2 {
  margin-bottom: 0.5rem !important;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 25px 40px rgba(5, 59, 35, 0.16);
}

.product-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: center;
  border-radius: 14px;
  margin-bottom: 16px;
  flex-shrink: 0;
  max-width: 100%;
}

.product-card h3 {
  margin: 10px 0 4px;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: center;
  line-height: 1.3;
  padding: 0 4px;
}

.precio {
  color: var(--green-900);
  font-weight: 600;
  font-size: 1.2rem;
  margin: 8px 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.4;
}

.unidad-medida {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--gray-700);
  white-space: normal;
  word-wrap: break-word;
}

.stock-disponible {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 8px 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible;
  padding: 0;
}

.stock-disponible .badge {
  font-size: 0.75rem !important;
  font-weight: 600;
  padding: 6px 8px !important;
  border-radius: 8px;
  display: inline-block !important;
  align-items: center;
  gap: 4px;
  max-width: 100% !important;
  width: auto;
  min-width: 0;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
  text-align: center;
  box-sizing: border-box;
  line-height: 1.4 !important;
  margin: 0 auto;
  overflow: visible !important;
  hyphens: auto;
}

.stock-disponible small {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
  text-align: center;
  margin-top: 4px !important;
  padding: 0 !important;
  line-height: 1.4;
  font-size: 0.7rem !important;
}

/* Estilos específicos para badges de Bootstrap dentro de product-card */
.product-card .badge.bg-info-subtle,
.product-card .badge.bg-success-subtle,
.product-card .badge.bg-danger-subtle {
  max-width: 100% !important;
  width: auto !important;
  min-width: 0 !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
  display: inline-block !important;
  box-sizing: border-box !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

.product-card .stock-disponible .badge strong {
  white-space: normal !important;
  word-wrap: break-word !important;
}

.agotado {
  display: inline-flex;
  padding: 6px 12px;
  background: rgba(255, 82, 82, 0.1);
  color: #ff5252;
}

/* Estilos para el formulario de cantidad en las tarjetas de producto */
.product-card .product-form {
  margin-top: auto;
  padding-top: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  flex-shrink: 0;
}

/* Contenedor de cantidad mejorado */
.product-card .cantidad-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  flex-wrap: wrap;
  padding: 0 4px;
  overflow: visible;
}

.product-card .cantidad-label {
  font-size: 0.8rem;
  color: var(--gray-700);
  white-space: nowrap;
  margin-bottom: 0;
  flex-shrink: 0;
}

.product-card .cantidad-input {
  width: 60px;
  min-width: 60px;
  max-width: 60px;
  text-align: center;
  font-weight: 600;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 6px 4px;
  box-sizing: border-box;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.product-card .cantidad-unidad {
  font-size: 0.75rem;
  color: var(--gray-700);
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card .product-form button {
  margin-top: 0;
  width: 100%;
  box-sizing: border-box;
}

/* Asegurar que la imagen tenga altura fija */
.product-card > img,
.product-card > div[style*="height: 200px"] {
  flex-shrink: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.product-card > div[style*="height: 200px"] {
  width: 100% !important;
  max-width: 100% !important;
}

.catalogo-collage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.catalogo-collage img {
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  object-fit: cover;
  width: 100%;
  height: 240px;
  object-position: center;
}

  border-radius: 999px;
  font-weight: 600;
}

/* ====== CARRITO ====== */
.tabla {
  width: min(960px, 92vw);
  margin: 36px auto;
  background: var(--white);
  border-collapse: collapse;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.tabla th,
.tabla td {
  padding: 16px;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.tabla th {
  background: var(--green-900);
  color: var(--white);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.tabla tr:last-child td {
  border-bottom: none;
}

/* ====== FORMULARIOS ====== */
form {
  width: min(420px, 90vw);
  margin: 50px auto;
  background: var(--white);
  padding: 30px;
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(11, 92, 55, 0.08);
}

form input {
  width: 100%;
  padding: 13px;
  margin-bottom: 16px;
  border-radius: 14px;
  border: 1px solid var(--gray-200);
  font-family: inherit;
  transition: border 0.2s ease;
}

form input:focus {
  border-color: var(--green-500);
  outline: none;
}

/* ====== CTA y BANNERS ====== */
.cta-banner {
  margin: 40px auto;
  padding: 40px 30px;
  background: linear-gradient(120deg, var(--green-900), var(--green-500));
  border-radius: 28px;
  color: var(--white);
  box-shadow: 0 30px 60px rgba(6, 47, 30, 0.4);
  text-align: center;
}

.cta-banner h2 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 3vw, 2.8rem);
}

.cta-banner p {
  margin-bottom: 24px;
  color: rgba(255, 255, 255, 0.9);
}

.cta-banner .btn-outline {
  color: var(--white);
  border-color: var(--white);
}

.cta-banner .btn-outline:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
}

.media-card img,
.cart-visual img,
.admin-hero img,
.repartidor-hero img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  object-position: center;
  border-radius: var(--rounded);
  box-shadow: var(--shadow-soft);
}

.admin-hero,
.cart-visual,
.repartidor-hero {
  border-radius: var(--rounded);
  overflow: hidden;
  max-width: 100%;
}

/* ====== UTILIDADES ====== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-900);
  font-weight: 600;
}

.card-muted {
  background: var(--green-100);
  border-radius: var(--rounded);
  padding: 30px;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .nav-menu {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
  }

  .hero {
    padding: 80px 16px;
  }

  .filtros input,
  .filtros select {
    min-width: 100%;
  }

  .product-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 10px 0 40px;
  }

  .product-card {
    min-height: auto;
    max-width: 100%;
    padding: 20px 10px;
  }

  .stock-disponible .badge {
    font-size: 0.7rem !important;
    padding: 5px 6px !important;
    max-width: 100% !important;
  }

  .product-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .hero-cta {
    flex-direction: column;
  }

  .tabla {
    font-size: 0.9rem;
  }

  .hero-gallery {
    grid-template-columns: 1fr;
  }

  .catalogo-collage img {
    height: 180px;
  }
}