/**
 * Product Card - ThemeForest Inspired Design
 * Clean, compact, professional
 */

/* ==========================================================================
   CARD CONTAINER
   ========================================================================== */

.dwc-product-card {
    display: flex;
    flex-direction: column;
    background: var(--dwc-bg-surface);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--dwc-border-color, #e6e6e6);
    transition: all 0.2s ease;
    height: 100%;
}

.dwc-product-card:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   IMAGE PREVIEW
   ========================================================================== */

.dwc-product-card__preview {
    position: relative;
    width: 100%;
    background: var(--dwc-bg-surface-2, #f9f9fb);
    overflow: visible;
}

.dwc-product-card__image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 50.847457627118644%;
    /* ThemeForest aspect ratio */
    overflow: hidden;
}

.dwc-product-card__image-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.dwc-product-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.dwc-product-card:hover .dwc-product-card__image {
    transform: scale(1.05);
}

.dwc-product-card__image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dwc-text-tertiary, #999);
    background: linear-gradient(135deg, #f5f5f5 0%, #e9e9e9 100%);
}

/* ==========================================================================
   SALE RIBBON (Corner Badge)
   ========================================================================== */

/* ==========================================================================
   DYNAMIC BADGES (LEFT SIDE) - TAB/LABEL STYLE
   ========================================================================== */

.dwc-product-card__badges {
    position: absolute;
    top: 12px;
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 4;
    pointer-events: none;
}

/* Tab/Label Badge Design - Icon Only */
.dwc-product-badge {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: #fff;
    box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.25s ease;
    cursor: pointer;
    clip-path: polygon(0 0, 100% 0, 85% 100%, 0% 100%);
}

.dwc-product-badge svg {
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Sale Badge - Red */
.dwc-product-badge--sale {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* New Badge - Blue */
.dwc-product-badge--new {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* Trending Badge - Purple */
.dwc-product-badge--trending {
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
}

/* Top Badge - Gold/Yellow */
.dwc-product-badge--top {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

/* Hover Effects - Extend the tab */
.dwc-product-card:hover .dwc-product-badge {
    width: 42px;
    box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.3);
}

.dwc-product-badge--sale:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}

.dwc-product-badge--new:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
}

.dwc-product-badge--trending:hover {
    background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
}

.dwc-product-badge--top:hover {
    background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%);
}

/* Responsive - Smaller on mobile */
@media (max-width: 640px) {
    .dwc-product-card__badges {
        top: 8px;
        gap: 6px;
    }

    .dwc-product-badge {
        width: 32px;
        height: 32px;
    }

    .dwc-product-badge svg {
        width: 14px;
        height: 14px;
    }

    .dwc-product-card:hover .dwc-product-badge {
        width: 36px;
    }
}

/* ==========================================================================
   OVERLAY & ACTIONS
   ========================================================================== */

.dwc-product-card__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 3;
    pointer-events: none;
}

.dwc-product-card:hover .dwc-product-card__overlay {
    opacity: 1;
}

.dwc-product-card__actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 0;
    pointer-events: auto;
}

.dwc-product-card__action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    color: var(--dwc-text-secondary, #707070);
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.dwc-product-card__action-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.dwc-product-card__action-btn:last-child {
    border-radius: 0 4px 4px 0;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.dwc-product-card__action-btn:hover {
    background: #fff;
    color: var(--dwc-color-primary, #6ca329);
    transform: scale(1.05);
}

.dwc-product-card__action-btn--wishlist.dwc-wishlist-btn--active {
    background: #ff6966;
    color: #fff;
}

.dwc-product-card__action-btn--collection.dwc-collection-btn--active {
    background: var(--dwc-color-primary, #6ca329);
    color: #fff;
}

.dwc-product-card__action-btn svg {
    flex-shrink: 0;
}

/* Dark mode overlay actions */
[data-theme="dark"] .dwc-product-card__action-btn {
    background: rgba(30, 30, 30, 0.95);
    color: var(--dwc-text-secondary);
}

[data-theme="dark"] .dwc-product-card__action-btn:hover {
    background: rgba(30, 30, 30, 1);
}

/* ==========================================================================
   CONTENT
   ========================================================================== */

.dwc-product-card__content {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
}

/* Title */
.dwc-product-card__title {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dwc-product-card__title a {
    color: var(--dwc-text-primary, #191919);
    text-decoration: none;
    transition: color 0.15s ease;
}

.dwc-product-card__title a:hover {
    color: var(--dwc-color-primary, #6ca329);
}

/* Verification Badges */
.dwc-product-card__verification {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 6px 0;
}

.dwc-verification-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 4px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.dwc-verification-badge svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

/* Product Verified Badge - Blue */
.dwc-verification-badge--product {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.dwc-verification-badge--product:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(59, 130, 246, 0.4);
}

/* Author Verified Badge - Green */
.dwc-verification-badge--author {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.dwc-verification-badge--author:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(16, 185, 129, 0.4);
}

/* Meta (Author & Category) */
.dwc-product-card__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 12px;
    line-height: 1.2;
    font-style: italic;
    margin: 0 0 6px 0;
}

.dwc-product-card__meta-label {
    color: var(--dwc-text-tertiary, #949494);
}

.dwc-product-card__meta-link {
    color: var(--dwc-text-secondary, #707070);
    text-decoration: none;
    transition: color 0.15s ease;
}

.dwc-product-card__meta-link:hover {
    color: var(--dwc-color-primary, #6ca329);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.dwc-product-card__footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
}

.dwc-product-card__footer-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.dwc-product-card__footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Price Badge - Floating on Image Bottom Right */
.dwc-product-card__price {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: var(--dwc-bg-surface, #fff);
    color: var(--dwc-text-primary, #191919);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--dwc-border-color, #e6e6e6);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 5;
    display: flex;
    align-items: baseline;
    gap: 5px;
    white-space: nowrap;
    backdrop-filter: blur(8px);
}

.dwc-product-card__price .price {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.dwc-product-card__price del {
    font-size: 11px;
    color: var(--dwc-text-tertiary, #949494);
    font-weight: 400;
    text-decoration: line-through;
}

.dwc-product-card__price ins {
    text-decoration: none;
    color: var(--dwc-color-primary, #6ca329);
    font-size: 14px;
    font-weight: 700;
}

.dwc-product-card__price-free {
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Free Price Badge - Special Styling */
.dwc-product-card__price--free {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
    z-index: 5;
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    display: flex;
    align-items: baseline;
    gap: 5px;
    white-space: nowrap;
}

.dwc-product-card__price--free:hover {
    transform: scale(1.05);
}

/* Rating */
.dwc-product-card__rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
}

.dwc-product-card__stars {
    display: flex;
    align-items: center;
    color: #ffc800;
}

.dwc-product-card__stars svg {
    width: 14px;
    height: 14px;
}

.dwc-product-card__rating-count {
    color: var(--dwc-text-tertiary, #949494);
}

/* Sales */
.dwc-product-card__sales {
    font-size: 14px;
    color: var(--dwc-text-secondary, #707070);
}

/* Cart Button */
.dwc-product-card__cart-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dwc-color-primary, #6ca329);
    color: #fff;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.15s ease;
    flex-shrink: 0;
    cursor: pointer;
}

.dwc-product-card__cart-btn:hover {
    background: var(--dwc-color-primary-hover, #79b530);
    color: #fff;
    transform: scale(1.05);
}

.dwc-product-card__cart-btn svg {
    flex-shrink: 0;
}

/* Loading state */
.dwc-product-card__cart-btn.dwc-btn--loading {
    position: relative;
    pointer-events: none;
}

.dwc-product-card__cart-btn.dwc-btn--loading svg {
    opacity: 0;
}

.dwc-product-card__cart-btn.dwc-btn--loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: dwc-spinner 0.6s linear infinite;
}

/* Success state */
.dwc-product-card__cart-btn.dwc-btn--success {
    background: #22c55e;
}

@keyframes dwc-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Preview Button */
.dwc-product-card__preview-btn {
    height: 40px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--dwc-bg-surface, #fff);
    color: var(--dwc-text-primary, #191919);
    border: 1px solid var(--dwc-border-color, #e6e6e6);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.dwc-product-card__preview-btn:hover {
    background: var(--dwc-bg-surface-2, #f9f9fb);
    border-color: var(--dwc-color-primary, #6ca329);
    color: var(--dwc-color-primary, #6ca329);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    .dwc-product-card__content {
        padding: 12px;
        gap: 5px;
    }

    .dwc-product-card__title {
        font-size: 15px;
        line-height: 1.3;
        margin-bottom: 3px;
    }

    .dwc-product-card__meta {
        font-size: 11px;
        line-height: 1.2;
        margin: 0;
    }

    .dwc-verification-badge {
        font-size: 10px;
        padding: 2px 6px;
        gap: 3px;
    }

    .dwc-verification-badge svg {
        width: 12px;
        height: 12px;
    }

    .dwc-product-card__footer {
        gap: 6px 10px;
    }

    .dwc-product-card__footer-left {
        gap: 4px;
    }

    .dwc-product-card__price {
        font-size: 13px;
        padding: 5px 10px;
        bottom: 6px;
        right: 6px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    }

    .dwc-product-card__price del {
        font-size: 10px;
    }

    .dwc-product-card__price ins {
        font-size: 13px;
    }

    .dwc-product-card__preview-btn {
        font-size: 13px;
        padding: 0 12px;
        height: 36px;
    }

    .dwc-product-card__cart-btn {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 640px) {
    .dwc-product-card__footer {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .dwc-product-card__footer-left {
        width: 100%;
    }

    .dwc-product-card__footer-right {
        width: 100%;
        justify-content: flex-end;
    }

    .dwc-product-card__preview-btn {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .dwc-product-card__content {
        padding: 10px;
        gap: 4px;
    }

    .dwc-product-card__title {
        font-size: 14px;
        line-height: 1.3;
        margin-bottom: 2px;
    }

    .dwc-product-card__meta {
        font-size: 10px;
    }

    .dwc-verification-badge {
        font-size: 9px;
        padding: 2px 5px;
    }

    .dwc-verification-badge svg {
        width: 10px;
        height: 10px;
    }

    .dwc-product-card__footer {
        gap: 8px;
    }

    .dwc-product-card__footer-left {
        gap: 3px;
    }

    .dwc-product-card__price {
        font-size: 12px;
        padding: 4px 8px;
        bottom: 5px;
        right: 5px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .dwc-product-card__price del {
        font-size: 9px;
    }

    .dwc-product-card__price ins {
        font-size: 12px;
    }

    .dwc-product-card__rating {
        font-size: 12px;
    }

    .dwc-product-card__stars svg {
        width: 12px;
        height: 12px;
    }

    .dwc-product-card__sales {
        font-size: 12px;
    }
}