/* Advice-style product card — left-aligned layout matching Advice.co.th */

.adv-pcard,
.product-card-new.adv-pcard,
.category-card.adv-pcard {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
    text-align: left;
}

.adv-pcard:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1);
}

/* ===== Image / badges ===== */
.adv-pcard__media {
    position: relative;
    background: #fff;
    min-height: 190px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.4rem 1.1rem 0.85rem;
    box-sizing: border-box;
}

.adv-pcard__media-top {
    position: absolute;
    inset: 0 0 auto 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 5;
    pointer-events: none;
    padding: 0;
}

.adv-pcard__media-left,
.adv-pcard__media-right {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 58%;
    pointer-events: none;
}

.adv-pcard__media-left {
    align-items: flex-start;
}

.adv-pcard__media-right {
    align-items: flex-end;
    padding: 8px 10px 0 0;
}

/* Flash Sale — flush left like Advice */
.adv-pcard__flash {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 10px 0 0 0;
    padding: 5px 12px 5px 10px;
    background: linear-gradient(90deg, #f39233 0%, #f5b041 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
    border-radius: 0 999px 999px 0;
    box-shadow: 0 2px 6px rgba(243, 146, 51, 0.35);
    white-space: nowrap;
}

.adv-pcard__flash i {
    font-size: 10px;
}

.adv-pcard__best-price {
    display: none !important;
}

.adv-pcard__new-badge {
    display: inline-block;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 4px;
}

.adv-pcard__incoming {
    background: #64748b;
    color: #fff;
    font-size: 9px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 4px;
}

.adv-pcard__feature-badges {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: flex-start;
    padding-left: 8px;
}

.adv-pcard__feature-badges .feature-badge {
    font-size: 7px !important;
    padding: 2px 5px !important;
    height: auto !important;
    border-radius: 4px !important;
    line-height: 1.15 !important;
}

.adv-pcard .brand-logo-badge-new,
.adv-pcard .category-card__brand-logo,
.adv-pcard__brand-logo {
    position: static !important;
    top: auto !important;
    right: auto !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.adv-pcard .brand-logo-img-new,
.adv-pcard .category-card__brand-logo img,
.adv-pcard__brand-logo img {
    max-height: 22px !important;
    max-width: 64px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

.adv-pcard__image-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.adv-pcard__image {
    max-width: 86%;
    max-height: 86%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* ===== Body — left aligned like Advice ===== */
.adv-pcard__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    /* +2px inset from left/right card edges */
    padding: 0.55rem calc(0.85rem + 2px) 0.85rem !important;
    gap: 0.28rem;
    min-height: 0;
    box-sizing: border-box;
    text-align: left;
    align-items: stretch;
}

.adv-pcard__brand {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #4aa3e0;
    text-transform: uppercase;
    line-height: 1.2;
    text-align: left;
}

.adv-pcard__title-link {
    text-decoration: none !important;
    color: inherit;
    text-align: left;
}

.adv-pcard__title {
    margin: 0;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.35;
    color: #1a1a1a !important;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    min-height: 2.7em;
    text-align: left;
}

.adv-pcard__title-link:hover .adv-pcard__title {
    color: #1d4ed8 !important;
}

.adv-pcard__specs {
    margin: 0;
    font-size: 11px;
    line-height: 1.4;
    color: #757575;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-align: left;
    min-height: 2.8em;
}

.adv-pcard__mid-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.4rem;
    margin-top: 0.1rem;
}

.adv-pcard__mid-main {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.adv-pcard__freebie {
    border: 1.5px dashed #3b82f6;
    border-radius: 8px;
    padding: 0.4rem 0.5rem;
    background: #f8fbff;
    font-size: 11px;
    line-height: 1.35;
    color: #1e293b;
    margin-top: 0.25rem;
    text-align: left;
}

.adv-pcard__freebie-label {
    color: #2563eb;
    font-weight: 700;
    margin-right: 0.15rem;
}

.adv-pcard__freebie-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.adv-pcard__freebie-more {
    display: inline-block;
    margin-top: 0.15rem;
    font-size: 11px;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
}

.adv-pcard__icon-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.adv-pcard__icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    background: #fff;
    text-decoration: none;
}

.adv-pcard__icon-btn:hover {
    color: #f39233;
    border-color: #f39233;
}

.adv-pcard__icon-btn i {
    font-size: 11px;
}

/* Price left + chips right */
.adv-pcard__price-chips-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.35rem;
    text-align: left;
    min-height: 4.25rem;
}

.adv-pcard__price-block {
    flex: 1;
    min-width: 0;
    text-align: left;
    min-height: 3.6rem;
}

.adv-pcard__price-start {
    font-size: 11px;
    color: #9ca3af;
    line-height: 1.3;
    margin-bottom: 2px;
}

.adv-pcard__price-old {
    text-decoration: line-through;
    color: #9ca3af;
    font-weight: 500;
}

.adv-pcard__price-label {
    font-size: 11px;
    color: #9ca3af;
}

.adv-pcard__price-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.4rem;
}

.adv-pcard__price-main {
    font-size: 19.5px;
    font-weight: 900;
    color: #0b5f9e;
    line-height: 1.1;
    letter-spacing: -0.03em;
    white-space: nowrap;
    word-break: keep-all;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-family: "Segoe UI", "Helvetica Neue", Arial, "Noto Sans Thai", sans-serif;
    -webkit-font-smoothing: antialiased;
}

.adv-pcard__price-main--contact {
    font-size: 11.25px;
    font-weight: 800;
    letter-spacing: 0;
    color: #b45309;
}

.adv-pcard__save-pill {
    display: inline-flex;
    align-items: center;
    background: #e53935;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    line-height: 1.2;
}

.adv-pcard__price-note {
    margin-top: 3px;
    font-size: 10px;
    color: #9ca3af;
    line-height: 1.3;
}

.adv-pcard__chips {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
    max-width: 46%;
    padding-top: 2px;
}

.adv-pcard__chip {
    display: inline-flex;
    align-items: center;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 999px;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adv-pcard__chip--accent {
    background: #e0f2fe;
    color: #0369a1;
}

/* Actions — Advice diagonal band CTA */
.adv-pcard__actions {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

/* Advice ปุ่มคาด — แถบทแยง + ไอคอนตะกร้า + สั่งซื้อเลย */
.adv-pcard__band-btn {
    display: flex !important;
    align-items: stretch;
    width: 100%;
    height: 50px;
    min-height: 50px;
    border-radius: 999px;
    overflow: hidden;
    text-decoration: none !important;
    color: #fff !important;
    background: #1a8fd4;
    box-shadow: 0 3px 12px rgba(10, 90, 160, 0.35);
    transition: filter 0.15s ease, transform 0.15s ease;
}

.adv-pcard__band-btn:hover {
    filter: brightness(1.06);
    color: #fff !important;
    transform: translateY(-1px);
}

.adv-pcard__band-btn-icon {
    position: relative;
    flex: 0 0 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #0a4f8c;
    clip-path: polygon(0 0, 100% 0, 72% 100%, 0 100%);
    font-size: 12.75px;
    color: #8ef0e8;
    z-index: 1;
}

.adv-pcard__band-btn-icon::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 50%;
    width: 10px;
    height: 12px;
    transform: translateY(-52%);
    background:
        linear-gradient(#8ef0e8, #8ef0e8) 0 2px / 7px 1.5px no-repeat,
        linear-gradient(#8ef0e8, #8ef0e8) 1px 6px / 6px 1.5px no-repeat,
        linear-gradient(#8ef0e8, #8ef0e8) 2px 10px / 5px 1.5px no-repeat;
    opacity: 0.9;
    pointer-events: none;
}

.adv-pcard__band-btn-icon i {
    position: relative;
    z-index: 1;
    margin-left: 4px;
}

.adv-pcard__band-btn-label {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px 0 2px;
    background: linear-gradient(180deg, #2a9ee0 0%, #1688c8 100%);
    font-size: 20.25px;
    font-weight: 900;
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;
}

/* Legacy cart / buy-now (old markup) */
.adv-pcard__cart-btn {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: #0b6dae;
    color: #fff !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    box-shadow: 0 2px 6px rgba(11, 109, 174, 0.28);
}

.adv-pcard__cart-btn i {
    font-size: 11.25px;
}

.adv-pcard__buy-now {
    flex: 1;
    min-width: 0;
    height: 46px;
    border-radius: 999px;
    background: #008de1;
    color: #fff !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    font-size: 20.25px;
    font-weight: 900;
    letter-spacing: 0.02em;
}

.adv-pcard__buy-now:hover {
    filter: brightness(1.06);
    color: #fff !important;
}

/* Advice Flash Sale CTA — diagonal bolt panel */
.adv-pcard__flash-btn {
    display: flex !important;
    align-items: stretch;
    width: 100%;
    height: 50px;
    min-height: 50px;
    border-radius: 999px;
    overflow: hidden;
    text-decoration: none !important;
    color: #fff !important;
    background: #f39233;
    box-shadow: 0 3px 10px rgba(232, 123, 18, 0.4);
    transition: filter 0.15s ease, transform 0.15s ease;
}

.adv-pcard__flash-btn:hover {
    filter: brightness(1.05);
    color: #fff !important;
    transform: translateY(-1px);
}

.adv-pcard__flash-btn-bolt {
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e06b12;
    clip-path: polygon(0 0, 100% 0, 78% 100%, 0 100%);
    font-size: 13.5px;
}

.adv-pcard__flash-btn-copy {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.05;
    padding: 0 12px 0 4px;
    background: linear-gradient(180deg, #f5a623 0%, #f08c1a 100%);
}

.adv-pcard__flash-btn-main {
    display: block;
    font-size: 20.25px;
    font-weight: 900;
    letter-spacing: 0.02em;
    line-height: 1;
}

.adv-pcard__flash-btn-sub {
    display: block;
    font-size: 10px;
    font-weight: 500;
    opacity: 0.95;
    margin-top: 2px;
    line-height: 1;
}

.adv-pcard__buy-now--contact {
    background: #d97706;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.28);
    border-radius: 999px;
    width: 100%;
    font-size: 13.5px;
}

/* Legacy single-buy (keep harmless if old markup cached) */
.adv-pcard__buy,
.adv-pcard__buy-now--flash {
    display: none !important;
}

.adv-pcard__views {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
    font-size: 11px;
    color: #9ca3af;
}

.adv-pcard__views i {
    font-size: 11px;
}

.adv-pcard .product-badges-sidebar,
.adv-pcard .right-badges-column,
.adv-pcard .floating-discount-pill,
.adv-pcard .review-stars-inline-new {
    display: none !important;
}

@media (max-width: 1199px) and (min-width: 577px) {
    .adv-pcard__media {
        min-height: 0;
        height: auto;
        max-height: 148px;
        aspect-ratio: 1 / 1;
        padding: 1.15rem 0.7rem 0.55rem;
    }

    .adv-pcard__image,
    .adv-pcard__image-link img {
        max-height: 100%;
        max-width: 92%;
        width: auto;
        height: auto;
        object-fit: contain;
    }

    .adv-pcard__body {
        padding: 0.45rem 0.65rem 0.7rem !important;
        gap: 0.25rem;
    }

    .adv-pcard__title {
        font-size: 12px;
        line-height: 1.3;
        -webkit-line-clamp: 2;
    }

    .adv-pcard__specs {
        font-size: 10.5px;
        min-height: 0;
        -webkit-line-clamp: 2;
    }

    .adv-pcard__mid-row {
        gap: 0.35rem;
        margin-top: 0.2rem;
    }

    .adv-pcard__icon-btn {
        width: 24px;
        height: 24px;
    }

    .adv-pcard__icon-btn i {
        font-size: 10px;
    }

    .adv-pcard__price-chips-row {
        min-height: 0;
        margin-top: 0.25rem;
        gap: 0.35rem;
        align-items: center !important;
    }

    .adv-pcard__price-block {
        min-height: 0;
    }

    .adv-pcard__price-main {
        font-size: 15px;
        letter-spacing: -0.02em;
    }

    .adv-pcard__save-pill {
        font-size: 10px;
        padding: 2px 6px;
    }

    .adv-pcard__chips {
        max-width: 42%;
        gap: 3px;
    }

    .adv-pcard__chip {
        font-size: 9px;
        padding: 3px 6px;
    }

    .adv-pcard__band-btn,
    .adv-pcard__flash-btn {
        height: 40px;
        min-height: 40px;
    }

    .adv-pcard__band-btn-icon {
        flex: 0 0 40px;
        font-size: 11px;
    }

    .adv-pcard__band-btn-label,
    .adv-pcard__flash-btn-main {
        font-size: 13px;
        padding: 0 10px 0 0;
    }

    .adv-pcard__buy-now {
        min-height: 40px;
        font-size: 12px;
        padding: 0 10px;
    }

    .product-carousel-slider .homepage-product-carousel-page .adv-pcard .adv-pcard__body {
        padding-bottom: 0.65rem !important;
    }
}

@media (max-width: 991px) and (min-width: 577px) {
    .adv-pcard__media {
        max-height: 132px;
        padding: 1rem 0.55rem 0.45rem;
    }

    .adv-pcard__price-main {
        font-size: 14px;
    }

    .adv-pcard__band-btn-label,
    .adv-pcard__flash-btn-main {
        font-size: 12px;
    }

    .adv-pcard__band-btn-icon::before {
        display: none;
    }
}

@media (max-width: 576px) {
    .adv-pcard__media {
        min-height: 150px;
        padding: 2rem 0.85rem 0.7rem;
    }

    .adv-pcard__body {
        padding: 0.5rem calc(0.75rem + 2px) 0.8rem !important;
    }

    .adv-pcard__title {
        font-size: 12.5px;
    }

    .adv-pcard__price-main {
        font-size: 16.5px;
        font-weight: 900;
    }

    .adv-pcard__band-btn,
    .adv-pcard__flash-btn {
        height: 46px;
        min-height: 46px;
    }

    .adv-pcard__band-btn-icon {
        flex-basis: 46px;
        font-size: 11.25px;
    }

    .adv-pcard__band-btn-label,
    .adv-pcard__flash-btn-main {
        font-size: 16.5px;
    }

    .adv-pcard__buy {
        min-height: 40px;
    }

    .adv-pcard__buy-icon {
        width: 40px;
    }

    .adv-pcard__price-chips-row {
        flex-wrap: wrap;
    }

    .adv-pcard__chips {
        max-width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
    }
}

.category-products-page .adv-pcard.category-card,
.category-products-page #products-grid .adv-pcard {
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
}

.category-products-page #products-grid {
    align-items: stretch !important;
}

.category-products-page #products-grid > * {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
}

.category-products-page #products-grid .adv-pcard {
    flex: 1 1 auto !important;
}

.category-products-page .adv-pcard .feature-badges-container {
    display: none !important;
}

/* =========================================================
   Equal-height Advice cards — keep cart/buy buttons aligned
   Overrides homepage carousel "height:auto / align-start" rules
   ========================================================= */
.product-carousel-slider .homepage-product-carousel-page .homepage-product-carousel-grid:has(.adv-pcard) {
    align-items: stretch !important;
}

.product-carousel-slider .homepage-product-carousel-page .homepage-product-carousel-grid-item:has(.adv-pcard) {
    align-self: stretch !important;
    height: auto !important;
    min-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

.product-carousel-slider .homepage-product-carousel-page .homepage-product-carousel-grid-item > .adv-pcard,
.product-carousel-slider .homepage-product-carousel-page .homepage-carousel-card-compact.adv-pcard,
.product-carousel-slider .homepage-product-carousel-page .product-card-new.adv-pcard {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: none !important;
}

.product-carousel-slider .homepage-product-carousel-page .adv-pcard .adv-pcard__body {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding-bottom: 0.85rem !important;
}

.product-carousel-slider .homepage-product-carousel-page .adv-pcard .adv-pcard__actions {
    margin-top: auto !important;
}

.product-carousel-slider .homepage-product-carousel-page .adv-pcard .adv-pcard__footer {
    margin-top: auto !important;
}

.product-carousel-slider .homepage-product-carousel-page .adv-pcard .adv-pcard__footer .adv-pcard__actions {
    margin-top: 0 !important;
}

.product-carousel-slider .homepage-product-carousel-page .adv-pcard .adv-pcard__views {
    margin-top: 0.35rem !important;
    flex-shrink: 0;
}

/* Class-based stretch (works even when :has() unsupported) */
.product-carousel-slider .homepage-product-carousel-page .homepage-product-carousel-grid-item--adv {
    align-self: stretch !important;
    height: auto !important;
    min-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

.product-carousel-slider .homepage-product-carousel-page .homepage-product-carousel-grid-item--adv > .adv-pcard {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: none !important;
}

/* Keep mid content / price blocks consistent so buttons line up */
.adv-pcard__specs {
    min-height: 2.8em;
}

.adv-pcard__price-chips-row {
    min-height: 4.25rem;
    align-items: flex-start !important;
}

.adv-pcard__price-block {
    min-height: 3.6rem;
}

.adv-pcard__footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
    flex-shrink: 0;
}

.adv-pcard__footer .adv-pcard__actions {
    margin-top: 0;
}
