/* Products Page Styles */

.products-section {
  padding: 0 0 2.5rem 0;
  background: white;
  position: relative;
}

.products-section .container {
  padding-top: 0;
}

.products-filters {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0;
  width: 100%;
}

.categories-label {
  font-family: "Poppins", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.category-trigger {
  width: 100%;
  text-align: left;
  padding: 12px 40px 12px 16px;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-family: "Poppins", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.category-trigger::after {
  content: "\f107";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color);
  transition: transform 0.3s ease;
}

.categories-sidebar.active .category-trigger::after {
  transform: translateY(-50%) rotate(180deg);
}

.categories-sidebar.active .category-trigger {
  border-color: var(--primary-color);
  background: var(--primary-gradient-light);
}

.products-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 3rem;
  align-items: start;
  margin-top: -7rem !important;
  padding-top: 0 !important;
  position: relative;
}

/* Background Blur Overlay */
.products-blur-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

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

/* Categories Sidebar */
.categories-sidebar {
  background: white;
  border-radius: var(--border-radius);
  padding: 1.75rem;
  border: 1px solid var(--border-color);
  position: sticky;
  top: 100px;
  box-shadow: var(--shadow-sm);
  z-index: 100;
  height: fit-content;
  margin-top: 1.5rem;
}

.categories-sidebar .products-filters {
  position: relative;
}

.categories-sidebar h3 {
  font-family: "Poppins", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 1.2rem;
  text-align: center;
}

.category-list {
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 0.8rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-height: 400px;
  overflow-y: auto;
}

.category-list.active {
  display: flex;
}

.category-item {
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  color: var(--text-dark);
  border: 1px solid transparent;
  text-decoration: none;
  display: block;
  font-size: 0.85rem;
}

.category-item:hover {
  background: var(--primary-gradient-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.category-item.active {
  background: var(--primary-gradient);
  color: white;
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
}

.category-item.active:hover {
  background: var(--primary-dark);
}

/* Products Content */
.products-content {
  min-height: 600px;
  padding: 1.5rem 0;
  align-self: start;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
  justify-items: center;
  margin-top: 0;
  padding-top: 7rem; /* Align with bottom of filters section */
}

.products-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
  padding-top: 1rem;
}

.products-header h2 {
  font-family: "Poppins", sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

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

.search-box input {
  width: 100%;
  padding: 11.5px 14px 11.5px 38px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.9rem;
  transition: all 0.3s ease;
  background: white;
  color: var(--text-dark);
}

.search-box input::placeholder {
  color: var(--text-light);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(81, 46, 114, 0.1);
  background: white;
}

.search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 0.9rem;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
  justify-items: center;
}

/* Desktop improvements */
@media (min-width: 769px) {
  .category-trigger,
  .search-box input {
    height: 52px;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    justify-items: center;
    padding-top: 0;
    margin-top: 0;
  }

  .products-grid .product-card {
    width: 100%;
    max-width: 220px;
    aspect-ratio: 2 / 3;
    padding: 6px;
  }

  .products-layout {
    grid-template-columns: clamp(280px, 24vw, 340px) 1fr;
    gap: 2rem;
  }

  .categories-sidebar {
    top: 100px;
    padding-top: 2rem;
  }

  .categories-sidebar .categories-label {
    display: block;
    padding-left: 0px;
    padding-top: 0;
    margin-top: 0;
  }

  .products-filters {
    margin-top: 0;
    gap: 0.6rem;
    align-items: stretch;
  }

  .products-filters .search-box {
    order: 1;
    margin-bottom: 1.75rem;
  }

  .products-filters .categories-label {
    order: 2;
    padding-top: 0;
    margin-top: 0.1rem;
    display: none;
  }

  .category-trigger {
    padding: 0 40px 0 16px;
    font-size: 1.05rem;
    display: none;
  }

  .search-box input {
    padding: 0 14px 0 38px;
    font-size: 0.95rem;
  }

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

  .whatsapp-btn {
    padding: 9px 14px;
    font-size: 0.82rem;
    min-height: 38px;
  }

  .product-info {
    padding: 0.85rem 0.6rem 0.6rem;
    gap: 0.7rem;
  }

  .share-btn {
    width: 38px;
    height: 38px;
    font-size: 1.15rem;
    top: 10px;
    right: 10px;
  }

  .category-list {
    display: grid;
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 0.45rem;
    margin-top: 0.25rem;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    max-height: none;
    overflow-y: visible;
  }

  .category-item {
    height: 56px;
    padding: 8px 10px;
    font-size: 0.85rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background: white;
    transform: none;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    overflow: hidden;
    text-overflow: clip;
    line-height: 1.2;
    word-break: break-word;
    hyphens: auto;
  }

  .category-item:hover {
    transform: none;
    box-shadow: none;
    background: var(--primary-gradient-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
  }

  .category-item:focus-visible {
    outline: 3px solid rgba(81, 46, 114, 0.25);
    outline-offset: 2px;
  }

  .category-item.active {
    background: var(--primary-gradient);
    color: white;
    border-color: var(--primary-color);
  }
}

@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.2rem;
    justify-items: center;
  }

  .products-grid .product-card {
    width: 100%;
    max-width: 220px;
  }

  .products-layout {
    grid-template-columns: clamp(300px, 22vw, 360px) 1fr;
    gap: 2.5rem;
  }

  .categories-sidebar {
    top: 90px;
  }
}

@media (min-width: 1200px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    justify-items: center;
  }

  .products-grid .product-card {
    width: 100%;
    max-width: 220px;
  }

  .products-layout {
    gap: 3rem;
  }
}

.product-card {
  background: white;
  border-radius: var(--border-radius);
  overflow: visible;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: relative;
  width: 100%;
  max-width: 280px;
  aspect-ratio: 2 / 3;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  padding: 8px;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

/* Highlighted Product Card */
.product-card.highlighted {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) scale(1.2) !important;
  z-index: 3000 !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
  border-color: var(--primary-color) !important;
  border-width: 2px !important;
  animation: highlightCard 0.3s ease-out !important;
  width: 280px !important;
  height: auto !important;
  max-height: 400px !important;
  min-height: auto !important;
  flex-shrink: 0 !important;
}

@keyframes highlightCard {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
}

.product-image {
  position: relative;
  width: 100%;
  flex: 1;
  overflow: hidden;
  margin: 0;
  border-radius: var(--border-radius-sm);
  background: white;
}

.product-image:has(img.image-loading) {
  background: white;
}

.product-image::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to bottom, transparent 0%, rgba(255, 255, 255, 0.4) 40%, rgba(255, 255, 255, 0.8) 70%, white 100%);
  pointer-events: none;
  z-index: 2;
}

.product-image img {
  mask-image: linear-gradient(to bottom, black 0%, black 80%, rgba(0, 0, 0, 0.7) 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 80%, rgba(0, 0, 0, 0.7) 90%, transparent 100%);
}

.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-info {
  padding: 0.75rem 0.5rem 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex-shrink: 0;
}

.product-name {
  font-family: "Poppins", sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.whatsapp-btn {
  background: var(--whatsapp-color);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  font-size: 0.8rem;
  width: 100%;
  min-height: 36px;
}

.whatsapp-btn:hover {
  background: #128c7e;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.share-btn {
  background: transparent;
  color: black;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  opacity: 0.7;
}

.share-btn:hover {
  opacity: 1;
  transform: scale(1.15);
  color: var(--primary-color);
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-light);
  grid-column: 1 / -1;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 0.8rem;
  color: var(--primary-color);
  opacity: 0.5;
}

.empty-state h3 {
  font-family: "Poppins", sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-dark);
}


/* Responsive Design - Tablet */
@media (min-width: 769px) and (max-width: 1023px) {
  .products-layout {
    grid-template-columns: clamp(260px, 30vw, 320px) 1fr;
    gap: 2rem;
  }

  .search-box {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 768px) {
  .products-layout {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .categories-sidebar {
    position: relative;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    margin: 0 0 0.5rem 0;
    z-index: 2;
  }

  .categories-sidebar h3 {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
    visibility: hidden !important;
  }

  .category-list {
    display: none;
    position: static;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.8rem;
    box-shadow: var(--shadow-lg);
    z-index: 1;
    max-height: 300px;
    overflow-y: auto;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.35rem;
    width: 100%;
  }

  .category-list.active {
    display: flex;
  }

  .category-item {
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid transparent;
  }

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

  .search-box {
    width: 100%;
  }

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

  .product-card {
    max-width: 100%;
    aspect-ratio: 2 / 3;
  }


  .product-card.highlighted {
    transform: translate(-50%, -50%) scale(1.1) !important;
    width: 260px !important;
    max-width: 90vw !important;
    max-height: 380px !important;
  }
}

@media (max-width: 480px) {
  .products-section {
    padding: 2.5rem 0;
  }

  .category-trigger {
    font-size: 0.9rem;
    padding: 10px 14px;
  }

  .category-list {
    padding: 0.6rem;
    max-height: 250px;
  }

  .category-item {
    padding: 8px 10px;
    font-size: 0.8rem;
  }

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

  .product-card {
    margin: 0;
    max-width: 100%;
    aspect-ratio: 2 / 3;
  }

  .product-info {
    padding: 1rem;
  }

  .product-actions {
    gap: 0.6rem;
  }

  .whatsapp-btn {
    padding: 10px 12px;
    font-size: 0.8rem;
    min-height: 40px;
  }

  .share-btn {
    width: 40px;
    height: 40px;
    padding: 10px;
    font-size: 0.9rem;
  }

  .product-card.highlighted {
    transform: translate(-50%, -50%) scale(1.05) !important;
    width: 240px !important;
    max-width: 95vw !important;
    max-height: 360px !important;
  }

}

.product-image-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 6000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.product-image-lightbox.active {
  display: flex;
}

.product-image-lightbox-img {
  max-width: min(900px, 92vw);
  max-height: 86vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.55);
  background: white;
}

.product-image-lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: white;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.product-image-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.28);
}
