:root {
  --primary: #dc2626;
  --primary-hover: #b91c1c;
  --dark: #0f172a;
  --light: #ffffff;
  --bg-body: #f8fafc;
  --surface: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md:
    0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Inter", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 16px;
}

/* Header & Nav */
header {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 5%;
  transition: all 0.3s ease;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.logo {
  font-weight: 800;
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: -0.5px;
  color: var(--dark);
}

.logo span {
  color: var(--primary);
}

.search-bar {
  flex-grow: 1;
  max-width: 400px;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 0.75rem 1.2rem;
  border: 1px solid var(--border-color);
  border-radius: 99px;
  outline: none;
  transition: 0.2s;
  background: #f1f5f9;
  color: var(--text-main);
  font-size: 0.95rem;
}

.search-bar input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

/* Filters */
.filters {
  display: flex;
  gap: 10px;
  padding: 1rem 5%;
  overflow-x: auto;
  white-space: nowrap;
  margin-bottom: 1rem;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--border-color);
  background: var(--surface);
  border-radius: 99px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.filter-btn:hover {
  border-color: #cbd5e1;
  color: var(--text-main);
}

.filter-btn.active {
  background: var(--dark);
  color: white;
  border-color: var(--dark);
  box-shadow: var(--shadow-md);
}

/* Grid */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
  padding: 0 5% 4rem 5%;
}

.product-card {
  background: var(--surface);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.03);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

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

.img-container {
  width: 100%;
  aspect-ratio: 1/1;
  background: #ffffff;
  overflow: hidden;
  padding: 10px;
  border-bottom: 1px solid var(--bg-body);
}

/* NUEVO: Transición de opacidad para el carrusel */
.img-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition:
    transform 0.5s ease,
    opacity 0.5s ease-in-out;
}

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

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

.product-info h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.3;
}

/* Etiqueta destacada para la variante durante la búsqueda */
.variant-badge {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 8px;
  display: inline-block;
}

.price-container {
  margin-top: auto;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.price-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.price-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.price-usd {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--primary);
  line-height: 1;
}

.price-bs {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.btn-add {
  width: 100%;
  padding: 0.8rem;
  background: var(--surface);
  color: var(--dark);
  border: 2px solid var(--dark);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-add:hover {
  background: var(--dark);
  color: white;
}

.btn-add:active {
  transform: scale(0.97);
}

/* Cart FAB */
.cart-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--primary);
  color: white;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px rgba(220, 38, 38, 0.4);
  z-index: 200;
  font-size: 1.5rem;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cart-fab:hover {
  transform: scale(1.05) translateY(-2px);
}

.cart-fab:active {
  transform: scale(0.95);
}

#cart-count {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--dark);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.show {
  opacity: 1;
}

.modal-content {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  height: 100%;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.show .modal-content {
  transform: translateX(0);
}

/* Modal Elements */
.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-color);
}

.cart-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 2px solid var(--bg-body);
}

.total-row {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--dark);
}

.btn-whatsapp {
  width: 100%;
  padding: 1rem;
  background: #25d366;
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 14px 0 rgba(37, 211, 102, 0.3);
  transition: all 0.2s ease;
}

.btn-whatsapp:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

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

/* Form Controls */
.form-control {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.95rem;
  outline: none;
  margin-top: 6px;
  background: #f8fafc;
  color: var(--text-main);
  transition: border-color 0.2s;
  font-weight: 500;
  appearance: none;
}

.form-control:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

select.form-control {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1em;
  padding-right: 2.5rem;
}

@media (max-width: 600px) {
  .nav-container {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .logo {
    text-align: center;
    font-size: 1.4rem;
  }

  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    padding: 0 5% 5rem 5%;
  }

  .product-info {
    padding: 1rem;
  }

  .product-info h3 {
    font-size: 0.85rem;
  }

  .price-usd {
    font-size: 1.15rem;
  }

  .price-bs {
    font-size: 0.8rem;
  }

  .price-label {
    font-size: 0.7rem;
  }

  .btn-add {
    padding: 0.6rem;
    font-size: 0.75rem;
    border-radius: 8px;
  }

  .modal {
    align-items: flex-end;
  }

  .modal-content {
    max-width: 100%;
    height: auto;
    max-height: 90vh;
    border-radius: 24px 24px 0 0;
    padding: 1.5rem;
    transform: translateY(100%);
  }

  .modal.show .modal-content {
    transform: translateY(0);
  }
}
