/**
 * DabDash Product Card - Modern Silicon Valley Design
 *
 * Clean, polished aesthetic with efficient use of space
 * @since 2.5.0
 */

/* ===== CSS VARIABLES ===== */
:root {
    --card-bg: #f9fafb;
    --card-bg-hover: #f3f4f6;
    --card-border: #e5e7eb;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --card-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    --card-radius: 16px;

    /* Greyscale with WCAG AA compliant contrast ratios */
    --text-primary: #000000;        /* 21:1 contrast on light bg */
    --text-secondary: #4b5563;      /* 8.59:1 contrast on light bg */
    --text-tertiary: #6b7280;       /* 5.74:1 contrast on light bg */

    --bg-subtle: #f3f4f6;
    --bg-muted: #e5e7eb;
    --bg-dark: #374151;

    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 20px;
    --spacing-xl: 24px;
}

/* Dark mode disabled - cards always use light neutral background */

/* ===== BASE CARD STYLES ===== */

.dabdash-product-card {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.dabdash-product-card.clickable {
    cursor: pointer;
}

.dabdash-product-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
    border-color: var(--card-border);
    background: var(--card-bg-hover);
}

/* ===== GRID VIEW (DEFAULT) ===== */

.dabdash-product-card--grid {
    max-width: 100%;
}

.dabdash-product-card--grid .dabdash-product-image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    max-height: 280px;
}

.dabdash-product-card--grid .dabdash-product-info {
    padding: var(--spacing-md);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* ===== LIST VIEW ===== */

.dabdash-product-card--list {
    flex-direction: row;
    align-items: stretch;
}

.dabdash-product-card--list .dabdash-product-image {
    width: 140px;
    min-width: 140px;
    aspect-ratio: 4 / 3;
    position: relative;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

.dabdash-product-card--list .dabdash-product-info {
    padding: var(--spacing-md);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.dabdash-product-card--list .dabdash-product-actions-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-top: auto;
}

.dabdash-product-card--list .dabdash-list-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* ===== PRODUCT IMAGE ===== */

.dabdash-product-image {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dabdash-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dabdash-product-card:hover .dabdash-product-image img {
    transform: scale(1.05);
}

.dabdash-product-placeholder {
    font-size: 3rem;
    color: var(--text-tertiary);
    opacity: 0.5;
}

/* ===== BADGES ===== */

.dabdash-badges {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    z-index: 1;
}

.dabdash-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dabdash-badge-sale {
    background: rgba(0, 0, 0, 0.9);
    color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 1);
}

.dabdash-badge-stock {
    background: rgba(107, 114, 128, 0.95);
    color: #ffffff;
}

.dabdash-badge-rating {
    background: rgba(255, 255, 255, 0.95);
    color: #000000;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.dabdash-badge-mix-match {
    background: linear-gradient(135deg, #1F7A3A 0%, #FFB938 100%);
    color: #ffffff;
    border: none;
    cursor: help;
    animation: mix-match-pulse 2s ease-in-out infinite;
}

@keyframes mix-match-pulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(31, 122, 58, 0.3);
    }
    50% {
        box-shadow: 0 2px 12px rgba(255, 185, 56, 0.5);
    }
}

/* ===== TYPE BADGE (Bottom Left) ===== */

.dabdash-type-badge {
    position: absolute;
    bottom: var(--spacing-sm);
    left: var(--spacing-sm);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.95);
    color: #000000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.15);
    z-index: 1;
}

/* ===== PRODUCT INFO ===== */

.dabdash-product-name {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== CANNABINOID PILLS ===== */

.dabdash-cannabinoids-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: -2px 0;
}

.dabdash-cannabinoid-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: var(--bg-subtle);
    color: #000000;
    border: 1px solid var(--bg-muted);
}

/* All cannabinoids use same greyscale styling for consistency */
.dabdash-cannabinoid-thc,
.dabdash-cannabinoid-cbd,
.dabdash-cannabinoid-cbg,
.dabdash-cannabinoid-cbn {
    background: var(--bg-subtle);
    color: #000000;
    border: 1px solid var(--bg-muted);
}

/* ===== STRAIN COMPOSITION ===== */

.dabdash-strain-composition {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ===== GRID VIEW META (Effects & Flavors) ===== */

.dabdash-grid-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
}

.dabdash-meta-compact {
    display: flex;
    gap: 6px;
    line-height: 1.4;
}

.dabdash-meta-compact .dabdash-meta-label {
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.dabdash-meta-compact .dabdash-meta-value {
    color: var(--text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== PRICING ===== */

.dabdash-product-pricing {
    margin-top: auto;
    padding-top: var(--spacing-xs);
}

.dabdash-price-wrapper {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.dabdash-price-regular {
    font-size: 14px;
    color: var(--text-tertiary);
    text-decoration: line-through;
}

.dabdash-price-current {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.dabdash-price-current .woocommerce-Price-currencySymbol {
    font-size: 16px;
    font-weight: 600;
}

/* ===== BUTTONS ===== */

.dabdash-product-actions {
    margin-top: var(--spacing-xs);
}

.dabdash-btn-cart {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    background: #000000;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.dabdash-btn-cart:hover:not(:disabled) {
    background: #1f2937;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

.dabdash-btn-cart:active:not(:disabled) {
    transform: translateY(0);
    background: #000000;
}

.dabdash-btn-cart-disabled {
    background: #d1d5db;
    color: #6b7280;
    cursor: not-allowed;
    box-shadow: none;
}

/* Select Options button (for variable products) - matches Add to Cart exactly */
a.dabdash-btn-cart.dabdash-btn-select-options {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    text-align: center;
    box-sizing: border-box;
}

a.dabdash-btn-cart.dabdash-btn-select-options:hover {
    background: #1f2937;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
    color: #ffffff;
}

a.dabdash-btn-cart.dabdash-btn-select-options:active {
    transform: translateY(0);
    background: #000000;
}

.dabdash-btn-outline {
    padding: 10px 16px;
    border: 1.5px solid var(--card-border);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
}

.dabdash-btn-outline:hover {
    background: var(--card-bg-hover);
    border-color: var(--text-secondary);
}

/* View Details Button (Greyscale) */
.dabdash-btn-view-details {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    background: #f3f4f6;
    color: #4b5563;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
}

.dabdash-btn-view-details:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #1f2937;
    text-decoration: none;
}

/* Product Image Link Wrapper */
.dabdash-product-image-link {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Image Hover Overlay */
.dabdash-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.dabdash-product-image-link:hover .dabdash-image-overlay {
    opacity: 1;
}

/* Outbound Link Icon */
.dabdash-link-icon {
    color: #ffffff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dabdash-product-image-link:hover .dabdash-link-icon {
    transform: scale(1.1);
}

/* ===== LIST VIEW META ===== */

.dabdash-list-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    margin-top: var(--spacing-xs);
}

.dabdash-meta-row {
    display: flex;
    gap: var(--spacing-xs);
}

.dabdash-meta-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 60px;
}

.dabdash-meta-value {
    color: var(--text-tertiary);
}

.dabdash-list-actions .dabdash-btn-cart {
    flex: 1.5;
}

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

@media (max-width: 768px) {
    .dabdash-product-card--list {
        flex-direction: column;
    }

    .dabdash-product-card--list .dabdash-product-image {
        width: 100%;
        aspect-ratio: 4 / 3;
        max-height: 240px;
    }

    .dabdash-product-name {
        font-size: 15px;
    }

    .dabdash-price-current {
        font-size: 20px;
    }
}

/* ===== ANIMATIONS ===== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dabdash-product-card {
    animation: fadeIn 0.3s ease-out;
}
