/* =============================================================
   WooCommerce Catalog Loop — Variations + Qty + Add to Cart
   File: your-theme/assets/css/catalog-loop.css
   ============================================================= */

/* ── 5 products per row ────────────────────────────────────── */
.woocommerce ul.products.columns-5,
.woocommerce-page ul.products.columns-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.woocommerce ul.products.columns-5 li.product,
.woocommerce-page ul.products.columns-5 li.product {
    width: auto !important;
    margin: 0 !important;
    float: none !important;
}

@media (max-width: 1024px) {
    .woocommerce ul.products.columns-5,
    .woocommerce-page ul.products.columns-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ── Mobile: 1 product per row (Flatsome grid override) ────── */
@media (max-width: 549px) {
    .box-text.box-text-products {
        text-align: center !important;
    }

    /* Flatsome renders: div.products.row.small-columns-2 > div.col  */
    .products.row[class*="small-columns-"] > .col {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Stack qty below the size dropdown */
    .clv-inline-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .clv-inline-row .clv-qty-wrap {
        margin-top: 6px;
    }
}

.clv-wrap {
    margin-top: 6px;
    padding: 0 8px 8px;
    text-align: center;
}

.clv-size-btns,
.clv-qty-wrap {
    justify-content: center;
}

/* ── Light gray border around each product card (incl. clv-wrap) */
.products.row > .col .col-inner {
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
}

.products.row > .col .col-inner .product-small.box {
    border: none;
}

/* ── Hide Flatsome's default add-to-cart button ────────────── */
.add-to-cart-button {
    display: none !important;
}

/* ── Subcategory buttons (shown on cat 229 only) ───────────── */
.clv-subcats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
    justify-content: center;
}

.clv-subcat-btn {
    display: inline-block;
    padding: 8px 16px;
    border: 2px solid #333;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s;
}

.clv-subcat-btn:hover {
    background: #333;
    color: #fff;
}

/* ── Attribute group (label + size buttons) ────────────────── */
.clv-attr-group {
    margin-bottom: 6px;
}

.clv-attr-label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
}

.clv-size-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.clv-size-btn {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: #333;
    background: #fff;
    border: 1.5px solid #d0d0d0;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
    line-height: 1.4;
}

.clv-size-btn:hover {
    border-color: #2b7de9;
    color: #2b7de9;
}

.clv-size-btn.is-active {
    background: #2b7de9;
    border-color: #2b7de9;
    color: #fff;
}

/* ── Variation price ───────────────────────────────────────── */
.clv-variation-price {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    text-align: center;
}

.clv-variation-price:empty {
    display: none;
}

/* ── Quantity wrapper ──────────────────────────────────────── */
.clv-qty-wrap-row {
    display: flex;
    justify-content: center;
    margin-bottom: 6px;
}

.clv-qty-wrap {
    display: inline-flex;
    align-items: stretch;
    border: 1.5px solid #d0d0d0;
    border-radius: 50px;
    overflow: hidden;
    flex-shrink: 0;
    margin-bottom: 0;
    background: #fff;
    height: 40px;
}

.clv-qty-btn {
background: transparent;
    border: none;
    width: 40px;
    flex-shrink: 0;
    font-size: 29px;
    font-weight: 400;
    color: #2b7de9;
    cursor: pointer;
    display: flex;
    justify-content: center;
    line-height: 1.14;
    padding: 0px 10px 0px 10px;
    user-select: none;
    transition: color .15s;
    flex-direction: row;
    align-content: stretch;
    text-align: center;
    margin: 0px;
}

.clv-qty-btn:hover {
    color: #1a5fbf;
    background: transparent;
}

.clv-qty {
    width: 44px;
    text-align: center;
    border: none;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    padding: 0;
    font-size: 15px;
    font-weight: 500;
    background: transparent;
    height: 100%;
    line-height: 40px;
    display: block;
    -moz-appearance: textfield;
}

.clv-qty::-webkit-outer-spin-button,
.clv-qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

/* ── Add to Cart button ────────────────────────────────────── */
.clv-atc {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 2px;
    font-size: 13px;
    cursor: pointer;
    transition: opacity .2s;
}

.clv-atc:disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Status message ────────────────────────────────────────── */
.clv-msg {
    font-size: 13px;
    line-height: 1.4;
}

.clv-msg:empty {
    display: none;
}

.clv-msg:not(:empty) {
    margin-top: 8px;
}

.clv-msg.success {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #eafaf1;
    border: 1px solid #a9dfbf;
    border-radius: 4px;
    padding: 7px 10px;
    color: #1e8449;
    font-weight: 600;
}

.clv-msg.success a {
    margin-left: auto;
    font-size: 12px;
    color: #1e8449;
    text-decoration: underline;
    white-space: nowrap;
}

.clv-msg.success a:hover {
    color: #145a32;
}

.clv-msg.error {
    background: #fdedec;
    border: 1px solid #f1948a;
    border-radius: 4px;
    padding: 7px 10px;
    color: #c0392b;
}

.clv-msg.loading { color: #888; }

/* ── Button spinner ────────────────────────────────────────── */
.clv-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: clv-spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 5px;
}

@keyframes clv-spin {
    to { transform: rotate(360deg); }
}