/*
 * Firma: WebsiteWerk - Internetdienstleistungen | Autor: Kristian Snaczke | https://www.websitewerk.de
 * Nutzen/Sinn:
 *   Styles des Carousel mit ALLEM: Preise, Badges, Prime, STERNE!
 */

.amazon-products-wrapper {
  position: relative;
  max-width: 100%;
  overflow: hidden;
  padding: 0 1px;
  margin: 20px 0 30px 0;
  box-sizing: border-box;
}

/* Shortcode type="grid": umbrechendes Raster, keine Slider-Pfeile */
.amazon-products-wrapper.amazon-display-type-grid .amazon-products {
  flex-wrap: wrap;
  overflow-x: visible;
  scroll-snap-type: none;
}

.amazon-products-wrapper.amazon-display-type-grid .amazon-product {
  scroll-snap-align: none;
}

.amazon-products-wrapper.amazon-display-type-grid .prev-arrow,
.amazon-products-wrapper.amazon-display-type-grid .next-arrow {
  display: none;
}

/* Shortcode type="list": kompakte Zeilen, Bild links / Inhalt rechts */
.amazon-products-wrapper[data-amazon-layout="list"] .amazon-products,
.amazon-products-wrapper.amazon-display-type-list .amazon-products {
  flex-direction: column;
  flex-wrap: nowrap;
  overflow-x: hidden;
  scroll-snap-type: none;
  gap: 8px;
  padding: 4px 0;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product,
.amazon-products-wrapper.amazon-display-type-list .amazon-product {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  scroll-snap-align: none;
}

.amazon-products-wrapper[data-amazon-layout="list"],
.amazon-products-wrapper.amazon-display-type-list {
  margin: 12px 0 18px;
}

.amazon-products-wrapper[data-amazon-layout="list"] .prev-arrow,
.amazon-products-wrapper[data-amazon-layout="list"] .next-arrow,
.amazon-products-wrapper.amazon-display-type-list .prev-arrow,
.amazon-products-wrapper.amazon-display-type-list .next-arrow {
  display: none;
}

/* List-Zeile: Medien links, Details rechts (eigenes Markup .amazon-product--list) */
.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product--list,
.amazon-products-wrapper.amazon-display-type-list .amazon-product--list {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 8px 10px;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product__media,
.amazon-products-wrapper.amazon-display-type-list .amazon-product__media {
  flex: 0 0 auto;
  display: block;
  text-decoration: none;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product__media .image-container,
.amazon-products-wrapper.amazon-display-type-list .amazon-product__media .image-container {
  width: 72px;
  min-width: 72px;
  height: 72px;
  margin: 0;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product__media .image-container img,
.amazon-products-wrapper.amazon-display-type-list .amazon-product__media .image-container img {
  width: 64px;
  height: 64px;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product__details,
.amazon-products-wrapper.amazon-display-type-list .amazon-product__details {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product__title-link,
.amazon-products-wrapper.amazon-display-type-list .amazon-product__title-link {
  text-decoration: none;
  width: 100%;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product__details h4,
.amazon-products-wrapper.amazon-display-type-list .amazon-product__details h4 {
  margin: 0;
  text-align: left;
  max-height: none;
  font-size: 14px !important;
  line-height: 1.3 !important;
  -webkit-line-clamp: 2;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product__details .amazon-rating,
.amazon-products-wrapper.amazon-display-type-list .amazon-product__details .amazon-rating {
  justify-content: flex-start;
  margin: 0;
  gap: 4px;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product__details .amazon-rating-stars img,
.amazon-products-wrapper.amazon-display-type-list .amazon-product__details .amazon-rating-stars img {
  width: 12px;
  height: 12px;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product__details .amazon-rating-count,
.amazon-products-wrapper.amazon-display-type-list .amazon-product__details .amazon-rating-count {
  font-size: 11px;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product__prices,
.amazon-products-wrapper.amazon-display-type-list .amazon-product__prices {
  line-height: 1.25;
  margin-top: 1px;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product__prices .price,
.amazon-products-wrapper.amazon-display-type-list .amazon-product__prices .price {
  font-size: 14px;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product__prices .old-price,
.amazon-products-wrapper.amazon-display-type-list .amazon-product__prices .old-price {
  font-size: 11px;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product__cta,
.amazon-products-wrapper.amazon-display-type-list .amazon-product__cta {
  text-decoration: none;
  margin-top: 2px;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product--list .shop-button,
.amazon-products-wrapper.amazon-display-type-list .amazon-product--list .shop-button {
  margin-top: 0;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.3;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product--list .prime-icon,
.amazon-products-wrapper.amazon-display-type-list .amazon-product--list .prime-icon {
  top: auto;
  bottom: 2px;
  left: 2px;
  opacity: 1;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product--list .prime-icon img,
.amazon-products-wrapper.amazon-display-type-list .amazon-product--list .prime-icon img {
  width: 28px;
  height: auto;
}

.amazon-products-wrapper[data-amazon-layout="list"] .amazon-product--list .savings,
.amazon-products-wrapper.amazon-display-type-list .amazon-product--list .savings {
  width: 36px;
  height: 36px;
  font-size: 11px;
  padding-top: 6px;
}

@media (max-width: 480px) {
  .amazon-products-wrapper[data-amazon-layout="list"] .amazon-product--list,
  .amazon-products-wrapper.amazon-display-type-list .amazon-product--list {
    flex-direction: column;
    align-items: stretch;
  }

  .amazon-products-wrapper[data-amazon-layout="list"] .amazon-product__media .image-container,
  .amazon-products-wrapper.amazon-display-type-list .amazon-product__media .image-container {
    width: 100%;
    min-width: 0;
    max-width: 140px;
    margin: 0 auto;
  }
}

/* Gegen starke Theme-CSS (z. B. flex-row auf .amazon-products) */
.amazon-products-wrapper[data-amazon-layout="list"] .amazon-products,
.amazon-products-wrapper.amazon-display-type-list .amazon-products {
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  overflow-x: hidden !important;
  scroll-snap-type: none !important;
  gap: 8px !important;
  padding-top: 4px !important;
  padding-bottom: 4px !important;
}

.amazon-products-wrapper[data-amazon-layout="list"] .prev-arrow,
.amazon-products-wrapper[data-amazon-layout="list"] .next-arrow,
.amazon-products-wrapper.amazon-display-type-list .prev-arrow,
.amazon-products-wrapper.amazon-display-type-list .next-arrow {
  display: none !important;
}

.amazon-products-wrapper[data-amazon-layout="grid"] .prev-arrow,
.amazon-products-wrapper[data-amazon-layout="grid"] .next-arrow,
.amazon-products-wrapper.amazon-display-type-grid .prev-arrow,
.amazon-products-wrapper.amazon-display-type-grid .next-arrow {
  display: none !important;
}

.amazon-products {
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 10px 0;
  width: 100%;
  box-sizing: border-box;
}

.amazon-products::-webkit-scrollbar {
  display: none;
}

.amazon-product {
  flex: 0 0 calc(25% - 15px);
  max-width: calc(25% - 15px);
  box-sizing: border-box;
  border: 1px solid #e8e8e8;
  border-radius: 3px;
  padding: 10px;
  text-align: center;
  background: #fff;
  scroll-snap-align: start;
}

@media (max-width: 1024px) {
  .amazon-product {
    flex: 0 0 calc(33.33% - 13.33px);
    max-width: calc(33.33% - 13.33px);
  }
}

@media (max-width: 768px) {
  .amazon-product {
    flex: 0 0 calc(50% - 10px);
    max-width: calc(50% - 10px);
  }
}

.image-container {
  position: relative;
  width: 100%;
  height: 100px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  width: 90px;
  height: 90px;
}

.shop-button {
  margin-top: 10px;
  font-size: 14px;
  line-height: 19px;
  font-weight: 500;
  color: #1b1b1b;
  text-decoration: none;
}

.shop-button:hover {
  color: #8d7844;
}

.savings {
  position: absolute;
  top: 0;
  right: 0;
  background-color: #b7a26d;
  color: #ffffff;
  font-size: 13px;
  width: 45px;
  height: 45px;
  padding-top: 8px;
  border-radius: 50%;
  font-weight: bold;
  z-index: 2;
  text-align: center;
}

.amazon-product .prime-icon {
  opacity: 0;
  transition: 0.2s linear;
  position: absolute;
  top: -34px;
  left: 0;
  z-index: 2;
  width: 35px;
}

.amazon-product:hover .prime-icon {
  opacity: 1;
}

.amazon-product h4 {
  font-size: 16px !important;
  margin: 10px 0;
  line-height: 21px !important;
  color: #1b1b1b;
  max-height: 2.8em;
  overflow: hidden;
  transition: 0.3s linear;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.amazon-product h4:hover {
  color: #8d7844;
  transition: 0.3s linear;
}

/* STERNE - Amazon-Style! */
.amazon-rating {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 8px 0;
}

.amazon-rating-stars {
  display: inline-flex;
  gap: 2px;
}

.amazon-rating-stars img {
  width: 14px;
  height: 14px;
}

.amazon-rating-count {
  font-size: 12px;
  color: #007185;
}

.price {
  font-weight: bold;
  color: #8d7844;
  font-size: 16px;
}

.old-price {
  text-decoration: line-through;
  color: #626262;
  font-size: 12px;
  margin-right: 10px;
  vertical-align: top;
}

.struck {
  text-decoration: line-through;
}

.prev-arrow,
.next-arrow {
  position: absolute;
  top: 40%;
  transform: translateY(-40%);
  background-color: #ffffff;
  color: white;
  border: none;
  padding: 10px !important;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.prev-arrow svg,
.next-arrow svg {
  fill: #000000;
}

.prev-arrow {
  left: 0;
}

.next-arrow {
  right: 0;
}

.amazon-products.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

/* Loading States */
.amazon-products-loading {
  padding: 20px;
  background: #fafafa;
  border-radius: 4px;
  margin: 20px 0;
}

.loading-skeleton {
  display: flex;
  gap: 20px;
}

.skeleton-product {
  flex: 0 0 calc(25% - 15px);
  height: 300px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 3px;
}

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

.loading-text {
  text-align: center;
  color: #666;
  font-size: 13px;
  margin-top: 15px;
}

/* Error & Fallback Notice */
.amazon-error,
.amazon-fallback-notice {
  background: #fff3cd;
  border: 1px solid #ffc107;
  padding: 15px;
  border-radius: 4px;
  color: #856404;
  text-align: center;
  margin: 20px 0;
}

.amazon-fallback-notice small {
  font-size: 12px;
}

/* OffersV2 NEU: Deal Badge (oben links auf Bild) */
.deal-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  background: linear-gradient(135deg, #FF6B6B 0%, #EE5A6F 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  z-index: 2;
  line-height: 1.2;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* OffersV2 NEU: BuyBox Winner Badge */
.buybox-badge {
  position: absolute;
  bottom: 5px;
  left: 5px;
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 3px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  z-index: 2;
}

/* OffersV2 NEU: Availability Message ("Nur noch X auf Lager") */
.availability-message {
  font-size: 12px;
  color: #B12704;
  font-weight: 600;
  margin: 5px 0;
  text-align: center;
}

/* OffersV2 NEU: Merchant Info ("Verkauft von Amazon") */
.merchant-info {
  font-size: 11px;
  color: #565959;
  margin: 3px 0;
  text-align: center;
}

/* OffersV2 NEU: Deal Countdown */
.deal-countdown {
  font-size: 12px;
  color: #B12704;
  font-weight: 600;
  margin: 5px 0;
  text-align: center;
  background: #FFF3CD;
  padding: 5px;
  border-radius: 3px;
}

.countdown-timer {
  font-weight: 700;
  color: #CC0C39;
}
