/**
 * WB Masonry Grid Styles - Image Focused with Hover Overlay
 * Inspired by gallery design with antique golden accents and modern minimalism
 */

.wb-masonry-grid {
    display: block;
    margin: 0 -15px;
    column-gap: 30px;
}

/* Grid sizer for Masonry.js (if using JS version) */
.wb-masonry-grid-sizer {
    width: 0;
}

/* Masonry item */
.wb-masonry-item {
    margin-bottom: 30px;
    padding: 0 15px;
    box-sizing: border-box;
    break-inside: avoid;
    page-break-inside: avoid;
}

/* Column configurations */
.wb-masonry-cols-2 {
    column-count: 1;
}

.wb-masonry-cols-3 {
    column-count: 1;
}

.wb-masonry-cols-4 {
    column-count: 2;
}

.wb-masonry-cols-5 {
    column-count: 2;
}

/* Tablet breakpoint */
@media (min-width: 768px) {
    .wb-masonry-cols-2 {
        column-count: 2;
    }

    .wb-masonry-cols-3 {
        column-count: 2;
    }

    .wb-masonry-cols-4 {
        column-count: 3;
    }

    .wb-masonry-cols-5 {
        column-count: 3;
    }
}

/* Desktop breakpoint */
@media (min-width: 1024px) {
    .wb-masonry-cols-2 {
        column-count: 2;
    }

    .wb-masonry-cols-3 {
        column-count: 3;
    }

    .wb-masonry-cols-4 {
        column-count: 4;
    }

    .wb-masonry-cols-5 {
        column-count: 5;
    }
}

/* Grid thumb - image container with overlay */
.wb-masonry-item .grid-thumb {
    position: relative;
    overflow: hidden;
    display: block;
    line-height: 0;
    background: #f8f8f8;
}

.wb-masonry-item .grid-thumb img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

/* Hover effect on image */
.wb-masonry-item .grid-thumb:hover img {
    transform: scale(1.05);
    opacity: 0.85;
}

/* Product actions overlay - hidden by default */
.wb-masonry-item .product-actions {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10;
}

/* Show overlay on hover */
.wb-masonry-item .grid-thumb:hover .product-actions {
    opacity: 1;
    visibility: visible;
}

/* Product actions top section - price/date at top right */
.product-actions-top {
    display: flex;
    justify-content: flex-end;
    text-align: right;
}

.product-actions-top .product-price,
.product-actions-top .product-date {
    color: #d4af37; /* Golden accent for price/date */
    font-size: 16px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Product actions bottom section - content and icons */
.product-actions-bottom {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
}

/* Product content section - title and description at bottom left */
.product-actions-content {
    text-align: left;
}

.product-actions-content .product-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.product-actions-content .product-title a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.product-actions-content .product-title a:hover {
    color: #d4af37; /* Golden accent */
}

.product-actions-content .product-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.5;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Product actions icons section - below content */
.product-actions-icon {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
}

.product-actions-icon a {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.product-actions-icon a:hover {
    background: #ffffff; /* Golden accent */
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.product-actions-icon a i {
    font-size: 16px;
}

/* Special styling for favorited/active states */
.product-actions-icon a.is-favorited,
.product-actions-icon a.wb-add-to-wishlist.active {
    background: #d4af37;
    color: #fff;
}

.product-actions-icon a.is-favorited i {
    font-weight: 900; /* Solid icon */
}

/* Loading state for add to cart */
.product-actions-icon a.wb-add-to-cart.loading {
    pointer-events: none;
    opacity: 0.6;
}

.product-actions-icon a.wb-add-to-cart.loading i {
    animation: spin 0.8s linear infinite;
}

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

/* Success state for add to cart */
.product-actions-icon a.wb-add-to-cart.added {
    background: #4caf50;
    color: #fff;
}

/* No posts message */
.wb-masonry-grid + p {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 16px;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .wb-masonry-item {
        margin-bottom: 20px;
    }

    .wb-masonry-item .product-actions {
        padding: 15px;
    }

    .product-actions-top .product-price,
    .product-actions-top .product-date {
        font-size: 14px;
    }

    .product-actions-content .product-title {
        font-size: 16px;
    }

    .product-actions-content .product-description {
        font-size: 13px;
    }

    .product-actions-bottom {
        gap: 12px;
    }

    .product-actions-icon a {
        width: 36px;
        height: 36px;
    }

    .product-actions-icon a i {
        font-size: 14px;
    }
}

/* Optional: Touch device support - show overlay on tap */
@media (hover: none) and (pointer: coarse) {
    .wb-masonry-item .grid-thumb.active .product-actions {
        opacity: 1;
        visibility: visible;
    }
}
