/* ============================================================
   Product List block styles (lipo-sachets/product-list)
   Auto-enqueued by WordPress whenever the block is rendered,
   via the 'style' handle registered in block-product-list.php.
   Self-contained — no dependency on product.css or product-archive.css.
   ============================================================ */

/* ── Product List block ──────────────────────────────────────── */

.lipo-product-list {
    padding-block: clamp(1.5rem, 4vw, 3rem);
}

.lipo-product-list__grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: center;
    gap: clamp(1rem, 2.2vw, 1.6rem);
}

.lipo-product-list__empty {
    border: 1px dashed var(--wp--preset--color--border-grey, #e6ecef);
    border-radius: 14px;
    padding: 1.25rem;
    color: var(--wp--preset--color--body-dark-60, #54626a);
}

/* Card — self-contained, does not rely on .lipo-product-card base */
.lipo-product-card--list {
    position: relative;
    flex: 0 1 calc((100% - (3 * clamp(1rem, 2.2vw, 1.6rem))) / 4);
    max-width: calc((100% - (3 * clamp(1rem, 2.2vw, 1.6rem))) / 4);
    box-sizing: border-box;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--wp--preset--color--border-grey, #e6ecef);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.lipo-product-card--list:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px rgba(10, 42, 51, 0.09);
    border-color: color-mix(in srgb, var(--wp--preset--color--primary, #333) 35%, #e6ecef 65%);
}

/* Image wrap */
.lipo-product-card__image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--wp--preset--color--background-alt, #f4f7f9);
    flex-shrink: 0;
}

.lipo-product-card__image-wrap img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    display: block;
    transition: transform 0.35s ease;
}

.lipo-product-card--list:hover .lipo-product-card__image-wrap img {
    transform: scale(1.04);
}

.lipo-product-card__no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #aaa;
}

/* Sale badge on image */
.lipo-product-card__sale-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 0.25rem 0.65rem;
    border-radius: 100px;
    background: var(--wp--preset--color--accent, #e53e3e);
    color: #fff;
    pointer-events: none;
}

/* Content area */
.lipo-product-card--list .lipo-product-card__content {
    padding: 1rem 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    flex: 1;
}

.lipo-product-card--list .lipo-product-card__title {
    margin: 0;
    font-size: clamp(0.95rem, 1.4vw, 1.1rem);
    line-height: 1.25;
}

.lipo-product-card--list .lipo-product-card__title a {
    color: var(--wp--preset--color--body, #111);
    text-decoration: none;
}

.lipo-product-card--list .lipo-product-card__title a:hover {
    color: var(--wp--preset--color--primary-dark, #0a2a33);
}

.lipo-product-card--list .lipo-product-card__excerpt {
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--wp--preset--color--body-dark-60, #54626a);
    margin: 0;
    margin-bottom: auto;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Bottom bar */
.lipo-product-card__bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: auto;
    width: 100%;
    padding-top: 0.85rem;
    border-top: 1px solid var(--wp--preset--color--border-grey, #e6ecef);
}

.lipo-product-card__bottom-price {
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.lipo-product-card__compare-price {
    font-size: 0.85rem;
    color: #aaa;
    text-decoration: line-through;
}

.lipo-product-card__price {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--wp--preset--color--primary-dark, #0a2a33);
}

.lipo-product-card__price--empty {
    color: #a9b2b8;
}

.lipo-product-card__bottom-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem !important;
    flex-shrink: 0;
}

.lipo-product-card__bottom-actions .wp-block-button {
    margin: 0;
}

.lipo-product-card__bottom-actions .wp-block-button__link {
    padding: 0.75rem 2rem;
    transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    border-radius: 999px;
    font-size: 16px !important;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    line-height: 1.2;
}

.lipo-product-card__bottom-actions .wp-block-button__link:hover {
    opacity: 0.85;
}

.lipo-product-card__bottom-actions .wp-block-button.is-style-accent {
    display: flex;
    line-height: 0;
}

.lipo-product-card__view-btn {
    max-height: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    box-sizing: border-box;
    white-space: nowrap;
    color: var(--wp--preset--color--body-light) !important;
    background-color:var(--wp--preset--color--primary-dark) !important;
}

.lipo-product-card__view-price {
    display: none;
}

.lipo-product-card__view-btn:hover {
    background-color: var(--wp--preset--color--primary, #f4f7f9) !important;
}

.lipo-product-card__add-btn {
    position: relative;
    flex: 0 0 40px;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    aspect-ratio: 1 / 1;
    padding: 0 !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    vertical-align: top;
    border: 0;
    background-color: var(--wp--preset--color--accent, #e53e3e) !important;
    color: var(--wp--preset--color--body-light, #fff);
    font-size: 0;
    line-height: 0;
}

.lipo-product-card__add-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 19px;
    height: 19px;
    background-color: currentColor;
    transform: translate(-56%, -50%);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 4h2l2.4 12.2a2 2 0 0 0 2 1.6h8.2a2 2 0 0 0 2-1.6L21 8H6' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='10' cy='21' r='1.5' fill='black'/%3E%3Ccircle cx='17' cy='21' r='1.5' fill='black'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: 19px 19px;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 4h2l2.4 12.2a2 2 0 0 0 2 1.6h8.2a2 2 0 0 0 2-1.6L21 8H6' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='10' cy='21' r='1.5' fill='black'/%3E%3Ccircle cx='17' cy='21' r='1.5' fill='black'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: 19px 19px;
}

.lipo-product-card__add-btn::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--wp--preset--color--body-light, #fff);
    box-shadow: 0 0 0 2px var(--wp--preset--color--accent, #e53e3e);
    background-image:
        linear-gradient(var(--wp--preset--color--accent, #e53e3e), var(--wp--preset--color--accent, #e53e3e)),
        linear-gradient(var(--wp--preset--color--accent, #e53e3e), var(--wp--preset--color--accent, #e53e3e));
    background-position: center center, center center;
    background-repeat: no-repeat;
    background-size: 2px 8px, 8px 2px;
}

.lipo-product-card__add-btn--disabled,
.lipo-product-card__add-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ── Responsive breakpoints ─────────────────────────────────────── */

@media (max-width: 1200px) {
    .lipo-product-card--list {
        flex-basis: calc((100% - (2 * clamp(1rem, 2.2vw, 1.6rem))) / 3);
        max-width: calc((100% - (2 * clamp(1rem, 2.2vw, 1.6rem))) / 3);
    }
}

@media (max-width: 768px) {
    .lipo-product-card--list {
        flex-basis: 100%;
        max-width: 100%;
        flex-direction: row;
        align-items: stretch;
        border-radius: 8px;
    }

    .lipo-product-card__image-wrap {
        flex: 0 0 110px;
        width: 110px;
        aspect-ratio: auto;
        border-right: 1px solid var(--wp--preset--color--border-grey, #e6ecef);
    }

    .lipo-product-card--list .lipo-product-card__content {
        flex: 1;
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 0.35rem 0.8rem;
        padding: 0.75rem 0.9rem;
    }

    .lipo-product-card--list .lipo-product-card__title {
        grid-column: 1 / 2;
        font-size: 0.95rem;
        margin: 0;
    }

    .lipo-product-card--list .lipo-product-card__excerpt {
        display: none;
    }

    .lipo-product-card__bottom-bar {
        grid-column: 2 / 3;
        align-self: center;
        margin: 0;
        padding: 0;
        width: auto;
        border-top: 0;
    }

    .lipo-product-card__bottom-price {
        display: none;
    }

    .lipo-product-card__view-price {
        display: none;
    }

    .lipo-product-card__bottom-actions {
        width: auto;
        gap: 0;
        align-items: center;
    }

    .lipo-product-card__bottom-actions .wp-block-button.is-style-accent {
        display: none;
    }

    .lipo-product-card__bottom-actions .wp-block-button:first-child .lipo-product-card__view-btn {
        width: 36px;
        min-width: 36px;
        min-height: 36px;
        height: 36px;
        max-height: 36px;
        padding: 0;
        border-radius: 999px;
        background: var(--wp--preset--color--accent, #e53e3e) !important;
        color: var(--wp--preset--color--body-light, #fff) !important;
        font-size: 0 !important;
        line-height: 0;
    }

    .lipo-product-card__bottom-actions .wp-block-button:first-child .lipo-product-card__view-btn .lipo-product-card__view-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .lipo-product-card__bottom-actions .wp-block-button:first-child .lipo-product-card__view-btn::after {
        content: '';
        display: block;
        width: 20px;
        height: 14px;
        background: currentColor;
        clip-path: polygon(0 40%, 62% 40%, 62% 14%, 100% 50%, 62% 86%, 62% 60%, 0 60%);
    }

    .lipo-product-card__bottom-actions .wp-block-button:first-child .lipo-product-card__view-btn:hover {
        background: var(--wp--preset--color--accent, #e53e3e) !important;
        opacity: 0.9;
    }
}

@media (max-width: 480px) {
    .lipo-product-card__image-wrap {
        flex-basis: 96px;
        width: 96px;
    }

    .lipo-product-card--list .lipo-product-card__content {
        padding: 0.7rem 0.8rem;
    }

    .lipo-product-card--list .lipo-product-card__title {
        font-size: 0.9rem;
    }
}
