/* ======================================================
   STM QUICK VIEW (Premium)
   Location: /wp-content/plugins/suntechmall-engine/modules/quick-view/assets/quick-view.css
   Purpose: Plugin-owned Quick View modal plus product-card image-hover trigger styling.
====================================================== */

/* Scroll lock when modal open */
html.stm-qv-open,
html.stm-qv-open body{
  overflow:hidden;
}

/* ======================================================
   PRODUCT LOOP: Hover button overlay (performance-safe)
   - Theme orange button
   - White text
   - Shows ONLY when user hovers the product feature image area
====================================================== */

/* Ensure media can hold overlay */
.stm-pl__media{
  position: relative;
  overflow: hidden;
}

/* Show shade only when the actual feature image/media area is hovered */
.stm-pl__media:hover::before{
  opacity: 1;
}

/* Quick View trigger inside media */
.stm-pl__media .stm-qv-trigger{
  position:absolute;
  left:50%;
  top:calc(50% - 22px);
  transform:translate(-50%,-50%) scale(.98);
  z-index:8;

  display:inline-flex;
  align-items:center;
  justify-content:center;

  min-width:96px;
  height:36px;
  padding:0 16px;
  border-radius:999px;
  border:1px solid #ff7a00;

  background:#ff7a00;
  color:#fff;
  font-weight:800;
  font-size:12px;
  line-height:1;
  white-space:nowrap;
  cursor:pointer;

  opacity:0;
  pointer-events:none;
  transition:opacity .16s ease, transform .16s ease, background-color .16s ease, border-color .16s ease;
}

/* Show only on feature image/media hover */
.stm-pl__media:hover .stm-qv-trigger{
  opacity:1;
  pointer-events:auto;
  transform:translate(-50%,-50%) scale(1);
}

/* Optional hover feedback */
.stm-pl__media .stm-qv-trigger:hover,
.stm-pl__media .stm-qv-trigger:focus-visible{
  background:#e65f00;
  border-color:#e65f00;
  color:#fff;
}

/* Hide on touch (mobile/tablet) for performance + UX */
@media (hover: none){
  .stm-pl__media::before{ display:none; }
  .stm-pl__media .stm-qv-trigger{ display:none; }
}

/* ======================================================
   MODAL (your existing CSS, kept)
====================================================== */

/* Overlay */
.stm-qv-overlay{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index:9999;

  background:rgba(15,23,42,.55);
  backdrop-filter:saturate(140%) blur(6px);
}

.stm-qv-overlay.is-open{ display:flex; }

/* Dialog */
.stm-qv-dialog{
  width:min(900px,92vw);
  max-height:calc(100vh - 72px);
  background:#fff;
  border-radius:16px;
  box-shadow:0 34px 100px rgba(0,0,0,.34);
  position:relative;

  display:grid;
  grid-template-columns:minmax(0,.96fr) minmax(0,1fr);
  gap:18px;
  padding:20px 20px 28px;
  overflow:hidden;
  align-items:start;
}

/* Close */
.stm-qv-close{
  position:absolute;
  top:10px;
  right:12px;
  width:34px;
  height:34px;
  border-radius:10px;
  border:1px solid #e5e7eb;
  background:#fff;
  font-size:21px;
  line-height:1;
  cursor:pointer;
  transition:background-color .16s ease,border-color .16s ease,filter .16s ease;
}
.stm-qv-close:hover,
.stm-qv-close:focus-visible{
  background:#f3f4f6;
  border-color:#d1d5db;
  filter:brightness(.98);
}

/* Back */
.stm-qv-back{
  position:absolute;
  top:10px;
  left:12px;
  height:34px;
  border-radius:10px;
  border:1px solid #e5e7eb;
  background:#fff;
  padding:0 12px;
  font-weight:800;
  cursor:pointer;
  transition:background-color .16s ease,border-color .16s ease,filter .16s ease;
}
.stm-qv-back:hover,
.stm-qv-back:focus-visible{
  background:#f3f4f6;
  border-color:#d1d5db;
  filter:brightness(.98);
}

/* Left column */
.stm-qv-left{
  display:grid;
  grid-template-rows:minmax(0, auto) auto;
  gap:10px;
  min-width:0;
  max-width:100%;
  align-self:start;
}

/* Main image */
.stm-qv-media{
  width:100%;
  max-width:100%;
  max-height:min(390px, calc(100vh - 250px));
  aspect-ratio:1/1;
  border:1px solid #e5e7eb;
  border-radius:12px;
  background:#f8fafc;
  display:grid;
  place-items:center;
  overflow:hidden;
}
.stm-qv-media img{
  width:100%;
  height:100%;
  max-width:100%;
  max-height:100%;
  object-fit:contain;
}

/* Thumbs */
.stm-qv-thumbs{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(52px, 58px));
  justify-content:start;
  align-items:start;
  gap:7px;
  max-width:100%;
  overflow:hidden;
}
.stm-qv-thumb{
  border:1px solid #e5e7eb;
  border-radius:10px;
  background:#fff;
  overflow:hidden;
  cursor:pointer;
  width:58px;
  max-width:100%;
  height:54px;
  min-width:0;

  display:grid;
  place-items:center;
}
.stm-qv-thumb img{
  width:100%;
  height:100%;
  max-width:100%;
  max-height:100%;
  object-fit:contain;
  image-rendering:auto;
}
.stm-qv-thumb.is-active{
  outline:2px solid #111827;
  outline-offset:0;
}

/* Right column */
.stm-qv-right{
  display:grid;
  gap:9px;
  align-content:start;
  min-width:0;
}

.stm-qv-brand{
  display:inline-block;
  font-weight:800;
  font-size:11px;
  border:1px solid #e5e7eb;
  border-radius:999px;
  padding:6px 10px;
  max-width:max-content;
  background:#f9fafb;
}

.stm-qv-title{
  font-size:24px;
  line-height:1.18;
  margin:0;
  font-weight:900;
  color:#0f172a;
}

/* Meta line */
.stm-qv-meta{
  display:flex;
  gap:14px;
  align-items:center;
  color:#6b7280;
  font-size:12px;
}

.stm-qv-stars{
  display:flex;
  gap:6px;
  align-items:center;
}
.stm-qv-stars .stm-qv-star{
  font-size:15px;
  line-height:1;
}

.stm-qv-price{
  font-size:21px;
  font-weight:900;
  display:flex;
  gap:10px;
  align-items:baseline;
}
.stm-qv-price del{
  color:#9ca3af;
  font-weight:700;
}
.stm-qv-price ins{
  text-decoration:none;
  color:#111827;
}

/* Stock */
.stm-qv-stock{ font-weight:800; }
.stm-qv-stock.is-in{
  color:#047857;
  background:#ecfdf5;
  border:1px solid #a7f3d0;
  display:inline-block;
  border-radius:999px;
  padding:6px 10px;
  font-size:13px;
}
.stm-qv-stock.is-out{
  color:#7c2d12;
  background:#fef3c7;
  border:1px solid #fcd34d;
  display:inline-block;
  border-radius:999px;
  padding:6px 10px;
  font-size:13px;
}

.stm-qv-short{
  color:#374151;
  margin:3px 0 6px;
  font-size:14px;
  line-height:1.45;
}

/* Buttons */
.stm-qv-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:14px;
}
.stm-qv-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:46px;
  border-radius:25px;
  padding:12px 18px;
  font-weight:800;
  text-decoration:none;
  border:1px solid #e5e7eb;
  cursor:pointer;
  transition:background-color .16s ease,border-color .16s ease,color .16s ease,transform .16s ease,box-shadow .16s ease;
}
.stm-qv-btn:hover,
.stm-qv-btn:focus-visible{
  transform:translateY(-1px);
  box-shadow:0 8px 18px rgba(15,23,42,.12);
}
.stm-qv-btn.primary{
  background:#ff7a00;
  color:#fff !important;
  border-color:#ff7a00;
}
.stm-qv-btn.primary:hover,
.stm-qv-btn.primary:focus-visible{
  background:#e65f00;
  border-color:#e65f00;
  color:#fff !important;
}
.stm-qv-btn.primary[aria-disabled="true"]{
  background:#d1d5db;
  border-color:#d1d5db;
  color:#6b7280 !important;
  cursor:not-allowed;
  box-shadow:none;
  transform:none;
}
.stm-qv-btn.ghost{
  background:#fff;
  color:#111827 !important;
  border-color:#16a34a;
}
.stm-qv-btn.ghost:hover,
.stm-qv-btn.ghost:focus-visible{
  background:#f0fdf4;
  color:#0f172a !important;
  border-color:#15803d;
}

/* Responsive */
@media (max-width: 900px){
  .stm-qv-dialog{
    grid-template-columns:1fr;
    gap:14px;
    padding:16px 16px 22px;
    width:min(92vw,720px);
    max-height:calc(100vh - 36px);
    overflow:auto;
  }
  .stm-qv-media{
    aspect-ratio:4/3;
    max-height:min(340px, calc(100vh - 280px));
  }
  .stm-qv-thumbs{ grid-template-columns:repeat(auto-fit, minmax(48px, 54px)); }
  .stm-qv-thumb{ width:54px; height:50px; }
  .stm-qv-title{ font-size:22px; }
  .stm-qv-actions{ margin-top:12px; }
}

@media (max-height: 760px) and (min-width: 901px){
  .stm-qv-dialog{
    max-height:calc(100vh - 56px);
    padding-bottom:26px;
  }
  .stm-qv-media{ max-height:calc(100vh - 260px); }
  .stm-qv-thumb{ height:52px; }
}

/* Desktop-only behavior (extra safety)
   JS also blocks it if enabled */
@media (max-width: 1023.98px){
  .stm-qv-overlay.is-desktop-only{ display:none !important; }
}

@media (max-width: 767.98px){
  .stm-qv-overlay.is-mobile-fullscreen .stm-qv-dialog{
    width:100vw;
    min-height:100vh;
    max-height:100vh;
    border-radius:0;
    padding:18px 16px 24px;
  }
}
