/* product-cards.css — Product card hover effects + badges
 * Used by product-listing.ejs and any card grid throughout the site
 */

/* ── Base card ───────────────────────────────────────────── */
.product-card {
    position: relative;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition:
        transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.22s ease,
        border-color 0.22s ease;
    text-decoration: none;
    color: inherit;
}

.product-card:hover {
    transform: translateY(-6px) scale(1.012);
    box-shadow: 0 16px 40px rgba(124, 58, 237, 0.14), 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #c4b5fd;
}

/* ── Thumbnail wrapper ───────────────────────────────────── */
.product-card-thumb {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4/3;
    background: #f8fafc;
    flex-shrink: 0;
}

.product-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.product-card:hover .product-card-thumb img {
    transform: scale(1.06);
}

/* Quick-view button (appears on hover) */
.product-card-quick-view {
    position: absolute;
    bottom: -48px;
    left: 0;
    right: 0;
    background: rgba(124, 58, 237, 0.92);
    backdrop-filter: blur(4px);
    color: #fff;
    text-align: center;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: bottom 0.22s ease;
    text-transform: uppercase;
}

.product-card:hover .product-card-quick-view {
    bottom: 0;
}

/* ── Badges ──────────────────────────────────────────────── */
.product-card-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 10;
    pointer-events: none;
}

.product-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1.6;
}

.product-badge.new {
    background: #7c3aed;
    color: #fff;
}

.product-badge.sale {
    background: #ef4444;
    color: #fff;
}

.product-badge.featured {
    background: #f59e0b;
    color: #fff;
}

.product-badge.popular {
    background: #10b981;
    color: #fff;
}

.product-badge.limited {
    background: #0f172a;
    color: #fff;
}

/* ── Body ────────────────────────────────────────────────── */
.product-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 6px;
}

.product-card-name {
    font-size: 15px;
    font-weight: 600;
    color: #1e1e2e;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card:hover .product-card-name {
    color: #7c3aed;
}

.product-card-category {
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ── Pricing ─────────────────────────────────────────────── */
.product-card-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
    flex-wrap: wrap;
}

.product-card-price-from {
    font-size: 11px;
    color: #94a3b8;
}

.product-card-price-val {
    font-size: 18px;
    font-weight: 700;
    color: #1e1e2e;
}

.product-card-price-old {
    font-size: 13px;
    color: #94a3b8;
    text-decoration: line-through;
}

.product-card-price-save {
    font-size: 12px;
    color: #10b981;
    font-weight: 600;
}

/* ── Add-to-cart footer ──────────────────────────────────── */
.product-card-footer {
    padding: 12px 16px 16px;
    border-top: 1px solid #f1f5f9;
}

.product-card-atc-btn {
    width: 100%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.product-card-atc-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.45);
}

.product-card-atc-btn:active {
    transform: scale(0.97);
}

.product-card-atc-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Product card grid ───────────────────────────────────── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}

@media (max-width: 640px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .product-card-body {
        padding: 12px;
    }

    .product-card-name {
        font-size: 13px;
    }

    .product-card-price-val {
        font-size: 15px;
    }
}

@media (max-width: 380px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Add-to-cart global helper (fired from any card) ──────── */
/* Triggered by class .atc-loading added via JS */
.product-card-atc-btn.atc-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ffffff80;
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 6px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}