/* styles.css - Enhanced Version */

/* ========================================
   Core Reset & Base Styles
   ======================================== */
img {
  object-fit: contain;
}

/* ========================================
   Dynamic Grid System for Product Cards
   ======================================== */
.product-grid {
  display: grid;
  gap: 1rem;
  justify-content: center;
  padding: 1rem;
}

/* Mobile: 2 columns */
@media (max-width: 639px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 0.75rem;
  }
}

/* Tablet: 3 columns */
@media (min-width: 640px) and (max-width: 1023px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(200px, 1fr));
    gap: 1rem;
  }
}

/* Desktop: 4 columns */
@media (min-width: 1024px) and (max-width: 1279px) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(220px, 280px));
    gap: 1.25rem;
  }
}

/* Large Desktop: 5 columns */
@media (min-width: 1280px) {
  .product-grid {
    grid-template-columns: repeat(5, minmax(220px, 260px));
    gap: 1.5rem;
  }
}

/* ========================================
   Product Card - Flexible Height
   ======================================== */
.product-card {
  width: 100%;
  min-height: 380px;
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border-radius: 0.75rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  position: relative;
}

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

/* Dark mode card shadow */
.dark .product-card {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.dark .product-card:hover {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* ========================================
   Image Container - Responsive
   ======================================== */
.img-container {
  background-color: #F2F2F2;
  min-height: 120px;
  max-height: 150px;
  border-radius: 0.5rem;
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  flex-shrink: 0;
}

.dark .img-container {
  background-color: #374151;
}

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

/* Mobile adjustments */
@media (max-width: 639px) {
  .img-container {
    min-height: 100px;
    max-height: 120px;
    padding: 0.75rem;
  }
  
  .product-card img {
    max-height: 80px;
  }
}

/* Tablet adjustments */
@media (min-width: 640px) and (max-width: 1023px) {
  .img-container {
    min-height: 110px;
    max-height: 140px;
  }
  
  .product-card img {
    max-height: 90px;
  }
}

/* ========================================
   Labels - Position & Style
   ======================================== */
.process-label {
  background-color: white;
  border-radius: 0.375rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 500;
  color: #6B7280;
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  z-index: 2;
  white-space: nowrap;
}

.terlaris-label {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background-color: #EF4444;
  color: white;
  font-size: 0.625rem;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
  z-index: 2;
  white-space: nowrap;
}

/* Dark mode labels */
.dark .process-label {
  background-color: #1F2937;
  color: #D1D5DB;
}

/* ========================================
   Text Container - Flexible Content
   ======================================== */
.text-container {
  flex: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 0;
}

.text-container p:first-child {
  font-size: 0.75rem;
  margin: 0;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.text-container h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.text-container .price {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0.25rem 0 0 0;
}

.text-container .sales-count {
  font-size: 0.75rem;
  font-weight: 500;
  margin: 0.125rem 0 0 0;
}

/* Mobile text adjustments */
@media (max-width: 639px) {
  .text-container {
    padding: 0.75rem;
  }
  
  .text-container h3 {
    font-size: 0.875rem;
  }
  
  .text-container .price {
    font-size: 0.8125rem;
  }
}

/* ========================================
   Status Container - Dynamic Height
   ======================================== */
.status-container {
  padding: 0 1rem 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

.status-container hr {
  border: none;
  border-top: 1px solid #E5E7EB;
  margin: 0;
}

.dark .status-container hr {
  border-top-color: #4B5563;
}

.status-container p {
  font-size: 0.75rem;
  font-weight: 500;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ========================================
   CTA Button - Responsive
   ======================================== */
.product-card a.cta-button,
.product-card a:last-child {
  margin: 0 1rem 1rem 1rem;
  padding: 0.5rem 1rem;
  text-align: center;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  text-decoration: none;
  display: block;
  flex-shrink: 0;
}

/* Mobile button adjustments */
@media (max-width: 639px) {
  .product-card a.cta-button,
  .product-card a:last-child {
    margin: 0 0.75rem 0.75rem 0.75rem;
    padding: 0.4375rem 0.75rem;
    font-size: 0.8125rem;
  }
}

/* ========================================
   Header & Navigation
   ======================================== */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 1rem 0;
  background-color: white;
}

.dark header {
  background-color: #1F2937;
}

/* Hamburger Menu Animation */
#hamburgerButton {
  z-index: 60;
  pointer-events: auto;
  position: relative;
}

#hamburgerButton .bi-list,
#hamburgerButton .bi-x-lg {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#hamburgerButton.is-open .bi-list {
  opacity: 0;
  transform: rotate(45deg);
}

#hamburgerButton.is-open .bi-x-lg {
  opacity: 1;
  transform: rotate(0deg);
}

#hamburgerButton:not(.is-open) .bi-x-lg {
  opacity: 0;
  transform: rotate(-45deg);
}

#hamburgerButton:not(.is-open) .bi-list {
  opacity: 1;
  transform: rotate(0deg);
}

/* Mobile Menu Animation */
#mobileMenu {
  transform: translateX(-100%);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#mobileMenu.is-open {
  transform: translateX(0);
  opacity: 1;
}

#menuOverlay {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#menuOverlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

@supports (backdrop-filter: blur(10px)) {
  #menuOverlay {
    backdrop-filter: blur(10px);
  }
}

/* ========================================
   Carousel Containers
   ======================================== */
.keunggulan-container,
.testimoni-container {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 0;
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.keunggulan-container > div,
.testimoni-container > div {
  flex: 0 0 300px;
  scroll-snap-align: center;
}

/* Hide scrollbar */
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Snap alignment */
.snap-x {
  scroll-snap-type: x mandatory;
}

.snap-center {
  scroll-snap-align: center;
}

/* ========================================
   Animations
   ======================================== */
@keyframes bounce {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.card-bounce {
  animation: bounce 0.5s ease-in-out;
}

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

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* ========================================
   Utility Classes
   ======================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Container widths */
.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .container {
    max-width: 640px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 768px;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 1024px;
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }
}

/* ========================================
   Loading States
   ======================================== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ========================================
   Responsive Breakpoints Summary
   ======================================== */
/* 
  Mobile: 0-639px (2 cols)
  Tablet: 640px-1023px (3 cols)
  Desktop: 1024px-1279px (4 cols)
  Large: 1280px+ (5 cols)
*/

/* ========================================
   Print Styles
   ======================================== */
@media print {
  header,
  .keunggulan-container,
  .testimoni-container,
  #hamburgerButton,
  #mobileMenu {
    display: none !important;
  }
  
  .product-card {
    break-inside: avoid;
  }
}