/* ═══════════════════════════════════════════════════════════
   Product Cards v2 — matches the Baseus/Lazada-style layout
   All selectors scoped to .pcv2 to avoid conflicts
═══════════════════════════════════════════════════════════ */

/* ── Grid reset for products page ─────────────────────── */
.products-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 14px !important;
    margin-bottom: 2rem !important;
}

/* ── List view override (must beat !important above) ─── */
.products-grid.list-view {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: unset !important;
    gap: 14px !important;
}

/* ── Card shell ───────────────────────────────────────── */
.pcv2 {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.04);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: box-shadow .2s ease, transform .2s ease;
    position: relative;
}

.pcv2:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.13);
    transform: translateY(-2px);
}

/* ── Image zone ───────────────────────────────────────── */
.pcv2-img {
    position: relative;
    width: 100%;
    height: 225px;
    background: #ffffff !important;
    overflow: hidden;
    flex-shrink: 0;
}

.pcv2-img > img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    display: block !important;
    transition: transform .4s ease;
}

.pcv2:hover .pcv2-img > img {
    transform: scale(1.06);
}

/* ── Flash sale banner (arrow tab top-left) ───────────── */
.pcv2-flash {
    position: absolute;
    top: 10px;
    left: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: none;
}

.pcv2-flash-label {
    display: inline-block;
    background: #f97316;
    color: #fff;
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .05em;
    padding: 3px 14px 3px 8px;
    text-transform: uppercase;
    line-height: 1.4;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%);
    white-space: nowrap;
}

.pcv2-flash-off {
    display: inline-block;
    background: #dc2626;
    color: #fff;
    font-size: .7rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 6px;
    line-height: 1.4;
    white-space: nowrap;
}

/* ── Generic badge (non-sale) ─────────────────────────── */
.pcv2-badge {
    position: absolute;
    top: 10px;
    left: 8px;
    z-index: 4;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1.4;
    color: #fff;
    background: #111;
    pointer-events: none;
}

.pcv2-badge-new          { background: #16a34a; }
.pcv2-badge-hot          { background: #dc2626; }
.pcv2-badge-bestseller   { background: #0284c7; }
.pcv2-badge-limited      { background: #b45309; }
.pcv2-badge-coming-soon  { background: #64748b; }
.pcv2-badge-sale         { background: #d97706; }

/* ── Wishlist heart (top-right) ───────────────────────── */
.pcv2-wish {
    position: absolute;
    top: 9px;
    right: 9px;
    z-index: 4;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    box-shadow: 0 1px 5px rgba(0,0,0,.15);
    transition: color .15s, transform .15s, background .15s;
    padding: 0;
}

.pcv2-wish:hover {
    color: #ef4444;
    transform: scale(1.12);
}

.pcv2-wish.wished {
    color: #ef4444;
    background: #fff0f0;
}

.pcv2-wish.wished svg {
    fill: #ef4444;
}

/* ── Cart button (bottom-right of image) ─────────────── */
.pcv2-cart {
    position: absolute;
    bottom: 9px;
    right: 9px;
    z-index: 4;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,.93);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    box-shadow: 0 1px 6px rgba(0,0,0,.16);
    transition: background .15s, color .15s, transform .15s;
    padding: 0;
    text-decoration: none;
}

.pcv2-cart:hover {
    background: #111;
    color: #fff;
    transform: scale(1.08);
}

.pcv2-cart.adding {
    background: #16a34a;
    color: #fff;
}

/* Out-of-stock cart circle — greyed, no interaction */
.pcv2-cart.pcv2-cart-oos {
    opacity: .38;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Body ─────────────────────────────────────────────── */
.pcv2-body {
    padding: 11px 12px 13px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

/* Product name — 3-line clamp */
.pcv2-name {
    font-size: .84rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-shrink: 0;
}

.pcv2-name a {
    color: inherit;
    text-decoration: none;
}

.pcv2-name a:hover { color: var(--primary-color, #0056B3); }

/* Category */
.pcv2-cat {
    font-size: .65rem;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .07em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

/* ── Price row ────────────────────────────────────────── */
.pcv2-prices {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: auto;
    padding-top: 4px;
}

.pcv2-price-main {
    font-size: 1.05rem;
    font-weight: 800;
    color: #111;
    letter-spacing: -.02em;
}

.pcv2-price-orig {
    font-size: .78rem;
    color: #adb5bd;
    text-decoration: line-through;
    font-weight: 400;
}

.pcv2-price-quote {
    font-size: .85rem;
    font-weight: 700;
    color: var(--primary-color, #0056B3);
}

/* ── Stock line ───────────────────────────────────────── */
.pcv2-stock {
    font-size: .67rem;
    font-weight: 600;
}

.pcv2-stock-in  { color: #16a34a; }
.pcv2-stock-low { color: #ea580c; }
.pcv2-stock-out { color: #adb5bd; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 900px) {
    .pcv2-img { height: 195px; }
}

@media (max-width: 600px) {
    .products-grid:not(.list-view) {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .pcv2-img   { height: 165px; }
    .pcv2-body  { padding: 9px 10px 11px; }
    .pcv2-name  { font-size: .78rem; }
    .pcv2-price-main { font-size: .9rem; }
    .pcv2-cart  { opacity: 1; }
}

/* ── Inline qty stepper (morphs from cart circle) ─────── */
.pcv2-stepper {
    position: absolute;
    bottom: 9px;
    right: 9px;
    z-index: 5;
    display: flex;
    align-items: center;
    background: #111;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,.28);
    pointer-events: auto;
    animation: pcv2StepperIn .15s ease;
}

@keyframes pcv2StepperIn {
    from { opacity: 0; transform: scale(.8); }
    to   { opacity: 1; transform: scale(1); }
}

.pcv2-stepper-btn {
    width: 30px;
    height: 32px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.05rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.pcv2-stepper-btn:hover {
    background: rgba(255,255,255,.18);
}

.pcv2-stepper-btn:disabled {
    opacity: .32;
    cursor: not-allowed;
    pointer-events: none;
}

.pcv2-stepper-num {
    min-width: 24px;
    text-align: center;
    font-size: .82rem;
    font-weight: 700;
    color: #fff;
    padding: 0 2px;
    line-height: 1;
    user-select: none;
}

[data-theme="dark"] .pcv2-stepper {
    background: #1f2937;
}

/* ═══════════════════════════════════════════════════════════
   Product List View v2 (plv2) — horizontal row card
═══════════════════════════════════════════════════════════ */

.plv2 {
    display: grid;
    grid-template-columns: 200px 1fr 230px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,.07);
    box-shadow: 0 1px 5px rgba(0,0,0,.06);
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow .2s ease, transform .2s ease;
    position: relative;
}

.plv2:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,.12);
    transform: translateY(-2px);
}

/* ── Image zone ─────────────────────────────────────── */
.plv2-img {
    position: relative;
    width: 200px;
    background: #fff;
    border-right: 1px solid #f3f4f6;
    overflow: hidden;
    flex-shrink: 0;
}

.plv2-img > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    transition: transform .4s ease;
}

.plv2:hover .plv2-img > img {
    transform: scale(1.05);
}

/* Flash badge (arrow tab) */
.plv2-flash {
    position: absolute;
    top: 10px;
    left: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: none;
}

.plv2-flash-label {
    display: inline-block;
    background: #f97316;
    color: #fff;
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .05em;
    padding: 3px 14px 3px 8px;
    text-transform: uppercase;
    line-height: 1.4;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%);
    white-space: nowrap;
}

.plv2-flash-off {
    display: inline-block;
    background: #dc2626;
    color: #fff;
    font-size: .7rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 6px;
    line-height: 1.4;
}

/* Generic badge */
.plv2-badge {
    position: absolute;
    top: 10px;
    left: 8px;
    z-index: 4;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #fff;
    background: #111;
    pointer-events: none;
}

.plv2-badge-new         { background: #16a34a; }
.plv2-badge-hot         { background: #dc2626; }
.plv2-badge-bestseller  { background: #0284c7; }
.plv2-badge-limited     { background: #b45309; }
.plv2-badge-coming-soon { background: #64748b; }
.plv2-badge-sale        { background: #d97706; }

/* Wishlist heart */
.plv2-wish {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 4;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,.92);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    box-shadow: 0 1px 4px rgba(0,0,0,.14);
    transition: color .15s, transform .15s;
    padding: 0;
}

.plv2-wish:hover { color: #ef4444; transform: scale(1.1); }
.plv2-wish.wished { color: #ef4444; }
.plv2-wish.wished svg { fill: #ef4444; }

/* ── Center: product info ─────────────────────────── */
.plv2-body {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    min-height: 190px;
}

.plv2-top { display: flex; flex-direction: column; gap: 6px; }

.plv2-cat {
    font-size: .62rem;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .07em;
    margin: 0;
}

.plv2-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.plv2-name a { color: inherit; text-decoration: none; }
.plv2-name a:hover { color: var(--primary-color, #0056B3); }

.plv2-desc {
    font-size: .82rem;
    color: #6b7280;
    line-height: 1.65;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* SKU / barcode meta pills */
.plv2-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: .7rem;
    color: #9ca3af;
    margin-top: 2px;
}

.plv2-meta strong { color: #6b7280; }

/* ── Right: price + action ────────────────────────── */
.plv2-action {
    padding: 20px 18px;
    border-left: 1px solid #f0f1f3;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    gap: 12px;
    min-height: 190px;
}

/* Price block */
.plv2-prices { display: flex; flex-direction: column; gap: 5px; }

.plv2-price-main {
    font-size: 1.5rem;
    font-weight: 800;
    color: #111;
    letter-spacing: -.03em;
    line-height: 1;
}

.plv2-price-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.plv2-price-orig {
    font-size: .82rem;
    color: #adb5bd;
    text-decoration: line-through;
}

.plv2-off-badge {
    background: #dc2626;
    color: #fff;
    font-size: .65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
}

.plv2-price-quote {
    font-size: .9rem;
    font-weight: 600;
    color: #6b7280;
}

/* Stock */
.plv2-stock { font-size: .72rem; font-weight: 700; }
.plv2-stock-in  { color: #16a34a; }
.plv2-stock-low { color: #ea580c; }
.plv2-stock-out { color: #9ca3af; }

/* Add to Cart button */
.plv2-cart-btn {
    width: 100%;
    padding: 11px 14px;
    background: var(--cart-btn-bg, #f97316);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: background .15s, transform .1s;
    font-family: inherit;
    letter-spacing: .01em;
}

.plv2-cart-btn:hover:not(:disabled) { background: var(--cart-btn-bg-hover, #ea6c0e); }
.plv2-cart-btn:active:not(:disabled) { transform: scale(.98); }

.plv2-cart-btn.oos {
    background: #f3f4f6;
    color: #adb5bd;
    cursor: not-allowed;
    border: 1.5px solid #e5e7eb;
    pointer-events: none;
}

/* List-view stepper (full-width pill inside action panel) */
.plv2-stepper {
    width: 100%;
    display: flex;
    align-items: center;
    background: #111;
    border-radius: 8px;
    overflow: hidden;
    animation: plv2StepIn .15s ease;
}

@keyframes plv2StepIn {
    from { opacity: 0; transform: scaleX(.9); }
    to   { opacity: 1; transform: scaleX(1); }
}

.plv2-stepper-btn {
    flex: 0 0 42px;
    height: 42px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s;
    padding: 0;
    line-height: 1;
}

.plv2-stepper-btn:hover { background: rgba(255,255,255,.15); }

.plv2-stepper-btn:disabled {
    opacity: .32;
    cursor: not-allowed;
    pointer-events: none;
}

.plv2-stepper-num {
    flex: 1;
    text-align: center;
    font-size: .9rem;
    font-weight: 700;
    color: #fff;
    user-select: none;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 960px) {
    .plv2 { grid-template-columns: 160px 1fr 200px; }
    .plv2-img { width: 160px; }
}

@media (max-width: 680px) {
    .plv2 {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 170px auto;
    }
    .plv2-img {
        grid-column: 1 / -1;
        width: 100%;
        height: 170px;
        border-right: none;
        border-bottom: 1px solid #f3f4f6;
    }
    .plv2-body  { min-height: unset; }
    .plv2-action {
        min-height: unset;
        border-left: 1px solid #f0f1f3;
        border-top: none;
        background: #fafafa;
    }
}

@media (max-width: 420px) {
    .plv2 { grid-template-columns: 1fr; grid-template-rows: 160px auto auto; }
    .plv2-action { border-left: none; border-top: 1px solid #f0f1f3; }
}

/* ── Dark mode ──────────────────────────────────────── */
[data-theme="dark"] .plv2 {
    background: var(--bg-secondary, #2d2d2d);
    border-color: var(--border-color, #404040);
}
[data-theme="dark"] .plv2-img  { background: #fff; border-color: var(--border-color, #404040); }
[data-theme="dark"] .plv2-name { color: var(--text-primary, #fff); }
[data-theme="dark"] .plv2-action {
    background: var(--bg-tertiary, #252525);
    border-color: var(--border-color, #404040);
}
[data-theme="dark"] .plv2-price-main { color: var(--text-primary, #fff); }
[data-theme="dark"] .plv2-stepper    { background: #1f2937; }

/* ── Dark mode ────────────────────────────────────────── */
[data-theme="dark"] .pcv2 {
    background: var(--bg-secondary, #2d2d2d);
    box-shadow: 0 1px 4px rgba(0,0,0,.4);
}

[data-theme="dark"] .pcv2:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.5);
}

[data-theme="dark"] .pcv2-img   { background: #fff; }
[data-theme="dark"] .pcv2-name  { color: var(--text-primary, #fff); }
[data-theme="dark"] .pcv2-price-main { color: var(--text-primary, #fff); }

[data-theme="dark"] .pcv2-wish,
[data-theme="dark"] .pcv2-cart {
    background: rgba(40,40,40,.92);
    color: #9ca3af;
    box-shadow: 0 1px 5px rgba(0,0,0,.5);
}

[data-theme="dark"] .pcv2-cart:hover {
    background: #374151;
    color: #fff;
}

/* ── Featured homepage slider: render pcv2 cards uniformly ───────────────
   The .mcdodo-product-card carousel adds a scale(0.9)/opacity(.7) "focus"
   effect; neutralise it so every card looks like a standard product card.
   Keep width 240px so the slider's fixed cardWidth (240 + 24 gap) holds. */
.mcdodo-products-slider .mcdodo-product-card.pcv2 {
    flex: 0 0 240px;
    width: 240px;
    /* Fixed height so every featured card is identical regardless of how many
       lines the name wraps to or whether the product has a price. */
    height: 372px;
    transform: none;
    opacity: 1;
    gap: 0;
    margin: 0;
}
.mcdodo-products-slider .mcdodo-product-card.pcv2.in-view,
.mcdodo-products-slider .mcdodo-product-card.pcv2:hover {
    transform: translateY(-4px);
    opacity: 1;
}
.mcdodo-products-slider .mcdodo-product-card.pcv2 .pcv2-img {
    height: 200px;
}
/* Body fills the remaining fixed height and keeps its rows on a steady grid. */
.mcdodo-products-slider .mcdodo-product-card.pcv2 .pcv2-body {
    flex: 1;
    min-height: 0;
}
/* Always reserve 3 lines for the name so the category/price rows below it line
   up across every card. */
.mcdodo-products-slider .mcdodo-product-card.pcv2 .pcv2-name {
    min-height: calc(0.84rem * 1.45 * 3);
}
/* Reserve the price row even when a product has no price, so the stock line
   stays on the same baseline on every card. */
.mcdodo-products-slider .mcdodo-product-card.pcv2 .pcv2-prices {
    min-height: 1.3rem;
}
