/**
 * WooCommerce Category-wise Product Display
 * File: /wp-content/themes/your-theme/woocommerce/category-products.css
 * Theme: Dark bg, purple/blue accent, rounded cards — matching your store style
 */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.cwp-shop-wrap {
    width: 100%;
    padding: 1.5rem 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #fff;
}

/* ── Top category filter buttons ─────────────────────────────────────────── */
.cwp-top-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 2rem;
}

.cwp-cat-btn {
    padding: 9px 22px;
    border-radius: 50px;
    border: 1.5px solid #444;
    background: transparent;
    color: #aaa;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    line-height: 1.4;
    letter-spacing: 0.3px;
}

.cwp-cat-btn:hover {
    border-color: #7B5CF0;
    color: #fff;
    background: rgba(123, 92, 240, 0.12);
}

.cwp-cat-btn.active {
    background: #7B5CF0;
    color: #fff;
    border-color: #7B5CF0;
}

/* ── Section (one main category) ─────────────────────────────────────────── */
.cwp-section {
    margin-bottom: 2.5rem;
}

.cwp-section-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1.2rem;
}

.cwp-cat-icon {
    font-size: 22px;
    line-height: 1;
}

.cwp-main-cat-label {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.2px;
}

.cwp-main-cat-tag {
    font-size: 11px;
    padding: 3px 10px;
    background: rgba(123, 92, 240, 0.2);
    color: #a78bfa;
    border-radius: 50px;
    font-weight: 500;
    border: 1px solid rgba(123, 92, 240, 0.3);
}

.cwp-view-all-link {
    margin-left: auto;
    font-size: 13px;
    color: #7B5CF0;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.cwp-view-all-link:hover {
    color: #a78bfa;
    text-decoration: underline;
}

/* ── Sub-category label ───────────────────────────────────────────────────── */
.cwp-sub-section {
    margin-bottom: 1.8rem;
}

.cwp-sub-cat-label {
    font-size: 13px;
    font-weight: 600;
    color: #bbb;
    margin-bottom: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.cwp-sub-cat-label::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 14px;
    border-radius: 2px;
    background: #7B5CF0;
    flex-shrink: 0;
}

/* ── Product grid ─────────────────────────────────────────────────────────── */
.cwp-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 20px;
}

/* ── Product card — dark style matching screenshot ───────────────────────── */
.cwp-product-card {
    background: #1a1a2e;
    border: 1.5px solid #2a2a4a;
    border-radius: 16px;
    overflow: visible;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.cwp-product-card:hover {
    border-color: #7B5CF0;
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(123, 92, 240, 0.25);
}

.cwp-product-link {
    text-decoration: none;
    color: inherit;
    flex: 1;
}

/* ── Product image area ───────────────────────────────────────────────────── */
.cwp-product-img {
    width: calc(100% - 20px);
    margin: 10px 10px 0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cwp-product-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.28s ease;
    padding: 8px;
}

.cwp-product-card:hover .cwp-product-img img {
    transform: scale(1.04);
}

/* ── Product info ─────────────────────────────────────────────────────────── */
.cwp-product-info {
    padding: 14px 14px 4px;
}

.cwp-product-name {
    font-size: 14px;
    font-weight: 500;
    color: #f0f0f0;
    margin-bottom: 8px;
    line-height: 1.45;
    min-height: 2.9em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cwp-product-price {
    font-size: 16px;
    font-weight: 700;
    color: #7B5CF0;
    margin-bottom: 12px;
}

/* WooCommerce price HTML — sale price style */
.cwp-product-price .woocommerce-Price-amount {
    color: #7B5CF0;
}

.cwp-product-price del {
    color: #666;
    font-size: 13px;
    font-weight: 400;
    margin-right: 6px;
}

.cwp-product-price del .woocommerce-Price-amount {
    color: #666;
}

.cwp-product-price ins {
    text-decoration: none;
    color: #7B5CF0;
}

/* ── Sale badge — green circle top-right like screenshot ─────────────────── */
.cwp-sale-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #6abf4b;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* New badge */
.cwp-new-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 50px;
    background: #7B5CF0;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    z-index: 2;
}

/* ── Quantity stepper ─────────────────────────────────────────────────────── */
.cwp-qty-wrap {
    display: flex;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0;
    margin: 0 auto 10px;
    height: 36px;
    width: auto;
    max-width: 130px;
}

/* Hard reset — fight theme button overrides */
.cwp-product-card .cwp-qty-btn,
.cwp-product-card .cwp-qty-btn:before,
.cwp-product-card .cwp-qty-btn:after {
    all: unset;
    box-sizing: border-box;
}

.cwp-qty-btn {
    width: 32px !important;
    height: 36px !important;
    min-width: 32px;
    max-width: 32px;
    border: 1.5px solid #444 !important;
    background: #1a1a2e !important;
    color: #ccc !important;
    font-size: 16px;
    line-height: 36px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    flex-grow: 0;
    padding: 0;
    box-sizing: border-box;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.cwp-qty-btn.cwp-qty-minus {
    border-radius: 6px 0 0 6px !important;
    border-right: none !important;
    padding: 3px 10px;
}

.cwp-qty-btn.cwp-qty-plus {
    border-radius: 0 6px 6px 0 !important;
    border-left: none !important;
    padding: 3px 11px 0 11px;
}

.cwp-qty-btn:hover {
    background: #2a2a4a !important;
    border-color: #7B5CF0 !important;
    color: #a78bfa !important;
}

.cwp-qty-input {
    width: 44px !important;
    height: 36px !important;
    border: 1.5px solid #444 !important;
    border-left: none !important;
    border-right: none !important;
    background: #1a1a2e !important;
    color: #fff !important;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    outline: none;
    -moz-appearance: textfield;
    box-sizing: border-box;
    flex-shrink: 0;
    padding: 0;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.cwp-qty-input::-webkit-outer-spin-button,
.cwp-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ── Add to Cart button — full width purple ───────────────────────────────── */
.cwp-add-to-cart {
    display: block;
    width: calc(100% - 28px);
    margin: 0 14px 14px;
    padding: 9px 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    border: none;
    background: #7B5CF0;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.12s ease;
    text-align: center;
    line-height: 1.3;
    box-sizing: border-box;
}

.cwp-add-to-cart:hover {
    background: #6d4ee0;
    transform: translateY(-1px);
}

.cwp-add-to-cart:active {
    transform: translateY(0);
}

.cwp-add-to-cart.loading {
    opacity: 0.65;
    pointer-events: none;
}

.cwp-add-to-cart.added {
    background: #4caf50;
}

/* ── Dividers ─────────────────────────────────────────────────────────────── */
.cwp-divider {
    border: none;
    border-top: 1px solid #2a2a3a;
    margin: 1.4rem 0;
}

.cwp-section-divider {
    border: none;
    border-top: 1px solid #2a2a3a;
    margin: 2.2rem 0;
}

/* ── Loading state ────────────────────────────────────────────────────────── */
.cwp-content.is-loading {
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* ── Fade in ──────────────────────────────────────────────────────────────── */
@keyframes cwpFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cwp-fade-in {
    animation: cwpFadeIn 0.28s ease both;
}

/* ── No products ──────────────────────────────────────────────────────────── */
.cwp-no-products {
    font-size: 13px;
    color: #666;
    padding: 0.5rem 0;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media ( max-width: 900px ) {
    .cwp-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
        gap: 16px;
    }
}

@media ( max-width: 600px ) {
    .cwp-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .cwp-product-img {
        height: 150px;
    }

    .cwp-top-bar {
        gap: 8px;
    }

    .cwp-cat-btn {
        font-size: 12px;
        padding: 7px 14px;
    }
}