/**
 * Single Product — Final Layer (v1.4.9)
 *
 * Card markup is now fully owned (template-parts/product/card.php), so this
 * file styles our own BEM classes instead of fighting Ecomus's card DOM.
 *
 * Covers:
 *   1. Icon buttons (wishlist + share)
 *   2. Grand Total value visibility
 *   3. Shelf sections (Related / Recently Viewed)
 *   4. Luxury product card
 *   5. Footer gap fix (single product page only)
 */

/* =====================================================================
 * 1. ICON BUTTONS
 * =================================================================== */

body.jw-single-product .jw-summary__actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-left: auto;
}
body.jw-single-product .jw-icon-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0 !important;
    background: #fff !important;
    border: 1px solid var(--jw-charcoal-10) !important;
    border-radius: 50%;
    color: var(--jw-charcoal-70);
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(26,26,26,0.04);
    transition: all 250ms var(--jw-ease);
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    line-height: 0;
}
body.jw-single-product .jw-icon-btn svg {
    width: 20px !important;
    height: 20px !important;
    display: block;
    pointer-events: none;
}
body.jw-single-product .jw-icon-btn:hover {
    background: var(--jw-charcoal) !important;
    color: #fff;
    border-color: var(--jw-charcoal) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(26,26,26,0.18);
}
body.jw-single-product .jw-icon-btn:focus-visible {
    outline: 2px solid var(--jw-champagne) !important;
    outline-offset: 3px !important;
}
body.jw-single-product .jw-icon-btn.is-loading {
    cursor: wait;
    pointer-events: none;
}
body.jw-single-product .jw-icon-btn.is-loading::after {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 2px solid rgba(26,26,26,0.15);
    border-top-color: var(--jw-champagne);
    animation: jwBtnSpin 700ms linear infinite;
}
@keyframes jwBtnSpin { to { transform: rotate(360deg); } }

body.jw-single-product .jw-wishlist-btn.is-active {
    background: linear-gradient(135deg, #A94540 0%, #7C2D2A 100%) !important;
    color: #fff !important;
    border-color: #7C2D2A !important;
    box-shadow: 0 4px 14px rgba(124,45,42,0.30);
    animation: jwHeartPop 380ms var(--jw-ease);
}
body.jw-single-product .jw-wishlist-btn.is-active:hover {
    background: linear-gradient(135deg, #7C2D2A 0%, #5E1E1B 100%) !important;
    border-color: #5E1E1B !important;
}
@keyframes jwHeartPop {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.18); }
    100% { transform: scale(1); }
}
body.jw-single-product .jw-wishlist-btn .jw-heart--filled { display: none; }
body.jw-single-product .jw-wishlist-btn.is-active .jw-heart--outline { display: none; }
body.jw-single-product .jw-wishlist-btn.is-active .jw-heart--filled { display: block; }
body.jw-single-product .jw-share-btn:hover {
    background: var(--jw-champagne) !important;
    border-color: var(--jw-champagne) !important;
    color: #fff;
}

/* =====================================================================
 * 2. GRAND TOTAL
 * =================================================================== */

body.jw-single-product .jw-breakup-table__row-total td {
    background: linear-gradient(135deg, #1A1A1A 0%, #2a2a2a 100%) !important;
    color: #fff !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
body.jw-single-product .jw-breakup-table__row-total td:first-child {
    color: #fff !important;
    font-family: var(--jw-font-serif);
    font-size: 20px;
    font-weight: 500;
    padding: 22px 20px !important;
}
body.jw-single-product .jw-breakup-table__value--final {
    background: none !important;
    background-image: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
    -webkit-text-fill-color: initial !important;
    color: #E8C476 !important;
    font-family: var(--jw-font-serif) !important;
    font-size: 26px !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    padding: 22px 20px !important;
    text-align: right !important;
}

/* =====================================================================
 * 3. SHELF SECTIONS (Related / Recently Viewed)
 * =================================================================== */

.jw-shelf {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    background: linear-gradient(180deg, #FFFFFF 0%, var(--jw-ivory) 100%);
    padding: 64px clamp(16px, 4vw, 40px) 72px;
}
.jw-shelf--recent {
    background: linear-gradient(180deg, var(--jw-ivory) 0%, #FFFFFF 100%);
    /* No bottom gap before footer */
    padding-bottom: 80px;
}
.jw-shelf::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--jw-champagne), transparent);
}

.jw-shelf__inner {
    max-width: 1240px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 44px;
}

.jw-shelf__head {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px;
    text-align: center;
}
.jw-shelf__eyebrow {
    margin: 0 !important;
    padding: 0 !important;
    font-family: var(--jw-font-sans);
    font-size: 11px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--jw-champagne-d);
    font-weight: 700;
    line-height: 1;
}
.jw-shelf__title {
    margin: 0 !important;
    padding: 0 0 14px !important;
    position: relative;
    display: inline-block;
    font-family: var(--jw-font-serif);
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 500;
    color: var(--jw-charcoal);
    letter-spacing: -0.01em;
    line-height: 1.1;
}
.jw-shelf__title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 42px;
    height: 2px;
    background: linear-gradient(90deg, var(--jw-champagne-l), var(--jw-champagne));
    border-radius: 2px;
}

/* =====================================================================
 * 4. CARD GRID + LUXURY CARD (owned markup)
 * =================================================================== */

ul.jw-card-grid {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 28px;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
}
ul.jw-card-grid::before,
ul.jw-card-grid::after { display: none !important; content: none !important; }

li.jw-card {
    flex: 0 1 calc(25% - 21px);
    min-width: 210px;
    max-width: 290px;
    display: flex;
    flex-direction: column;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #FFFFFF;
    border: 1px solid var(--jw-charcoal-10);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(26,26,26,0.03);
    transition: transform 420ms var(--jw-ease), box-shadow 420ms var(--jw-ease), border-color 300ms var(--jw-ease);
}
li.jw-card:hover {
    transform: translateY(-6px);
    border-color: rgba(184,147,90,0.35);
    box-shadow: 0 24px 48px rgba(26,26,26,0.09), 0 6px 16px rgba(184,147,90,0.08);
}

/* Media — 1:1, absolutely stacked images, crossfade on hover */
.jw-card__media {
    display: block;
    position: relative;
    aspect-ratio: 1 / 1;
    width: 100%;
    overflow: hidden;
    background: var(--jw-ivory);
    text-decoration: none;
}
.jw-card__img {
    position: absolute !important;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    transition: transform 800ms var(--jw-ease), opacity 450ms var(--jw-ease);
}
.jw-card__img--hover { opacity: 0; }
li.jw-card:hover .jw-card__img--primary { transform: scale(1.06); }
li.jw-card:hover .jw-card__img--hover   { opacity: 1; transform: scale(1.06); }

/* Body */
.jw-card__body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 18px 18px 20px;
}
.jw-card__title {
    margin: 0 !important;
    padding: 0 !important;
    font-family: var(--jw-font-serif);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: -0.005em;
}
.jw-card__title a {
    color: var(--jw-charcoal);
    text-decoration: none;
    transition: color 250ms var(--jw-ease);
}
li.jw-card:hover .jw-card__title a { color: var(--jw-champagne-d); }

.jw-card__meta {
    margin: 0 !important;
    padding: 0 !important;
    font-family: var(--jw-font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--jw-charcoal-50);
    text-transform: uppercase;
}

.jw-card__price {
    margin: 6px 0 0 !important;
    padding: 0 !important;
    font-family: var(--jw-font-mono);
    font-size: 15px;
    font-weight: 700;
    color: var(--jw-charcoal);
    letter-spacing: 0.01em;
}
.jw-card__price .amount,
.jw-card__price .woocommerce-Price-amount {
    font-family: inherit !important;
    color: inherit !important;
    font-weight: inherit !important;
}
.jw-card__price del {
    color: var(--jw-charcoal-30);
    font-weight: 400;
    font-size: 12px;
    margin-right: 6px;
}
.jw-card__price ins {
    background: transparent;
    text-decoration: none;
    font-weight: 700;
    color: var(--jw-charcoal);
}

/* Kill any legacy shelf markup from earlier hotfixes */
body.jw-single-product .jw-related-wrap,
body.jw-single-product .jw-recently-viewed-wrap,
body.jw-single-product .jw-related:not(.jw-shelf),
body.jw-single-product .jw-recently-viewed:not(.jw-shelf) {
    display: none !important;
}

/* =====================================================================
 * 5. FOOTER GAP FIX — single product page only
 *    The shelves are full-bleed; ensure zero dead space before footer
 *    and remove the parent theme's default bottom padding on this template.
 * =================================================================== */

body.jw-single-product .jw-product__below {
    padding: 0 !important;
}
body.jw-single-product .jw-product__below > :last-child {
    margin-bottom: 0 !important;
}

body.jw-single-product .site-content,
body.jw-single-product .site-main,
body.jw-single-product main,
body.jw-single-product #main,
body.jw-single-product .content-area,
body.jw-single-product .main-content {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}
body.jw-single-product .woocommerce-notices-wrapper:empty { display: none !important; }

/* Neutralize the parent theme's footer top spacing on this page */
body.jw-single-product .site-footer,
body.jw-single-product footer.footer,
body.jw-single-product .footer {
    margin-top: 0 !important;
}

/* =====================================================================
 * 6. RESPONSIVE
 * =================================================================== */

@media (max-width: 1024px) {
    li.jw-card { flex: 0 1 calc(33.333% - 19px); }
}
@media (max-width: 768px) {
    .jw-shelf { padding: 48px 16px 56px; }
    .jw-shelf__inner { gap: 32px; }
    ul.jw-card-grid { gap: 16px; }
    li.jw-card {
        flex: 0 1 calc(50% - 8px);
        min-width: 0;
        border-radius: 12px;
    }
    .jw-card__body { padding: 14px 14px 16px; gap: 4px; }
    .jw-card__title { font-size: 14px; }
    .jw-card__price { font-size: 13px; }
    body.jw-single-product .jw-icon-btn { width: 40px; height: 40px; }
    body.jw-single-product .jw-breakup-table__row-total td:first-child { font-size: 16px !important; }
    body.jw-single-product .jw-breakup-table__value--final { font-size: 20px !important; }
}

/* =====================================================================
 * Summary-header wishlist — WCBoost button styled as the round icon
 * button (replaces the old custom heart). Fixes the heavy black-circle
 * hover and gives a proper filled/active state.
 * =================================================================== */
body.jw-single-product .jw-summary__wishlist { display: inline-flex; }

body.jw-single-product .jw-summary__wishlist .wcboost-wishlist-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 0;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    border: 1px solid var(--jw-charcoal-10) !important;
    border-radius: 50% !important;
    color: var(--jw-charcoal-70) !important;
    box-shadow: 0 1px 3px rgba(26,26,26,0.04);
    transition: all 250ms var(--jw-ease);
    line-height: 0;
    text-indent: 0;
}
/* Icon-only: hide WCBoost's text label + tooltip bubble. */
body.jw-single-product .jw-summary__wishlist .wcboost-wishlist-button__text,
body.jw-single-product .jw-summary__wishlist .wcboost-wishlist-button::after,
body.jw-single-product .jw-summary__wishlist .wcboost-wishlist-button::before { display: none !important; }

body.jw-single-product .jw-summary__wishlist .wcboost-wishlist-button__icon,
body.jw-single-product .jw-summary__wishlist .wcboost-wishlist-button svg {
    width: 20px; height: 20px; display: block; margin: 0;
}
body.jw-single-product .jw-summary__wishlist .wcboost-wishlist-button svg { fill: none; stroke: currentColor; }

/* Hover — soft, not a heavy black disc. */
body.jw-single-product .jw-summary__wishlist .wcboost-wishlist-button:hover {
    background: #FBF3F2 !important;
    border-color: #C8A24B !important;
    color: #A94540 !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(26,26,26,0.12);
}

/* Added state — filled red heart, matching the old active look. */
body.jw-single-product .jw-summary__wishlist .wcboost-wishlist-button.wcboost-wishlist-button--added {
    background: linear-gradient(135deg, #A94540 0%, #7C2D2A 100%) !important;
    border-color: #7C2D2A !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(124,45,42,0.30);
}
body.jw-single-product .jw-summary__wishlist .wcboost-wishlist-button--added svg { fill: currentColor; stroke: currentColor; }
body.jw-single-product .jw-summary__wishlist .wcboost-wishlist-button--added:hover {
    background: linear-gradient(135deg, #7C2D2A 0%, #5E1E1B 100%) !important;
    border-color: #5E1E1B !important;
}
