/**
 * PWD Masonry Gallery - Frontend Styles (Minimal - Elementor will override)
 */

.pwd-woocommerce-masonry {
    display: grid;
    grid-gap: 10px;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    list-style: none;
}

.pwd-masonry-item {
    border: 1px solid #ddd;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pwd-masonry-image-link {
    display: block;
    margin-bottom: 15px;
    overflow: hidden;
    border-radius: 4px;
    position: relative;
    background: transparent;
}

.pwd-masonry-image-link img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ===========================
   WooCommerce Secondary Image Hover
=========================== */
/* Only apply hover effect to products with secondary images */
.pwd-woocommerce-product.has-secondary-image .pwd-primary-image {
    position: relative;
    z-index: 2;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.pwd-woocommerce-product.has-secondary-image .pwd-secondary-image {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pwd-woocommerce-product.has-secondary-image:hover .pwd-primary-image {
    opacity: 0;
}

.pwd-woocommerce-product.has-secondary-image:hover .pwd-secondary-image {
    opacity: 1;
}

/* Disable secondary image on mobile */
@media (max-width: 767px) {
    .pwd-woocommerce-product.has-secondary-image:hover .pwd-primary-image {
        opacity: 1;
    }
    
    .pwd-woocommerce-product.has-secondary-image:hover .pwd-secondary-image {
        opacity: 0;
    }
}

.pwd-masonry-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 600;
}

.pwd-masonry-title a {
    color: inherit;
    text-decoration: none;
}

.pwd-masonry-title a:hover {
    color: #536878;
}

.pwd-masonry-price {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.pwd-masonry-price .amount {
    color: inherit;
}

.pwd-masonry-price del {
    opacity: 0.6;
    margin-right: 8px;
}

.pwd-masonry-price ins {
    text-decoration: none;
    color: #4caf50;
}

/* ===========================
   Vendor Store Info (WCFM Integration)
=========================== */
.pwd-vendor-info {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pwd-vendor-logo {
    flex-shrink: 0;
}

.pwd-vendor-logo-image {
    max-width: 50px;
    max-height: 50px;
    width: auto;
    height: auto;
    display: block;
    border-radius: 4px;
}

.pwd-vendor-logo-link {
    display: block;
    text-decoration: none;
}

.pwd-vendor-name {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.pwd-vendor-name-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.pwd-vendor-name-link:hover {
    color: #536878;
    text-decoration: none;
}

.pwd-masonry-button {
    display: inline-block;
    padding: 12px 24px;
    background-color: #536878;
    color: #fff;
    text-decoration: none;
    text-align: center;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    margin-top: auto;
}

.pwd-masonry-button:hover {
    background-color: #3d4f5c;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(83, 104, 120, 0.3);
}

/* ===========================
   Load More Button
=========================== */
.pwd-load-more-container {
    text-align: center;
    margin: 30px 0 20px 0;
    clear: both;
}

.pwd-load-more-button {
    display: inline-block;
    padding: 14px 32px;
    background-color: #536878;
    color: #fff;
    text-decoration: none;
    text-align: center;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.pwd-load-more-button:hover {
    background-color: #3d4f5c;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(83, 104, 120, 0.4);
}

.pwd-load-more-button.loading {
    opacity: 0.6;
    cursor: wait;
}

.pwd-load-more-button.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* ===========================
   Active Filters Indicator
=========================== */
.pwd-active-filters {
    background: #f0f0f0;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    border-left: 3px solid #536878;
}

.pwd-active-filters-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #536878;
}

.pwd-active-filter-tag {
    display: inline-block;
    background: #fff;
    padding: 6px 12px;
    margin: 4px;
    border-radius: 3px;
    font-size: 13px;
    border: 1px solid #ddd;
}

.pwd-clear-filters {
    display: inline-block;
    margin-left: 10px;
    color: #536878;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.pwd-clear-filters:hover {
    text-decoration: underline;
}

.pwd-category-filters {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e0e5e8;
}

.pwd-category-filter {
    display: inline-block;
    padding: 8px 16px;
    margin: 5px;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.15s ease;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    border: 1px solid transparent;
}

.pwd-category-filter:hover {
    background: #fff;
    border-color: #c5d0d8;
}

.pwd-category-filter.active {
    font-weight: 700;
}

.pwd-no-products {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: #6b7c8a;
    font-size: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #c5d0d8;
}

.pwd-loading {
    position: relative;
    min-height: 300px;
    pointer-events: none;
}

.pwd-loading .pwd-masonry-item {
    opacity: 0.3;
}

.pwd-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    margin: -25px 0 0 -25px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #536878;
    border-radius: 50%;
    animation: pwd-spin 1s linear infinite;
    z-index: 10;
}

@keyframes pwd-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media screen and (max-width: 1199px) {
    .pwd-masonry-item {
        padding: 12px;
    }
}

@media screen and (max-width: 991px) {
    .pwd-category-filters {
        padding: 15px;
    }
    .pwd-masonry-item {
        padding: 10px;
    }
}

@media screen and (max-width: 767px) {
    .pwd-category-filter {
        display: block;
        margin: 5px auto;
        max-width: 200px;
    }
    .pwd-masonry-button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
/* ===========================
   Portfolio-Specific Styles
=========================== */
.pwd-masonry-caption {
    margin: 5px 0 0 0;
    font-size: 14px;
    color: #666;
    font-style: italic;
    line-height: 1.5;
}

/* ===========================
   Portfolio Hover Effects
=========================== */

/* Zoom In Effect */
.pwd-hover-zoom-in .pwd-portfolio-item .pwd-masonry-image-link img {
    transition: transform 0.4s ease;
}

.pwd-hover-zoom-in .pwd-portfolio-item:hover .pwd-masonry-image-link img {
    transform: scale(1.1);
}

/* Zoom Out Effect */
.pwd-hover-zoom-out .pwd-portfolio-item .pwd-masonry-image-link img {
    transform: scale(1.1);
    transition: transform 0.4s ease;
}

.pwd-hover-zoom-out .pwd-portfolio-item:hover .pwd-masonry-image-link img {
    transform: scale(1);
}

/* Fade Overlay Effect */
.pwd-hover-fade-overlay .pwd-portfolio-item .pwd-masonry-image-link {
    position: relative;
}

.pwd-hover-fade-overlay .pwd-portfolio-item .pwd-masonry-image-link::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.pwd-hover-fade-overlay .pwd-portfolio-item:hover .pwd-masonry-image-link::after {
    opacity: 1;
}

/* Slide Up Overlay Effect */
.pwd-hover-slide-up .pwd-portfolio-item .pwd-masonry-image-link {
    position: relative;
    overflow: hidden;
}

.pwd-hover-slide-up .pwd-portfolio-item .pwd-masonry-image-link::after {
    content: '';
    position: absolute;
    bottom: -100%;
    left: 0;
    right: 0;
    height: 100%;
    background: rgba(83, 104, 120, 0.8);
    transition: bottom 0.4s ease;
}

.pwd-hover-slide-up .pwd-portfolio-item:hover .pwd-masonry-image-link::after {
    bottom: 0;
}

/* Grayscale to Color Effect */
.pwd-hover-grayscale .pwd-portfolio-item .pwd-masonry-image-link img {
    filter: grayscale(100%);
    transition: filter 0.4s ease;
}

.pwd-hover-grayscale .pwd-portfolio-item:hover .pwd-masonry-image-link img {
    filter: grayscale(0%);
}

/* Blur to Sharp Effect */
.pwd-hover-blur .pwd-portfolio-item .pwd-masonry-image-link img {
    filter: blur(3px);
    transition: filter 0.4s ease;
}

.pwd-hover-blur .pwd-portfolio-item:hover .pwd-masonry-image-link img {
    filter: blur(0);
}

/* Tilt 3D Effect */
.pwd-hover-tilt-3d .pwd-portfolio-item {
    perspective: 1000px;
}

.pwd-hover-tilt-3d .pwd-portfolio-item .pwd-masonry-image-link {
    transition: transform 0.4s ease;
    transform-style: preserve-3d;
    transform-origin: center center;
}

.pwd-hover-tilt-3d .pwd-portfolio-item .pwd-masonry-image-link img {
    transform-origin: center center;
}

.pwd-hover-tilt-3d .pwd-portfolio-item:hover .pwd-masonry-image-link {
    transform: rotateY(5deg) rotateX(5deg);
}

/* Disable hover effects on mobile */
@media (max-width: 767px) {
    .pwd-hover-zoom-in .pwd-portfolio-item:hover .pwd-masonry-image-link img,
    .pwd-hover-zoom-out .pwd-portfolio-item:hover .pwd-masonry-image-link img,
    .pwd-hover-grayscale .pwd-portfolio-item:hover .pwd-masonry-image-link img,
    .pwd-hover-blur .pwd-portfolio-item:hover .pwd-masonry-image-link img {
        transform: none !important;
        filter: none !important;
    }
    
    .pwd-hover-fade-overlay .pwd-portfolio-item:hover .pwd-masonry-image-link::after,
    .pwd-hover-slide-up .pwd-portfolio-item:hover .pwd-masonry-image-link::after {
        opacity: 0 !important;
        bottom: -100% !important;
    }
    
    .pwd-hover-tilt-3d .pwd-portfolio-item:hover .pwd-masonry-image-link {
        transform: none !important;
    }
}

/* ===========================
   Blog Post Styles
=========================== */
.pwd-blog-meta {
    margin: 10px 0;
    font-size: 14px;
    color: #999;
}

.pwd-blog-date {
    margin-right: 15px;
}

.pwd-blog-author {
    font-style: italic;
}

.pwd-blog-excerpt {
    margin: 10px 0 15px 0;
    font-size: 15px;
    line-height: 1.6;
    color: #555;
}

.pwd-blog-item .pwd-masonry-button {
    margin-top: auto;
}

/* ===========================
   Blog Image Hover Effects
=========================== */

/* Zoom Hover Effect */
.pwd-blog-hover-zoom .pwd-blog-item .pwd-masonry-image-link img {
    transition: transform 0.4s ease;
}

.pwd-blog-hover-zoom .pwd-blog-item:hover .pwd-masonry-image-link img {
    transform: scale(1.1);
}

/* Grayscale Hover Effect */
.pwd-blog-hover-grayscale .pwd-blog-item .pwd-masonry-image-link img {
    filter: grayscale(100%);
    transition: filter 0.4s ease;
}

.pwd-blog-hover-grayscale .pwd-blog-item:hover .pwd-masonry-image-link img {
    filter: grayscale(0%);
}

/* Opacity Hover Effect */
.pwd-blog-hover-opacity .pwd-blog-item .pwd-masonry-image-link img {
    opacity: 0.7;
    transition: opacity 0.4s ease;
}

.pwd-blog-hover-opacity .pwd-blog-item:hover .pwd-masonry-image-link img {
    opacity: 1;
}

/* Disable hover effects on mobile for blog */
@media (max-width: 767px) {
    .pwd-blog-hover-zoom .pwd-blog-item:hover .pwd-masonry-image-link img,
    .pwd-blog-hover-grayscale .pwd-blog-item:hover .pwd-masonry-image-link img,
    .pwd-blog-hover-opacity .pwd-blog-item:hover .pwd-masonry-image-link img {
        transform: none !important;
        filter: none !important;
        opacity: 1 !important;
    }
}
/* ===========================
   WooCommerce Product Badges
=========================== */
.pwd-product-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 5px;
    pointer-events: none;
}

.pwd-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.4;
    color: #fff;
    width: fit-content;
}

.pwd-badge-sale {
    background-color: #e74c3c;
}

.pwd-badge-out-of-stock {
    background-color: #7f8c8d;
}

.pwd-badge-new {
    background-color: #27ae60;
}

.pwd-badge-hot {
    background-color: #e67e22;
}

/* ===========================
   Portfolio — Masonry Layout
=========================== */
.pwd-portfolio-gallery.pwd-layout-masonry {
    display: block !important;
    column-count: 3;
    column-gap: 10px;
}

.pwd-portfolio-gallery.pwd-layout-masonry .pwd-masonry-item {
    break-inside: avoid;
    display: block;
    margin-bottom: 10px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 991px) {
    .pwd-portfolio-gallery.pwd-layout-masonry {
        column-count: 2;
    }
}

@media (max-width: 767px) {
    .pwd-portfolio-gallery.pwd-layout-masonry {
        column-count: 1;
    }
}

/* ===========================
   Blog — Chess Layout
=========================== */
.pwd-blog-gallery.pwd-layout-chess {
    display: block !important;
}

.pwd-blog-gallery.pwd-layout-chess .pwd-blog-item {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
    width: 100%;
    box-sizing: border-box;
}

/* Odd items: image left, text right */
.pwd-blog-gallery.pwd-layout-chess .pwd-blog-item:nth-child(odd) {
    flex-direction: row;
}

/* Even items: text left, image right (the chess flip) */
.pwd-blog-gallery.pwd-layout-chess .pwd-blog-item:nth-child(even) {
    flex-direction: row-reverse;
}

.pwd-blog-gallery.pwd-layout-chess .pwd-blog-item .pwd-masonry-image-link {
    flex: 0 0 45%;
    margin-bottom: 0;
}

.pwd-blog-gallery.pwd-layout-chess .pwd-blog-item .pwd-masonry-image-link img {
    width: 100%;
    height: auto;
    display: block;
}

/* Text content wrapper fills remaining space */
.pwd-blog-gallery.pwd-layout-chess .pwd-blog-item > :not(.pwd-masonry-image-link) {
    flex: 1 1 55%;
}

/* Tablet: keep chess but adjust proportion */
@media (max-width: 991px) {
    .pwd-blog-gallery.pwd-layout-chess .pwd-blog-item .pwd-masonry-image-link {
        flex: 0 0 40%;
    }
}

/* Mobile: stack vertically */
@media (max-width: 767px) {
    .pwd-blog-gallery.pwd-layout-chess .pwd-blog-item,
    .pwd-blog-gallery.pwd-layout-chess .pwd-blog-item:nth-child(even),
    .pwd-blog-gallery.pwd-layout-chess .pwd-blog-item:nth-child(odd) {
        flex-direction: column !important;
    }

    .pwd-blog-gallery.pwd-layout-chess .pwd-blog-item .pwd-masonry-image-link {
        flex: none;
        width: 100%;
        margin-bottom: 15px;
    }
}
