/* css/tienda.css */

/* ===== Variables y Reset ===== */
:root {
  --primary-green: #0b3d0b;
  --secondary-green: #2a6d2a;
  --light-green: #e6f1e6;
  --dark-green: #084a08;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-600: #6c757d;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--gray-100);
  color: #333;
}

/* ===== Hero Section ===== */
.hero-tienda {
  position: relative;
  background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 100%);
  padding: 80px 0;
  overflow: hidden;
}

.hero-tienda::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(255,255,255,0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255,255,255,0.1) 0%, transparent 50%);
  pointer-events: none;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="2" fill="white" opacity="0.1"/></svg>');
  opacity: 0.3;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: rgb(240, 219, 219);
}

.hero-content h1 {
  font-family: 'Dancing Script', cursive;
  font-size: 3.5rem;
  text-shadow: 2px 2px 4px rgba(244, 153, 153, 0.2);
  color: white;
}

.hero-content .lead {
  font-size: 1.3rem;
  font-weight: 300;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-top: 2rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  padding: 1.5rem 2rem;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.2);
}

.stat-item i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.stat-item span {
  font-size: 1.8rem;
  font-weight: 700;
  display: block;
}

.stat-item small {
  font-size: 0.85rem;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 80px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.loading .spinner-grow {
  width: 1rem;
  height: 1rem;
  animation-delay: 0.1s;
}

.loading .spinner-grow:nth-child(2) {
  animation-delay: 0.2s;
}

.loading .spinner-grow:nth-child(3) {
  animation-delay: 0.3s;
}

/* ===== Filtros Section ===== */
.filtros-section {
  background: white;
  padding: 2rem;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 3rem;
}

.search-box {
  position: relative;
}

.search-box i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-600);
  font-size: 1.1rem;
}

.search-box input {
  padding-left: 3rem;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  height: 50px;
  font-size: 1rem;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 4px rgba(11, 61, 11, 0.1);
  outline: none;
}

.custom-select {
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  height: 50px;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.custom-select:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 4px rgba(11, 61, 11, 0.1);
  outline: none;
}

.resultados-info {
  color: var(--gray-600);
  font-size: 0.95rem;
  font-weight: 500;
}

/* ===== Grid de Productos ===== */
.productos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

/* ===== Tarjeta de Producto ===== */
.product-card {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.product-image-container {
  position: relative;
  overflow: hidden;
  height: 220px;
  background: var(--light-green);
}

.product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.product-card:hover .product-img {
  transform: scale(1.1);
}

.badge-stock {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  color: var(--primary-green);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 4px;
}

.badge-categoria {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--primary-green);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
  box-shadow: var(--shadow-sm);
}

.product-info {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.product-name {
  font-size: 1.2rem;
  font-weight: 600;
  color: #222;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.product-description {
  font-size: 0.9rem;
  color: var(--gray-600);
  margin-bottom: 1rem;
  flex-grow: 1;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.precio {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-green);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.precio small {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--gray-600);
}

.btn-agregar {
  background: var(--primary-green);
  border: none;
  color: white;
  padding: 0.7rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-agregar:hover {
  background: var(--dark-green);
  transform: scale(1.05);
}

.btn-agregar:active {
  transform: scale(0.98);
}

/* ===== Sin resultados ===== */
.sin-resultados {
  text-align: center;
  padding: 4rem 2rem;
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}

.sin-resultados i {
  font-size: 4rem;
  color: var(--primary-green);
  opacity: 0.3;
  margin-bottom: 1rem;
}

.sin-resultados h4 {
  color: #333;
  margin-bottom: 0.5rem;
}

.sin-resultados p {
  color: var(--gray-600);
  font-size: 1rem;
}

/* ===== Error Container ===== */
.error-container {
  text-align: center;
  padding: 4rem 2rem;
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  max-width: 600px;
  margin: 4rem auto;
}

.error-icon {
  font-size: 5rem;
  color: #dc3545;
  margin-bottom: 1.5rem;
}

.error-container h3 {
  color: #333;
  margin-bottom: 1rem;
}

.error-container p {
  color: var(--gray-600);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.error-details {
  background: var(--gray-100);
  padding: 1.5rem;
  border-radius: 12px;
  text-align: left;
  margin: 1.5rem 0;
}

.error-details ul {
  margin: 0.5rem 0 0 1.5rem;
  color: var(--gray-600);
}

.error-details code {
  background: white;
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--primary-green);
  font-weight: 600;
}

/* ===== Mini Carrito ===== */
.mini-carrito {
  position: fixed;
  right: -400px;
  top: 0;
  height: 100vh;
  width: 400px;
  background: white;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  z-index: 1050;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.mini-carrito.active {
  right: 0;
}

.mini-carrito-header {
  padding: 1.5rem;
  border-bottom: 2px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mini-carrito-header h5 {
  margin: 0;
  font-weight: 600;
  color: var(--primary-green);
}

.btn-close-carrito {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-600);
  transition: var(--transition);
}

.btn-close-carrito:hover {
  color: #000;
}

.mini-carrito-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.carrito-vacio {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-600);
}

.carrito-vacio i {
  font-size: 4rem;
  opacity: 0.3;
  margin-bottom: 1rem;
}

.mini-carrito-footer {
  padding: 1.5rem;
  border-top: 2px solid var(--gray-200);
}

.carrito-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 1.2rem;
  font-weight: 600;
}

.total-precio {
  color: var(--primary-green);
  font-size: 1.5rem;
}

.btn-finalizar {
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 12px;
}

.carrito-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.carrito-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===== Botón Carrito Navbar ===== */
#btn-carrito {
  position: relative;
  padding: 0.5rem 1rem;
}

#carrito-count {
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
  .hero-content h1 {
    font-size: 2.5rem;
  }

  .hero-stats {
    gap: 1.5rem;
  }

  .stat-item {
    padding: 1rem 1.5rem;
  }

  .productos-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .hero-content h1 {
    font-size: 2rem;
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .stat-item span {
    font-size: 1.5rem;
  }

  .productos-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }

  .filtros-section {
    padding: 1.5rem;
  }

  .mini-carrito {
    width: 100%;
    right: -100%;
  }

  .product-image-container {
    height: 180px;
  }
}

@media (max-width: 576px) {
  .hero-tienda {
    padding: 50px 0;
  }

  .hero-content h1 {
    font-size: 1.8rem;
  }

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

  .product-image-container {
    height: 200px;
  }
}
/* ===== Items del Carrito ===== */
.carrito-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--gray-100);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.carrito-item-info {
  flex-grow: 1;
}

.carrito-item-info h6 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
}

.carrito-item-info p {
  margin: 0.25rem 0 0 0;
  font-size: 0.85rem;
}

.carrito-item-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  padding: 0.25rem;
  border-radius: 8px;
}

.btn-cantidad {
  background: none;
  border: none;
  color: var(--primary-green);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-cantidad:hover {
  color: var(--dark-green);
  transform: scale(1.1);
}

.cantidad {
  min-width: 30px;
  text-align: center;
  font-weight: 600;
  color: #333;
}

.btn-eliminar {
  background: none;
  border: none;
  color: #dc3545;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  transition: var(--transition);
}

.btn-eliminar:hover {
  color: #bb2d3b;
  transform: scale(1.1);
}

/* ===== Notificación ===== */
.notificacion {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--primary-green);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  display: flex;
  align-items: center;
  font-weight: 500;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.notificacion.show {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive para notificaciones */
@media (max-width: 576px) {
  .notificacion {
    left: 20px;
    right: 20px;
    bottom: 80px;
  }
}
/* ===== Validación de Formularios ===== */
.is-invalid {
  border-color: #dc3545 !important;
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.is-invalid:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.invalid-feedback {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875em;
  color: #dc3545;
}

/* ===== Notificaciones de Error ===== */
.notificacion.error {
  background: #dc3545;
}

.notificacion.success {
  background: var(--primary-green);
}

/* ===== Spinner en Botones ===== */
.spinner-border-sm {
  width: 1rem;
  height: 1rem;
  border-width: 0.2em;
}

/* ===== Checkout Items ===== */
.checkout-item {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--gray-100);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.checkout-item span:first-child {
  font-weight: 500;
  color: #333;
}

.checkout-item span:last-child {
  font-weight: 600;
  color: var(--primary-green);
}

.checkout-total {
  display: flex;
  justify-content: space-between;
  padding: 1rem;
  background: var(--light-green);
  border-radius: 8px;
  font-size: 1.2rem;
}

.checkout-resumen {
  background: white;
  padding: 1rem;
  border-radius: 12px;
  border: 2px solid var(--gray-200);
}

.checkout-resumen h6 {
  color: var(--primary-green);
  font-weight: 600;
  margin-bottom: 1rem;
}

/* ===== Success Icon ===== */
.success-icon {
  font-size: 5rem;
  color: var(--primary-green);
  animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===== Estados de carga ===== */
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== Mejoras responsive para formularios ===== */
@media (max-width: 576px) {
  .checkout-item {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .checkout-item span:last-child {
    text-align: right;
  }
}