/* product_card.css — Premium E-commerce Product Card */

/* ── Card Container ── */
.product-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    transition: transform .3s cubic-bezier(.25,.46,.45,.94),
                box-shadow .3s cubic-bezier(.25,.46,.45,.94),
                border-color .3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,.08);
    border-color: #d0d5dd;
}

/* ── Image Section ── */
.card-image-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    aspect-ratio: 1 / 1.1;
    background: linear-gradient(135deg, #f8f9fb 0%, #f0f2f5 100%);
    padding: 20px;
    width: 100%;
    cursor: pointer;
}
.card-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .4s cubic-bezier(.25,.46,.45,.94);
}
.product-card:hover .card-image-wrap img {
    transform: scale(1.08);
}

/* ── Discount Badge ── */
.discount-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(239,68,68,.35);
    z-index: 5;
    line-height: 1;
    letter-spacing: -.2px;
}

/* ── Out of Stock Overlay ── */
.out-of-stock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.7);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
}
.out-of-stock-label {
    background: rgba(0,0,0,.75);
    color: #fff;
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .3px;
}

/* ── Action Buttons ── */
.card-actions {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity .3s ease, transform .3s ease;
    z-index: 10;
}
.product-card:hover .card-actions {
    opacity: 1;
    transform: translateX(0);
}
.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.95);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-light);
    transition: all .2s ease;
    cursor: pointer;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    backdrop-filter: blur(8px);
}
.action-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(37,99,235,.15);
}
.action-btn.wish-active {
    color: var(--danger);
    border-color: var(--danger);
    background: #fef2f2;
}
.action-btn.wish-active:hover {
    box-shadow: 0 4px 12px rgba(220,38,38,.15);
}

/* ── Badges Row ── */
.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 14px;
    margin-top: 10px;
}
.badge-item {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    line-height: 1.4;
    letter-spacing: .2px;
}

/* ── Card Body ── */
.card-body {
    padding: 12px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

/* Brand */
.card-brand {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: .3px;
    margin-bottom: 2px;
}

/* Title */
.card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
    min-height: 39px;
    transition: color .2s ease;
}
.card-title:hover {
    color: var(--accent);
}

/* ── Rating Stars ── */
.card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 4px 0;
}
.card-rating .stars {
    display: flex;
    gap: 1px;
}
.card-rating .star {
    font-size: 12px;
    color: #d1d5db;
    line-height: 1;
}
.card-rating .star.filled {
    color: #f59e0b;
}
.card-rating .rating-text {
    font-size: 11px;
    color: var(--ink-faint);
    font-weight: 500;
}

/* ── Price Area ── */
.card-footer-area {
    margin-top: auto;
    padding-top: 8px;
}
.card-price-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.price-original {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #9ca3af;
}
.price-original del {
    text-decoration: line-through;
    color: #9ca3af;
}
.price-discounted {
    color: var(--danger) !important;
    font-weight: 700;
}
.card-price {
    font-size: 17px;
    font-weight: 800;
    color: var(--ink);
    line-height: 1.3;
}
.card-price .currency {
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-faint);
    margin-right: 2px;
}

/* ── Add to Cart Button ── */
.btn-cart {
    margin-top: 10px;
    width: 100%;
    padding: 10px 0;
    background: linear-gradient(135deg, var(--accent) 0%, #1d4ed8 100%);
    color: #fff;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all .25s ease;
    box-shadow: 0 2px 8px rgba(37,99,235,.2);
}
.btn-cart:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(37,99,235,.3);
}
.btn-cart:active {
    transform: translateY(0);
}
.btn-cart:disabled {
    background: var(--border);
    color: var(--ink-faint);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* ── Variant Accordion ── */
.variant-accordion {
    margin-top: 8px;
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
    display: none;
}
.variant-accordion.open {
    display: block;
}
.variant-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 6px;
    transition: background .15s ease;
}
.variant-row:last-child {
    border-bottom: none;
}
.variant-row:hover {
    background: #fff;
}
.var-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.var-title {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.var-price-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.var-price-old {
    font-size: 11px;
    color: #9ca3af;
    text-decoration: line-through;
}
.var-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
}
.var-price-discount {
    color: var(--danger) !important;
}
.var-discount-percent {
    background: var(--danger);
    color: #fff;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    flex-shrink: 0;
}
.btn-mini-cart {
    background: var(--accent);
    color: #fff;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    transition: background .2s ease;
}
.btn-mini-cart:hover {
    background: #1d4ed8;
}

/* ── Quantity Controller ── */
.qty-ctrl {
    display: none;
    width: 100%;
    align-items: center;
    border: 1.5px solid var(--accent);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--accent-soft);
}
.qty-ctrl.visible {
    display: flex !important;
    align-items: center;
}
.add-to-cart-btn {
    flex: 0 0 36px;
    height: 36px;
    background: none;
    border: none;
    font-size: 17px;
    color: var(--accent);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease;
}
.add-to-cart-btn:hover {
    background: rgba(37,99,235,.08);
}
.qty-val {
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
}
.qty-btn {
    flex: 0 0 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    transition: background .15s ease;
    font-family: var(--font-primary);
}
.qty-btn:hover {
    background: rgba(37,99,235,.08);
}
.qty-btn:active {
    background: rgba(37,99,235,.15);
}

/* ── Unavailable Badge ── */
.badge-unavail {
    display: block;
    text-align: center;
    padding: 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

/* ── Skeleton Loader ── */
.skeleton-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}
.skeleton-image {
    aspect-ratio: 1 / 1.1;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
.skeleton-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.h-lg { height: 18px; }
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Tilt Card: 3D Effect ── */
.product-card[data-tilt] {
    transform-style: preserve-3d;
    will-change: transform;
}
.product-card[data-tilt].is-tilting {
    z-index: 10;
}
.product-card[data-tilt]:hover {
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.12);
}

/* ── Tilt Glare Layer ── */
.tilt-glare {
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    pointer-events: none;
    z-index: 20;
    opacity: 0;
    transition: opacity .3s ease;
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
    .product-card[data-tilt] {
        transform: none !important;
    }
    .product-card[data-tilt]:hover {
        transform: none !important;
    }
    .tilt-glare {
        display: none !important;
    }
}

/* ── Mobile Responsive ── */
@media (max-width: 640px) {
    .product-card:hover {
        transform: none;
        box-shadow: 0 1px 3px rgba(0,0,0,.04);
    }
    .product-card[data-tilt]:hover {
        transform: none !important;
    }
    .product-card[data-tilt].is-tilting {
        transform: none !important;
    }
    .tilt-glare {
        display: none;
    }

    .card-image-wrap {
        aspect-ratio: 1 / 1;
        padding: 12px;
    }

    .card-actions {
        opacity: 1;
        transform: translateX(0);
        top: 8px;
        left: 8px;
        gap: 6px;
    }
    .action-btn {
        width: 30px;
        height: 30px;
        font-size: 13px;
        background: rgba(255,255,255,.9);
    }

    .card-body {
        padding: 8px 10px 12px;
        gap: 2px;
    }
    .card-brand { font-size: 10px; }
    .card-title {
        font-size: 12px;
        min-height: 34px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    .card-rating .star { font-size: 10px; }
    .card-rating .rating-text { font-size: 10px; }

    .card-price {
        font-size: 14px;
        font-weight: 800;
    }
    .card-price .currency { font-size: 10px; }
    .price-original { font-size: 11px; }
    .card-price-wrap { gap: 1px; margin-bottom: 4px; }

    .btn-cart {
        padding: 8px 0;
        font-size: 11px;
        gap: 4px;
        margin-top: 6px;
    }

    .discount-badge {
        font-size: 10px;
        padding: 3px 8px;
        top: 8px;
        right: 8px;
    }

    .badge-item {
        font-size: 9px;
        padding: 2px 7px;
    }
    .card-badges { padding: 0 10px; margin-top: 6px; }

    .variant-accordion { margin-top: 4px; font-size: 11px; }
    .variant-row { padding: 6px 8px; gap: 6px; }
    .var-title { font-size: 10px; }
    .var-price { font-size: 11px; }
    .var-price-old { font-size: 10px; }
    .btn-mini-cart { width: 26px; height: 26px; font-size: 11px; }

    .badge-unavail { font-size: 10px; padding: 5px; }
}
