/* Popular Products Section Styles */
.popular-products-section {
  padding: 4rem 0;
  background: var(--cream);
  border-radius: 0;
}

.popular-products-section .section-intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  text-align: left;
}

.popular-products-section .section-intro h2 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--dark-brown);
  margin: 0;
  font-family: var(--font-main);
}

.view-all-link {
  color: var(--forest-green);
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.view-all-link:hover {
  color: var(--dark-brown);
  transform: translateX(4px);
}

.view-all-link span {
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.view-all-link:hover span {
  transform: translateX(2px);
}

/* Popular Products Grid */
.popular-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.popular-product-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(44, 74, 60, 0.12);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid rgba(44, 74, 60, 0.1);
  position: relative;
}

.popular-product-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(44, 74, 60, 0.02);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.popular-product-card:hover::after {
  opacity: 1;
}

.popular-product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(44, 74, 60, 0.18);
}

.product-image-container {
  position: relative;
  width: 100%;
  height: 220px;
  background: var(--light-green);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

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

/* Discount Badges */
.discount-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--forest-green);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 10;
}

/* When multiple badges exist, position them differently */
.product-image-container .discount-badge:first-child {
  top: 12px;
  left: 12px;
}

.product-image-container .discount-badge:nth-child(2) {
  top: 12px;
  right: 12px;
  left: auto;
}

/* Ensure special badge (Most Popular) is positioned on the right */
.discount-badge.special {
  top: 12px !important;
  right: 12px !important;
  left: auto !important;
  background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
  animation: pulse 2s infinite;
}

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

/* Product Content */
.popular-product-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 300px; /* Ensure enough space for buttons */
  background: var(--forest-green);
}

.popular-product-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.popular-product-description {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  margin: 0 0 1rem 0;
  line-height: 1.4;
}

/* Pricing */
.popular-product-pricing {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.popular-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
}

.original-price {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: line-through;
}

/* Product Meta */
.popular-product-meta {
  margin-bottom: 1rem;
}

.shipping-details {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

.shipping-details span {
  display: flex;
  align-items: center;
}

.shipping-details span:before {
  content: "•";
  color: var(--light-green);
  margin-right: 0.5rem;
  font-weight: bold;
}

/* Add to Cart Button */
.popular-add-to-cart-btn {
  width: 100%;
  background: white;
  color: var(--forest-green);
  border: 2px solid white;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: auto;
}

.popular-add-to-cart-btn:hover {
  background: var(--light-green);
  color: var(--forest-green);
  border-color: var(--light-green);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

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

/* Popular Products Frame Selection */
.popular-frame-selection {
  margin: 1rem 0;
}

.popular-frame-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 0.5rem;
}

.popular-frame-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.popular-frame-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.popular-frame-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
}

.popular-frame-option.active {
  background: rgba(255, 255, 255, 0.2);
  border-color: white;
  color: white;
}

.popular-frame-option .frame-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

/* Frame swatch colors for popular products - use actual frame images */
.popular-frame-option .frame-light { 
  background: url('../images/wood-grains-white-oak.png') center/cover;
}
.popular-frame-option .frame-medium { 
  background: url('../images/wood-grains-cherry.png') center/cover;
}
.popular-frame-option .frame-dark { 
  background: url('../images/wood-grains-walnut.png') center/cover;
}
.popular-frame-option .frame-maple { 
  background: url('../images/wood-grains-maple.png') center/cover;
}


/* Trust Signals for Popular Products */
.popular-trust-signals {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3rem;
  margin-top: 3rem;
  padding: 1.5rem 0;
}

.popular-trust-signals .trust-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--forest-green);
  font-size: 0.9rem;
  font-weight: 500;
}

.popular-trust-signals .trust-icon {
  color: var(--forest-green);
}

/* Coupon Code Styles */
.coupon-section {
  padding: 1rem 0;
  border-bottom: 1px solid #eee;
  margin-bottom: 1rem;
}

.coupon-input-group {
  display: flex;
  gap: 0.5rem;
}

.coupon-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #f9f9f9;
}

.coupon-input:focus {
  outline: none;
  border-color: var(--forest-green);
  background: white;
}

.apply-coupon-btn {
  background: var(--forest-green);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.apply-coupon-btn:hover {
  background: var(--dark-green);
}

.coupon-message {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  min-height: 1rem;
}

.coupon-message.success {
  color: #28a745;
}

.coupon-message.error {
  color: #dc3545;
}

.total-row.coupon-discount {
  color: #28a745;
  font-weight: 500;
}

/* Flash Message */
.cart-empty-flash {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  animation: flashMessage 2s ease-in-out;
}

@keyframes flashMessage {
  0%, 100% { opacity: 0; }
  20%, 80% { opacity: 1; }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .popular-products-section {
    padding: 3rem 0;
  }
  
  .popular-products-section .section-intro {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
  }
  
  .popular-products-section .section-intro h2 {
    font-size: 1.75rem;
  }
  
  .popular-products-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
  }
  
  .product-image-container {
    height: 200px;
  }
  
  .popular-product-content {
    padding: 1.25rem;
  }
}

@media (max-width: 480px) {
  .popular-products-grid {
    grid-template-columns: 1fr;
  }
  
  .popular-product-card {
    margin: 0 0.5rem;
  }
  
  .popular-trust-signals {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}

/* Additional mobile modal fixes */
@media (max-width: 768px) {
  .frame-help-modal {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: calc(100vw - 2rem) !important;
    max-width: calc(100vw - 2rem) !important;
    margin: 0 !important;
    max-height: calc(100vh - 2rem) !important;
  }
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
  .popular-product-card {
    background: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  .popular-product-content h3 {
    color: white;
  }
  
  .popular-product-description {
    color: #ccc;
  }
  
  .popular-price {
    color: white;
  }
}
