/* ============================================================
   ai-product-card-generated.css
   Global product card + product list + quick-add-cart modal
   Cyberpunk neon aesthetic — all colors via CSS variables
   ============================================================ */

/* -------------------------------------------------------
   0. CSS Custom Properties (local tokens, NOT colors)
   Colors come from ai-container runtime injection.
   ------------------------------------------------------- */

/* -------------------------------------------------------
   1. Card Root
   ------------------------------------------------------- */
.ai-card {
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-color);
  border: 1px solid color-mix(in srgb, var(--brand-color) 25%, transparent);
  box-shadow:
    0 0 18px color-mix(in srgb, var(--brand-color) 12%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--neutral-color) 5%, transparent);
  transition: box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-card:hover {
  box-shadow:
    0 0 32px color-mix(in srgb, var(--brand-color) 28%, transparent),
    0 0 60px color-mix(in srgb, var(--secondary-color) 10%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--neutral-color) 8%, transparent);
  transform: scale(1.03);
}

.ai-card__inner {
  height: 100%;
}

/* -------------------------------------------------------
   2. Media / Image Area
   ------------------------------------------------------- */
.ai-card__media {
  aspect-ratio: 3 / 4;
  background: color-mix(in srgb, var(--bg-color) 85%, var(--brand-color));
}

.ai-card__media-link {
  display: block;
  height: 100%;
}

/* Hover image — hidden by default */
.ai-card__img--hover {
  opacity: 0;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-card:hover .ai-card__img--hover {
  opacity: 1;
}

/* Conditionally hide primary image only when hover image exists */
.ai-card__img {
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* -------------------------------------------------------
   3. Badges
   ------------------------------------------------------- */
.ai-card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 4px 10px;
  font-family: 'Orbitron', 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg-color);
  background: var(--striking-color);
  clip-path: polygon(0 0, 100% 0, 92% 100%, 0 100%);
  line-height: 1.4;
  box-shadow: 0 0 14px color-mix(in srgb, var(--striking-color) 50%, transparent);
}

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

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

/* -------------------------------------------------------
   5. Overlay (hover add-to-cart)
   ------------------------------------------------------- */
.ai-card__overlay {
  z-index: 3;
  padding: 10px;
  background: linear-gradient(
    to top,
    color-mix(in srgb, var(--bg-color) 92%, transparent),
    transparent
  );
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.35s ease;
}

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

.ai-card__overlay-btn {
  width: 100%;
  padding: 10px 0;
  border: 1px solid var(--brand-color);
  border-radius: 2px;
  background: color-mix(in srgb, var(--brand-color) 18%, transparent);
  backdrop-filter: blur(12px);
  color: var(--neutral-color);
  font-family: 'Orbitron', 'Rajdhani', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

.ai-card__overlay-btn:hover {
  background: var(--brand-color);
  color: var(--bg-color);
  box-shadow: 0 0 20px color-mix(in srgb, var(--brand-color) 50%, transparent);
}

.ai-card__overlay-btn:active {
  background: var(--accent-color);
  color: var(--bg-color);
}

/* -------------------------------------------------------
   6. Info Area
   ------------------------------------------------------- */
.ai-card__info {
  padding: 14px 12px;
  gap: 8px;
  background: var(--bg-color);
}

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

/* Vendor — hidden by default, shown for fashion */
.ai-card__vendor {
  font-family: 'Orbitron', 'Rajdhani', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--secondary-color);
  text-shadow: 0 0 8px color-mix(in srgb, var(--secondary-color) 35%, transparent);
}

/* Title */
.ai-card__title {
  font-family: 'Inter', 'Exo 2', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-color);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: text-shadow 0.3s ease;
}

.ai-card:hover .ai-card__title {
  text-shadow: 0 0 8px color-mix(in srgb, var(--brand-color) 30%, transparent);
}

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

.ai-price__current {
  font-family: 'Orbitron', 'Rajdhani', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--striking-color);
  text-shadow: 0 0 10px color-mix(in srgb, var(--striking-color) 30%, transparent);
}

.ai-price__compare {
  font-family: 'Inter', 'Exo 2', sans-serif;
  font-size: 12px;
  color: color-mix(in srgb, var(--neutral-color) 50%, transparent);
  text-decoration: line-through;
}

/* -------------------------------------------------------
   8. Swatches — shown for fashion/apparel
   ------------------------------------------------------- */
.ai-card__swatches {
  padding-top: 2px;
}

.ai-card__swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--neutral-color) 25%, transparent);
  cursor: pointer;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.ai-card__swatch:hover {
  border-color: var(--brand-color);
  box-shadow: 0 0 8px color-mix(in srgb, var(--brand-color) 40%, transparent);
}

.ai-card__swatch-dot {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.ai-card__swatch-more {
  font-size: 11px;
  color: var(--neutral-color);
  padding-left: 4px;
}

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

/* -------------------------------------------------------
   10. Info area add-to-cart — hidden (overlay takes priority)
   ------------------------------------------------------- */
.ai-card__add-wrap {
  display: none;
}

/* -------------------------------------------------------
   11. Card Back — hidden by default
   ------------------------------------------------------- */
.ai-card__back {
  display: none;
}

/* -------------------------------------------------------
   12. Add-to-cart button states (overlay button)
   ------------------------------------------------------- */
ai-quick-add-cart[data-state="loading"] .ai-card__overlay-btn {
  opacity: 0.6;
  pointer-events: none;
  animation: neon-pulse-subtle 1s infinite alternate;
}

ai-quick-add-cart[data-state="success"] .ai-card__overlay-btn {
  background: color-mix(in srgb, var(--secondary-color) 25%, transparent);
  border-color: var(--secondary-color);
  color: var(--secondary-color);
  box-shadow: 0 0 16px color-mix(in srgb, var(--secondary-color) 40%, transparent);
}

ai-quick-add-cart[data-state="error"] .ai-card__overlay-btn {
  background: color-mix(in srgb, var(--striking-color) 20%, transparent);
  border-color: var(--striking-color);
  color: var(--striking-color);
  animation: shake 0.4s ease;
}

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

@keyframes neon-pulse-subtle {
  0% { box-shadow: 0 0 8px color-mix(in srgb, var(--brand-color) 20%, transparent); }
  100% { box-shadow: 0 0 20px color-mix(in srgb, var(--brand-color) 40%, transparent); }
}

/* -------------------------------------------------------
   13. Product List — Grid Mode
   ------------------------------------------------------- */
.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: 18px;
  }
}

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

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

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

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

/* Carousel arrows */
.ai-pl-prev,
.ai-pl-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--brand-color) 40%, transparent);
  border-radius: 2px;
  background: color-mix(in srgb, var(--bg-color) 85%, transparent);
  backdrop-filter: blur(12px);
  color: var(--neutral-color);
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

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

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

.ai-pl-prev:hover,
.ai-pl-next:hover {
  background: var(--brand-color);
  color: var(--bg-color);
  border-color: var(--brand-color);
  box-shadow: 0 0 18px color-mix(in srgb, var(--brand-color) 45%, transparent);
}

@media (max-width: 749px) {
  .ai-pl-prev,
  .ai-pl-next {
    width: 32px;
    height: 32px;
  }

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

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

/* -------------------------------------------------------
   15. Quick Add Cart Modal (.qac-*)
   ------------------------------------------------------- */

/* Wrapper root — initial / exit state */
.qac-wrapper {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.qac-wrapper:not([data-open]) .qac-overlay {
  opacity: 0;
}

.qac-wrapper[data-open] .qac-overlay {
  opacity: 1;
}

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

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

/* Overlay */
.qac-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg-color) 80%, transparent);
  backdrop-filter: blur(6px);
  transition: opacity 0.3s ease;
}

/* Modal */
.qac-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1001;
  width: 680px;
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-color);
  border: 1px solid color-mix(in srgb, var(--brand-color) 30%, transparent);
  border-radius: 4px;
  box-shadow:
    0 0 40px color-mix(in srgb, var(--brand-color) 20%, transparent),
    0 0 80px color-mix(in srgb, var(--secondary-color) 8%, transparent);
  overflow: hidden;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 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(--brand-color) 15%, transparent);
}

.qac-product-title {
  font-family: 'Orbitron', 'Rajdhani', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 12px;
}

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

.qac-close:hover {
  border-color: var(--striking-color);
  color: var(--striking-color);
  background: color-mix(in srgb, var(--striking-color) 10%, transparent);
}

/* Body — side-by-side layout */
.qac-body {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  gap: 20px;
}

.qac-product-media {
  flex: 0 0 40%;
  max-width: 40%;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--brand-color) 15%, transparent);
}

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

.qac-product-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Footer */
.qac-footer {
  padding: 16px 20px;
  border-top: 1px solid color-mix(in srgb, var(--brand-color) 15%, transparent);
}

/* Submit button */
.qac-submit {
  width: 100%;
  padding: 14px 24px;
  border: 1px solid var(--brand-color);
  border-radius: 2px;
  background: var(--brand-color);
  color: var(--bg-color);
  font-family: 'Orbitron', 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease, color 0.3s ease, opacity 0.3s ease;
}

.qac-submit:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--bg-color);
  box-shadow: 0 0 24px color-mix(in srgb, var(--brand-color) 50%, transparent);
}

.qac-submit:focus {
  outline: 2px solid var(--secondary-color);
  outline-offset: 2px;
  color: var(--bg-color);
}

.qac-submit:active {
  background: var(--accent-color);
  color: var(--bg-color);
}

.qac-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: color-mix(in srgb, var(--neutral-color) 20%, transparent);
  border-color: color-mix(in srgb, var(--neutral-color) 30%, transparent);
  color: color-mix(in srgb, var(--neutral-color) 50%, transparent);
  box-shadow: none;
}

/* Sold out */
.qac-submit[data-sold-out] {
  opacity: 0.4;
  cursor: not-allowed;
  background: color-mix(in srgb, var(--neutral-color) 15%, transparent);
  border-color: color-mix(in srgb, var(--neutral-color) 25%, transparent);
  color: color-mix(in srgb, var(--neutral-color) 50%, transparent);
}

/* Loading state */
.qac-submit[data-loading] {
  opacity: 0.6;
  pointer-events: none;
  animation: neon-pulse-subtle 1s infinite alternate;
}

/* Success state */
.qac-submit[data-success] {
  background: color-mix(in srgb, var(--secondary-color) 25%, transparent);
  border-color: var(--secondary-color);
  color: var(--secondary-color);
  box-shadow: 0 0 20px color-mix(in srgb, var(--secondary-color) 40%, transparent);
}

/* Error state */
.qac-submit[data-error] {
  background: color-mix(in srgb, var(--striking-color) 25%, transparent);
  border-color: var(--striking-color);
  color: var(--striking-color);
  animation: shake 0.4s ease;
}

/* -------------------------------------------------------
   16. QAC Modal — Mobile Responsive
   ------------------------------------------------------- */
@media (max-width: 749px) {
  .qac-modal {
    width: 96vw;
    max-height: 85vh;
  }

  .qac-body {
    flex-direction: column;
    padding: 16px;
    gap: 16px;
  }

  .qac-product-media {
    flex: none;
    max-width: 100%;
    max-height: 240px;
  }

  .qac-product-img {
    max-height: 240px;
    object-fit: contain;
  }

  .qac-header {
    padding: 12px 16px;
  }

  .qac-footer {
    padding: 12px 16px;
  }

  .qac-submit {
    padding: 12px 20px;
  }
}

/* -------------------------------------------------------
   17. Scanline / Glitch ambient animation
   ------------------------------------------------------- */
@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

.ai-card__media::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to bottom,
    transparent 48%,
    color-mix(in srgb, var(--secondary-color) 4%, transparent) 50%,
    transparent 52%
  );
  background-size: 100% 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.ai-card:hover .ai-card__media::after {
  opacity: 1;
  animation: scanline 3s linear infinite;
}

/* Neon glow pulse for CTA */
@keyframes neon-glow-pulse {
  0%, 100% {
    box-shadow: 0 0 8px color-mix(in srgb, var(--brand-color) 30%, transparent);
  }
  50% {
    box-shadow:
      0 0 16px color-mix(in srgb, var(--brand-color) 50%, transparent),
      0 0 32px color-mix(in srgb, var(--brand-color) 20%, transparent);
  }
}

/* -------------------------------------------------------
   18. Mobile Card Adjustments
   ------------------------------------------------------- */
@media (max-width: 749px) {
  .ai-card__title {
    font-size: 13px;
  }

  .ai-price__current {
    font-size: 14px;
  }

  .ai-card__vendor {
    font-size: 9px;
  }

  .ai-card__info {
    padding: 10px 10px;
    gap: 6px;
  }

  .ai-card__badge {
    font-size: 10px;
    padding: 3px 8px;
  }
}
