/* ==========================================================
   CW WISHLIST PRO v7 — UnboxTools.com
   ========================================================== */

/* ----------------------------------------------------------
   SVG GLOBAL 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;
}

/* ----------------------------------------------------------
   PRODUCT CARD — relative for ALL loop contexts
   ---------------------------------------------------------- */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
ul.products li.product,
.product-grid-item,
.wc-block-grid__product {
    position: relative !important;
    overflow: visible !important;
}

/* ----------------------------------------------------------
   HEART WRAP — Desktop: hidden by default, shown on hover
   ---------------------------------------------------------- */
.cw-heart-wrap {
    position: absolute !important;
    top: 8px !important;
    left: 8px !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 99 !important;
    line-height: 0 !important;
    opacity: 0 !important;
    transform: scale(0.7) !important;
    transition: opacity .18s ease, transform .18s ease !important;
    pointer-events: none !important;
}

/* Desktop hover triggers */
.woocommerce ul.products li.product:hover .cw-heart-wrap,
.woocommerce-page ul.products li.product:hover .cw-heart-wrap,
ul.products li.product:hover .cw-heart-wrap,
.product-grid-item:hover .cw-heart-wrap,
.wc-block-grid__product:hover .cw-heart-wrap,
a:hover > .cw-heart-wrap,
a:hover .cw-heart-wrap,
.woocommerce-LoopProduct-link:hover .cw-heart-wrap {
    opacity: 1 !important;
    transform: scale(1) !important;
    pointer-events: auto !important;
}

/* Always show when in wishlist */
.cw-heart-wrap.is-active {
    opacity: 1 !important;
    transform: scale(1) !important;
    pointer-events: auto !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.96) !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 — heart injected top-left by JS
   ---------------------------------------------------------- */
.woocommerce div.product .woocommerce-product-gallery,
.woocommerce div.product .woocommerce-product-gallery__image,
.woocommerce div.product .images {
    position: relative !important;
}
.cw-single-heart-wrap {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    right: auto !important;
    z-index: 99 !important;
    line-height: 0 !important;
    opacity: 0 !important;
    transform: scale(0.7) !important;
    transition: opacity .18s ease, transform .18s ease !important;
    pointer-events: none !important;
}
.woocommerce div.product .woocommerce-product-gallery:hover .cw-single-heart-wrap,
.woocommerce div.product .images: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;
}

/* ----------------------------------------------------------
   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; background: transparent; white-space: nowrap;
}

/* KEY FIX: All cells vertically centered */
.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;
}

/* Column widths */
.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; white-space: nowrap; }
.cw-col-remove { width: 100px; white-space: nowrap; }

/* Thumbnail */
.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 — left */
.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; }

/* Product name */
.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; }

/* Variation meta */
.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; }

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

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

/* ----------------------------------------------------------
   ISSUE 3 FIX: "Add to cart" and "Remove" button alignment
   Both are in the SAME row — they must be same height baseline
   ---------------------------------------------------------- */

/* Cart cell — plain text link */
.cw-td-cart {
    vertical-align: middle !important;
}
.cw-atc-btn-row,
.cw-atc-link {
    display: block !important;
    color: #333333 !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    font-family: inherit !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: color .18s !important;
    white-space: nowrap !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1.4 !important;
    text-align: left !important;
}
.cw-atc-btn-row:hover,
.cw-atc-link:hover { color: #e74c3c !important; }

/* Remove cell — black button */
.cw-td-remove {
    vertical-align: middle !important;
    padding-right: 0 !important;
}
.cw-remove-btn {
    display: inline-block !important;
    padding: 8px 16px !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;
    line-height: 1.2 !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 card layout
   ========================================================== */
@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
   
   Strategy: Use @media (hover: none) for CSS layer.
   JS layer adds inline style directly (bypasses Flatsome).
   The .cw-heart-wrap[style] rule ensures inline style wins.
   ========================================================== */

/* CSS layer — targets touch/mobile */
@media (hover: none), (pointer: coarse) {
    .cw-heart-wrap {
        opacity: 1 !important;
        transform: scale(1) !important;
        pointer-events: auto !important;
        visibility: visible !important;
    }
}

/* JS class layer — added by JS on touch devices */
body.cw-is-touch .cw-heart-wrap {
    opacity: 1 !important;
    transform: scale(1) !important;
    pointer-events: auto !important;
    visibility: visible !important;
}
