/* ALSET Affiliate Product Shop Styles */

:root {
  --alset-bg-light: #f8f8f8;
  --alset-primary: #0c6a74;
  --alset-accent: #f85d5d;
  --alset-text-dark: #333;
  --alset-text-light: #666;
  --alset-border: #e0e0e0;
  --alset-white: #ffffff;
}

/* Added wrapper to isolate plugin styles from theme */
.alset-aps-wrapper {
  all: initial;
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #333;
  background: #f8f8f8;
  padding: 40px 0;
}

.alset-aps-wrapper * {
  box-sizing: border-box;
}

.alset-aps-wrapper a {
  text-decoration: none;
}

.alset-aps-wrapper img {
  max-width: 100%;
  height: auto;
  display: block;
}
/* End wrapper isolation styles */

/* Grid Layout */
/* Updated grid to support dynamic columns via data-columns attribute */
.alset-aps-grid {
  display: grid;
  gap: 24px;
  padding: 20px 0;
}

/* Default: 3 columns on desktop */
.alset-aps-grid[data-columns="1"] {
  grid-template-columns: 1fr;
}

.alset-aps-grid[data-columns="2"] {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.alset-aps-grid[data-columns="3"] {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.alset-aps-grid[data-columns="4"] {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.alset-aps-grid[data-columns="5"] {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.alset-aps-grid[data-columns="6"] {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* Responsive behavior */
@media (min-width: 768px) {
  .alset-aps-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
  }

  .alset-aps-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
  }

  .alset-aps-grid[data-columns="4"] {
    grid-template-columns: repeat(3, 1fr);
  }

  .alset-aps-grid[data-columns="5"],
  .alset-aps-grid[data-columns="6"] {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1200px) {
  .alset-aps-grid[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
  }

  .alset-aps-grid[data-columns="5"] {
    grid-template-columns: repeat(5, 1fr);
  }

  .alset-aps-grid[data-columns="6"] {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Mobile: always 1 column */
@media (max-width: 767px) {
  .alset-aps-grid[data-columns] {
    grid-template-columns: 1fr !important;
  }
}

/* Redesigned product card with compact layout */
.alset-aps-card {
  background: var(--alset-white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.alset-aps-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  transform: translateY(-4px);
}

.alset-aps-card-image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 75%; /* Increased image height from 60% to 75% to show more of the product */
  overflow: hidden;
  background: var(--alset-bg-light);
}

.alset-aps-card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.alset-aps-card:hover .alset-aps-card-image {
  transform: scale(1.08);
}

.alset-aps-card-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px; /* Reduced padding and gap to tighten up spacing */
  flex-grow: 1;
}

.alset-aps-card-title {
  /* Removed bottom margin and reduced min-height to eliminate gap between title and rating */
  font-size: 17px;
  font-weight: 600;
  color: var(--alset-text-dark);
  margin: 0; /* Removed bottom margin */
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px; /* Reduced from 44px */
}

.alset-aps-card-rating {
  /* Removed margin to sit directly under title */
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.alset-aps-card-rating .alset-aps-star {
  font-size: 16px;
}

.alset-aps-rating-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--alset-text-dark);
  margin-left: 4px;
}

/* Added price styling for product cards */
.alset-aps-card-price {
  font-size: 22px; /* Adjusted price margin for tighter spacing */
  font-weight: 700;
  color: var(--alset-primary);
  margin: 2px 0; /* Adjusted price margin for tighter spacing */
}

/* Updated source icon to shop icon */
.alset-aps-card-source {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--alset-primary);
  font-size: 13px;
  font-weight: 500;
}

.alset-aps-card-source svg {
  flex-shrink: 0;
}

.alset-aps-card-buttons {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.alset-aps-card-button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 8px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
}

.alset-aps-buy-btn {
  background: var(--alset-primary);
  /* Improved button text contrast - force white text */
  color: #ffffff !important;
}

.alset-aps-buy-btn:hover {
  background: #0a5560;
  /* Ensure white text on hover */
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(12, 106, 116, 0.3);
}

.alset-aps-details-btn {
  background: var(--alset-accent);
  /* Improved button text contrast - force white text */
  color: #ffffff !important;
}

.alset-aps-details-btn:hover {
  background: #e64545;
  /* Ensure white text on hover */
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(248, 93, 93, 0.3);
}

/* Star Rating Styles */
.alset-aps-star {
  color: #ddd;
  font-size: 18px;
  display: inline-block;
}

.alset-aps-star.filled {
  color: #ffa500;
}

.alset-aps-star.partial {
  position: relative;
  color: #ddd;
}

.alset-aps-star.partial::before {
  content: "★";
  position: absolute;
  left: 0;
  color: #ffa500;
  overflow: hidden;
  width: var(--fill-percentage);
}

/* Single Product Page */
.alset-aps-single-product {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
}

.alset-aps-hero-section {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 80px 20px;
  position: relative;
  margin-bottom: 40px;
}

.alset-aps-hero-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.alset-aps-hero-container {
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.alset-aps-hero-content h1 {
  color: var(--alset-white);
  font-size: 48px;
  font-weight: 800;
  margin: 0 0 20px 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.alset-aps-hero-breadcrumb {
  margin: 0;
}

.alset-aps-hero-breadcrumb .breadcrumb {
  background: transparent;
  padding: 0;
  margin: 0;
  list-style: none;
  display: flex;
  gap: 8px;
  align-items: center;
}

.alset-aps-hero-breadcrumb .breadcrumb-item {
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
}

.alset-aps-hero-breadcrumb .breadcrumb-item a {
  color: var(--alset-white);
  text-decoration: none;
  transition: color 0.3s ease;
}

.alset-aps-hero-breadcrumb .breadcrumb-item a:hover {
  color: var(--alset-accent);
}

.alset-aps-hero-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  padding-right: 8px;
  color: rgba(255, 255, 255, 0.7);
}

.alset-aps-hero-breadcrumb .breadcrumb-item.active {
  color: rgba(255, 255, 255, 0.8);
}

.alset-aps-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 30px;
  font-size: 14px;
  color: var(--alset-text-light);
}

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

.alset-aps-breadcrumb a:hover {
  color: var(--alset-accent);
}

.alset-aps-breadcrumb .separator {
  color: var(--alset-text-light);
}

.alset-aps-breadcrumb .current {
  color: var(--alset-text-dark);
  font-weight: 500;
}

.alset-aps-single-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 60px;
  margin-bottom: 60px;
  background: var(--alset-white);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

@media (min-width: 968px) {
  .alset-aps-single-container {
    grid-template-columns: 1fr 1fr;
  }
}

.alset-aps-single-image-section {
  position: relative;
}

/* Added image zoom effect on hover for single product page */
.alset-aps-single-image {
  background: linear-gradient(135deg, #f8f8f8 0%, #ffffff 100%);
  border-radius: 16px;
  overflow: hidden;
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  border: 1px solid var(--alset-border);
  cursor: zoom-in;
}

.alset-aps-gallery-thumbnails {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.alset-aps-thumbnail {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.3s ease;
  opacity: 0.6;
}

.alset-aps-thumbnail:hover {
  opacity: 1;
  border-color: var(--alset-primary);
}

.alset-aps-thumbnail.active {
  opacity: 1;
  border-color: var(--alset-accent);
}

.alset-aps-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Added smooth transition for gallery image changes */
.alset-aps-single-image img {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: contain;
  display: block;
  /* Enhanced zoom effect on hover - scales image to 1.15x */
  transition: opacity 0.3s ease, transform 0.5s ease;
}

.alset-aps-single-image:hover img {
  /* Increased zoom from 1.05 to 1.15 for more noticeable effect */
  transform: scale(1.15);
}

.alset-aps-single-details {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.alset-aps-single-title {
  font-size: 36px;
  font-weight: 800;
  color: var(--alset-text-dark);
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.alset-aps-single-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.alset-aps-single-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
  padding: 8px 16px;
  border-radius: 50px;
}

.alset-aps-star {
  color: #ddd;
  font-size: 20px;
}

.alset-aps-star.filled {
  color: #ffa500;
}

.alset-aps-rating-text {
  color: var(--alset-text-dark);
  font-size: 16px;
  font-weight: 600;
  margin-left: 4px;
}

.alset-aps-single-source {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--alset-primary);
  font-weight: 600;
  font-size: 14px;
  background: rgba(12, 106, 116, 0.1);
  padding: 8px 16px;
  border-radius: 50px;
}

/* Removed old price box styling and added simple price styling */
.alset-aps-single-price-simple {
  font-size: 48px;
  font-weight: 900;
  color: var(--alset-primary);
  letter-spacing: -1px;
  margin: 8px 0;
}

/* Updated short description to remove heading and simplify styling */
.alset-aps-single-short-desc {
  background: var(--alset-bg-light);
  padding: 24px;
  border-radius: 12px;
  border-left: 4px solid var(--alset-accent);
}

.alset-aps-single-short-desc h3 {
  /* Hidden heading since we removed it from template */
  display: none;
}

.alset-aps-single-short-desc p {
  font-size: 16px;
  line-height: 1.7;
  color: var(--alset-text-dark);
  margin: 0;
}

.alset-aps-buy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--alset-accent) 0%, #e64545 100%);
  /* Improved button text contrast - force white text with higher specificity */
  color: #ffffff !important;
  padding: 20px 40px;
  border-radius: 12px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  /* Changed to neutral shadow that adapts to any button color */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  letter-spacing: 0.5px;
}

.alset-aps-buy-button:hover {
  /* Ensure white text on hover with higher specificity */
  color: #ffffff !important;
  transform: translateY(-3px);
  /* Changed to neutral shadow on hover */
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

/* Override any theme styles that might affect button text color */
.alset-aps-buy-button,
.alset-aps-buy-button:visited,
.alset-aps-buy-button:active,
.alset-aps-buy-button:focus {
  color: #ffffff !important;
  text-decoration: none !important;
}

.alset-aps-buy-button svg {
  width: 20px;
  height: 20px;
  /* Ensure icon is also white */
  fill: #ffffff;
}

.alset-aps-trust-badges {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--alset-border);
}

.alset-aps-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--alset-primary);
  font-size: 14px;
  font-weight: 600;
}

.alset-aps-badge svg {
  width: 24px;
  height: 24px;
  color: var(--alset-primary);
}

.alset-aps-single-description {
  background: var(--alset-white);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  margin-bottom: 60px;
}

.alset-aps-single-description h2 {
  font-size: 32px;
  font-weight: 800;
  color: var(--alset-primary);
  margin: 0 0 24px 0;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--alset-accent);
  display: inline-block;
}

.alset-aps-description-content {
  font-size: 17px;
  line-height: 1.8;
  color: var(--alset-text-dark);
}

.alset-aps-description-content p {
  margin-bottom: 16px;
}

.alset-aps-description-content h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--alset-accent);
  margin: 32px 0 16px 0;
}

.alset-aps-description-content ul,
.alset-aps-description-content ol {
  margin: 16px 0;
  padding-left: 24px;
}

.alset-aps-description-content li {
  margin-bottom: 8px;
  line-height: 1.7;
}

/* Similar Products Section */
.alset-aps-similar-products {
  margin-top: 60px;
}

.alset-aps-similar-products h2 {
  font-size: 32px;
  font-weight: 800;
  color: var(--alset-primary);
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--alset-accent);
  display: inline-block;
}

/* Responsive Design */
@media (max-width: 767px) {
  .alset-aps-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Force smaller title on mobile - override theme h1 styles */
  h1.alset-aps-single-title,
  .alset-aps-single-title {
    font-size: 22px !important;
    line-height: 1.3 !important;
  }

  /* Kept price at 24px but ensured both classes are targeted */
  .alset-aps-single-price,
  .alset-aps-single-price-simple {
    font-size: 24px;
  }

  .alset-aps-buy-button {
    width: 100%;
    max-width: none;
  }

  .alset-aps-hero-content h1 {
    font-size: 32px;
  }

  .alset-aps-gallery-thumbnails {
    gap: 8px;
  }

  .alset-aps-thumbnail {
    width: 60px;
    height: 60px;
  }
}

@media (max-width: 967px) {
  .alset-aps-single-container {
    padding: 24px;
    gap: 32px;
  }

  /* Force smaller title on tablets - override theme h1 styles */
  h1.alset-aps-single-title,
  .alset-aps-single-title {
    font-size: 26px !important;
    line-height: 1.3 !important;
  }

  /* Kept price at 32px for tablets */
  .alset-aps-single-price,
  .alset-aps-single-price-simple {
    font-size: 32px;
  }

  .alset-aps-buy-button {
    width: 100%;
    padding: 18px 32px;
    font-size: 18px;
  }

  .alset-aps-single-description {
    padding: 24px;
  }

  .alset-aps-single-description h2 {
    font-size: 24px;
  }
}
