/* ==========================================================================
   Crista Products Widget — Frontend Styles
   ========================================================================== */

/* -- Wrapper -------------------------------------------------------------- */
.crista-products {
    font-family: inherit;
}

/* -- Header --------------------------------------------------------------- */
.crista-products__header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
}

.crista-products__header-text {
    flex: 1 1 auto;
}

.crista-products__title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 6px;
    padding: 0;
    color: #1a1a2e;
}

.crista-products__desc {
    margin: 0;
    font-size: 0.95rem;
    color: #888;
}

/* -- View All Button ------------------------------------------------------ */
.crista-products__view-all {
    display: inline-block;
    padding: 8px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1a1a2e;
    background: transparent;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    flex-shrink: 0;
    align-self: flex-start;
}

.crista-products__view-all:hover {
    background: #1a1a2e;
    color: #fff;
    border-color: #1a1a2e;
}

/* -- Grid ----------------------------------------------------------------- */
.crista-products__grid {
    display: grid;
    grid-template-columns: repeat(var(--crista-pc, 4), 1fr);
    gap: 20px;
}

/* -- Card ----------------------------------------------------------------- */
.crista-products__card {
    position: relative;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.25s, transform 0.2s;
}

.crista-products__card--default {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

.crista-products__card--default:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.13);
    transform: translateY(-2px);
}

.crista-products__card--bordered {
    border: 1px solid #e5e5e5;
}

.crista-products__card--bordered:hover {
    border-color: #b0b0b0;
}

.crista-products__card--minimal {
    box-shadow: none;
    border: none;
}

/* -- Thumbnail ------------------------------------------------------------ */
.crista-products__thumb {
    display: block;
    position: relative;
    overflow: hidden;
    background: #f7f8fa;
    border-radius: 8px 8px 0 0;
    text-decoration: none;
}

/* Aspect ratio variants */
.crista-products__thumb--ratio-1-1  { aspect-ratio: 1 / 1; }
.crista-products__thumb--ratio-4-3  { aspect-ratio: 4 / 3; }
.crista-products__thumb--ratio-3-4  { aspect-ratio: 3 / 4; }
.crista-products__thumb--ratio-16-9 { aspect-ratio: 16 / 9; }
.crista-products__thumb--ratio-auto { aspect-ratio: auto; }

.crista-products__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.35s ease;
    padding: 10px;
    box-sizing: border-box;
}

.crista-products__card:hover .crista-products__img {
    transform: scale(1.04);
}

/* -- Overlay -------------------------------------------------------------- */
.crista-products__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.08);
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
    border-radius: inherit;
}

.crista-products__card:hover .crista-products__overlay {
    opacity: 1;
}

/* -- Badge ---------------------------------------------------------------- */
.crista-products__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff;
    background: #f4b942;
    border-radius: 20px;
    line-height: 1.4;
    z-index: 2;
    text-transform: none;
    pointer-events: none;
}

.crista-products__badge--sale        { background: #e74c3c; }
.crista-products__badge--new         { background: #2ecc71; }
.crista-products__badge--bestseller  { background: #f4b942; }
.crista-products__badge--custom      { background: #3498db; }

/* -- Card Body ------------------------------------------------------------ */
.crista-products__card-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* -- Sub-label ------------------------------------------------------------ */
.crista-products__sub-label {
    margin: 0 0 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #999;
    line-height: 1.3;
}

/* -- Product Title -------------------------------------------------------- */
.crista-products__product-title {
    margin: 0 0 10px;
    padding: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
    color: #1a1a2e;
    flex: 1;
}

.crista-products__product-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.crista-products__product-title a:hover {
    color: #4a90d9;
}

/* -- Footer (price + cart) ------------------------------------------------ */
.crista-products__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
}

/* -- Price ---------------------------------------------------------------- */
.crista-products__price .price {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.2;
}

.crista-products__price ins {
    text-decoration: none;
}

.crista-products__price ins .amount {
    color: #e74c3c;
    font-weight: 700;
}

.crista-products__price del {
    text-decoration: line-through;
    margin-left: 4px;
}

.crista-products__price del .amount {
    color: #aaa;
    font-size: 0.85em;
}

.crista-products__price .woocommerce-Price-currencySymbol {
    font-size: 0.85em;
}

/* -- Cart Button ---------------------------------------------------------- */
.crista-products__cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: #1a1a2e;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
}

.crista-products__cart-btn:hover {
    background: #2d2d4e;
    transform: scale(1.07);
}

.crista-products__cart-btn svg {
    width: 16px;
    height: 16px;
    stroke: #fff;
    fill: none;
    display: block;
    pointer-events: none;
}

/* Loading state */
.crista-products__cart-btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

.crista-products__cart-btn.added {
    background: #2ecc71;
}

/* -- No products ---------------------------------------------------------- */
.crista-products__no-products {
    color: #999;
    font-size: 0.95rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
    .crista-products__grid {
        grid-template-columns: repeat(var(--crista-pc-tablet, var(--crista-pc, 2)), 1fr);
    }
}

@media (max-width: 767px) {
    .crista-products__grid {
        grid-template-columns: repeat(var(--crista-pc-mobile, 1), 1fr);
    }

    .crista-products__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .crista-products__title {
        font-size: 1.5rem;
    }
}
