@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css");

/* Estilos generales */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans",
    "Helvetica Neue", sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f9f9f9;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Títulos y textos */
.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: #111;
}

/* Barra de búsqueda */
.search-container {
  margin-bottom: 2rem;
}

.search-box {
  position: relative;
  max-width: 400px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #666;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid #ddd;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  background-color: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Botones de filtro */
.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  background-color: #f3f4f6;
  color: #4b5563;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn.active {
  background-color: #2563eb;
  color: white;
  transform: scale(1.05);
}

.filter-btn:hover:not(.active) {
  background-color: #e5e7eb;
  transform: translateY(-1px);
}

/* ✅ CUADRÍCULA DE PRODUCTOS - COMPORTAMIENTO FIJO */
.product-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1.5rem;
  transition: opacity 0.3s ease;
}

@media (min-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ✅ TARJETA DE PRODUCTO - TAMAÑO UNIFORME GARANTIZADO */
.product-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: white;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;

  /* ✅ FUERZO que todas tengan exactamente el mismo tamaño */
  min-height: 400px;
  max-height: 450px;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ✅ IMAGEN - TAMAÑO EXACTO PARA TODAS */
.product-image-container {
  position: relative;
  overflow: hidden;
  height: 200px; /* ✅ ALTURA FIJA */
  flex-shrink: 0;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .product-image {
  transform: scale(1.05);
}

.badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  z-index: 1;
}

.badge.featured {
  background-color: #2563eb;
  color: white;
}

/* ✅ CONTENIDO - ALTURA CONTROLADA */
.product-content {
  flex-grow: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  height: 120px; /* ✅ ALTURA FIJA */
  overflow: hidden;
}

.product-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #111;
  /* ✅ EXACTAMENTE 2 LÍNEAS */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  height: 2.6em;
}

.product-description {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 0.5rem;
  /* ✅ EXACTAMENTE 3 LÍNEAS */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  height: 3.6em;
  flex-grow: 1;
}

.product-category {
  margin-top: auto;
}

.category-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border: 1px solid #ddd;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  color: #666;
}

/* ✅ PIE - ALTURA FIJA */
.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  height: 80px; /* ✅ ALTURA FIJA */
  flex-shrink: 0;
  border-top: 1px solid #f3f4f6;
}

.product-price {
  display: none;
  font-weight: 700;
  font-size: 1.125rem;
  color: #111;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn.primary {
  background-color: #2563eb;
  color: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn.primary:hover {
  background-color: #1d4ed8;
  transform: translateY(-1px);
}

.btn.secondary {
  background-color: transparent;
  border: 1px solid #ddd;
  color: #333;
}

.btn.secondary:hover {
  background-color: #f3f4f6;
}

/* Mensaje de no productos */
.no-products {
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
}

.no-products p {
  font-size: 1.125rem;
  margin-bottom: 1rem;
}

/* Paginación */
.pagination {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
  gap: 0.25rem;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  border: 1px solid #ddd;
  background-color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.page-btn.active {
  background-color: #2563eb;
  color: white;
  border-color: #2563eb;
}

.page-btn:hover:not(.active) {
  background-color: #f3f4f6;
  transform: translateY(-1px);
}

.page-dots {
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
}

/* Página de detalle de producto */
.back-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: #333;
  text-decoration: none;
  margin-bottom: 1.5rem;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

.back-link i {
  margin-right: 0.5rem;
}

.product-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  .product-detail {
    grid-template-columns: 1fr 1fr;
  }
}

.product-images {
  display: flex;
  flex-direction: column;
}

.main-image {
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 1rem;
}

.main-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.thumbnail-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.thumbnail {
  border: 1px solid #ddd;
  border-radius: 0.25rem;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.thumbnail:hover {
  transform: scale(1.05);
}

.thumbnail.active {
  border-color: #2563eb;
  border-width: 2px;
}

.thumbnail img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.product-header {
  margin-bottom: 1.5rem;
}

.product-header .product-title {
  font-size: 1.875rem;
  margin: 0.5rem 0;
}

.product-header .product-price {
  font-size: 1.5rem;
  margin: 1rem 0;
}

.product-actions {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
}

.product-actions .btn {
  flex: 1;
  padding: 0.75rem 1rem;
}

.product-tabs {
  margin-top: 2rem;
}

.tabs-header {
  display: flex;
  border-bottom: 1px solid #ddd;
}

.tab-btn {
  flex: 1;
  padding: 0.75rem;
  background: none;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  color: #2563eb;
  border-bottom: 2px solid #2563eb;
}

.tab-btn:hover:not(.active) {
  color: #333;
}

.tab-content {
  display: none;
  padding: 1rem 0;
  font-size: 0.875rem;
}

.tab-content.active {
  display: block;
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
}

.specs-table tr:nth-child(even) {
  background-color: #f3f4f6;
}

.specs-table td {
  padding: 0.5rem 1rem;
}

.spec-name {
  font-weight: 500;
}

/* Animaciones para filtros */
.product-card {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
