/* ============================================================
   Custom Product Showcase — Public Styles v1.1
   ============================================================ */

/* ---- Wrapper ---- */
.cps-showcase {
    --cps-cols: 4;
    --cps-gap: 1px;
    --cps-border: #e0e0e0;
    --cps-text: #000000;
    --cps-price-color: #000000;
    --cps-plus-size: 34px;
    --cps-nav-size: 38px;
    --cps-img-size: 300px;   /* fixed image square */
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    width: 100%;
    position: relative;
    border: none;
    padding: 20px;
    box-sizing: border-box;
    /* background set inline from admin */
}

.cps-showcase.cps-cols-2 { --cps-cols: 2; }
.cps-showcase.cps-cols-3 { --cps-cols: 3; }
.cps-showcase.cps-cols-4 { --cps-cols: 4; }
.cps-showcase.cps-cols-5 { --cps-cols: 5; }

/* ---- Grid mode ---- */
.cps-grid-inner {
    display: grid;
    grid-template-columns: repeat(var(--cps-cols), 1fr);
    gap: 12px;
}

/* ---- Swiper mode ---- */
.cps-swiper {
    overflow: hidden;
    position: relative;
}

.cps-swiper .swiper-wrapper {
    display: flex;
    align-items: stretch;
}

/* ---- Product Card ---- */
.cps-product-card {
    border: 1px solid var(--cps-border);
    background: inherit;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s ease;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
}

.cps-product-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.10);
    z-index: 2;
}

/* ---- Product Image — fixed 300×300 ---- */
.cps-image-wrap {
    display: block;
    width: 100%;
    height: var(--cps-img-size);
    overflow: hidden;
    background: #f5f5f5;
    flex-shrink: 0;
}

.cps-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform .4s ease;
}

.cps-product-card:hover .cps-image-wrap img {
    transform: scale(1.05);
}

/* ---- Card footer: meta + add-to-cart side by side ---- */
.cps-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    gap: 8px;
    border-top: 1px solid var(--cps-border);
    background: inherit;
}

/* ---- Card Meta ---- */
.cps-card-meta {
    flex: 1;
    min-width: 0;
}

.cps-product-name {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--cps-text);
    text-decoration: none;
    line-height: 1.3;
    margin-bottom: 2px;
    letter-spacing: .04em;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cps-product-name:hover { text-decoration: underline; }

.cps-product-price {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--cps-price-color);
    line-height: 1.2;
}

.cps-product-price .woocommerce-Price-amount {
    font-size: 12px;
    color: var(--cps-price-color);
}

.cps-product-price del .woocommerce-Price-amount {
    color: #999;
    font-size: 11px;
    margin-right: 4px;
}

/* ---- Add to Cart button ---- */
.cps-add-to-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--cps-plus-size);
    height: var(--cps-plus-size);
    min-width: var(--cps-plus-size);
    border: 1px solid var(--cps-border);
    background: #ffffff;
    color: #1a1a1a;
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    position: relative;
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .15s ease;
    outline: none;
    flex-shrink: 0;
    border-radius: 0;
    padding: 0;
}

.cps-add-to-cart:hover {
    background: #1a1a1a;
    color: #ffffff;
    border-color: #1a1a1a;
    transform: scale(1.08);
}

.cps-add-to-cart:active { transform: scale(.95); }

.cps-plus-icon {
    display: block;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    transition: opacity .15s ease;
}

/* Spinner (hidden by default) */
.cps-cart-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    position: absolute;
    animation: cps-spin .6s linear infinite;
}

@keyframes cps-spin { to { transform: rotate(360deg); } }

.cps-add-to-cart.loading .cps-plus-icon { opacity: 0; }
.cps-add-to-cart.loading .cps-cart-spinner { display: block; }

.cps-add-to-cart.added {
    background: #2a7a2a;
    border-color: #2a7a2a;
    color: #fff;
}
.cps-add-to-cart.added .cps-plus-icon::before {
    content: '✓';
    position: absolute;
    font-size: 14px;
    left: 50%; top: 50%;
    transform: translate(-50%,-50%);
}
.cps-add-to-cart.added .cps-plus-icon { opacity: 0; }

/* ---- Navigation arrows wrapper ---- */
.cps-nav-wrap {
    display: flex;
    gap: 4px;
    margin-top: 12px;
}

/* Arrow position variants */
.cps-arrows-left  .cps-nav-wrap { justify-content: flex-start; }
.cps-arrows-center .cps-nav-wrap { justify-content: center; }
.cps-arrows-right  .cps-nav-wrap { justify-content: flex-end; }

/* ---- Individual arrow buttons ---- */
.cps-nav {
    width: var(--cps-nav-size);
    height: var(--cps-nav-size);
    border: 1px solid var(--cps-border);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 300;
    cursor: pointer;
    color: #1a1a1a;
    user-select: none;
    transition: background .18s ease, color .18s ease, transform .15s ease;
    line-height: 1;
    flex-shrink: 0;
}

.cps-nav:hover {
    background: #1a1a1a;
    color: #ffffff;
    border-color: #1a1a1a;
}

.cps-nav:active { transform: scale(.92); }

.cps-nav.swiper-button-disabled {
    opacity: .3;
    pointer-events: none;
}

/* ---- Error ---- */
.cps-error {
    color: #b32d2e;
    font-size: 13px;
    padding: 10px;
    border: 1px solid #f5c6c6;
    background: #fdf2f2;
    border-radius: 4px;
    display: inline-block;
}

/* ============================================================
   Responsive breakpoints
   ============================================================ */

/* 750px — tablet landscape / small tablet */
@media (max-width: 750px) {
    .cps-showcase {
        --cps-cols: 2;
        --cps-img-size: 220px;
        padding: 14px;
    }
    .cps-grid-inner {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
    .cps-product-name { font-size: 10px; }
    .cps-product-price,
    .cps-product-price .woocommerce-Price-amount { font-size: 11px; }
}

/* 450px — mobile landscape / large phone */
@media (max-width: 450px) {
    .cps-showcase {
        --cps-cols: 2;
        --cps-img-size: 160px;
        --cps-plus-size: 30px;
        padding: 10px;
    }
    .cps-grid-inner {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px;
    }
    .cps-card-footer { padding: 8px 8px; gap: 4px; }
    .cps-product-name { font-size: 9px; letter-spacing: .02em; }
    .cps-product-price,
    .cps-product-price .woocommerce-Price-amount { font-size: 10px; }
    .cps-nav { width: 32px; height: 32px; font-size: 18px; }
}

/* 320px — small phone (iPhone SE, etc.) */
@media (max-width: 320px) {
    .cps-showcase {
        --cps-cols: 1;
        --cps-img-size: 240px;
        --cps-plus-size: 32px;
        padding: 8px;
    }
    .cps-grid-inner {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }
    .cps-card-footer { padding: 10px 10px; }
    .cps-product-name { font-size: 11px; white-space: normal; }
}

/* Swiper slide width — JS handles per-view count but we enforce min */
.cps-swiper .swiper-slide { height: auto; }

/* ============================================================
   Admin-only: placeholder card indicator
   ============================================================ */

.cps-placeholder-card {
    position: relative;
    opacity: 0.55;
}

.cps-placeholder-card::after {
    content: 'No Image';
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ff9800;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 5;
    font-family: 'Helvetica Neue', sans-serif;
}
