/* Controles móviles: Filters y Búsqueda */
.mobile-controls {
  display: none; /* Oculto por defecto, se muestra en móvil */
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
  border: 1px solid #f0f0f0;
}

/* Contenedor de búsqueda móvil - ocupa espacio disponible */
.mobile-search-container {
  flex: 1;
  min-width: 0;
}

.mobile-search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.mobile-search-input {
  width: 100%;
  padding: 0.7rem 2.5rem 0.7rem 1rem;
  border: 2px solid #e9ecef;
  border-radius: 25px;
  font-size: 0.9rem;
  color: var(--text-color);
  background-color: white;
  transition: all 0.3s ease;
  outline: none;
}

.mobile-search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}

.mobile-search-input::placeholder {
  color: #999;
  font-style: italic;
}

.mobile-search-icon {
  position: absolute;
  right: 1rem;
  color: #999;
  font-size: 0.9rem;
  pointer-events: none;
  z-index: 1;
}

.mobile-clear-search-btn {
  position: absolute;
  right: 2.5rem;
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 2;
}

.mobile-clear-search-btn:hover {
  background-color: #f0f0f0;
  color: var(--primary-color);
}

/* Botón de ordenamiento compacto */
.mobile-sort-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-color);
  color: white;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.mobile-sort-btn:hover,
.mobile-sort-btn:active {
  background: #d63384;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
}

.mobile-sort-btn i {
  font-size: 1.1rem;
}

/* Botón de filtros compacto */
.mobile-filters-btn {
  display: flex; /* Oculto por defecto, se muestra en móvil */
  align-items: center;
  justify-content: center;
  background: var(--primary-color);
  color: white;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.mobile-filters-btn:hover,
.mobile-filters-btn:active {
  background: #d63384;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
}

.mobile-filters-btn i {
  font-size: 1.1rem;
}

.filters-count {
  background: white;
  color: var(--primary-color);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  position: absolute;
  top: -5px;
  right: -5px;
  border: 2px solid var(--primary-color);
}

/* Modal de filtros */
.filters-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.filters-modal.open {
  display: flex;
  opacity: 1;
}

.filters-modal-content {
  background: white;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.filters-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e9ecef;
  background: var(--primary-color);
  color: white;
}

.filters-modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.close-filters-modal {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.close-filters-modal:hover {
  background: rgba(255, 255, 255, 0.1);
}

.filters-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.filters-modal-footer {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid #e9ecef;
  background: #f8f9fa;
}

.clear-filters-mobile,
.apply-filters-mobile {
  flex: 1;
  padding: 0.875rem 1rem;
  border: none;

/* --- Código de bulto en cards --- */
.product-bulk-code,
.product-code-badge {
  margin: 4px 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: #444;
  background: none;
  border: none;
  padding: 0;
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.clear-filters-mobile {
  background: #6c757d;
  color: white;
}

.clear-filters-mobile:hover {
  background: #5a6268;
  transform: translateY(-1px);
}

.apply-filters-mobile {
  background: var(--primary-color);
  color: white;
}

.apply-filters-mobile:hover {
  background: #d63384;
  transform: translateY(-1px);
}

/* Modal de ordenamiento para móvil */
.sort-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1001;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sort-modal.open {
  display: flex;
  opacity: 1;
}

.sort-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.sort-modal-content {
  background: white;
  width: 90%;
  max-width: 400px;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 2;
  animation: scaleIn 0.3s ease-out;
  overflow: hidden;
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.sort-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e9ecef;
  background: var(--primary-color);
  color: white;
}

.sort-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.close-sort-modal {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.3s;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-sort-modal:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sort-modal-body {
  padding: 0.5rem;
}

.sort-options {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sort-option {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 8px;
  position: relative;
}

.sort-option:hover {
  background: #f8f9fa;
}

.sort-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sort-option-text {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-color);
  font-weight: 500;
}

.sort-option-text i {
  color: var(--primary-color);
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.sort-check {
  color: var(--primary-color);
  font-size: 1.1rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sort-option input[type="radio"]:checked ~ .sort-check {
  opacity: 1;
}

.sort-option input[type="radio"]:checked ~ .sort-option-text {
  color: var(--primary-color);
  font-weight: 600;
}

/* Filtros Sidebar - Solo desktop */
.filters-sidebar {
  width: 280px;
  background-color: var(--card-color);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  height: fit-content;
  top: 2rem;
}

/* Override visual para que el código (bulk/box/unit mostrado) se vea más fuerte en /tienda/ */
.products-grid .product-card .product-bulk-code {
  font-weight: 600;
  color: #444;
  background: none;
  border: none;
  letter-spacing: 0.4px;
  font-size: 0.72rem;
}

.filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}

.filters-header h3 {
  margin: 0;
  color: var(--secondary-color);
  font-size: 1.2rem;
}

.clear-filters {
  background: none;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.3s;
}

.clear-filters:hover {
  background-color: var(--primary-color);
  color: white;
}

.filter-section {
  margin-bottom: 1.5rem;
}

.filter-title {
  color: var(--secondary-color);
  font-size: 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

/* Headers colapsables */
.filter-header-collapsible {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 0.75rem;
  border-radius: 6px;
  transition: background-color 0.3s;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  margin-bottom: 0.5rem;
}

.filter-header-collapsible:hover {
  background-color: #e9ecef;
}

.filter-header-collapsible .filter-title {
  margin-bottom: 0;
  flex: 1;
  font-size: 0.95rem;
}

.collapse-btn {
  background: none;
  border: none;
  color: var(--secondary-color);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.collapse-btn:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.collapse-btn i {
  transition: transform 0.3s;
  font-size: 0.8rem;
}

.collapse-btn.collapsed i {
  transform: rotate(-90deg);
}

/* Contenido colapsable */
.filter-content {
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out, padding 0.3s ease-out;
  max-height: 400px;
  opacity: 1;
  padding: 0.75rem;
  background-color: white;
  border: 1px solid #e9ecef;
  border-top: none;
  border-radius: 0 0 6px 6px;
}

.filter-content.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0 0.75rem;
  margin-bottom: 0;
}

/* Buscador de filtros */
.filter-search {
  position: relative;
  margin-bottom: 0.75rem;
}

.search-input {
  width: 100%;
  padding: 0.6rem 2.25rem 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.85rem;
  background-color: white;
  transition: border-color 0.3s, box-shadow 0.3s;
  box-sizing: border-box;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(230, 57, 70, 0.1);
}

.search-input::placeholder {
  color: #999;
  font-style: italic;
  font-size: 0.8rem;
}

.search-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 0.8rem;
  pointer-events: none;
}

/* Filtro de Precio */
.price-filter {
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 6px;
}

.price-range-container {
  position: relative;
  height: 30px;
  margin-bottom: 1.5rem;
}

.price-track {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  width: 100%;
  background: #ddd;
  border-radius: 2px;
}

.price-slider {
  position: absolute;
  width: 100%;
  height: 30px;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  pointer-events: none;
}

.price-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: var(--primary-color);
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  pointer-events: all;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.price-slider::-moz-range-thumb {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: var(--primary-color);
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  pointer-events: all;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.price-inputs {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.price-input-group label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  color: var(--text-color);
}

.price-input-group input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
}

.filter-btn {
  width: 100%;
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.3s;
}

.filter-btn:hover {
  background-color: #d63384;
}

/* Filtros de Categoría y Marca */
.category-filters,
.brand-filters,
.stock-filters {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 150px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* Scrollbar personalizado */
.category-filters::-webkit-scrollbar,
.brand-filters::-webkit-scrollbar {
  width: 3px;
}

.category-filters::-webkit-scrollbar-track,
.brand-filters::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 2px;
}

.category-filters::-webkit-scrollbar-thumb,
.brand-filters::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 2px;
}

.category-filters::-webkit-scrollbar-thumb:hover,
.brand-filters::-webkit-scrollbar-thumb:hover {
  background: #999;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.85rem;
  position: relative;
  padding: 0.4rem 0.5rem 0.4rem 1.75rem;
  transition: all 0.3s;
  border-radius: 4px;
}

.filter-checkbox.hidden {
  display: none !important;
}

.filter-checkbox:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.filter-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkmark {
  position: absolute;
  left: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  height: 16px;
  width: 16px;
  background-color: white;
  border: 2px solid #ddd;
  border-radius: 3px;
  transition: all 0.3s;
}

.filter-checkbox:hover input ~ .checkmark {
  border-color: var(--primary-color);
}

.filter-checkbox input:checked ~ .checkmark {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
  left: 4px;
  top: 1px;
  width: 3px;
  height: 7px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.filter-checkbox input:checked ~ .checkmark:after {
  display: block;
}

/* Mensaje cuando no hay resultados de búsqueda */
.no-results-message {
  text-align: center;
  color: #999;
  font-size: 0.8rem;
  padding: 0.75rem;
  font-style: italic;
  background-color: #f8f9fa;
  border-radius: 4px;
  margin-top: 0.5rem;
}

/* Header de Productos */
.products-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1rem;
  background-color: var(--card-color);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.products-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
}

/* Campo de búsqueda desktop */
.desktop-search-container {
  flex: 0 1 300px;
  max-width: 400px;
}

.desktop-search-wrapper {
  position: relative;
  width: 100%;
}

.desktop-search-input {
  width: 100%;
  padding: 0.6rem 2.5rem 0.6rem 2.5rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  background-color: white;
}

.desktop-search-input:focus {
  outline: none;
  border-color: var(--primary-color, #667eea);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.desktop-search-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  pointer-events: none;
  font-size: 0.9rem;
}

.clear-search-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.clear-search-btn:hover {
  background-color: #f0f0f0;
  color: #333;
}

.clear-search-btn i {
  font-size: 0.8rem;
}

.results-count {
  color: var(--text-color);
  font-size: 0.9rem;
  white-space: nowrap;
}

.products-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-group label {
  font-size: 0.9rem;
  color: var(--text-color);
  white-space: nowrap;
}

.control-select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: white;
  font-size: 0.9rem;
  cursor: pointer;
}

.view-toggle {
  display: flex;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}

.view-btn {
  background-color: white;
  border: none;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: all 0.3s;
  border-right: 1px solid #ddd;
}

.view-btn:last-child {
  border-right: none;
}

.view-btn.active,
.view-btn:hover {
  background-color: var(--primary-color);
  color: white;
}

/* Layout con filtros */
.shop-container {
  display: flex;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.products-section {
  flex: 1;
}

/* GRID DE PRODUCTOS - ALTURA UNIFORME */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

/* Tarjeta de producto con altura uniforme */
.product-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--primary-color);
}

/* Image wrapper with 1:1 aspect ratio for consistent cards */
.product-image-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

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

.product-details {
  flex: 1;
}

.product-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--secondary-color);
  margin-bottom: 0.5rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.2rem;
}

.product-description {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 1rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 1rem;
}

/* Truncation utility class for preventing card expansion */
.truncate-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-wrap: break-word;
  hyphens: auto;
}

/* Secondary product name styling */
.product-secondary-name {
  font-size: 0.9rem;
  color: #777;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.product-bulk-code {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: #4f4f4f;
  letter-spacing: 0.02em;
  background: none;
}

.product-bulk-code__value {
  font-weight: 600;
  color: inherit;
}

.product-bulk-code.is-missing {
  color: #8a8a8a;
  font-weight: 400;
}

.product-bulk-code.is-missing .product-bulk-code__value {
  color: #9f9f9f;
  font-weight: 500;
}

.product-meta {
  margin-bottom: 1rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.detail-label {
  font-weight: 500;
  color: var(--secondary-color);
}

.product-actions {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid #f0f0f0;
}

.product-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.75rem;
}

.stock-info {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 1rem;
  padding: 0.5rem;
  background-color: #f8f9fa;
  border-radius: 4px;
}

.add-to-cart {
  width: 100%;
  background: linear-gradient(135deg, var(--primary-color), #d63384);
  color: white;
  border: none;
  padding: 0.875rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.add-to-cart:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

.add-to-cart:active {
  transform: translateY(0);
}

/* Vista de lista */
.products-grid.list-view {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.products-grid.list-view .product-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  padding: 1.5rem;
  height: auto;
  min-height: 180px;
}

.products-grid.list-view .product-image {
  width: 160px;
  height: 160px;
  margin-right: 2rem;
  flex-shrink: 0;
  border-radius: 8px;
}

.products-grid.list-view .product-info {
  flex: 1;
  display: flex;
  flex-direction: row;
  gap: 2rem;
  padding: 0;
  align-items: stretch;
}

.products-grid.list-view .product-details {
  flex: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin-bottom: 0;
}

.products-grid.list-view .product-actions {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  min-width: 200px;
  flex-shrink: 0;
}

/* Mensaje cuando no hay productos */
.no-products {
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
  font-size: 1.1rem;
  grid-column: 1 / -1;
}

/* Responsive */
@media (max-width: 1024px) {
  /* TABLETS: Mostrar botón de filtros y búsqueda móvil, ocultar sidebar */
  .mobile-filters-btn,
  .mobile-sort-btn {
    display: flex;
  }

  .mobile-controls {
    display: flex !important;
  }

  .filters-sidebar {
    display: none;
  }

  .shop-container {
    flex-direction: column;
  }

  .products-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  /* Ocultar búsqueda desktop en tablets */
  .desktop-search-container {
    display: none;
  }

  .products-controls {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

@media (max-width: 768px) {
  /* MÓVIL: Mostrar botón, búsqueda móvil y ocultar sidebar */
  .mobile-filters-btn,
  .mobile-sort-btn {
    display: flex;
  }

  .mobile-controls {
    display: flex !important;
  }

  .mobile-search-container {
    display: flex !important;
    flex: 1;
    max-width: none;
    margin-left: 0;
  }

  .mobile-search-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 0.9rem;
    color: var(--text-color);
    background-color: white;
    transition: all 0.3s ease;
    outline: none;
  }

  .mobile-search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
  }

  .mobile-search-input::placeholder {
    color: #999;
    font-style: italic;
  }

  .filters-sidebar {
    display: none;
  }

  .shop-container {
    padding: 1rem;
    gap: 1rem;
  }

  /* MÓVIL: Ocultar TODOS los controles del products-header */
  .products-header {
    display: none !important;
  }

  .products-grid {
  grid-template-columns: repeat(2, 1fr);
   
  }

  .product-image {
  height: 100%;
  }

  .product-name {
    font-size: 1rem;
  }

  .product-price {
    font-size: 1.1rem;
  }

  /* Modal en móvil ocupa toda la pantalla */
  .filters-modal-content {
    margin: 0;
    border-radius: 0;
  }

  /* Lista view responsive */
  .products-grid.list-view .product-card {
    flex-direction: column;
    min-height: auto;
    padding: 1.5rem;
  }

  .products-grid.list-view .product-image {
    width: 100%;
    height: 200px;
    margin-right: 0;
    margin-bottom: 1.5rem;
  }

  .products-grid.list-view .product-info {
    flex-direction: column;
    gap: 1rem;
  }

  .products-grid.list-view .product-actions {
    align-items: stretch;
    min-width: auto;
  }
}

@media (max-width: 480px) {
  .mobile-controls {
    /* Mantener diseño horizontal SIEMPRE */
    flex-direction: row;
    gap: 0.5rem;
    padding: 0.75rem;
    align-items: center;
  }

  .mobile-search-container {
    flex: 1;
    min-width: 0;
  }

  .mobile-search-input {
    padding: 0.6rem 2rem 0.6rem 0.8rem;
    font-size: 0.85rem;
  }

  /* Asegurar que los botones mantengan su tamaño */
  .mobile-filters-btn,
  .mobile-sort-btn {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr); /* keep two columns on very small screens */
  }

  .product-card {
    max-width: 100%;
  }

  .filters-modal-header,
  .filters-modal-footer {
    padding: 1rem;
  }

  .filters-modal-body {
    padding: 0.75rem;
  }
}

/* Media query específico para pantallas muy pequeñas (iPhone SE, etc.) */
@media (max-width: 375px) {
  .mobile-controls {
    padding: 0.5rem;
    gap: 0.4rem;
  }

  .mobile-search-input {
    padding: 0.55rem 1.8rem 0.55rem 0.7rem;
    font-size: 0.8rem;
  }

  .mobile-filters-btn,
  .mobile-sort-btn {
    width: 40px;
    height: 40px;
  }

  .mobile-filters-btn i,
  .mobile-sort-btn i {
    font-size: 1rem;
  }
}



/* ================================================= */
/* == REFACTOR: TARJETAS DE PRODUCTO MÁS COMPACTAS == */
/* ================================================= */

@media (max-width: 768px) {

  /* Ajustamos la grilla para que las tarjetas estén un poco más juntas */
  .products-grid {
    gap: 0.75rem;
  }

  /* Aseguramos que la imagen aproveche todo el contenedor en móvil */
  .product-image-container {
    aspect-ratio: 1 / 1;
  }

  .product-image {
    width: 100%;
    height: 100%;
    max-height: none;
  }

  /* Reducimos el padding general de la información */
  .product-info {
    padding: 0.75rem;
  }

  /* Más compacto en móviles - mantener descripción visible */

  /* También ocultamos detalles secundarios como el código o las unidades por caja */
  .product-meta {
    display: none;
  }

  /* Ajustamos el nombre del producto */
  .product-name {
    font-size: 0.9rem;      /* Un poco más pequeño */
    min-height: 2.4em;      /* Aseguramos espacio para 2 líneas */
    line-height: 1.2em;
    margin-bottom: 0.5rem;
  }

  /* Juntamos la sección de acciones y quitamos la línea divisora */
  .product-actions {
    padding-top: 0.5rem;
    margin-top: 0.5rem;
    border-top: none;
  }

  /* Ocultamos la información de stock para simplificar la vista */
  .stock-info {
    display: none;
  }

  /* Hacemos el botón de agregar al carrito un poco más compacto */
  .add-to-cart {
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
  }
}

/* Compact card mode: hide secondary info, smaller paddings, tighter name */
.product-card.compact .product-info {
  padding: 0.9rem;
}

.product-card.compact .product-meta,
.product-card.compact .stock-info,
.product-card.compact .quantity-info {
  display: none !important;
}

.product-card.compact .product-name {
  font-size: 1rem;
  min-height: 2.2em;
}

.product-card.compact .add-to-cart {
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
}



/* ======================================= */
/* == WIDGETS: OFERTA Y ME GUSTA (CORAZÓN) == */
/* ======================================= */

/* Contenedor de la imagen necesario para posicionar los widgets */
/* Ensure container rules also apply from earlier definition */
.product-image-container {
  position: relative;
}

/* Estilo para la insignia de "Oferta" */
.product-offer-badge {
  position: absolute;
  top: 12px;
  right: -35px; /* Lo movemos fuera para rotarlo y que las esquinas queden perfectas */
  background-color: var(--primary-color); /* Usamos el color primario para consistencia */
  color: white;
  padding: 4px 35px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  transform: rotate(45deg);
  z-index: 2;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Estilo para el botón de "Me Gusta" (corazón) */
.product-like-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  border: 1px solid #eee;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all 0.2s ease;
}

/* Ajustar posición del botón de favoritos cuando hay badge popular */
.product-image-container:has(.popular-badge) .product-like-btn {
  top: 45px;
}

.product-like-btn:hover {
  transform: scale(1.1);
  background: white;
  color: #e63946; /* Color rojo para el hover */
}

/* Clase que añadiremos con JS cuando un producto tenga "me gusta" */
.product-like-btn.liked {
  background: #e63946;
  color: white;
  border-color: #e63946;
}

/* El ícono dentro del botón */
.product-like-btn i {
  transition: transform 0.2s ease;
}

/* Pequeña animación al dar "me gusta" */
.product-like-btn.liked i {
  transform: scale(1.2);
}

/* --- ESTILOS PARA LA FUNCIONALIDAD DE OFERTAS --- */

/* Etiqueta de "OFERTA" en la esquina */
.offer-badge {
    position: absolute;
    top: 10px;
    right: -8px;
    background-color: #e63946; /* Rojo para llamar la atención */
    color: white;
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: bold;
    border-radius: 4px;
    transform: rotate(20deg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 2;
}

/* Badge de producto popular */
.popular-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(238, 90, 111, 0.4);
    z-index: 2;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Contenedor para alinear precios */
.price-container {
    display: flex;
    align-items: baseline; /* Alinea los precios por su base */
    gap: 0.5rem; /* Espacio entre precios */
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    justify-content: space-between;
}

/* Precio de oferta (más grande y prominente) */
.product-price.offer-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--price-color); /* Usa el color de precio principal */
}

/* Precio original (tachado y más pequeño) */
.product-price.original-price {
    font-size: 1rem;
    color: #999; /* Un color gris para que sea menos importante */
    text-decoration: line-through; /* ¡El tachado! */
}

/* Pagination Styles */
@import url("pagination.css");


/* Estilos existentes... */

/* Barra de búsqueda de productos */
.product-search {
  margin-bottom: 15px;
  position: relative; /* Añadir posición relativa al contenedor */
}

.search-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.product-search-input {
  width: 100%;
  padding: 12px 40px 12px 15px;
  border: 2px solid #e8e0dd;
  border-radius: 8px;
  font-size: 14px;
  color: #7f6f67;
  background-color: white;
  transition: all 0.3s ease;
  outline: none;
}

.product-search-input:focus {
  border-color: #be7c69;
  box-shadow: 0 0 0 3px rgba(190, 124, 105, 0.1);
}

.product-search-input::placeholder {
  color: #b6aa9d;
  font-style: italic;
}

.search-input-container .search-icon {
  position: absolute;
  right: 15px;
  color: #b6aa9d;
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
}

.clear-search-btn {
  position: absolute;
  right: 40px;
  background: none;
  border: none;
  color: #b6aa9d;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 2;
}

.clear-search-btn:hover {
  background-color: #f0f0f0;
  color: #be7c69;
}

/* Sugerencias de búsqueda - CORREGIDO */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid #e8e0dd;
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  /* Asegurar que se mantenga dentro del sidebar */
  max-width: 100%;
  width: 100%;
}

/* Asegurar que el sidebar tenga overflow visible para las sugerencias */
.filters-sidebar {
  overflow: visible;
}

.filter-section {
  overflow: visible;
}

.search-suggestion {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.search-suggestion:hover {
  background-color: #f1faee;
}

.search-suggestion:last-child {
  border-bottom: none;
}

.suggestion-name {
  font-weight: 500;
  color: #7f6f67;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-category {
  font-size: 10px;
  color: #b6aa9d;
  background-color: #f0f0f0;
  padding: 2px 4px;
  border-radius: 8px;
  white-space: nowrap;
}

.suggestion-price {
  font-weight: 600;
  color: #be7c69;
  font-size: 12px;
  white-space: nowrap;
}

/* Indicador de búsqueda activa */
.product-search-input.searching {
  border-color: #be7c69;
  background-color: #fefefe;
}

/* Mensaje de no resultados en búsqueda */
.no-search-results {
  padding: 15px;
  text-align: center;
  color: #b6aa9d;
  font-style: italic;
  font-size: 13px;
}

/* Header de productos mejorado */
.products-header {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.products-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.products-info {
  flex: 1;
}

.products-title {
  font-size: 1.5em;
  font-weight: 600;
  color: var(--secondary-color);
  margin: 0 0 8px 0;
}

.results-count {
  font-size: 0.9em;
  color: var(--text-color);
}

/* Búsqueda móvil */
.mobile-search-container {
  display: none; /* Oculto por defecto, se muestra en móvil */
  flex: 1;
  max-width: 300px;
  margin-left: 20px;
}

.mobile-search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.mobile-search-input {
  width: 100%;
  padding: 12px 40px 12px 15px;
  border: 2px solid #e8e0dd;
  border-radius: 25px;
  font-size: 14px;
  color: #7f6f67;
  background-color: white;
  transition: all 0.3s ease;
  outline: none;
}

.mobile-search-input:focus {
  border-color: #be7c69;
  box-shadow: 0 0 0 3px rgba(190, 124, 105, 0.1);
}

.mobile-search-input::placeholder {
  color: #b6aa9d;
  font-style: italic;
}

.mobile-search-icon {
  position: absolute;
  right: 15px;
  color: #b6aa9d;
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
}

.mobile-clear-search-btn {
  position: absolute;
  right: 40px;
  background: none;
  border: none;
  color: #b6aa9d;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 2;
}

.mobile-clear-search-btn:hover {
  background-color: #f0f0f0;
  color: #be7c69;
}

/* Controles de productos */
.products-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.filters-and-search {
  display: flex;
  align-items: center;
  gap: 15px;
}

.products-controls-right {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

/* Botón de filtros móvil mejorado */
.mobile-filters-btn {
  display: flex; /* Oculto por defecto, se muestra en móvil */
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  white-space: nowrap;
  flex-shrink: 0;
}

.mobile-filters-btn:hover {
  background-color: var(--secondary-color);
  transform: translateY(-1px);
}

.mobile-filters-btn .filters-count {
  background-color: rgba(255, 255, 255, 0.9);
  color: var(--primary-color);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
}

/* Estilos para el nuevo selector de códigos en las tarjetas */
.card-code-selector-container {
    margin-bottom: 10px;
    width: 100%;
}

.card-code-options {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.card-code-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid #ccc;
    background-color: #f9f9f9;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    flex-grow: 1;
}

.card-code-option-btn .code-type {
    font-weight: bold;
}

.card-code-option-btn .code-details {
    font-size: 0.7rem;
    color: #555;
}

.card-code-option-btn.selected {
    border-color: #007bff;
    background-color: #e7f1ff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

/* Estilos para el selector de cantidad */
.card-quantity-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.card-quantity-selector .quantity-btn {
    background-color: #eee;
    border: 1px solid #ccc;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 1rem;
}

.card-quantity-selector .quantity-input {
    width: 40px;
    text-align: center;
    border: 1px solid #ccc;
    border-left: none;
    border-right: none;
    padding: 5px;
}

/* Estilos para el precio dinámico */
.card-dynamic-price {
    text-align: center;
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 1.1rem;
    color: #333;

/* ======================================= */
/* == OUT OF STOCK PRODUCT STYLES == */
/* ======================================= */

/* Out of stock product card - grayscale effect */
.product-card.out-of-stock {
  opacity: 0.7;
  position: relative;
}

.product-card.out-of-stock .product-image-container {
  filter: grayscale(100%);
}

.product-card.out-of-stock:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Out of stock badge */
.stock-badge.out-of-stock-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: #6c757d;
  color: white;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 4px;
  z-index: 3;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.5px;
}

/* Out of stock message in cart controls */
.out-of-stock-message {
  padding: 0.75rem;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 6px;
  text-align: center;
  color: #721c24;
  font-weight: 600;
  font-size: 0.85rem;
}

/* Disable interactions for out of stock products */
.product-card.out-of-stock .add-to-cart,
.product-card.out-of-stock .quantity-btn,
.product-card.out-of-stock .quantity-input,
.product-card.out-of-stock .card-code-option-btn {
  pointer-events: none;
  opacity: 0.5;
  cursor: not-allowed;
}

/* Optional: Notify me button for out of stock products */
.notify-me-btn {
  width: 100%;
  background-color: #6c757d;
  color: white;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.notify-me-btn:hover {
  background-color: #5a6268;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}
}
