/**
 * Ajax Category Products - Widget Styles
 */

/* Prevent flash on initial page load */
.acp-widget-container {
    position: relative;
    width: 100%;
    visibility: hidden;
}

.acp-widget-container.acp-loaded {
    visibility: visible;
}

.acp-content-wrapper {
    position: relative;
    overflow: hidden;
}

/* Hide loading flash */
.acp-widget-container .acp-products-view {
    visibility: hidden;
    opacity: 0;
}

.acp-widget-container .acp-products-view.acp-active {
    visibility: visible;
    opacity: 1;
}

/* Fix WooCommerce placeholder pink background */
.acp-category-image,
.acp-product-image {
    background-color: #f5f5f5 !important;
}

.acp-category-image img,
.acp-product-image img {
    background-color: #f5f5f5 !important;
}

/* Prevent pink flash during page load */
.acp-widget-container {
    background-color: #ffffff;
}

.acp-widget-container * {
    background-color: transparent;
}

.acp-widget-container .acp-category-image,
.acp-widget-container .acp-product-image,
.acp-widget-container .acp-category-item,
.acp-widget-container .acp-product-item {
    background-color: #ffffff !important;
}

/* Force override WooCommerce styles that might cause pink flash */
.acp-widget-container .woocommerce-product-gallery__image,
.acp-widget-container .woocommerce-placeholder {
    background-color: #f5f5f5 !important;
}

/* Smooth image loading */
.acp-category-image img,
.acp-product-image img {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.acp-category-image img[src=""],
.acp-category-image img:not([src]),
.acp-product-image img[src=""],
.acp-product-image img:not([src]) {
    opacity: 0;
}

/* Additional WooCommerce placeholder fixes */
.acp-widget-container img.woocommerce-placeholder {
    background-color: #f5f5f5 !important;
}

.acp-widget-container .attachment-woocommerce_thumbnail {
    background-color: #f5f5f5 !important;
}

/* Prevent any SVG or inline style backgrounds */
.acp-widget-container img[src*="data:image/svg"] {
    background-color: #f5f5f5 !important;
}

/* Categories Grid */
.acp-categories-grid {
    display: grid;
    gap: 20px;
    /* grid-template-columns controlled by inline styles */
}

/* Category Item */
.acp-category-item {
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.acp-category-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.acp-category-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
}

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

.acp-category-item:hover .acp-category-image img {
    transform: scale(1.05);
}

.acp-category-info {
    padding: 15px;
    text-align: center;
}

.acp-category-title {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.acp-category-count {
    font-size: 13px;
    color: #666;
}

/* Views */
.acp-categories-view,
.acp-products-view {
    width: 100%;
}

.acp-categories-view {
    display: none;
}

.acp-categories-view.acp-active {
    display: block;
}

.acp-products-view {
    display: none;
}

.acp-products-view.acp-active {
    display: block;
}

/* Products Header */
.acp-products-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.acp-back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.acp-back-button:hover {
    background: #555;
}

.acp-current-category-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

/* Products Grid */
.acp-products-wrapper {
    display: grid;
    gap: 20px;
    /* grid-template-columns controlled by inline styles */
}

/* Products List Style */
.acp-products-wrapper.acp-style-list {
    grid-template-columns: 1fr;
}

.acp-style-list .acp-product-item {
    display: grid;
    grid-template-columns: 200px 1fr auto;
    gap: 20px;
    align-items: center;
}

.acp-style-list .acp-product-image {
    aspect-ratio: 1;
}

.acp-style-list .acp-product-info {
    text-align: left;
    padding: 0;
}

.acp-style-list .acp-product-excerpt {
    margin-top: 10px;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

/* Product Item */
.acp-product-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.acp-product-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.acp-product-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.acp-product-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
}

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

.acp-product-item:hover .acp-product-image img {
    transform: scale(1.05);
}

.acp-product-info {
    padding: 15px;
    text-align: center;
}

.acp-product-title {
    margin: 0 0 8px 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

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

.acp-product-price del {
    color: #999;
    font-weight: 400;
    margin-right: 5px;
}

.acp-product-price ins {
    text-decoration: none;
    color: #c00;
}

.acp-product-actions {
    padding: 0 15px 15px;
    text-align: center;
}

.acp-product-actions .button,
.acp-product-actions .add_to_cart_button {
    width: 100%;
    padding: 10px 15px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    text-align: center;
    display: inline-block;
    text-decoration: none;
}

.acp-product-actions .button:hover,
.acp-product-actions .add_to_cart_button:hover {
    background: #555;
}

.acp-product-actions .added_to_cart {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #28a745;
}

/* Loading */
.acp-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.acp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: acp-spin 0.8s linear infinite;
    margin-bottom: 15px;
}

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

/* No Products */
.acp-no-products {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
}

/* Pagination */
.acp-pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.acp-pagination a,
.acp-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.acp-pagination a:hover {
    background: #333;
    color: #fff;
}

.acp-pagination .current {
    background: #333;
    color: #fff;
}

/* Animations */
.acp-animation-fade-enter {
    opacity: 0;
}

.acp-animation-fade-enter-active {
    opacity: 1;
    transition: opacity var(--acp-animation-duration, 300ms) ease;
}

.acp-animation-fade-exit {
    opacity: 1;
}

.acp-animation-fade-exit-active {
    opacity: 0;
    transition: opacity var(--acp-animation-duration, 300ms) ease;
}

.acp-animation-slide-left-enter {
    transform: translateX(100%);
    opacity: 0;
}

.acp-animation-slide-left-enter-active {
    transform: translateX(0);
    opacity: 1;
    transition: transform var(--acp-animation-duration, 300ms) ease, opacity var(--acp-animation-duration, 300ms) ease;
}

.acp-animation-slide-left-exit {
    transform: translateX(0);
    opacity: 1;
}

.acp-animation-slide-left-exit-active {
    transform: translateX(-100%);
    opacity: 0;
    transition: transform var(--acp-animation-duration, 300ms) ease, opacity var(--acp-animation-duration, 300ms) ease;
}

.acp-animation-slide-right-enter {
    transform: translateX(-100%);
    opacity: 0;
}

.acp-animation-slide-right-enter-active {
    transform: translateX(0);
    opacity: 1;
    transition: transform var(--acp-animation-duration, 300ms) ease, opacity var(--acp-animation-duration, 300ms) ease;
}

.acp-animation-slide-right-exit {
    transform: translateX(0);
    opacity: 1;
}

.acp-animation-slide-right-exit-active {
    transform: translateX(100%);
    opacity: 0;
    transition: transform var(--acp-animation-duration, 300ms) ease, opacity var(--acp-animation-duration, 300ms) ease;
}

.acp-animation-slide-up-enter {
    transform: translateY(30px);
    opacity: 0;
}

.acp-animation-slide-up-enter-active {
    transform: translateY(0);
    opacity: 1;
    transition: transform var(--acp-animation-duration, 300ms) ease, opacity var(--acp-animation-duration, 300ms) ease;
}

.acp-animation-slide-up-exit {
    transform: translateY(0);
    opacity: 1;
}

.acp-animation-slide-up-exit-active {
    transform: translateY(-30px);
    opacity: 0;
    transition: transform var(--acp-animation-duration, 300ms) ease, opacity var(--acp-animation-duration, 300ms) ease;
}

/* Breadcrumb Navigation */
.acp-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.acp-breadcrumb-item {
    cursor: pointer;
    color: #333;
    transition: color 0.3s ease;
}

.acp-breadcrumb-item:hover {
    color: #000;
    text-decoration: underline;
}

.acp-breadcrumb-separator {
    color: #999;
}

.acp-breadcrumb-current {
    color: #666;
    font-weight: 500;
}

/* Responsive - tylko style pomocnicze, kolumny są kontrolowane przez Elementor */
@media (max-width: 768px) {
    .acp-products-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .acp-current-category-title {
        font-size: 20px;
    }

    .acp-style-list .acp-product-item {
        grid-template-columns: 120px 1fr;
        grid-template-rows: auto auto;
    }

    .acp-style-list .acp-product-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 480px) {
    .acp-category-title {
        font-size: 14px;
    }

    .acp-product-title {
        font-size: 14px;
    }

    .acp-style-list .acp-product-item {
        grid-template-columns: 100px 1fr;
    }
}
