/**
 * Empapy Caffe - Product Card Styles
 * Extracted from product-card.blade.php for better caching and maintainability
 */

/* Enhanced Product Card Styles */
.product-card {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    border-radius: var(--radius-lg, 16px);
}

.product-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(201, 162, 39, 0.2);
}

/* Image wrapper with skeleton */
.product-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.product-image-wrapper img {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.product-image-wrapper img.loaded {
    opacity: 1;
}

.skeleton-placeholder {
    border-radius: 0;
}

/* Animate pulse for badges */
.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Quick Add Overlay */
.quick-add-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background: linear-gradient(to top, rgba(44, 24, 16, 0.95), transparent);
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
}

.product-card:hover .quick-add-overlay {
    transform: translateY(0);
    opacity: 1;
}

.quick-add-btn {
    background: var(--gradient-gold, linear-gradient(135deg, #C9A227 0%, #E8C547 50%, #C9A227 100%));
    border: none;
    padding: 12px 25px;
    border-radius: var(--radius-full, 50px);
    font-weight: 600;
    color: var(--espresso, #2C1810);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.quick-add-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(201, 162, 39, 0.4);
}

.out-of-stock-msg {
    color: white;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Product Category */
.product-category-wrapper {
    margin-bottom: 8px;
}

.product-category {
    font-size: 0.75rem;
    color: var(--gold, #C9A227);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    background: rgba(201, 162, 39, 0.1);
    padding: 4px 10px;
    border-radius: var(--radius-full, 50px);
}

/* Price Range for products with weight options */
.price-range {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold, #C9A227);
}

/* Product Footer */
.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--gray-100, #F5F5F5);
    gap: 10px;
}

/* Main Add to Cart Button - Always Visible */
.btn-add-cart-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--radius-full, 50px);
    background: var(--gradient-gold, linear-gradient(135deg, #C9A227 0%, #E8C547 50%, #C9A227 100%));
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--espresso, #2C1810);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(201, 162, 39, 0.3);
}

.btn-add-cart-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 162, 39, 0.5);
}

.btn-add-cart-main:active {
    transform: translateY(0);
}

.btn-add-cart-main .cart-icon-btn {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-add-cart-main .btn-text {
    display: inline;
}

.btn-add-cart-main.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-add-cart-main.success {
    background: #22c55e !important;
    color: white !important;
}

/* Out of Stock Label */
.out-of-stock-label {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border-radius: var(--radius-full, 50px);
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .btn-add-cart-main .btn-text {
        display: none;
    }

    .btn-add-cart-main {
        padding: 10px;
        min-width: 40px;
        min-height: 40px;
    }

    .product-actions {
        opacity: 1 !important;
        transform: translateX(-50%) translateY(0) !important;
    }

    .quick-add-overlay {
        display: none;
    }
}

@media (max-width: 480px) {
    .product-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .btn-add-cart-main {
        width: 100%;
        justify-content: center;
    }

    .btn-add-cart-main .btn-text {
        display: inline;
    }
}

/* Stock badges */
.product-badge.low-stock {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    top: auto;
    bottom: 15px;
    right: 15px;
}

.product-badge.out-of-stock {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    top: 50px;
}

/* Wishlist active state */
.wishlist-btn.active {
    background: #ff6b9d;
    color: white;
}

.wishlist-btn.active:hover {
    background: #ff4785;
}

/* Product actions hover effects */
.btn-action {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-action:hover {
    transform: scale(1.15) translateY(-2px);
}

/* Add loading state to cart buttons */
.add-to-cart-btn.loading {
    pointer-events: none;
}

.add-to-cart-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.add-to-cart-btn.success {
    background: #22c55e !important;
    color: white !important;
}

.add-to-cart-btn.success i::before {
    content: "\F26B";
}

/* Inline Wishlist Button */
.wishlist-btn-inline {
    background: transparent;
    border: none;
    color: #9ca3af;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

.wishlist-btn-inline:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    transform: scale(1.1);
}

.wishlist-btn-inline.active {
    color: #ef4444;
}

.wishlist-btn-inline i {
    font-size: 1.2rem;
}

/* ========================================
   Dark Mode Support
   ======================================== */
[data-theme="dark"] .product-card {
    background: rgba(30, 30, 40, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .product-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(201, 162, 39, 0.3);
}

[data-theme="dark"] .product-title a {
    color: #f5f5f5;
}

[data-theme="dark"] .product-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .product-meta .meta-item {
    color: #9ca3af;
}

[data-theme="dark"] .skeleton-placeholder {
    background: linear-gradient(90deg, #2a2a3a 0%, #3a3a4a 50%, #2a2a3a 100%);
}

[data-theme="dark"] .wishlist-btn-inline {
    color: #6b7280;
}

[data-theme="dark"] .wishlist-btn-inline:hover {
    background: rgba(239, 68, 68, 0.2);
}
