/* =====================================================================
   LKPGMERCH – Product cards (EXPANDING FLYOUT SOLUTION) v.1.7
   ===================================================================== */

:root {
  --lkpg-card-radius: 10px; /* Ändrad från 8px till 10px */
  --lkpg-card-bg: #fff;
  --lkpg-card-text: #242424;
  --lkpg-muted: #a9773b;
  --lkpg-accent: #5bbf00;
  --lkpg-border: rgba(0,0,0,.08);
  --lkpg-shadow: 0 10px 28px rgba(0,0,0,.14);
  --lkpg-transition: .25s ease;
  --lkpg-icon-size: 36px;
  --lkpg-icon-bg: rgba(255,255,255,.95);
  --lkpg-icon-bg-hover: #fff;
  --lkpg-icon-color: #222;
  --lkpg-icon-border: rgba(0,0,0,.1);
  --lkpg-cta-h: 40px;
  --lkpg-grow-scale: 1.03;
  --lkpg-flyout-extra-height: 140px; /* Extra höjd för flyout */
  
  --lkpg-swatch-size: 24px;
  --lkpg-swatch-color-size: 21px;
  --lkpg-swatch-border: #FFFFFF;
  --lkpg-swatch-shadow: 0 2px 4px rgba(0,0,0,0.1);
    
  /* Justera ribbon höjd om needed */
  --lkpg-ribbon-height: 50px;
}

ul.products {
  --lkpg-gap: 32px;
  gap: var(--lkpg-gap);
  position: relative;
}

.lkpg-product-card {
  list-style: none;
  position: relative;
  z-index: 1;
}

.lkpg-product-card:hover {
  z-index: 10000 !important;
}

/* Kortets kärna - behåller normal höjd */
.lkpg-product-card .lkpg-card-inner {
  position: relative;
  border-radius: var(--lkpg-card-radius);
  background: var(--lkpg-card-bg);
  border: 1px solid var(--lkpg-border);
  overflow: visible; /* Viktigt: visible så flyout kan expandera */
  transition: transform var(--lkpg-transition), box-shadow var(--lkpg-transition), border-color var(--lkpg-transition);
  transform-origin: center center;
  height: auto; /* Naturlig höjd */
}

.lkpg-product-card:hover .lkpg-card-inner {
  transform: scale(1.05); /* Öka från 1.03 till 1.05 */
  box-shadow: var(--lkpg-shadow);
  border-color: transparent;
}

/* =================== DEFAULT CONTENT =================== */
.lkpg-product-image {
  position: relative;
  background: #f2f2f2;
  overflow: hidden;
  border-radius: var(--lkpg-card-radius) var(--lkpg-card-radius) 0 0; /* Rundade övre hörn */
}

.woocommerce ul.products li.product a img { margin-bottom: 0; }

.lkpg-product-image img {
  display: block;
  width: 100%;
  height: auto;
}

.woocommerce ul.products li.product .onsale {
  top: 10px; left: 10px; right: auto;
  margin: 0;
  z-index: 2;
}

.lkpg-icons-top {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  grid-auto-flow: row;
  gap: 8px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity var(--lkpg-transition), transform var(--lkpg-transition);
  z-index: 3;
}

.lkpg-product-card:hover .lkpg-icons-top {
  opacity: 1;
  transform: none;
}

/* RIBBON MED DELAY - ENDAST I FLYOUT */
.lkpg-image-ribbon {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: var(--lkpg-ribbon-height);
  background: #fff;
  border-bottom: 1px #ccc solid !important;
  transform: translateY(100%);
  opacity: 0;
  z-index: 2;
}

.lkpg-product-card:hover .lkpg-image-ribbon {
  animation: slideInRibbon 0.4s ease 0.3s forwards;
}

@keyframes slideInRibbon {
  0% {
    transform: translateY(100%);
    opacity: 0;
  }
  100% {
    transform: translateY(0%);
    opacity: 1;
  }
}

.lkpg-info {
  padding: 16px 16px 18px;
  text-align: center;
  position: relative;
  z-index: 1;
  background: var(--lkpg-card-bg);
  border-radius: 0 0 var(--lkpg-card-radius) var(--lkpg-card-radius); /* Rundade nedre hörn */
}

.lkpg-title {
  font-size: 16px;
  line-height: 1.35;
  margin: 0 0 6px 0;
  font-weight: 700;
  text-transform: uppercase;
}

.lkpg-title a { color: inherit; text-decoration: none; }

.lkpg-title a:hover { opacity: 0.85; }

.lkpg-cats {
  font-size: 13px;
  color: var(--lkpg-muted);
  margin-bottom: 8px;
}

.lkpg-price {
  color: var(--lkpg-accent);
  font-weight: 700;
  font-size: 15px;
}

/* =================== FLYOUT SOM KAN EXPANDERA =================== */
.lkpg-flyout {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--lkpg-card-bg);
  border-radius: var(--lkpg-card-radius);
  border: 1px solid var(--lkpg-border);
  box-shadow: var(--lkpg-shadow);
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--lkpg-transition), transform var(--lkpg-transition);
  z-index: 50;
  
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: auto;
  transform: scale(0.98);
  transform-origin: top center;
  overflow: hidden; /* Viktigt för att border-radius ska synas */
}

.lkpg-product-card:hover .lkpg-flyout {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1.05); /* Samma skalning som card-inner */
  min-height: calc(100% + var(--lkpg-flyout-extra-height));
}

/* Bildsektion i flyout */
.lkpg-flyout-image {
  position: relative;
  background: #f2f2f2;
  overflow: hidden;
  flex: 0 0 auto; /* Behåll naturlig höjd */
  border-radius: var(--lkpg-card-radius) var(--lkpg-card-radius) 0 0; /* Rundade övre hörn */
}

/* DRAMATISK ZOOM EFFECT PÅ BILD 2 FRÅN GALLERI */
.lkpg-flyout-image img,
.lkpg-flyout-image .hover-gallery-image,
.lkpg-flyout-image .attachment-woocommerce_thumbnail {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 2s ease !important; /* 2 SEKUNDER */
  transform-origin: center center !important;
}

.lkpg-product-card:hover .lkpg-flyout-image img,
.lkpg-product-card:hover .lkpg-flyout-image .hover-gallery-image,
.lkpg-product-card:hover .lkpg-flyout-image .attachment-woocommerce_thumbnail {
  transform: scale(1.3) !important; /* 30% ZOOM */
}

/* Ikoner i flyout */
.lkpg-flyout .lkpg-icons-top {
  opacity: 1;
  transform: none;
}

/* Info-sektion i flyout */
.lkpg-flyout-info {
  padding: 16px 16px 12px;
  text-align: center;
  flex: 0 0 auto; /* Behåll naturlig höjd */
  background: var(--lkpg-card-bg);
}

.lkpg-flyout-title {
  font-size: 16px;
  line-height: 1.35;
  margin: 0 0 6px 0;
  font-weight: 700;
  text-transform: uppercase;
}

.lkpg-flyout-title a { color: inherit; text-decoration: none; }

.lkpg-flyout-title a:hover { opacity: 0.85; }

.lkpg-flyout-cats {
  font-size: 13px;
  color: var(--lkpg-muted);
  margin-bottom: 8px;
}

.lkpg-flyout-price {
  color: var(--lkpg-accent);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
}

/* Extra innehåll i flyout - detta får den extra höjden */
.lkpg-flyout-content {
  padding: 0 16px 18px;
  flex: 1 1 auto; /* Expandera för att fylla tillgängligt utrymme */
  background: var(--lkpg-card-bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px; /* Garanti för minsta höjd för extra innehåll */
  border-radius: 0 0 var(--lkpg-card-radius) var(--lkpg-card-radius); /* Rundade nedre hörn */
}

.lkpg-short-desc {
  font-size: 13px;
  color: #444;
  line-height: 1.5;
  text-align: center;
  margin-bottom: 12px;
  flex: 1; /* Expandera för att fylla utrymme */
}

/* =================== CTA + Ikoner (rad) =================== */
.lkpg-actions-row {
  display: grid;
  grid-template-columns: var(--lkpg-icon-size) 1fr var(--lkpg-icon-size);
  align-items: center;
  gap: 10px;
  flex: 0 0 auto; /* Fix höjd */
}

.lkpg-cta .button,
.lkpg-cta .add_to_cart_button,
.lkpg-cta .ajax_add_to_cart {
  width: 100%;
  height: var(--lkpg-cta-h);
  line-height: 1 !important;
  color: #1D1D1D !important;
  background: #FF9C0070 !important;
  border: 2px solid #FF9C00 !important;
  border-radius: 30px !important;
  font-family: 'Inter', sans-serif !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  letter-spacing: -0.01em !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 14px;
  transition: all var(--lkpg-transition);
  text-transform: none;
}

.lkpg-cta .button:hover,
.lkpg-cta .add_to_cart_button:hover,
.lkpg-cta .ajax_add_to_cart:hover {
  color: #1D1D1d !important;
  background: #FF9C001A !important;
  border: 2px solid #FF9C00 !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(255, 156, 0, 0.3);
}

/* =================== Ikonknappar =================== */
.lkpg-icon {
  width: var(--lkpg-icon-size);
  height: var(--lkpg-icon-size);
  border-radius: 999px;
  background: var(--lkpg-icon-bg);
  border: 1px solid var(--lkpg-icon-border);
  display: grid;
  place-items: center;
  transition: background var(--lkpg-transition), box-shadow var(--lkpg-transition), transform var(--lkpg-transition);
  text-decoration: none;
  position: relative;
}

.lkpg-icon::before {
  content: '';
  width: 18px;
  height: 18px;
  mask-size: contain;
  mask-repeat: no-repeat;
  background: var(--lkpg-icon-color);
  opacity: .9;
}

.lkpg-icon-compare::before {
  mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23000" d="M10 3h4v2h-4V3zm7 4h-3v14h3V7zM7 10h3v11H7V10z"/></svg>');
}

.lkpg-icon-wishlist::before,
.lkpg-icon-heart::before {
  mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23000" d="M12 21s-6.716-4.418-9.193-8.39C1.04 10.51 2.17 7.5 5.09 6.91c1.66-.33 3.21.42 4.1 1.82.89-1.4 2.44-2.15 4.1-1.82 2.92.59 4.05 3.6 2.28 5.7C18.716 16.582 12 21 12 21z"/></svg>');
}

.lkpg-icon-quickview::before {
  mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23000" d="M12 5c7 0 10 7 10 7s-3 7-10 7S2 12 2 12s3-7 10-7zm0 3a4 4 0 100 8 4 4 0 000-8z"/></svg>');
}

.lkpg-icon:hover {
  background: var(--lkpg-icon-bg-hover);
  box-shadow: var(--lkpg-shadow-sm);
  transform: translateY(-1px);
}

/* =================== Touch-stöd =================== */
.lkpg-product-card.is-open {
  z-index: 10000 !important;
}

.lkpg-product-card.is-open .lkpg-card-inner {
  transform: scale(var(--lkpg-grow-scale));
}

.lkpg-product-card.is-open .lkpg-flyout {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  min-height: calc(100% + var(--lkpg-flyout-extra-height));
}

@media (max-width: 1024px) {
  .lkpg-icons-top { opacity: 1; transform: none; }
}


/* =================== FÄRGVÄLJARE I RIBBON =================== */
.lkpg-color-swatches {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 16px;
  height: 100%;
}

.lkpg-swatch-label {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

.lkpg-swatches-container {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.lkpg-swatch {
  width: var(--lkpg-swatch-size) !important;
  height: var(--lkpg-swatch-size)!important;
  border: 1px solid transparent;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lkpg-swatch:hover {
  transform: scale(1.1);
  border-color: rgba(0,0,0,0.2);
}

.lkpg-swatch.selected {
  border-color: var(--lkpg-swatch-border) !important;
  box-shadow: 0 0 0 1px #fff, 0 0 0 1px #fff;
}

.lkpg-swatch-color {
  width: var(--lkpg-swatch-color-size) !important;
  height: var(--lkpg-swatch-color-size) !important;
  border-radius: 50%;
  display: block;
  position: relative;
  overflow: hidden;
  background-clip: padding-box;
  border: 1px solid #d5d5d5;
  background: none;
}

.lkpg-swatch-text {
  font-size: 9px;
  font-weight: 600;
  color: #333;
  text-transform: uppercase;
  line-height: 1;
}

/* Överskriv border för färgswatches */
.lkpg-product-card .lkpg-swatch {
  border-width: 1px !important;
  border-color: rgba(0,0,0,0) !important;
  border-style: solid !important;
  background-color: #FFFFFF !important;
}

.lkpg-product-card .lkpg-swatch:hover {
  border-color: rgba(0,0,0,0) !important;
}

.lkpg-product-card .lkpg-swatch.selected {
  border-color: #000000 !important;
  border-width: 1px !important;
}

/* Animation för swatches i ribbon */
.lkpg-product-card:hover .lkpg-swatches-container .lkpg-swatch {
  animation: swatchAppear 0.3s ease forwards;
  opacity: 0;
  transform: translateY(5px);
}

.lkpg-product-card:hover .lkpg-swatches-container .lkpg-swatch:nth-child(1) { animation-delay: 0.4s; }
.lkpg-product-card:hover .lkpg-swatches-container .lkpg-swatch:nth-child(2) { animation-delay: 0.45s; }
.lkpg-product-card:hover .lkpg-swatches-container .lkpg-swatch:nth-child(3) { animation-delay: 0.5s; }
.lkpg-product-card:hover .lkpg-swatches-container .lkpg-swatch:nth-child(4) { animation-delay: 0.55s; }
.lkpg-product-card:hover .lkpg-swatches-container .lkpg-swatch:nth-child(5) { animation-delay: 0.6s; }
.lkpg-product-card:hover .lkpg-swatches-container .lkpg-swatch:nth-child(6) { animation-delay: 0.65s; }
.lkpg-product-card:hover .lkpg-swatches-container .lkpg-swatch:nth-child(7) { animation-delay: 0.7s; }
.lkpg-product-card:hover .lkpg-swatches-container .lkpg-swatch:nth-child(8) { animation-delay: 0.75s; }
.lkpg-product-card:hover .lkpg-swatches-container .lkpg-swatch:nth-child(9) { animation-delay: 0.8s; }
.lkpg-product-card:hover .lkpg-swatches-container .lkpg-swatch:nth-child(10) { animation-delay: 0.85s; }
.lkpg-product-card:hover .lkpg-swatches-container .lkpg-swatch:nth-child(11) { animation-delay: 0.9s; }
.lkpg-product-card:hover .lkpg-swatches-container .lkpg-swatch:nth-child(12) { animation-delay: 0.95s; }
.lkpg-product-card:hover .lkpg-swatches-container .lkpg-swatch:nth-child(13) { animation-delay: 1s; }

@keyframes swatchAppear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsiv anpassning */
@media (max-width: 768px) {
  .lkpg-color-swatches {
    flex-direction: column;
    gap: 6px;
    padding: 6px 12px;
  }
  
  .lkpg-swatch-label {
    font-size: 11px;
  }
  
  .lkpg-swatch {
    width: 20px;
    height: 20px;
  }
  
  .lkpg-swatch-color {
    width: 14px;
    height: 14px;
  }
}


/* ==========================================================
   TOOLTIP (flyttad hit från plugin)
   ========================================================== */
.lkpg-swatch[data-tooltip] { position: relative; }

/* Tooltip bubbla */
.lkpg-swatch[data-tooltip]:hover::after,
.lkpg-swatch[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  background: #111;
  color: #fff;
  font-size: 12px;
  line-height: 1.2;
  padding: 6px 8px;
  border-radius: 6px;
  white-space: nowrap;
  max-width: 240px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  transition: opacity .15s ease, transform .15s ease;
}

/* Triangel */
.lkpg-swatch[data-tooltip]:hover::before,
.lkpg-swatch[data-tooltip]:focus-visible::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%) translateY(4px);
  border: 6px solid transparent;
  border-top-color: #111;
  opacity: 0;
  pointer-events: none;
  z-index: 19;
  transition: opacity .15s ease, transform .15s ease;
}

/* Aktiv */
.lkpg-swatch[data-tooltip]:hover::after,
.lkpg-swatch[data-tooltip]:hover::before,
.lkpg-swatch[data-tooltip]:focus-visible::after,
.lkpg-swatch[data-tooltip]:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ======================================================
   TOOLTIP – För färgprickar (swatches)
   Hanteras i temat, inte i pluginet.
====================================================== */

.aur-swatch[data-tooltip] {
  position: relative;
}

.aur-swatch[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: 12px;
  line-height: 1.3;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  transform-origin: bottom center;
  z-index: 9999;
}

.aur-swatch[data-tooltip]:hover::after,
.aur-swatch[data-tooltip]:focus::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}


/* Radbrytning */
@supports (width: max-content) {
  .lkpg-swatch[data-tooltip]:hover::after,
  .lkpg-swatch[data-tooltip]:focus-visible::after { white-space: normal; }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .lkpg-swatch[data-tooltip]:hover::after,
  .lkpg-swatch[data-tooltip]:focus-visible::after { background: #000; }
  .lkpg-swatch[data-tooltip]:hover::before,
  .lkpg-swatch[data-tooltip]:focus-visible::before { border-top-color: #000; }
}

/* Tillgänglighet */
@media (prefers-reduced-motion: reduce) {
  .lkpg-swatch[data-tooltip]::before,
  .lkpg-swatch[data-tooltip]::after { transition: none; }
}