/* ==========================================================================
   TopLog VariaPro — Frontend Styles (Shoptimizer compatible)
   Version: 1.2.0
   ========================================================================== */

/* ==========================================================================
   1. GRID — Hide WC variation form / swatcher for variable products
   The badges handle variation display, no need for WC's ugly form in grid
   ========================================================================== */

/* Hide the WC default variable add-to-cart form in product grid */
ul.products li.product form.variations_form,
ul.products li.product .variations_form,
ul.products li.product .woocommerce-variation-add-to-cart,
ul.products li.product .woocommerce-variation,
ul.products li.product form.cart .variations {
    display: none !important;
}

/* Hide any swatcher/variation buttons rendered by plugins in the grid */
ul.products li.product .ccecom-swatchers,
ul.products li.product .ccecom-woo-swatchers,
ul.products li.product .swatch-wrapper,
ul.products li.product .variation-swatches,
ul.products li.product .tawcvs-swatches {
    display: none !important;
}

/* ==========================================================================
   2. GRID — "de la" price label
   ========================================================================== */
.tvp-price-from {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
}

.tvp-price-from__label {
    font-size: 0.7em;
    font-weight: 500;
    color: #777;
    text-transform: lowercase;
    letter-spacing: 0.02em;
}

ul.products li.product .tvp-price-from .woocommerce-Price-amount {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

ul.products li.product .tvp-price-from del {
    font-size: 0.8em;
    color: #999;
}

ul.products li.product .tvp-price-from ins {
    background: transparent;
    text-decoration: none;
}

/* ==========================================================================
   3. GRID — Variation Badges (liter/capacity tags)
   ========================================================================== */
.tvp-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    margin-bottom: 4px;
    margin-left: 4px;
    margin-right: 44px;  /* Keep clear of arrow button (34px + 10px gap) */
    max-width: 100%;  /* Never wider than parent card */
    overflow: hidden;  /* Clip any badges that somehow overflow */
}

.tvp-badge {
    display: inline-block;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 600;
    font-family: 'Gilroy', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.4;
    color: #333;
    background: #f3f3f3;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.tvp-badge:hover {
    background: #ffc222;
    border-color: #ffc222;
    color: #1e1d23;
}

.tvp-badge--oos {
    color: #aaa;
    background: #fafafa;
    border-color: #eee;
    text-decoration: line-through;
}

.tvp-badge--oos:hover {
    background: #fafafa;
    border-color: #eee;
    color: #aaa;
}

.tvp-badge--more {
    color: #777;
    background: transparent;
    border-color: #ddd;
    font-weight: 700;
    cursor: default;
}

@media (max-width: 992px) {
    .tvp-badges {
        margin-top: 4px;
        margin-left: 0;
        margin-right: 0;
    }

    .tvp-badge {
        font-size: 9px;
        padding: 1px 5px;
    }
}

/* ==========================================================================
   4. SINGLE PRODUCT — Hide duplicate variation price & attribute labels
   When VariaPro is active (tvp-single-active class added by JS),
   hide the WC variation price so only the main .price shows.
   Also hide the attribute label row (e.g. "Attribute Name: No selection")
   since VariaPro handles title/variation display.
   ========================================================================== */

/* Hide the variation price container inside the form (prevents 2x price) */
.tvp-single-active .woocommerce-variation-price {
    display: none !important;
}

/* Hide the WC / CommerceKit attribute label text above swatches
   (e.g. "PRODUCT NAME 2MC / 2000L: No selection")
   The variation title is already in the h1, no need for the raw attribute label */
.tvp-single-active .variations .label,
.tvp-single-active .variations td.label,
.tvp-single-active .variations th.label {
    display: none !important;
}

/* Hide "Clear" / reset link — TVP always preselects a variation */
.tvp-single-active .variations .reset_variations {
    display: none !important;
}

/* Ensure the main price is visible and styled */
.tvp-single-active .summary > .price,
.tvp-single-active .summary .product-page-price .price {
    display: block !important;
}

/* ==========================================================================
   5. SINGLE PRODUCT — Title animation on variation change
   ========================================================================== */
.product_title.tvp-title-changing {
    animation: tvp-title-fade 0.35s ease;
}

@keyframes tvp-title-fade {
    0%   { opacity: 0.4; transform: translateY(-3px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   6. SEO Navigation — Crawlable but visually hidden (screen-reader only)
   ========================================================================== */
.tvp-seo-nav {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tvp-seo-nav .tvp-seo-link {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

/* ==========================================================================
   7. Related/Upsells — Hide badges (compact cards)
   ========================================================================== */
.related.products .tvp-badges,
.upsells.products .tvp-badges {
    display: none;
}
