/* ===== ESTILOS GENERALES ===== */
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;600;700&display=swap");

:root {
  --dl-primary: #27ae60;
  --dl-primary-dark: #219653;
  --dl-secondary: #ff6b35;
  --dl-text-dark: #2c3e50;
  --dl-text-light: #ffffff;
  --dl-bg-light: #f9f9f9;
  --dl-border-color: #e8f5e9;
  --dl-shadow: 0 5px 15px rgba(39, 174, 96, 0.1);
  --dl-hover-green: #1e8449;
}

.catalog-container {
  padding: 30px 0;
  background-color: #ffffff;
  min-height: 100vh;
  font-family: "Montserrat", sans-serif !important;
}

.catalog-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

/* ===== MIGAS DE PAN ===== */
.catalog-breadcrumb {
  display: flex;
  justify-content: left;
  align-items: left;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 20px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: var(--dl-shadow);
  font-size: 15px;
  font-weight: 500;
  color: var(--dl-text-dark);
}

.catalog-breadcrumb a {
  text-decoration: none;
  color: var(--dl-primary);
  transition: color 0.3s ease;
}

.catalog-breadcrumb a:hover {
  color: var(--dl-primary-dark);
}

.catalog-breadcrumb span {
  color: #888;
  font-size: 14px;
}

.catalog-breadcrumb .active {
  font-weight: 600;
  color: var(--dl-text-dark);
}

/* ===== TÍTULO Y DESCRIPCIÓN ===== */
.catalog-header {
  text-align: center;
  margin-bottom: 30px;
}

.catalog-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--dl-text-dark);
  margin-bottom: 10px;
}

.catalog-description {
  color: #6c757d;
  margin-bottom: 30px;
  font-size: 1.1rem;
}

/* ===== CONTROLES DEL CATÁLOGO ===== */
.catalog-controls {
  margin-bottom: 30px;
  background: white;
  border-radius: 15px;
  padding: 20px;
  box-shadow: var(--dl-shadow);
  position: relative;
}

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

.control-filter,
.control-sort,
.control-view {
  flex: 1;
}

.control-view {
  display: flex;
  justify-content: flex-end;
}

.filter-btn {
  background: var(--dl-primary);
  color: var(--dl-text-light);
  border: none;
  padding: 12px 20px;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(39, 174, 96, 0.15);
}

.filter-btn:hover {
  background-color: var(--dl-hover-green);
  transform: translateY(-2px);
}

.sort-select {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--dl-border-color);
  border-radius: 50px;
  background: white;
  font-size: 14px;
  color: #555;
  box-shadow: 0 4px 10px rgba(39, 174, 96, 0.1);
}

.sort-select:focus {
  outline: none;
  border-color: var(--dl-primary);
}

.view-controls {
  display: flex;
  gap: 10px;
}

.view-btn {
  background: white;
  border: 1px solid var(--dl-border-color);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--dl-primary);
  box-shadow: var(--dl-shadow);
}

.view-btn.active,
.view-btn:hover {
  background: var(--dl-primary);
  color: var(--dl-text-light);
  border-color: var(--dl-primary);
  transform: translateY(-2px);
}

/* ===== PANEL DE FILTROS ===== */
.filter-panel-container {
  position: relative;
}

.filter-panel {
  display: none;
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  margin-top: 15px;
  position: absolute;
  width: 500px;
  z-index: 100;
  right: 0;
  top: 100%;
  animation: slideDown 0.3s ease;
  border: 1px solid var(--dl-border-color);
}

.filter-panel.active {
  display: block;
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--dl-border-color);
}

.filter-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--dl-text-dark);
}

.close-filter {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6c757d;
  transition: color 0.3s ease;
}

.close-filter:hover {
  color: var(--dl-text-dark);
}

.filter-content {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.filter-content::-webkit-scrollbar {
  width: 6px;
}

.filter-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.filter-content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.filter-content::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.filter-widget {
  margin-bottom: 20px;
}

.filter-widget h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--dl-text-dark);
}

.filter-categories {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 5px;
}

.filter-categories li {
  padding: 5px 0;
  border-bottom: 1px solid var(--dl-border-color);
  margin-bottom: 8px;
}

.filter-categories li:last-child {
  border-bottom: none;
}

.filter-categories label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--dl-text-dark);
  padding: 5px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.filter-categories label:hover {
  background-color: var(--dl-border-color);
}

.filter-categories input[type="checkbox"] {
  margin-right: 10px;
}

.price-filter {
  padding: 10px 0;
}

.price-slider {
  padding: 20px 0;
}

.ui-slider {
  position: relative;
  background: #e0e0e0;
  height: 4px;
  border-radius: 2px;
}

.ui-slider-range {
  position: absolute;
  background: var(--dl-primary);
  height: 100%;
  border-radius: 2px;
}

.ui-slider-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--dl-primary);
  border-radius: 50%;
  cursor: pointer;
  top: -7px;
  margin-left: -9px;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.price-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  justify-content: center;
}

.price-inputs input {
  width: 80px;
  padding: 8px 12px;
  border: 1px solid var(--dl-border-color);
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
  background: var(--dl-bg-light);
}

.filter-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 15px;
  border-top: 1px solid var(--dl-border-color);
  position: sticky;
  bottom: 0;
  background: white;
  z-index: 5;
}

.filter-apply,
.filter-clear {
  padding: 10px 20px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  min-width: 120px;
  box-shadow: 0 4px 10px rgba(39, 174, 96, 0.15);
}

.filter-apply {
  background: var(--dl-primary);
  color: var(--dl-text-light);
}

.filter-apply:hover {
  background: var(--dl-hover-green);
  transform: translateY(-2px);
}

.filter-clear {
  background: #6c757d;
  color: var(--dl-text-light);
}

.filter-clear:hover {
  background: #5a6268;
  transform: translateY(-2px);
}

.filter-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

/* ===== PRODUCTOS ===== */
.catalog-products {
  margin-bottom: 30px;
}

.loading-spinner {
  display: none;
  text-align: center;
  padding: 40px;
}

.loading-spinner.active {
  display: block;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(39, 174, 96, 0.1);
  border-left-color: var(--dl-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== TARJETAS DE PRODUCTO ===== */
.products-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
}

.product-item {
  flex: 0 0 calc(33.333% - 20px);
  max-width: calc(33.333% - 20px);
}

.product-card {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: var(--dl-shadow);
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--dl-border-color);
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.product-badge {
  position: relative;
  top: 10px;
  left: 10px;
  z-index: 2;
  flex-direction: column;
  gap: 5px;
}

.sale-badge,
.outofstock-badge {
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.sale-badge {
  background: var(--dl-secondary);
  color: white;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  position: static; /* Cambiar de absolute a static */
  display: none; /* Mostrar siempre, no solo en hover */
  margin-bottom: 5px;
}

.outofstock-badge {
  background: #6c757d;
  color: white;
}

.product-image {
  position: relative;
  overflow: hidden;
  height: 250px;
}

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

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

.product-actions {
  position: absolute;
  bottom: -50px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.95);
  transition: bottom 0.3s ease;
}

.product-card:hover .product-actions {
  bottom: 0;
}

.action-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: white;
  color: var(--dl-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--dl-shadow);
}

.action-btn:hover {
  background: var(--dl-primary);
  color: white;
  transform: translateY(-3px);
}

.action-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

.action-btn.added {
  background: var(--dl-primary);
  color: white;
}

.product-info {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.product-category {
  font-size: 0.8rem;
  color: #6c757d;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.product-title {
  margin: 0 0 10px;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--dl-text-dark);
}

.product-title a {
  color: var(--dl-text-dark);
  text-decoration: none;
  transition: color 0.3s ease;
}

.product-title a:hover {
  color: var(--dl-primary);
}

.product-rating {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
}

.star-rating {
  color: #219653;
  font-size: 0.9rem;
  font-weight: 500;
}

.review-count {
  font-size: 0.8rem;
  color: #6c757d;
}

.product-price {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--dl-primary);
  margin-bottom: 10px;
}

.product-price del {
  font-size: 0.9rem;
  color: #6c757d;
  margin-right: 5px;
}

.product-price ins {
  text-decoration: none;
}

.product-description {
  font-size: 0.9rem;
  color: #6c757d;
  margin-bottom: 15px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-meta {
  margin-top: auto;
  font-size: 0.8rem;
  color: #6c757d;
}

.product-sku {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--dl-border-color);
}

/* ===== NUEVO PRODUCT FOOTER (BOTÓN "VER PRODUCTO") ===== */
.product-footer {
  padding: 0 20px 20px;
  text-align: center;
}

.view-product-btn {
  background: var(--dl-primary);
  color: var(--dl-text-light);
  padding: 10px 20px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(39, 174, 96, 0.15);
}

.view-product-btn:hover {
  background: var(--dl-hover-green);
  transform: translateY(-2px);
}

/* ===== PAGINACIÓN ===== */
.catalog-pagination {
  margin-top: 30px;
  text-align: center;
}

.catalog-pagination ul {
  display: flex;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
  justify-content: center;
}

.catalog-pagination li {
  display: flex;
  align-items: center;
  justify-content: center;
}

.catalog-pagination a,
.catalog-pagination span {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.catalog-pagination a {
  color: var(--dl-text-dark);
  background: white;
  box-shadow: var(--dl-shadow);
  border: 1px solid var(--dl-border-color);
}

.catalog-pagination a:hover {
  background: var(--dl-primary);
  color: var(--dl-text-light);
  transform: translateY(-2px);
}

.catalog-pagination span.current {
  background: var(--dl-primary);
  color: var(--dl-text-light);
}

.catalog-pagination span.dots {
  background: transparent;
  color: #6c757d;
}

/* ===== MODAL DE VISTA RÁPIDA ===== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 0;
  border-radius: 15px;
  width: 90%;
  max-width: 800px;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: slideIn 0.3s ease;
  border: 1px solid var(--dl-border-color);
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  color: #6c757d;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
  transition: color 0.3s ease;
}

.close-modal:hover {
  color: var(--dl-text-dark);
}

.modal-body {
  padding: 30px;
  max-height: 80vh;
  overflow-y: auto;
}

/* ===== VISTA DE LISTA ===== */
.products-grid.list-view {
  flex-direction: column;
  gap: 20px;
}

.products-grid.list-view .product-item {
  flex: 0 0 100%;
  max-width: 100%;
  margin-bottom: 20px;
}

.products-grid.list-view .product-card {
  transition: box-shadow 0.3s ease; /* Solo transición para la sombra */
}

.products-grid.list-view .product-card:hover {
  transform: none; /* Eliminamos la transformación en modo lista */
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.products-grid.list-view .product-image {
  flex-shrink: 0;
}

.products-grid.list-view .product-info {
  padding: 15px 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  text-align: left;
}

.products-grid.list-view .product-actions {
  position: relative;
  bottom: 0;
  opacity: 1;
  transform: none;
  padding: 10px 0;
  background: transparent;
}

.products-grid.list-view .product-description {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.products-grid.list-view .product-meta {
  display: block;
}

.products-grid.list-view .product-footer {
  padding: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* ===== NOTIFICACIÓN TOAST ===== */
.toast-notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--dl-primary);
  color: var(--dl-text-light);
  padding: 15px 20px;
  border-radius: 50px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.5s;
  box-shadow: var(--dl-shadow);
  font-weight: 500;
}

.toast-notification.show {
  opacity: 1;
}

.toast-notification.success {
  background-color: var(--dl-primary);
}

.toast-notification.error {
  background-color: #e74c3c;
}

.toast-notification.warning {
  background-color: #f39c12;
}

/* ===== ESTADOS ESPECIALES ===== */
body.no-scroll {
  overflow: hidden;
}

.no-products {
  text-align: center;
  padding: 40px;
  font-size: 1.1rem;
  color: #6c757d;
  grid-column: 1 / -1;
}

/* ===== MEDIA QUERIES ===== */
@media (max-width: 992px) {
  .product-item {
    flex: 0 0 calc(50% - 15px);
    max-width: calc(50% - 15px);
  }
}

@media (max-width: 768px) {
  .catalog-container {
    padding: 15px 0;
  }

  .controls-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .control-view {
    justify-content: flex-start;
  }

  .catalog-title {
    font-size: 1.8rem;
  }

  .products-grid.list-view .product-card {
    flex-direction: column;
    gap: 10px; /* Gap más pequeño en móvil */
  }

  .products-grid.list-view .product-image {
    width: 100%;
    height: 250px;
  }

  .products-grid.list-view .product-footer {
    padding: 10px 0;
    text-align: center;
    justify-content: center;
  }

  .modal-content {
    width: 95%;
    margin: 10% auto;
  }

  .filter-panel {
    width: calc(100% - 30px);
    max-width: none;
    right: 15px;
    left: 15px;
  }

  .product-image {
    height: 200px;
  }
}

@media (max-width: 576px) {
  .product-item {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .catalog-title {
    font-size: 1.6rem;
  }

  .filter-actions {
    flex-direction: column;
  }

  .filter-apply,
  .filter-clear {
    width: 100%;
  }

  .catalog-pagination ul {
    flex-wrap: wrap;
  }

  .filter-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    z-index: 1000;
    overflow-y: auto;
    animation: slideInRight 0.3s ease;
  }

  .filter-header {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
  }

  .filter-overlay.active {
    display: block;
  }

  .filter-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  }

  .product-image {
    height: 180px;
  }

  .view-product-btn {
    width: 100%; /* Botón full width en móvil pequeño */
  }
}

/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

