/* ==========================================================
   CW WISHLIST PRO v7 — UnboxTools.com
   Flatsome-specific fixes based on live DOM inspection
   ========================================================== */

/* SVG reset */
.cw-heart-btn svg, .cw-heart-wrap svg, .cw-share-btn svg,
.cw-x-btn svg, .cw-header-heart, .cw-empty-icon svg {
    display: block !important;
    max-width: none !important;
    max-height: none !important;
    flex-shrink: 0 !important;
}

/* ==========================================================
   FLATSOME HOVER FIX — Multi-image products
   
   .box-image structure:
   ├── .cw-heart-wrap (z-index:99, always on top)
   └── .image-fade_in_back
       ├── a > img (first image, always visible)
       └── a > img.show-on-hover.back-image (second image, shows on hover)
   
   Our heart wrap was interfering with Flatsome's hover CSS.
   Fix: ensure heart is z-index above both images, pointer-events
   only on heart button itself.
   ========================================================== */

/* Heart wrap — sits above ALL image layers */
.cw-heart-wrap {
    position: absolute !important;
    top: 8px !important;
    left: 8px !important;
    z-index: 99 !important;
    line-height: 0 !important;
    /* Hidden by default — shown on hover via CSS or JS */
    opacity: 0 !important;
    transform: scale(0.75) !important;
    transition: opacity .18s ease, transform .18s ease !important;
    /* IMPORTANT: pointer-events none on wrap so hover passes through to images */
    pointer-events: none !important;
}

/* Flatsome desktop hover — .col.has-hover:hover shows .show-on-hover elements */
/* This also shows our heart */
.col.has-hover:hover .cw-heart-wrap,
.product-small:hover .cw-heart-wrap {
    opacity: 1 !important;
    transform: scale(1) !important;
}

/* Heart button itself gets pointer-events */
.cw-heart-wrap .cw-heart-btn {
    pointer-events: auto !important;
}

/* Always visible when product is in wishlist */
.cw-heart-wrap.is-active {
    opacity: 1 !important;
    transform: scale(1) !important;
}

/* === HEART BUTTON === */
.cw-heart-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    background: rgba(255,255,255,0.95) !important;
    border: 1.5px solid #cccccc !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    outline: none !important;
    box-shadow: 0 1px 6px rgba(0,0,0,.13) !important;
    transition: border-color .18s, box-shadow .18s, transform .15s !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}
.cw-heart-btn:hover {
    border-color: #e74c3c !important;
    box-shadow: 0 2px 10px rgba(231,76,60,.25) !important;
    transform: scale(1.10) !important;
}
.cw-heart-btn .cw-svg-heart {
    width: 14px !important;
    height: 14px !important;
    fill: none !important;
    stroke: #bbbbbb !important;
    stroke-width: 2 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    transition: fill .18s, stroke .18s !important;
}
.cw-heart-btn.in-wishlist {
    border-color: #e74c3c !important;
    background: rgba(255,240,240,0.97) !important;
}
.cw-heart-btn.in-wishlist .cw-svg-heart {
    fill: #e74c3c !important;
    stroke: #e74c3c !important;
}
.cw-heart-btn.loading { opacity: .5 !important; pointer-events: none !important; }

@keyframes cw-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.30); }
    70%  { transform: scale(.94); }
    100% { transform: scale(1); }
}
.cw-heart-btn.pop { animation: cw-pop .30s ease forwards !important; }

/* === SINGLE PRODUCT GALLERY === */
.woocommerce div.product .woocommerce-product-gallery,
.woocommerce div.product .images { position: relative !important; }

/* === QUICK VIEW GALLERY === */
.product-quick-view-container .product-gallery,
.product-quick-view-container .product-gallery-slide,
.product-quick-view-container .slider { position: relative !important; }

.cw-single-heart-wrap {
    position: absolute !important;
    top: 10px !important; left: 10px !important; right: auto !important;
    z-index: 999 !important; line-height: 0 !important;
    opacity: 0 !important; transform: scale(0.75) !important;
    transition: opacity .18s ease, transform .18s ease !important;
    pointer-events: none !important;
}
.cw-single-heart-wrap .cw-heart-btn {
    pointer-events: auto !important;
}
.woocommerce div.product .woocommerce-product-gallery:hover .cw-single-heart-wrap,
.woocommerce div.product .images:hover .cw-single-heart-wrap,
.product-quick-view-container .product-gallery:hover .cw-single-heart-wrap,
.product-quick-view-container .slider:hover .cw-single-heart-wrap {
    opacity: 1 !important; transform: scale(1) !important; pointer-events: auto !important;
}
.cw-single-heart-wrap.is-active {
    opacity: 1 !important; transform: scale(1) !important; pointer-events: auto !important;
}

/* Quick view — heart always visible */
.product-quick-view-container .cw-single-heart-wrap {
    opacity: 1 !important;
    transform: scale(1) !important;
    pointer-events: auto !important;
}

/* === HEADER BADGE === */
.cw-header-wrap { position: relative; display: inline-flex; align-items: center; vertical-align: middle; }
.cw-header-heart { width: 20px !important; height: 20px !important; fill: none; stroke: currentColor; stroke-width: 2; }
.cw-count-badge {
    position: absolute; top: -7px; right: -9px;
    background: #e74c3c; color: #fff; border-radius: 50%;
    min-width: 17px; height: 17px; font-size: 10px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center; padding: 0 3px; line-height: 1;
}

/* === TOAST === */
.cw-toast {
    position: fixed; bottom: 20px; left: 50%;
    transform: translateX(-50%) translateY(14px);
    background: #333; color: #fff; padding: 10px 20px; border-radius: 4px;
    font-size: 13px; font-weight: 500; z-index: 999999; opacity: 0;
    transition: opacity .24s, transform .24s; white-space: nowrap; pointer-events: none;
    max-width: calc(100vw - 32px); text-align: center; box-shadow: 0 3px 14px rgba(0,0,0,.2);
}
.cw-toast.show    { opacity: 1; transform: translateX(-50%) translateY(0); }
.cw-toast.success { background: #27ae60; }
.cw-toast.info    { background: #555555; }
.cw-toast.error   { background: #e74c3c; }

/* ==========================================================
   WISHLIST PAGE TABLE
   ========================================================== */
.cw-wishlist-wrap { font-family: inherit; font-size: 14px; color: #333; }
.cw-wishlist-title { font-size: 20px; font-weight: 700; margin: 0 0 16px; color: #333; }

.cw-wl-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cw-wl-table thead th {
    padding: 10px 14px; border-bottom: 2px solid #dddddd;
    text-align: left; font-size: 11px; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase; color: #888; white-space: nowrap;
}
.cw-wl-table tbody tr { border-bottom: 1px solid #eeeeee; }
.cw-wl-table tbody tr:hover { background: #fafafa; }
.cw-wl-table td { padding: 14px; vertical-align: middle; }

.cw-col-x      { width: 34px; }
.cw-col-thumb  { width: 96px; }
.cw-col-price  { width: 160px; white-space: nowrap; }
.cw-col-stock  { width: 110px; }
.cw-col-cart   { width: 120px; }
.cw-col-remove { width: 100px; }

.cw-td-thumb img {
    width: 78px !important; height: 78px !important;
    object-fit: contain !important; display: block !important;
    border: 1px solid #eeeeee; border-radius: 2px; background: #fff;
}

/* X circle button */
.cw-x-btn {
    display: flex !important; align-items: center !important; justify-content: center !important;
    width: 22px !important; height: 22px !important; min-width: 22px !important;
    background: none !important; border: 2px solid #cccccc !important;
    border-radius: 50% !important; cursor: pointer !important;
    padding: 0 !important; color: #aaaaaa !important;
    transition: border-color .18s, color .18s !important; -webkit-appearance: none !important;
}
.cw-x-btn:hover { border-color: #e74c3c !important; color: #e74c3c !important; }
.cw-x-btn svg { width: 10px !important; height: 10px !important; display: block !important; }

.cw-pname { font-weight: 400; color: #333; text-decoration: none; font-size: 14px; line-height: 1.4; display: block; }
.cw-pname:hover { color: #e74c3c; text-decoration: none; }

.cw-variation-meta { display: block; font-size: 12px; color: #888; margin-top: 3px; line-height: 1.4; }
.cw-variation-meta strong { font-weight: 600; color: #555; }

.cw-td-price del { color: #aaaaaa; font-size: 13px; margin-right: 4px; }
.cw-td-price ins { text-decoration: none; color: #e74c3c; font-weight: 700; }

.cw-in-stock  { color: #333333; font-size: 13px; }
.cw-out-stock { color: #e74c3c; font-size: 13px; }

/* ==========================================================
   ISSUE 3 FIX: "Add to cart" and "REMOVE" alignment
   
   Problem: cw-td-cart child offsetTop=263 (text, 17px tall)
            cw-td-remove child offsetTop=244 (button, 43px tall)
   Both tds have vertical-align:middle but their children differ.
   
   Fix: Make REMOVE button same visual weight as "Add to cart" text
   by removing padding — make it a plain text link like "Add to cart"
   ========================================================== */
.cw-td-cart   { vertical-align: middle !important; text-align: left !important; }
.cw-td-remove { vertical-align: middle !important; text-align: left !important; }

/* "Add to cart" — plain text, no padding */
.cw-atc-btn-row,
.cw-atc-link {
    display: inline !important;
    color: #333333 !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    font-family: inherit !important;
    text-decoration: none !important;
    cursor: pointer !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: inherit !important;
    vertical-align: baseline !important;
    -webkit-appearance: none !important;
}
.cw-atc-btn-row:hover,
.cw-atc-link:hover { color: #e74c3c !important; }

/* REMOVE — same baseline as Add to cart text */
.cw-remove-btn {
    display: inline-block !important;
    padding: 7px 14px !important;
    background: #222222 !important;
    color: #ffffff !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: .04em !important;
    text-transform: uppercase !important;
    border: none !important;
    border-radius: 2px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: background .18s !important;
    font-family: inherit !important;
    -webkit-appearance: none !important;
    vertical-align: middle !important;
}
.cw-remove-btn:hover { background: #e74c3c !important; }

/* Share bar */
.cw-share-bar { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid #eeeeee; flex-wrap: wrap; }
.cw-share-label { font-size: 12px; font-weight: 600; color: #777777; margin-right: 2px; white-space: nowrap; }
.cw-share-btn {
    display: inline-flex !important; align-items: center !important; justify-content: center !important;
    width: 28px !important; height: 28px !important; min-width: 28px !important;
    border-radius: 50% !important; border: 1.5px solid #dddddd !important; background: #ffffff !important;
    text-decoration: none !important; overflow: hidden !important; flex-shrink: 0 !important;
    transition: border-color .18s !important;
}
.cw-share-btn:hover { border-color: #999999 !important; }
.cw-share-btn svg { width: 11px !important; height: 11px !important; display: block !important; }

/* Empty state */
.cw-empty-state { text-align: center; padding: 50px 20px; }
.cw-empty-icon .cw-svg-heart { width: 48px !important; height: 48px !important; fill: none !important; stroke: #dddddd !important; stroke-width: 1.5 !important; display: block !important; margin: 0 auto 12px !important; }
.cw-empty-state p { font-size: 14px; color: #888888; margin: 0 0 16px; }
.cw-shop-btn { display: inline-block; padding: 9px 22px; background: #333; color: #fff !important; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; text-decoration: none; border-radius: 2px; }
.cw-shop-btn:hover { background: #e74c3c; color: #fff !important; }

/* ==========================================================
   MOBILE — Wishlist page
   ========================================================== */
@media (max-width: 768px) {
    .cw-wl-table thead { display: none; }
    .cw-wl-table tbody tr.cw-wl-row {
        display: grid !important;
        grid-template-columns: 26px 80px 1fr !important;
        grid-template-rows: auto auto auto auto !important;
        gap: 0 10px !important;
        padding: 12px 8px !important;
        border-bottom: 1px solid #eee !important;
        align-items: start !important;
    }
    .cw-wl-table td { padding: 0 !important; }
    .cw-td-x      { grid-column: 1; grid-row: 1 / 3; display: flex; align-items: flex-start; padding-top: 2px !important; }
    .cw-td-thumb  { grid-column: 2; grid-row: 1 / 4; }
    .cw-td-name   { grid-column: 3; grid-row: 1; padding-bottom: 3px !important; }
    .cw-td-price  { grid-column: 3; grid-row: 2; padding-bottom: 2px !important; }
    .cw-td-stock  { grid-column: 3; grid-row: 3; padding-bottom: 6px !important; }
    .cw-td-cart   { grid-column: 2 / 4; grid-row: 4; padding-top: 6px !important; text-align: center; }
    .cw-td-remove { display: none !important; }
    .cw-td-thumb img { width: 70px !important; height: 70px !important; }
    .cw-pname { font-size: 13px; font-weight: 600; }
    .cw-td-price::before { content: "Price: "; font-size: 11px; color: #888; }
    .cw-td-stock::before { content: "Stock: "; font-size: 11px; color: #888; }
    .cw-atc-btn-row, .cw-atc-link.cw-select-opts {
        display: block !important; width: 100% !important; text-align: center !important;
        padding: 8px 10px !important; border: 1.5px solid #333 !important; border-radius: 2px !important;
        font-size: 12px !important; font-weight: 600 !important; color: #333 !important; background: transparent !important;
    }
    .cw-atc-btn-row:hover, .cw-atc-link.cw-select-opts:hover { background: #333 !important; color: #fff !important; }
}
@media (max-width: 480px) {
    .cw-wl-table tbody tr.cw-wl-row { grid-template-columns: 24px 64px 1fr !important; gap: 0 8px !important; }
    .cw-td-thumb img { width: 58px !important; height: 58px !important; }
    .cw-pname { font-size: 12px !important; }
}

/* ==========================================================
   ISSUES 1 & 4: MOBILE HEART — ALWAYS VISIBLE
   
   Two-layer approach:
   1. CSS: @media (hover:none) — pure CSS for touch
   2. JS: inline style via element.style.setProperty — beats all CSS
   ========================================================== */
@media (hover: none), (pointer: coarse) {
    .cw-heart-wrap {
        opacity: 1 !important;
        transform: scale(1) !important;
        pointer-events: auto !important;
        visibility: visible !important;
        transition: none !important;
    }
}
