/*
 * Ferrari Firearms - Best Seller Section CSS
 * For WordPress Implementation
 * Version: 1.0
 * Last Updated: January 2026
 */

/* ============================================
   BEST SELLER SECTION - MAIN CONTAINER
   ============================================ */

/*
 * Ferrari Firearms - Best Seller Section CSS
 * For WordPress Implementation
 * Version: 1.1 - Color Corrected
 * Last Updated: January 2026
 */

/* ============================================
   BEST SELLER SECTION - MAIN CONTAINER
   ============================================ */

.bestseller-section {
  background-color: #0F1821; /* Primary Dark Background */
  padding: 80px 0;
  position: relative;
  overflow: hidden;
}

/* ============================================
   SECTION HEADER
   ============================================ */

.bestseller-header {
  text-align: center;
  margin-bottom: 60px;
}

.bestseller-title {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 30px; /* H2 Size */
  font-weight: 700;
  line-height: 36px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #FFFFFF; /* White Text */
  margin: 0 0 16px 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

/* Gold Lines around Title */
.bestseller-title::before,
.bestseller-title::after {
    content: "";
    display: block;
    width: 96px;
    height: 2px;
    background: #D4A574; /* Gold Accent */
}

.bestseller-subtitle {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  color: #99A1AF; /* Custom gray */
  margin: 0;
  padding: 0;
}

/* ============================================
   PRODUCT GRID
   ============================================ */

.bestseller-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 48px;
  padding: 48px 51.5px; /* Added padding as requested */
}

/* ============================================
   PRODUCT CARD
   ============================================ */

.bestseller-product-card {
  background-color: #1A2332; /* Secondary Dark Background */
  border: 1px solid #2A3C4D; /* Tertiary Dark Border */
  border-radius: 0; /* Sharp corners */
  overflow: hidden;
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.bestseller-product-card:hover {
  border-color: #D4A574; /* Gold on Hover */
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ============================================
   PRODUCT BADGE
   ============================================ */

.bestseller-badge-container {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bestseller-badge {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #FFFFFF;
  padding: 6px 12px;
  border-radius: 0; /* Sharp corners */
  display: inline-block;
}

.bestseller-badge.sale {
  background-color: #c41e3a; /* Ferrari Red */
}

.bestseller-badge.new {
  background-color: #333;
}

/* ============================================
   PRODUCT IMAGE
   ============================================ */

.bestseller-image-container {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 Aspect Ratio */
  background-color: #FFFFFF; /* White background for image specifically */
  overflow: hidden;
  border-bottom: 1px solid #2A3C4D;
}

/* ============================================
   PRODUCT IMAGE CONTAINER - FIXED CENTERING
   ============================================ */

.bestseller-image-container {
  position: relative;
  width: 100%;
  padding-top: 15%;           /* 1:1 square aspect ratio */
  background-color: #FFFFFF;
  overflow: hidden;
  display: flex;               /* New centering method */
  align-items: center;         /* Vertical center */
  justify-content: center;     /* Horizontal center */
  border-bottom: 1px solid #2A3C4D;
}

/* ============================================
   PRODUCT IMAGE - CLEAN CENTERING
   ============================================ */

.bestseller-product-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;         /* Keeps proper proportions */
  transition: transform 0.4s ease;
}

/* Hover effect */
.bestseller-product-card:hover .bestseller-product-image {
  transform: scale(1.05);
}

/* Quick View Overlay */
.bestseller-quick-view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 24, 33, 0.7); /* Dark semi-transparent */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.bestseller-product-card:hover .bestseller-quick-view {
  opacity: 1;
}

.bestseller-quick-view-btn {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #FFFFFF;
  background-color: #c41e3a; /* Ferrari Red */
  border: none;
  border-radius: 0; 
  padding: 12px 24px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.bestseller-quick-view-btn:hover {
  background-color: #a01828; /* Darker Red */
}

/* ============================================
   PRODUCT INFO
   ============================================ */

.bestseller-product-info {
  padding: 16px; /* Reduced from 24px to reduce white space */
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background-color: #FFFFFF; /* White Background */
}

/* Product Brand (replaces Category) */
.bestseller-product-brand {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 14px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #99A1AF;
  margin: 0 0 6px 0;
  display: inline-block;
}

.bestseller-product-category:hover {
  color: #D4A574; /* Gold Hover */
}

/* Product Title */
.bestseller-product-title {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
  color: #0F1821; /* Dark Text for White Background */
  margin: 0 0 12px 0;
  text-decoration: none;
  display: block;
  transition: color 0.3s ease;
  min-height: 48px;
}

.bestseller-product-title:hover {
  color: #D4A574; /* Gold Hover */
}

/* Product Rating */
.bestseller-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.bestseller-stars {
  display: flex;
  gap: 2px;
}

.bestseller-star {
  color: #D4A574; /* Gold Stars */
  font-size: 14px;
}

.bestseller-star.empty {
  color: #4B5563; /* Gray empty stars */
}

.bestseller-rating-count {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: #99A1AF;
}

/* ============================================
   PRODUCT PRICING
   ============================================ */

/* ============================================
   PRODUCT PRICING & ACTIONS ROW
   ============================================ */

.bestseller-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  gap: 12px;
}

.bestseller-price-container {
  margin-bottom: 0; /* Remove bottom margin as it is now in flex row */
}

.bestseller-current-price {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 18px; /* Slightly smaller to fit */
  font-weight: 700;
  line-height: 24px;
  color: #c41e3a; /* Ferrari Red */
  margin: 0;
}

.bestseller-original-price {
  font-size: 16px;
  color: #6B7280;
  text-decoration: line-through;
  margin-left: 8px;
}

/* ============================================
   PRODUCT ACTIONS
   ============================================ */

/* ============================================
   PRODUCT ACTIONS
   ============================================ */

.bestseller-actions {
  margin-top: 0; /* Handled by bottom-row */
  flex-shrink: 0;
}

.bestseller-btn {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: none;
  border-radius: 0;
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto; /* Allow auto width for compact layout */
  gap: 8px;
}

.bestseller-btn-sm {
  padding: 8px 16px;
  font-size: 12px;
  line-height: 16px;
}

.bestseller-btn-primary {
  background-color: #c41e3a; /* Ferrari Red */
  color: #FFFFFF;
  border: 2px solid #c41e3a;
}

.bestseller-btn-primary:hover {
  background-color: #a01828;
  border-color: #a01828;
}

.bestseller-btn-disabled {
  background-color: #9E9E9E;
  color: #FFFFFF;
  border: 2px solid #9E9E9E;
  cursor: not-allowed;
  opacity: 0.7;
}

/* ============================================
   VIEW ALL BUTTON
   ============================================ */

.bestseller-view-all {
  text-align: center;
  margin-top: 48px;
}

.bestseller-view-all-btn {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #FFFFFF;
  background-color: transparent;
  border: 2px solid #D4A574; /* Gold Border */
  border-radius: 0;
  padding: 16px 48px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.bestseller-view-all-btn:hover {
  background-color: #D4A574;
  color: #0F1821; /* Dark Text on Gold */
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}

/* ============================================
   RESPONSIVE DESIGN - TABLET
   ============================================ */

@media (max-width: 1024px) {
  .bestseller-section {
    padding: 60px 0;
  }

  .bestseller-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .bestseller-title {
    font-size: 36px;
    line-height: 44px;
  }

  .bestseller-product-title {
    font-size: 16px;
    line-height: 22px;
    min-height: 44px;
  }

  .bestseller-current-price {
    font-size: 18px;
    line-height: 26px;
  }
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE
   ============================================ */

@media (max-width: 768px) {
  .bestseller-section {
    padding: 48px 0;
  }

  .bestseller-container {
    padding: 0 16px;
  }

  .bestseller-header {
    margin-bottom: 40px;
  }

  .bestseller-title {
    font-size: 28px;
    line-height: 36px;
    margin-bottom: 12px;
  }

  .bestseller-subtitle {
    font-size: 16px;
    line-height: 24px;
  }

  .bestseller-grid {
    grid-template-columns: 1fr; /* 1 Column per row on mobile */
    gap: 24px;
    margin-bottom: 32px;
  }

  .bestseller-product-info {
    padding: 16px;
  }

  .bestseller-product-title {
    font-size: 15px;
    line-height: 20px;
    min-height: 40px;
    margin-bottom: 8px;
  }

  .bestseller-product-description {
    display: none; /* Hide on mobile to save space */
  }

  .bestseller-current-price {
    font-size: 16px;
    line-height: 24px;
  }

  .bestseller-original-price {
    font-size: 14px;
    line-height: 20px;
  }

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

  .bestseller-btn {
    font-size: 13px;
    padding: 10px 16px;
  }

  .bestseller-badge-container {
    top: 0 !important;
    left: 0 !important;
  }

  .bestseller-badge {
    font-size: 10px;
    padding: 4px 8px;
  }
  
  /* MAXIMIZE MOBILE IMAGE SIZE */
  .bestseller-product-image {
      padding: 0 !important;
  }
  
  .bestseller-image-container {
      border-bottom: 0; /* Remove border to save vertical pixel */
  }

  .bestseller-view-all-btn {
    font-size: 14px;
    padding: 14px 32px;
    width: 100%;
  }
}

/* ============================================
   RESPONSIVE DESIGN - SMALL MOBILE
   ============================================ */

@media (max-width: 480px) {
  .bestseller-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .bestseller-image-container {
    padding-top: 66.67%; /* 3:2 Aspect Ratio on mobile */
  }

  .bestseller-title {
    font-size: 24px;
    line-height: 32px;
  }
}

/* ============================================
   LOADING STATE
   ============================================ */

.bestseller-product-card.loading {
  pointer-events: none;
}

.bestseller-skeleton {
  background: linear-gradient(
    90deg,
    #1A1A1A 0%,
    #2A2A2A 50%,
    #1A1A1A 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

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

.bestseller-skeleton-image {
  width: 100%;
  height: 100%;
  background-color: #2A2A2A;
}

.bestseller-skeleton-text {
  height: 16px;
  background-color: #2A2A2A;
  margin-bottom: 8px;
}

.bestseller-skeleton-title {
  height: 24px;
  width: 80%;
  background-color: #2A2A2A;
  margin-bottom: 12px;
}

.bestseller-skeleton-price {
  height: 28px;
  width: 40%;
  background-color: #2A2A2A;
  margin-bottom: 16px;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.bestseller-btn:focus,
.bestseller-product-title:focus,
.bestseller-product-category:focus,
.bestseller-view-all-btn:focus {
  outline: 2px solid #D32F2F;
  outline-offset: 2px;
}

.bestseller-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .bestseller-section {
    background-color: white;
    padding: 20px 0;
  }

  .bestseller-product-card {
    border: 1px solid #000;
    page-break-inside: avoid;
  }

  .bestseller-quick-view,
  .bestseller-actions,
  .bestseller-view-all {
    display: none;
  }

  .bestseller-title,
  .bestseller-product-title,
  .bestseller-current-price {
    color: #000;
  }
}

/* ============================================
   CUSTOM SCROLLBAR (Optional)
   ============================================ */

.bestseller-section *::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.bestseller-section *::-webkit-scrollbar-track {
  background: #1A1A1A;
}

.bestseller-section *::-webkit-scrollbar-thumb {
  background: #D32F2F;
  border-radius: 0; /* Sharp corners */
}

.bestseller-section *::-webkit-scrollbar-thumb:hover {
  background: #B71C1C;
}

/* ============================================
   ANIMATION UTILITIES
   ============================================ */

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

.bestseller-product-card {
  animation: fadeInUp 0.5s ease-out;
  animation-fill-mode: both;
}

.bestseller-product-card:nth-child(1) { animation-delay: 0.1s; }
.bestseller-product-card:nth-child(2) { animation-delay: 0.2s; }
.bestseller-product-card:nth-child(3) { animation-delay: 0.3s; }
.bestseller-product-card:nth-child(4) { animation-delay: 0.4s; }
.bestseller-product-card:nth-child(5) { animation-delay: 0.5s; }
.bestseller-product-card:nth-child(6) { animation-delay: 0.6s; }
.bestseller-product-card:nth-child(7) { animation-delay: 0.7s; }
.bestseller-product-card:nth-child(8) { animation-delay: 0.8s; }

/* ============================================
   WORDPRESS INTEGRATION HELPERS
   ============================================ */

/* WooCommerce Product Integration */
.bestseller-section .woocommerce ul.products {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.bestseller-section .woocommerce ul.products li.product {
  background-color: #121212;
  border: 1px solid #2A2A2A;
  border-radius: 0;
}

/* Clear default WooCommerce styles */
.bestseller-section .woocommerce ul.products li.product .button {
  border-radius: 0;
}

.bestseller-section .woocommerce ul.products li.product .price {
  color: #D32F2F;
  font-family: 'Chakra Petch', sans-serif;
}

.bestseller-section .woocommerce span.onsale {
  border-radius: 0;
  background-color: #D32F2F;
  font-family: 'Chakra Petch', sans-serif;
}

/* ============================================
   DISCOUNTS SECTION (OUR TOP DISCOUNTS)
   ============================================ */

.discounts-section {
  background-color: #1A2332;
  padding: 80px 0;
}

.discounts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 0 16px; /* Inner padding for safety */
}

.discount-card {
  width: 100%;
  max-width: none !important; /* Override .category-card limit */
  height: 316px; /* Specific height requested */
  border: 1px solid #D4A574;
  overflow: hidden;
  display: block;
  position: relative;
  transition: all 0.3s ease;
}

.discount-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border-color: #fff; 
}

/* Responsive Adjusments */
@media (max-width: 1280px) {
    .discounts-grid {
        grid-template-columns: repeat(3, 1fr); /* Switch to fluid if screen is too narrow */
    }
}

@media (max-width: 990px) {
  .discounts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .discounts-grid {
    grid-template-columns: 1fr;
  }
  .discount-card {
      height: 316px; /* Maintain height or adjust if needed */
  }
}

/* Fix MAP price color */
.map-price-hidden {
    color: #C42B30 !important;
}

/* Fix MAP price color for dynamically generated spans (e.g. plugins) */
.map-see-price-text, .map-see-price-text span {
    color: #C42B30 !important;
}
