/* Downloadable Products Widget Styles */

.dpw-products-container {
    width: 100%;
    margin: 0 auto;
}

/* Dark Background Optimizations */
.dpw-products-container {
    background: transparent;
    padding: 20px 0;
}

/* Enhanced Product Card for Dark Background */
.dpw-product-card {
    background: #ffffff;
    border: 2px solid transparent;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.dpw-product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    border-color: #FF7221;
}

/* Enhanced Category Filter for Dark Background */
.dpw-categories-filter {
    border-bottom: 2px solid #404040;
    background: rgba(255, 255, 255, 0.05);
    padding: 25px 20px 20px;
    border-radius: 12px;
    margin-bottom: 40px;
}

.dpw-category-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #313131;
    border: 2px solid transparent;
    border-radius: 30px;
    padding: 12px 24px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 13px;
}

.dpw-category-btn:hover,
.dpw-category-btn.active {
    background: #FF7221;
    color: white;
    border-color: #FF7221;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 114, 33, 0.4);
}

.dpw-category-count {
    background: #313131;
    color: white;
    border-radius: 50%;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 10px;
    min-width: 20px;
    height: 20px;
    line-height: 12px;
}

/* Enhanced Button Styling */
.dpw-product-actions .button {
    background: linear-gradient(135deg, #313131 0%, #404040 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 15px 25px;
    font-weight: 700;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.dpw-product-actions .button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 114, 33, 0.4), transparent);
    transition: left 0.5s;
}

.dpw-product-actions .button:hover {
    background: linear-gradient(135deg, #FF7221 0%, #ff8a42 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 114, 33, 0.4);
}

.dpw-product-actions .button:hover::before {
    left: 100%;
}

/* Enhanced Pagination for Dark Background */
.dpw-pagination {
    margin-top: 50px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.dpw-pagination .page-numbers a,
.dpw-pagination .page-numbers span {
    background: rgba(255, 255, 255, 0.9);
    color: #313131;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 0 4px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.dpw-pagination .page-numbers a:hover {
    background: #FF7221;
    color: white;
    border-color: #FF7221;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 114, 33, 0.4);
}

.dpw-pagination .page-numbers .current {
    background: #FF7221;
    color: white;
    border-color: #FF7221;
    box-shadow: 0 4px 15px rgba(255, 114, 33, 0.3);
}

/* Enhanced Error Messages */
.dpw-error,
.dpw-no-products {
    background: rgba(255, 255, 255, 0.95);
    color: #313131;
    border: 2px solid #FF7221;
    border-radius: 12px;
    padding: 30px;
    font-size: 18px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Mobile Responsiveness Enhancements */
@media (max-width: 768px) {
    .dpw-products-container {
        padding: 15px 10px;
    }

    .dpw-categories-filter {
        padding: 20px 15px 15px;
        margin-bottom: 30px;
    }

    .dpw-category-btn {
        padding: 10px 18px;
        font-size: 12px;
    }

    .dpw-product-actions .button {
        padding: 12px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .dpw-categories-filter {
        padding: 15px 10px 10px;
    }

    .dpw-category-btn {
        padding: 8px 15px;
        font-size: 11px;
    }
}

.dpw-products-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

/* Grid Layout */
.dpw-columns-1 {
    grid-template-columns: 1fr;
}

.dpw-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.dpw-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.dpw-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.dpw-columns-5 {
    grid-template-columns: repeat(5, 1fr);
}

.dpw-columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* Category Filter */
.dpw-categories-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #383838;
}

.dpw-category-btn {
    padding: 10px 20px;
    border: 1px solid #ECECEC;
    border-radius: 25px;
    background: white;
    color: #404040;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.dpw-category-btn:hover,
.dpw-category-btn.active {
    background: #FF7221;
    color: white;
    border-color: #FF7221;
}

.dpw-category-count {
    background: #000000;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    display: inline-block;
    min-width: 18px;
    height: 18px;
    line-height: 14px;
    text-align: center;
}

@media (max-width: 768px) {
    .dpw-categories-filter {
        gap: 8px;
    }

    .dpw-category-btn {
        padding: 8px 15px;
        font-size: 13px;
    }
}

/* Product Card */
.dpw-product-card {
    background: #ffffff;
    border: 1px solid #ECECEC;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(64, 64, 64, 0.1);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.dpw-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(64, 64, 64, 0.15);
    border-color: #FF7221;
}

/* Product Image */
.dpw-product-image {
    position: relative !important;
    overflow: hidden;
    background: #ECECEC;
    aspect-ratio: 1;
}

.dpw-product-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.dpw-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.dpw-no-image,
.dpw-placeholder-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #ECECEC;
    color: #404040;
    font-size: 48px;
}

/* Product Content */
.dpw-product-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
}

.dpw-product-title {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    color: #313131;
}

.dpw-product-title a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

.dpw-product-title a:hover {
    color: #FF7221;
}

.dpw-product-price {
    font-size: 16px;
    font-weight: 700;
    color: #FF7221;
}

.dpw-product-price .woocommerce-Price-amount {
    font-weight: 700;
}

.dpw-product-price del {
    color: #404040;
    font-weight: 400;
    margin-right: 8px;
}

.dpw-product-excerpt {
    color: #404040;
    font-size: 14px;
    line-height: 1.5;
    flex-grow: 1;
}

.dpw-product-actions {
    margin-top: auto;
    padding-top: 10px;
}

.dpw-product-actions .button,
.dpw-product-actions .add_to_cart_button {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    background: #313131;
    color: white;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 14px;
    display: inline-block;
    box-sizing: border-box;
}

.dpw-product-actions .button:hover,
.dpw-product-actions .add_to_cart_button:hover {
    background: #FF7221;
    transform: translateY(-1px);
}

.dpw-product-actions .added_to_cart {
    display: none;
}

/* Pagination */
.dpw-pagination {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.dpw-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.dpw-pagination .page-numbers li {
    margin: 0;
}

.dpw-pagination .page-numbers a,
.dpw-pagination .page-numbers span {
    display: inline-block;
    padding: 10px 15px;
    margin: 0 2px;
    border: 1px solid #ECECEC;
    border-radius: 4px;
    text-decoration: none;
    color: #313131;
    background: white;
    transition: all 0.3s ease;
    font-weight: 500;
}

.dpw-pagination .page-numbers a:hover {
    background: #FF7221;
    color: white;
    border-color: #FF7221;
}

.dpw-pagination .page-numbers .current {
    background: #FF7221;
    color: white;
    border-color: #FF7221;
}

/* Error and No Products Messages */
.dpw-error,
.dpw-no-products {
    text-align: center;
    padding: 40px 20px;
    background: #ECECEC;
    border-radius: 8px;
    color: #404040;
    font-size: 16px;
}

.dpw-error {
    background: rgba(255, 114, 33, 0.1);
    color: #313131;
    border: 1px solid rgba(255, 114, 33, 0.3);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dpw-columns-6 {
        grid-template-columns: repeat(4, 1fr);
    }

    .dpw-columns-5 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {

    .dpw-columns-6,
    .dpw-columns-5,
    .dpw-columns-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .dpw-products-grid {
        gap: 15px;
    }

    .dpw-columns-6,
    .dpw-columns-5,
    .dpw-columns-4,
    .dpw-columns-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .dpw-product-content {
        padding: 15px;
        gap: 10px;
    }

    .dpw-product-title {
        font-size: 12px;
    }

    .dpw-product-price {
        font-size: 14px;
    }

    .dpw-product-excerpt {
        font-size: 13px;
    }
}

@media (max-width: 480px) {

    .dpw-columns-6,
    .dpw-columns-5,
    .dpw-columns-4,
    .dpw-columns-3,
    .dpw-columns-2 {
        grid-template-columns: 1fr;
    }

    .dpw-products-grid {
        gap: 12px;
    }

    .dpw-product-content {
        padding: 12px;
    }

    .dpw-pagination .page-numbers a,
    .dpw-pagination .page-numbers span {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* Category Loading State */
.dpw-loading-categories .dpw-products-grid {
    opacity: 0.5;
    pointer-events: none;
}

.dpw-loading-categories .dpw-products-grid::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 4px solid #ECECEC;
    border-top: 4px solid #FF7221;
    border-radius: 50%;
    animation: dpw-spin 1s linear infinite;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.dpw-products-grid {
    position: relative;
}

/* Loading Animation */
.dpw-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.dpw-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #ECECEC;
    border-top: 4px solid #FF7221;
    border-radius: 50%;
    animation: dpw-spin 1s linear infinite;
}

@keyframes dpw-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* WooCommerce Integration */
.dpw-product-card .woocommerce-loop-product__link {
    text-decoration: none;
}

.dpw-product-card .woocommerce-loop-product__title {
    font-size: inherit;
    margin: 0;
    font-weight: inherit;
}

.dpw-product-card .price {
    margin: 0;
}

.dpw-product-card .star-rating {
    margin: 0 0 10px 0;
}

/* Elementor Editor Styles */
.elementor-editor-active .dpw-placeholder-image {
    border: 2px dashed #ECECEC;
    background: #ECECEC;
}

/* Performance & Accessibility Improvements */
.dpw-product-image img {
    will-change: transform;
}

.dpw-product-card:not(:hover) .dpw-product-image img {
    will-change: auto;
}

/* Focus states for accessibility */
.dpw-category-btn:focus,
.dpw-product-actions .button:focus,
.dpw-product-title a:focus,
.dpw-product-category:focus {
    outline: 2px solid #FF7221;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .dpw-product-card,
    .dpw-product-image img,
    .dpw-category-btn,
    .dpw-product-actions .button {
        transition: none;
    }

    .dpw-product-card:hover {
        transform: none;
    }

    .dpw-product-card:hover .dpw-product-image img {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .dpw-product-card {
        border: 2px solid;
    }
}
