.top3-affiliate-widget {
  max-width: 100%;
  display: flex;
  justify-content: center;
  gap: 16px;
  border-radius: 10px;
  transition: all 0.3s ease;
  font-family: "Roboto", sans-serif;
  align-items: stretch;
}

.product-card-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 8px;
  border-radius: 12px;
  height: 100%;
}

.product-card-wrapper.top-product-animated::before {
  content: "";
  position: absolute;
  top: calc(-1 * var(--animation-border-width, 5px));
  left: calc(-1 * var(--animation-border-width, 5px));
  right: calc(-1 * var(--animation-border-width, 5px));
  bottom: calc(-1 * var(--animation-border-width, 5px));
  border-radius: 12px;
  background: linear-gradient(
    270deg,
    var(--animation-color-1),
    var(--animation-color-2),
    var(--animation-color-3),
    var(--animation-color-4)
  );
  background-size: 400% 400%;
  z-index: -1;
  animation: gradient-border-rotate var(--animation-speed, 6s) linear infinite;
}

@keyframes gradient-border-rotate {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.top3-affiliate-widget .product-card {
  position: relative;
  overflow: hidden;
  background-color: #ffffff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.top3-affiliate-widget .product-card:hover {
  box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.2);
}

/* Redesigned Modern Badges */
.top3-affiliate-widget .product-card .badge {
  position: absolute;
  top: 10px;
  left: 10px;
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  z-index: 2;
  transition: all 0.3s ease;
}

.top3-affiliate-widget .product-card .badge::after {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.top3-affiliate-widget .product-card .badge:hover::after {
  opacity: 1;
}

/* Badge with icons */
.top3-affiliate-widget .product-card .badge.badge-with-icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top3-affiliate-widget .product-card .badge.badge-with-icon i {
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top3-affiliate-widget .product-card .badge .badge-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.top3-affiliate-widget .product-card .badge .badge-icon-wrapper svg {
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

/* Fixed Diamond Badge Style */
.top3-affiliate-widget .product-card .badge.badge-diamond {
  transform: rotate(45deg);
  border-radius: 4px;
}

.top3-affiliate-widget .product-card .badge.badge-diamond .diamond-content {
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.top3-affiliate-widget .product-card .badge.badge-diamond.badge-with-icon {
  width: 46px;
  height: 46px;
}

.top3-affiliate-widget .product-card .badge.badge-diamond .badge-icon-wrapper {
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Square badge improved */
.top3-affiliate-widget .product-card .badge.badge-square {
  border-radius: 8px;
}

/* Ensure icons are centered in all badge styles */
.top3-affiliate-widget .product-card .badge.badge-with-icon .badge-icon-wrapper,
.top3-affiliate-widget .product-card .badge.badge-with-icon i {
  margin: 0;
}

/* Position adjustments for different badge styles */
.top3-affiliate-widget .product-card .badge.badge-ribbon.badge-with-icon {
  padding: 8px 15px;
}

/* Badge shapes */
.top3-affiliate-widget .product-card .badge.badge-ribbon {
  border-radius: 5px;
  padding: 8px 12px;
  top: 15px;
  left: -8px;
  clip-path: polygon(0% 0%, 100% 0%, 100% 70%, 85% 100%, 0% 100%);
}

.top3-affiliate-widget .product-card .badge.badge-ribbon::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  border-width: 5px;
  border-style: solid;
  border-color: transparent;
  border-top-color: inherit;
  border-right-color: inherit;
  filter: brightness(70%);
}

/* Badge position variants */
.top3-affiliate-widget .product-card .badge.position-top-right {
  left: auto;
  right: 10px;
}

/* Special handling for diamond badge positioning */
.top3-affiliate-widget .product-card .badge.badge-diamond.position-top-right {
  right: 10px;
}

.top3-affiliate-widget
  .product-card
  .badge.badge-diamond.position-top-right:hover {
  transform: rotate(45deg) scale(1.1);
}

/* Badge colors for each product - can be overridden by Elementor controls */
.top3-affiliate-widget
  .product-card-wrapper:nth-of-type(1)
  .product-card
  .badge {
  background-color: #ffa500; /* Gold/Orange for 1st */
}

.top3-affiliate-widget
  .product-card-wrapper:nth-of-type(2)
  .product-card
  .badge {
  background-color: #5271ff; /* Blue for 2nd - changed from red to blue */
}

.top3-affiliate-widget
  .product-card-wrapper:nth-of-type(3)
  .product-card
  .badge {
  background-color: #32cd32; /* Green for 3rd */
}

.top3-affiliate-widget .product-card-title {
  font-size: 22px;
  font-weight: 700;
  color: #333;
  margin-bottom: -20px;
  max-width: 70%;
  align-self: center;
  text-align: center;
  min-height: 60px;
}

.top3-affiliate-widget .product-card .product-card-content-pros-label,
.top3-affiliate-widget .product-card .product-card-content-cons-label {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin: 10px 0;
  text-align: center;
  min-height: 24px;
}

.top3-affiliate-widget .product-image-wrapper {
  text-align: center;
  margin-bottom: 15px;
  flex-shrink: 0;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top3-affiliate-widget .main-product-image {
  max-width: 100%;
  height: auto;
  max-height: 200px;
  border-radius: 8px;
  object-fit: contain;
}

.top3-affiliate-widget .product-card-description {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  margin-top: 8px;
}

.product-card-content {
  margin-bottom: 15px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 290px;
}

.top3-affiliate-widget .pros,
.top3-affiliate-widget .cons {
  flex: 1;
  flex-grow: 1;
  padding: 4px;
  border-radius: 5px;
  margin-bottom: 15px;
}

.top3-affiliate-widget .pros {
  color: #28a745;
  font-weight: 500;
  min-height: 60px;
}

.top3-affiliate-widget .cons {
  color: #dc3545;
  font-weight: 500;
  min-height: 60px;
}

.top3-affiliate-widget ul {
  list-style-type: none;
  margin-left: 20px;
}

.top3-affiliate-widget ul li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  background-color: transparent;
}

.top3-affiliate-widget ul.pros li i {
  color: #28a745;
  margin-right: 8px;
}

.top3-affiliate-widget ul.cons li i {
  color: #dc3545;
  margin-right: 8px;
}

.top3-affiliate-widget .btn-view {
  background-color: #007acc;
  color: #ffffff;
  border-radius: 20px;
  padding: 8px 16px;
  transition: 0.3s;
}

.top3-affiliate-widget .affiliate-logo {
  width: 40px;
  height: auto;
  border-radius: 0;
  margin-bottom: 0;
}

.affiliate-table-container {
  margin-top: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Redesigned affiliate table with flex layout */
.top3-affiliate-widget .affiliate-table {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.top3-affiliate-widget .affiliate-table tr {
  display: flex;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  height: auto;
  min-height: 60px;
  justify-content: center;
}

.top3-affiliate-widget .affiliate-table tr:hover {
  background-color: rgba(248, 249, 250, 1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.top3-affiliate-widget .td-top3-widget {
  padding: 0;
  display: flex;
  align-items: center;
  font-weight: 500;
  color: black;
  background-color: transparent !important;
  border: none;
}

.top3-affiliate-widget .td-top3-widget:nth-child(1) {
  width: 50px;
  justify-content: center;
  margin-right: 10px;
}

.top3-affiliate-widget .td-top3-widget:nth-child(2) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top3-affiliate-widget .td-top3-widget:nth-child(3) {
  width: 70px;
  margin: 0 10px;
  font-weight: 600;
  color: #444;
  justify-content: center;
}

.top3-affiliate-widget .td-top3-widget:nth-child(4) {
  width: 80px;
  justify-content: center;
}

.top3-affiliate-widget .affiliate-logo {
  width: 36px;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 3px;
  transition: transform 0.2s ease;
}

.top3-affiliate-widget tr:hover .affiliate-logo {
  transform: scale(1.05);
}

.top3-affiliate-widget .product-card .btn-view {
  background-color: #007acc;
  color: #ffffff;
  border-radius: 20px;
  padding: 8px 16px;
  transition: all 0.3s ease;
  display: inline-block;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
}

.top3-affiliate-widget .product-card .btn-view:hover {
  background-color: #a61e9b;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

@media (max-width: 1026px) {
  .top3-affiliate-widget {
    flex-direction: column;
  }

  .product-image-wrapper {
    height: auto;
  }

  .top3-affiliate-widget .product-card-wrapper {
    margin-bottom: 15px;
  }

  .top3-affiliate-widget .product-image-wrapper {
    height: auto;
  }

  .product-card-content {
    min-height: auto;
    margin-bottom: 0px;
  }

  .top3-affiliate-widget .td-top3-widget {
    font-size: 20px;
  }

  .top3-affiliate-widget .td-top3-widget:nth-child(2) {
    max-width: 180px;
  }

  .affiliate-table-container {
    /* min-height property is removed */
  }

  .top3-affiliate-widget .product-card-title {
    font-size: 20px;
  }

  /*.top3-affiliate-widget .website-name {
    display: none;
  }*/

  .top3-affiliate-widget ul.pros,
  .top3-affiliate-widget ul.cons {
    min-height: unset;
    width: 340px;
    justify-self: center;
  }
}

/* Styles for the "See more" button */
.see-more-container {
  display: flex;
  justify-content: center;
  width: 100%;
}

.see-more-button {
  font-weight: 600;
  background-color: #007acc;
  border-radius: 20px;
  color: white;
  cursor: pointer;
  font-size: 14px;
  padding: 8px 16px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.see-more-button:hover {
  background-color: #a61e9b;
  color: white;
}

.see-less-text {
  display: none;
}

.show-all-shops .see-more-text {
  display: none;
}

.show-all-shops .see-less-text {
  display: block;
}

.shop-hidden {
  display: none;
}

/* Additional responsive styles */
@media (max-width: 480px) {
  .top3-affiliate-widget .affiliate-table tr {
    padding: 10px 8px;
    min-height: 50px;
  }

  .top3-affiliate-widget .btn-view {
    padding: 6px 12px;
    font-size: 13px;
  }

  .top3-affiliate-widget .affiliate-logo {
    width: 40px;
    height: auto;
  }

  .top3-affiliate-widget .td-top3-widget:nth-child(3) {
    width: 60px;
    margin: 0 6px;
    font-size: 14px;
  }
  /* logo bug a fix la taille est limité a 50px max */
  .top3-affiliate-widget .td-top3-widget:nth-child(4) {
    width: 70px;
  }

  .top3-affiliate-widget .product-card .badge {
    width: 40px;
    height: 40px;
    font-size: 14px;
    top: 10px;
    left: 10px;
  }

  .top3-affiliate-widget .product-card .badge.badge-with-icon {
    width: 44px;
    height: 44px;
  }

  .top3-affiliate-widget .product-card .badge.badge-with-icon i {
    font-size: 16px;
  }
}

/* Tablet responsiveness improvements */
@media (max-width: 768px) and (min-width: 481px) {
  .top3-affiliate-widget .affiliate-table tr {
    padding: 10px;
  }

  .top3-affiliate-widget .td-top3-widget:nth-child(2) {
    max-width: 120px;
  }
}

/* Add these new styles to ensure alignment */
.top3-affiliate-widget ul.pros,
.top3-affiliate-widget ul.cons {
  display: flex;
  flex-direction: column;
}

.top3-affiliate-widget ul.pros {
  min-height: 120px;
}

.top3-affiliate-widget ul.cons {
  min-height: 120px;
}

/* Cloaked Link Styles */
.cloaked-link {
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
}

.cloaked-link:hover {
  opacity: 0.9;
}

/* Product order */

@media (max-width: 1026px) {
  .product-card-wrapper:nth-child(4) {
    order: 3;
  }
  .product-card-wrapper:nth-child(2) {
    order: 2;
  }
  .product-card-wrapper:nth-child(3) {
    order: 1;
  }
}
