/* 
 * TruthForge Nuclear — SHARED GRAD PARITY SYSTEM
 * This file governs ALL product grids across the entire site (Home, Shop, Archives).
 * To ensure 100% visual parity, do NOT define grid styles elsewhere.
 */

:root {
    --tf-card-radius: 4px; /* Tightened from 12px for Nuclear Parity */
    --tf-grid-gap: 24px;
    --tf-grid-gap-mobile: 12px;
}

/* 1. THE SHARED GRID ENGINE — ABSOLUTE NUCLEAR PARITY */
.truth-product-grid,
.woocommerce ul.products:not(.list),
.woocommerce-page ul.products:not(.list),
.archive.taxonomy-product_cat ul.products:not(.list),
.post-type-archive-product ul.products:not(.list) {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important; /* FORCED 3-COLUMN ABSOLUTE PARITY */
    gap: var(--tf-grid-gap) !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.woocommerce ul.products::before,
.woocommerce ul.products::after {
    display: none !important;
}

/* Remove WC float legacy */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
    width: 100% !important;
    margin: 0 !important;
    float: none !important;
    list-style: none !important;
}

/* Responsive Grid Control */
@media (max-width: 1200px) {
    .truth-product-grid,
    .woocommerce ul.products,
    .woocommerce-page ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}


@media (max-width: 768px) {
    .truth-product-grid,
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    .archive.taxonomy-product_cat ul.products,
    .post-type-archive-product ul.products {
        grid-template-columns: 1fr !important; /* HOMEPAGE MASTER PARITY: 1-COL STRICT */
        gap: var(--tf-mobile-space-xl, 32px) !important; /* MASTER 32PX GAP */
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        justify-items: center !important;
    }

    .woocommerce ul.products li.product,
    .woocommerce-page ul.products li.product {
        width: 100% !important;
        margin: 0 !important;
        float: none !important;
        max-width: none !important;
    }
}

/* NUCLEAR MOBILE HARDENING: STRICT QUALITY PASS (320px - 480px) */
@media (max-width: 480px) {
    .truth-product-grid,
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    .archive.taxonomy-product_cat ul.products,
    .post-type-archive-product ul.products {
        grid-template-columns: 1fr !important; /* FORCED 1-COL ABSOLUTE PARITY */
        gap: var(--tf-mobile-space-xl) !important; /* 32px Master Gap */
    }

    /* Scaling fix for giant titles */
    .truth-heading.shop-title {
        font-size: clamp(2rem, 12vw, 2.8rem) !important;
        line-height: 1.05 !important;
    }
}

/* 2. THE NUCLEAR PRODUCT CARD COMPONENT */
.nuclear-product-card {
    background: #000;
    position: relative;
    border-radius: var(--tf-card-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    text-align: left; /* FOrcing Absolute Parity with Home */
    border: 1px solid rgba(255,255,255,0.08); /* Subtle card boundaries */
    transition: border-color 0.3s ease;
}

.nuclear-product-card:hover {
    border-color: rgba(255,255,255,0.15);
}

.card-image-wrapper {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #0a0a0a;
    overflow: hidden;
    margin-bottom: 8px;
    border-radius: var(--tf-card-radius); /* Ensure inner image is rounded per brand */
}

.card-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nuclear-product-card:hover .card-main-image {
    transform: scale(1.05);
}

/* Badge System — Parity across Home & Shop */
.card-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    padding: 6px 12px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 4px;
    z-index: 10;
}

.card-badge.badge-white {
    background: #fff;
    color: #000;
}

.card-badge.badge-purple {
    background: #7c3aed; /* var(--tf-brand-primary) fallback */
    background-color: #7c3aed;
    color: #fff !important;
}

.card-badge.badge-black {
    background: #000;
    color: #fff;
}

.card-badge.badge-yellow {
    background: #facc15;
    color: #000;
}

/* Laser Scan Effect */
.laser-scan-overlay {
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        transparent 0%,
        rgba(124, 58, 237, 0) 45%,
        rgba(124, 58, 237, 0.6) 50%,
        rgba(124, 58, 237, 0) 55%,
        transparent 100%
    );
    z-index: 5;
    pointer-events: none;
}

.nuclear-product-card:hover .laser-scan-overlay {
    animation: laserScan 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes laserScan {
    0% { top: -100%; }
    100% { top: 100%; }
}

/* 3. INTERACTION OVERLAY SYSTEM */
.card-interaction-overlay {
    position: absolute;
    bottom: 0px;
    left: 0;
    right: 0;
    padding: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(100%);
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 20;
    background: linear-gradient(to top, rgba(0,0,0,0.4) 0%, transparent 100%);
}

.nuclear-product-card:hover .card-interaction-overlay {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

.interaction-buttons {
    display: flex;
    gap: 8px;
    width: 100%;
}

/* Component Buttons Shared Styles */
.interaction-buttons a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
}

/* QUICK VIEW Button Parity */
.interaction-buttons .btn-nuke-quickview,
.btn-nuke-quickview {
    flex: 1 !important;
    background: #ffffff !important;
    color: #000000 !important;
    height: 44px !important;
    padding: 0 16px !important; /* Generous horizontal padding */
    text-decoration: none !important;
    gap: 8px !important; /* SPACING: gap between eye icon and QUICK VIEW text */
}

.interaction-buttons .btn-nuke-quickview span,
.interaction-buttons .btn-nuke-quickview svg,
.btn-nuke-quickview span,
.btn-nuke-quickview svg {
    color: #000000 !important;
    stroke: currentColor;
}

.interaction-buttons .btn-nuke-quickview:hover,
.btn-nuke-quickview:hover {
    background: #f3f4f6 !important;
    transform: translateY(-2px) !important;
}

/* ADD TO CART Button Parity - THE MINIMAL BAG: icon-only on desktop */
.btn-nuke-addcart {
    width: 44px !important;
    min-width: 44px !important; /* Prevent flex shrink */
    height: 44px !important;
    flex: 0 0 44px !important; /* FIXED: must not grow, must not shrink */
    background: #7c3aed !important; /* Brand Purple */
    color: #ffffff !important;
    padding: 0 !important;
}

/* Hide the text label on desktop — icon only */
.btn-nuke-addcart .atc-text-mobile {
    display: none; /* Removed !important to allow easier responsive overrides */
}

.btn-nuke-addcart:hover {
    background: #8b5cf6 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 0 15px rgba(124, 58, 237, 0.5) !important;
}

/* 4. FOOTER & METADATA PARITY */
.card-footer-nuclear {
    padding: 0 4px;
}

.card-meta-line {
    display: block;
    font-size: 10px;
    font-weight: 950;
    letter-spacing: 0.15em;
    color: #7c3aed; /* Brand Purple parity */
    margin-bottom: 4px;
    text-transform: uppercase;
}

.card-product-title {
    font-family: 'Inter', sans-serif !important;
    font-weight: 900 !important;
    font-style: italic !important;
    font-size: 18px !important;
    text-transform: uppercase !important;
    color: #fff !important;
    margin: 0 0 12px 0 !important; /* Reduced from 16px */
    letter-spacing: 0.02em !important;
    line-height: 1.1 !important; /* Tighter line height */
    
    /* FIX: Force 2-line height for absolute grid alignment */
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    height: 40px !important; 
}

.card-price-value {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.05em;
}

/* 5. MOBILE LOCKDOWN OVERRIDES — GOD MODE PARITY */
@media (max-width: 768px) {
    .card-interaction-overlay {
        display: none !important; /* HIDDEN ON MOBILE: ATC is moved below price */
    }

    .interaction-buttons {
        display: flex !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .btn-nuke-quickview {
        display: none !important; /* KILL: Too much friction for mobile grid parity */
    }

    /* SPECIFIC LOCKDOWN: Related Products context often overrides shared grids */
    .interaction-buttons a.btn-nuke-quickview,
    .shop-products-section-total-grid .btn-nuke-quickview,
    .related.products .btn-nuke-quickview,
    .upsells.products .btn-nuke-quickview,
    .cross-sells.products .btn-nuke-quickview {
        display: none !important;
        width: 0 !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    .btn-nuke-addcart {
        width: 100% !important; 
        flex: 1 1 100% !important;
        height: 44px !important;
        border-radius: 6px !important; /* Standard brand radius */
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        margin: 0 !important;
    }

    /* Force 100% for related context too */
    .shop-products-section-total-grid .btn-nuke-addcart,
    .related.products .btn-nuke-addcart,
    .upsells.products .btn-nuke-addcart {
        width: 100% !important;
        flex: 1 1 100% !important;
        display: flex !important;
    }

    .btn-nuke-addcart .atc-text-mobile {
        display: flex !important; /* FORCED OVERRIDE: Show label on mobile */
        margin-left: 0 !important;
        font-size: 14px !important;
        font-weight: 800 !important;
        letter-spacing: 0.1em !important;
        text-transform: uppercase !important;
        line-height: 1 !important;
        justify-content: center !important;
        align-items: center !important;
    }

    .btn-nuke-addcart svg {
        display: none !important; /* KILL: Just use text label on mobile */
    }

    /* NUCLEAR: Force card footer to be a full-width flex column on mobile */
    .nuclear-product-card,
    .nuclear-product-card.mode-grid {
        align-items: stretch !important; /* CRITICAL: stops flex children from shrinking */
    }

    .card-content-wrapper-nuke {
        width: 100% !important;
        align-self: stretch !important;
    }

    .card-footer-nuclear {
        padding: 0 var(--tf-container-px-small) !important;
        width: 100% !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important; /* CRITICAL: stretch children to full width */
    }

    /* ONE GLOBAL RULE — MOBILE ATC BUTTON */
    /* Applies to: Shop, Homepage, Category Archives, Cross-sells, Related Products */
    .mobile-atc-wrapper {
        display: block !important;
        width: 100% !important;
        align-self: stretch !important;
        box-sizing: border-box !important;
        margin: 16px 0 0 !important;
    }
    
    .btn-nuke-addcart-mobile {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        height: 48px !important;
        min-height: 48px !important;
        box-sizing: border-box !important;
        background: #7c3aed !important;
        color: #fff !important;
        font-size: var(--tf-font-body-mobile) !important;
        font-weight: 800 !important;
        letter-spacing: var(--tf-ls-utility) !important;
        text-transform: uppercase !important;
        border-radius: 4px !important;
        text-decoration: none !important;
        transition: all 0.3s ease !important;
        padding: 0 !important;
    }
    
    .btn-nuke-addcart-mobile:hover, .btn-nuke-addcart-mobile.loading, .btn-nuke-addcart-mobile.added {
        background: #8b5cf6 !important;
        opacity: 0.9 !important;
    }
    
    .btn-nuke-addcart-mobile .added_to_cart, .btn-nuke-addcart-mobile::after, .btn-nuke-addcart-mobile::before, .btn-nuke-addcart-mobile .loading-spinner {
        display: none !important;
    }
}

.mobile-atc-wrapper {
    display: none; /* Default hidden on desktop */
}

/* ============================================================
 * 6. WOOCOMMERCE AJAX STATE CLEANUP — NUCLEAR LEVEL
 * WC injects <a class="added_to_cart wc-forward">View cart</a>
 * as a sibling inside .interaction-buttons after AJAX add to cart.
 * This is the black box. Kill it with extreme prejudice.
 * ============================================================ */

/* NUCLEAR KILL — All possible selectors for the WC View Cart link */
a.added_to_cart,
a.added_to_cart.wc-forward,
.interaction-buttons a.added_to_cart,
.interaction-buttons a.wc-forward,
.btn-nuke-addcart + a,
.btn-nuke-addcart ~ a.added_to_cart,
.card-interaction-overlay a.added_to_cart,
.nuclear-product-card a.added_to_cart,
li.product a.added_to_cart {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
    border: none !important;
    background: none !important;
    font-size: 0 !important;
    line-height: 0 !important;
    clip: rect(0,0,0,0) !important;
}

/* Suppress WC button feedback states that break layout */
.btn-nuke-addcart::after,
.btn-nuke-addcart::before,
.btn-nuke-addcart .loading-spinner {
    display: none !important;
    content: none !important;
}

/* Visual feedback on .loading / .added — no layout change, only color */
.btn-nuke-addcart.loading,
.btn-nuke-addcart.added {
    background: #8b5cf6 !important;
    opacity: 0.85 !important;
    pointer-events: none !important;
    transform: none !important;
}

/* ============================================================
 * 7. SUCCESS TOAST — Cart Confirmation Notification
 * ============================================================ */
#tf-cart-success-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1a1a1a;
    color: #fff;
    border: 1px solid rgba(124, 58, 237, 0.4);
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(124, 58, 237, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 99999;
    pointer-events: none;
}

#tf-cart-success-toast svg {
    color: #7c3aed;
    flex-shrink: 0;
}

#tf-cart-success-toast.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
 * 8. NUCLEAR RECOMMENDATIONS SYSTEM (Global Parity)
 * This governs all cross-sell sections (Cart, Related, Upsells)
 * ============================================================ */

.tf-cart-recommendations {
    width: 100% !important;
    display: block !important;
    clear: both !important;
    margin-top: 60px !important;
    padding-top: 40px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.rec-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 24px !important;
    padding: 0 4px !important;
}

.rec-header-left {
    display: flex !important;
    flex-direction: column !important;
}

.rec-eyebrow-wrapper {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 4px !important;
}

.eyebrow-line {
    display: block !important;
    width: 40px !important;
    height: 2px !important;
    background: #7c3aed !important; /* Brand Purple */
    flex-shrink: 0 !important;
}

.rec-eyebrow {
    font-size: 10px !important;
    font-weight: 900 !important;
    color: #7c3aed !important;
    letter-spacing: 0.4em !important;
    text-transform: uppercase !important;
}

.rec-title {
    font-family: 'Oswald', sans-serif !important;
    font-size: clamp(24px, 5vw, 40px) !important;
    font-weight: 950 !important;
    font-style: italic !important;
    text-transform: uppercase !important;
    margin: 0 !important;
    line-height: 1.1 !important;
    color: #fff !important;
}

.purple-accent {
    color: #7c3aed !important;
}

.rec-see-all {
    font-size: 11px !important;
    font-weight: 950 !important;
    color: rgba(255, 255, 255, 0.4) !important;
    text-decoration: none !important;
    letter-spacing: 0.2em !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    transition: all 0.3s ease !important;
}

.rec-see-all:hover {
    color: #fff !important;
    transform: translateX(8px) !important;
}

.tf-cart-recommendations-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 24px !important;
    margin-top: 32px !important;
}

@media (max-width: 1024px) {
    .tf-cart-recommendations-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .tf-cart-recommendations {
        margin-top: 40px !important;
        padding-top: 20px !important;
    }

    .tf-cart-recommendations-grid {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
        padding: 0 !important;
    }

    .rec-header {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 16px !important;
    }

    .rec-eyebrow-wrapper {
        justify-content: center !important;
    }

    .rec-title {
        font-size: 28px !important;
        white-space: normal !important;
    }
}
