/* ============================================================
   Vankel — ai-product-card global CSS decorator
   Style: Deutsches Industrie-Minimalismus
   ============================================================ */

/* ----------------------------------------------------------
   Card base
   ---------------------------------------------------------- */
.ai-card {
  background: var(--background);
  color: var(--foreground);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--foreground) 10%, transparent);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  position: relative;
}

.ai-card:hover {
  border-color: var(--striking);
  box-shadow: 0 0 0 1px var(--striking);
}

.ai-card__inner {
  position: relative;
}

/* ----------------------------------------------------------
   Front / back faces
   ---------------------------------------------------------- */
.ai-card__front {
  display: block;
}

.ai-card__back {
  display: none;
}

/* ----------------------------------------------------------
   Media / image area
   ---------------------------------------------------------- */
.ai-card__media {
  aspect-ratio: 4 / 5;
  background: #111111;
}

/* Hover image swap */
.ai-card__img--hover {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.ai-card[data-has-hover-img]:hover .ai-card__img--hover {
  opacity: 1;
}

.ai-card[data-has-hover-img]:hover .ai-card__img {
  opacity: 0;
}

.ai-card__img {
  transition: opacity 0.4s ease;
}

/* ----------------------------------------------------------
   Discount badge
   ---------------------------------------------------------- */
.ai-card__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--striking);
  color: var(--striking-foreground);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 1px;
  line-height: 1.4;
  z-index: 2;
}

/* New badge — hidden by default */
.ai-card__badge--new {
  display: none;
}

/* ----------------------------------------------------------
   Wishlist — hidden
   ---------------------------------------------------------- */
.ai-card__wishlist {
  display: none;
}

/* ----------------------------------------------------------
   Overlay (slide-up add-to-cart)
   ---------------------------------------------------------- */
.ai-card__overlay {
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--cta);
  color: var(--cta-foreground);
}

.ai-card:hover .ai-card__overlay {
  transform: translateY(0);
}

.ai-card__overlay-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  color: var(--cta-foreground);
  border: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.ai-card__overlay-btn:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.ai-card__overlay-btn:active {
  opacity: 0.85;
}

/* ----------------------------------------------------------
   Add-to-cart inside info area — hidden (use overlay only)
   ---------------------------------------------------------- */
.ai-card__add-wrap {
  display: none;
}

/* ----------------------------------------------------------
   Info area
   ---------------------------------------------------------- */
.ai-card__info {
  padding: 14px 14px 16px;
  gap: 6px;
  background: var(--background);
  color: var(--foreground);
}

.ai-card__info-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-card__info-link:hover {
  color: var(--foreground);
  text-decoration: none;
}

/* Vendor — hidden */
.ai-card__vendor {
  display: none;
}

/* Title */
.ai-card__title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--foreground);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ----------------------------------------------------------
   Price
   ---------------------------------------------------------- */
.ai-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.ai-price__current {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--foreground);
}

.ai-price__compare {
  font-size: 12px;
  font-weight: 400;
  color: color-mix(in srgb, var(--foreground) 45%, transparent);
  text-decoration: line-through;
}

/* Price on striking surface (when card uses striking background) */
.ai-card--on-striking .ai-price__current {
  color: var(--striking-foreground);
}

/* ----------------------------------------------------------
   Swatches — hidden
   ---------------------------------------------------------- */
.ai-card__swatches {
  display: none;
}

/* ----------------------------------------------------------
   Rating — hidden
   ---------------------------------------------------------- */
.ai-card__rating {
  display: none;
}

/* ----------------------------------------------------------
   Quick add-to-cart button state feedback (overlay placement)
   ---------------------------------------------------------- */
ai-quick-add-cart[data-state="loading"] .ai-card__overlay-btn {
  opacity: 0.6;
  pointer-events: none;
  cursor: wait;
}

ai-quick-add-cart[data-state="success"] .ai-card__overlay-btn {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

ai-quick-add-cart[data-state="error"] .ai-card__overlay-btn {
  animation: ai-shake 0.4s ease;
}

@keyframes ai-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-4px); }
  40%       { transform: translateX(4px); }
  60%       { transform: translateX(-3px); }
  80%       { transform: translateX(3px); }
}

/* ----------------------------------------------------------
   Product list — Grid
   ---------------------------------------------------------- */
.ai-pl-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 750px) {
  .ai-pl-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .ai-pl-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
}

/* ----------------------------------------------------------
   Product list — Carousel
   ---------------------------------------------------------- */
.ai-pl-carousel-wrap {
  position: relative;
}

.ai-pl-carousel {
  display: flex;
  overflow: hidden;
}

.ai-pl-carousel ai-product-card {
  flex-shrink: 0;
}

/* Arrow buttons */
.ai-pl-prev,
.ai-pl-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: var(--background);
  color: var(--foreground);
  border: 1px solid color-mix(in srgb, var(--foreground) 20%, transparent);
  width: 36px;
  height: 36px;
  border-radius: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ai-pl-prev {
  left: -18px;
}

.ai-pl-next {
  right: -18px;
}

.ai-pl-prev:hover,
.ai-pl-next:hover {
  background: var(--striking);
  color: var(--striking-foreground);
  border-color: var(--striking);
}

.ai-pl-prev:active,
.ai-pl-next:active {
  opacity: 0.85;
}

/* ----------------------------------------------------------
   QAC Modal
   ---------------------------------------------------------- */
.qac-wrapper {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.qac-wrapper[data-open] {
  opacity: 1;
  pointer-events: auto;
}

.qac-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 9998;
}

.qac-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.97);
  z-index: 9999;
  width: min(700px, 94vw);
  max-height: 90vh;
  background: var(--background);
  color: var(--foreground);
  border-radius: 2px;
  border: 1px solid color-mix(in srgb, var(--foreground) 12%, transparent);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.qac-wrapper[data-open] .qac-modal {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* Header */
.qac-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid color-mix(in srgb, var(--foreground) 10%, transparent);
  background: var(--background);
  color: var(--foreground);
  flex-shrink: 0;
}

.qac-product-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--foreground);
  margin: 0;
}

.qac-close {
  background: transparent;
  color: var(--foreground);
  border: 1px solid color-mix(in srgb, var(--foreground) 20%, transparent);
  width: 32px;
  height: 32px;
  border-radius: 1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.qac-close:hover {
  background: var(--striking);
  color: var(--striking-foreground);
  border-color: var(--striking);
}

.qac-close:focus-visible {
  outline: 2px solid var(--striking);
  outline-offset: 2px;
}

/* Body */
.qac-body {
  display: flex;
  flex-direction: row;
  overflow: auto;
  flex: 1 1 auto;
}

.qac-product-media {
  flex: 0 0 40%;
  background: #111111;
  overflow: hidden;
}

.qac-product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.qac-product-info {
  flex: 1 1 60%;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--background);
  color: var(--foreground);
}

/* Footer */
.qac-footer {
  padding: 16px 20px;
  border-top: 1px solid color-mix(in srgb, var(--foreground) 10%, transparent);
  background: var(--background);
  flex-shrink: 0;
}

/* Submit button */
.qac-submit {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: var(--cta);
  color: var(--cta-foreground);
  border: none;
  border-radius: 1px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.qac-submit:hover:not(:disabled):not([data-loading]):not([data-success]):not([data-sold-out]) {
  background: var(--accent);
  color: var(--accent-foreground);
}

.qac-submit:focus-visible {
  outline: 2px solid var(--striking);
  outline-offset: 2px;
}

.qac-submit:disabled,
.qac-submit[data-sold-out] {
  background: color-mix(in srgb, var(--foreground) 15%, transparent);
  color: color-mix(in srgb, var(--foreground) 40%, transparent);
  cursor: not-allowed;
  opacity: 0.6;
  border: 1px solid color-mix(in srgb, var(--foreground) 12%, transparent);
}

.qac-submit[data-loading] {
  opacity: 0.65;
  pointer-events: none;
  cursor: wait;
  background: var(--cta);
  color: var(--cta-foreground);
}

.qac-submit[data-success] {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.qac-submit[data-error] {
  background: #c0392b;
  color: #ffffff;
  animation: ai-shake 0.4s ease;
}

/* ----------------------------------------------------------
   Responsive — mobile modal stacks vertically
   ---------------------------------------------------------- */
@media (max-width: 600px) {
  .qac-body {
    flex-direction: column;
  }

  .qac-product-media {
    flex: 0 0 220px;
    height: 220px;
  }

  .qac-modal {
    width: 96vw;
    max-height: 92vh;
  }

  .ai-pl-prev {
    left: 0;
  }

  .ai-pl-next {
    right: 0;
  }
}