/* ============================================
   PRODUCT CARD
   ============================================ */

.product-card {
    position: relative;   /* ← add this */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    background: white;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Card link */
.product-card-link {
    display: block;
    cursor: pointer;
}

/* Image container */
.product-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8f9fa;
}

/* Image */
.product-card .card-img-top {
    height: auto !important;
    aspect-ratio: 3.8 / 5;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    display: block !important;
    background: #f8f9fa;
    position: relative;
}

.product-card .card-img-top img,
.product-card .card-img-top video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: top center !important;
    display: block !important;
    transition: transform 0.5s ease;
}

/* Image placeholder */
.product-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #ccc;
    font-size: 48px;
}

/* Badges */
.product-badge-top-left {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 5;
    max-width: calc(100% - 16px);
}

.product-badge-sale {
    background: linear-gradient(135deg, #dc3545, #ff6b6b);
    color: white;
    padding: 2px 6px;
    border-radius: 20px;
    font-size: 7px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
    display: inline-block;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.product-badge-out-of-stock {
    position: absolute;
    bottom: 8px;
    left: 8px;
    transform: none;
    background: rgba(220, 53, 69, 0.95);
    color: #ffffff;
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 10px;
    z-index: 6;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: none;
}

/* Wishlist Button — mobile-first */
.product-wishlist-btn {
    position: absolute;
    top: 50%;
    right: 0px !important;
    transform: translateY(-50%);
    border-radius: 50% !important;
    padding: 0 !important;
    z-index: 5;

    width: 22px !important;
    height: 22px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-width: 0.5px !important;
}

.product-wishlist-btn .fa-heart {
    font-size: 8px !important;
}

/* Larger on tablet and up */
@media (min-width: 577px) {
    .product-wishlist-btn {
        width: 26px !important;
        height: 26px !important;
        right: 0px !important;
    }
    .product-wishlist-btn .fa-heart {
        font-size: 10px !important;
    }
}

@media (min-width: 993px) {
    .product-wishlist-btn {
        width: 30px !important;
        height: 30px !important;
        right: 0 !important; 
    }
    .product-wishlist-btn .fa-heart {
        font-size: 12px !important;
    }
}

/* Card body */
.product-card-body {
    padding: 8px 10px 10px 10px !important;
}

/* Product Name */
.product-card .card-title {
    font-size: 0.8rem !important;
    font-weight: 400 !important;
    max-width: 70%; 
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    color: #1a1a2e !important;
}

.product-card .card-title a {
    color: #1a1a2e !important;
    text-decoration: none !important;
}

.product-card .card-title a:hover {
    color: #667eea !important;
}

/* Product meta row — vendor · rating · buttons */
.product-meta {
    min-height: 24px;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 4px;
    overflow: hidden;
    width: 100%;
}
.product-meta .product-vendor {
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.product-meta .product-rating {
    flex-shrink: 0;
}
.product-meta .action-buttons-meta {
    margin-left: auto;
    flex-shrink: 0;
    gap: 2px;
}

.product-vendor {
    font-size: 0.5rem !important;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 0px 4px !important;
    background: #f8f9fa !important;
    border-radius: 4px !important;
    border: 1px solid #f0f0f0 !important;
}

.product-vendor .fa-store {
    font-size: 0.4rem;
}

.product-rating {
    font-size: 0.5rem;
    white-space: nowrap;
}

.product-review-count {
    font-size: 0.4rem;
    font-weight: 500;
}

.product-no-rating {
    font-size: 0.4rem;
}

/* ============================================
   BOTTOM ROW - Price Left | Buttons Right
   ============================================ */

.bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 4px;
    gap: 6px;
    flex-wrap: wrap;
}

/* Left: Price Section */
.price-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

/* Price */
.price-wrapper {
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
    max-width: 100%;
}

.compare-price {
    font-size: 0.55rem;
    color: #999;
    text-decoration: line-through;
    flex-shrink: 0;
}

.main-price {
    font-weight: 300;
    color: #2c3e50;
    font-size: 0.65rem;
    display: inline-flex;
    align-items: baseline;
    gap: 1px;
    flex-shrink: 0;
}

.main-price .price-whole {
    font-size: 1.2em;
    font-weight: 700;
}

.main-price .price-decimal {
    font-size: 0.5em;
    vertical-align: super;
    opacity: 0.5;
}

.main-price .flash-badge {
    background: linear-gradient(135deg, #dc3545, #ff6b6b);
    color: white;
    font-size: 0.45rem;
    padding: 0px 4px;
    border-radius: 8px;
    margin-left: 2px;
}

/* ============================================
   CONVERTED PRICE - ORIGINAL TEMPLATE STYLE
   ============================================ */
.converted-price {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.7rem;
    color: #6c757d;
    flex-shrink: 0;
}

.converted-price .converted-label {
    color: #6c757d;
}

.converted-price .converted-value {
    font-weight: 500;
    color: #4363ee;
}

.converted-price .converted-loading {
    color: #6c757d;
}

/* Indicators (variant count, stock indicator) */
.indicators {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 1;
    min-width: 0;
}

.indicator-badge,
.variant-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.5rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
}

.variant-badge {
    background: transparent;
    color: #6c757d;
    border: none;
    padding: 0;
}

.variant-badge .fa-tshirt {
    font-size: 0.5rem;
    line-height: 1;
}

@media (max-width: 576px) {
    .indicators { gap: 4px; }
    .indicator-badge,
    .variant-badge,
    .variant-badge .fa-tshirt {
        font-size: 0.45rem;
    }
}

.stock-badge {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.new-badge {
    background: #d4edda;
    color: #155724;
    border: 1px solid #28a745;
}

/* Right: Action Buttons */
.action-buttons {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.action-buttons .btn {
    font-size: 0.7rem;
    padding: 3px 8px;
    height: 28px;
    min-width: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border-width: 0.7px;
}

.action-buttons .btn i {
    font-size: 12px;
}

/* ─── Compact card (recently-viewed) button sizing ─── */
.product-card.compact .action-buttons {
    gap: 2px;
}
.product-card.compact .action-buttons .btn {
    height: 24px;
    min-width: 24px;
    padding: 2px 6px;
    font-size: 0.6rem;
}
.product-card.compact .action-buttons .btn i {
    font-size: 10px;
}
/* Cart button — not in cart (outline) */
.action-buttons .btn-cart {
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.action-buttons .btn-cart:hover {
    background: #667eea;
    color: white;
    transform: scale(1.05);
}

/* Cart button — in cart (solid gradient) */
.action-buttons .btn-cart.is-added {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.action-buttons .btn-cart.is-added:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.action-buttons .btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.action-buttons .compare-btn:hover,
.action-buttons .btn-outline-primary:hover {
    background: #667eea !important;
    color: white !important;
    border-color: #667eea !important;
}

/* Out of Stock */
.product-card.out-of-stock {
    opacity: 0.7;
    filter: grayscale(0.3);
}

.product-card.out-of-stock .action-buttons .btn-cart,
.product-card.out-of-stock .action-buttons .btn-cart-variant {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* Responsive */
@media (max-width: 768px) {
    .product-card .card-img-top {
        aspect-ratio: 3.8 / 5;
    }
    .product-badge-top-left {
        top: 6px;
        left: 6px;
    }
    .product-badge-sale {
        padding: 1px 5px;
        font-size: 6px;
    }
    .product-card-body {
        padding: 6px 8px 8px 8px !important;
    }
    .main-price {
        font-size: 0.6rem !important;
    }
    .action-buttons .btn {
        height: 26px !important;
        min-width: 26px !important;
        font-size: 0.65rem !important;
    }
    .action-buttons .btn i {
        font-size: 11px !important;
    }
    .indicator-badge {
        font-size: 0.45rem !important;
        padding: 0px 4px !important;
    }
    .converted-price {
        font-size: 0.65rem !important;
    }
}

@media (max-width: 576px) {
    .product-card .card-img-top {
        aspect-ratio: 3.8 / 5;
    }
    .product-badge-top-left {
        top: 4px;
        left: 4px;
        max-width: calc(100% - 8px);
    }
    .product-badge-sale {
        padding: 1px 4px;
        font-size: 6px;
        box-shadow: 0 1px 4px rgba(220, 53, 69, 0.3);
    }
    .product-card .card-title {
        font-size: 0.7rem !important;
    }
    .main-price {
        font-size: 0.55rem !important;
    }
    .action-buttons .btn {
        height: 24px !important;
        min-width: 24px !important;
        font-size: 0.6rem !important;
    }
    .action-buttons .btn i {
        font-size: 10px !important;
    }
    .indicator-badge {
        font-size: 0.4rem !important;
        padding: 0px 3px !important;
    }
    .converted-price {
        font-size: 0.6rem !important;
    }
    .compare-price {
        font-size: 0.5rem !important;
    }
    .product-vendor {
        font-size: 0.45rem !important;
    }
}
.product-card-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 10;
    display: inline-block;
    background: linear-gradient(135deg, #dc3545, #ff6b6b);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 8px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(220, 53, 69, 0.3);
    pointer-events: none;
}

/* ─── Meta-row action buttons ─── */
.product-card .action-buttons-meta .btn {
    height: 28px;
    min-width: 28px;
    padding: 0;
    font-size: 0.7rem;
    border-radius: 50%;
}
.product-card .action-buttons-meta .btn i {
    font-size: 12px;
}

@media (max-width: 576px) {
    .product-meta {
        gap: 3px;
    }
    .product-card .action-buttons-meta {
        gap: 2px;
    }
    .product-card .action-buttons-meta .btn {
        height: 24px;
        min-width: 24px;
    }
    .product-card .action-buttons-meta .btn i {
        font-size: 10px;
    }
}

/* ─── Action buttons row: indicators on left, buttons on right ─── */
.action-buttons-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    margin-top: 4px;
    margin-bottom: 4px;
}

.action-buttons-row .indicators {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
}

.action-buttons-row .action-buttons {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.action-buttons-row .btn {
    height: 28px;
    min-width: 28px;
    padding: 0;
    font-size: 0.65rem;
    border-radius: 50%;
    border-width: 0.7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-buttons-row .btn i {
    font-size: 10px;
}

@media (max-width: 576px) {
    .action-buttons-row {
        gap: 4px;
        margin-top: 3px;
        margin-bottom: 3px;
    }
    .action-buttons-row .indicators {
        gap: 4px;
    }
    .action-buttons-row .btn {
        height: 22px;
        min-width: 22px;
    }
    .action-buttons-row .btn i {
        font-size: 9px;
    }
}


/* ─── Stock indicator — mirrors the variant badge exactly ─── */
.stock-indicator {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.5rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: help;
}

.stock-indicator .fa-bolt {
    font-size: 0.5rem;
    line-height: 1;
}

.stock-indicator__count {
    font-size: 0.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.stock-indicator--new { color: #16a34a; }
.stock-indicator--low { color: #dc2626; }

@media (max-width: 576px) {
    .variant-badge,
    .stock-indicator,
    .variant-badge .fa-tshirt,
    .stock-indicator .fa-bolt,
    .stock-indicator__count {
        font-size: 0.45rem;
    }
}

/* ─── Compact (recently-viewed) card — minimal, responsive ─── */
.product-card.compact .card-title {
    font-size: clamp(0.65rem, 2.5vw, 0.8rem) !important;
    max-width: 100% !important;      /* no reserved space for buttons anymore */
}

.product-card.compact .bottom-row {
    flex-wrap: wrap;
    gap: 4px;
}

.product-card.compact .price-section {
    flex: 1 1 100%;                  /* price on its own full row */
    margin-bottom: 4px;
}

.product-card.compact .main-price,
.product-card.compact .price-whole {
    font-size: clamp(0.7rem, 3vw, 0.9rem) !important;
}

.product-card.compact .converted-price,
.product-card.compact .converted-price-compact {
    font-size: 0.55rem !important;
}
.product-card.compact .converted-price .converted-label,
.product-card.compact .converted-price .converted-value {
    font-size: inherit !important;
}

.product-card.compact .action-buttons {
    flex: 1 1 100%;
    justify-content: flex-end;
}

/* ============================================ */
/* RECENTLY VIEWED — compact grid (smaller cards) */
/* ============================================ */
.product-grid--compact {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

@media (min-width: 576px) {
    .product-grid--compact { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 768px) {
    .product-grid--compact { grid-template-columns: repeat(5, 1fr); gap: 0.65rem; }
}

@media (min-width: 992px) {
    .product-grid--compact { grid-template-columns: repeat(6, 1fr); }
}
