/* Frontend Styles */
/* IMPORTANTE: Todos os estilos devem usar seletores específicos (.aps-*) para não interferir com o tema */

/* Proteção: Garantir que imagens em destaque de posts normais não sejam afetadas */
.single-post .post-thumbnail,
.single-post .wp-post-image,
.single-post .entry-image,
article:not(.amazon_product) .post-thumbnail,
article:not(.amazon_product) .wp-post-image,
article:not(.amazon_product) .entry-image {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}


.aps-product-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    margin: 15px 0;
    transition: box-shadow 0.3s ease;
}

.aps-product-container:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Single Product View Adjustments */
.single-amazon_product .aps-product-container {
    max-width: 900px;
    margin: 40px auto;
    display: flex;
    flex-direction: row;
    gap: 40px;
    align-items: flex-start;
}

.single-amazon_product .aps-product-image {
    flex: 1;
    min-height: 400px;
}

.single-amazon_product .aps-product-info {
    flex: 1;
    text-align: left;
}

.single-amazon_product .aps-product-title {
    font-size: 28px;
    margin-bottom: 20px;
}

.aps-product-image {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    overflow: hidden;
    border-radius: 4px;
    background-color: #f5f5f5;
    min-height: 200px;
}

.aps-product-image img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.aps-product-info {
    text-align: center;
}

.aps-product-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
    line-height: 1.4;
    color: #333;
}

.aps-product-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.aps-product-title a:hover {
    color: #e47911;
}

.aps-product-price {
    margin: 12px 0;
}

.aps-price-value {
    font-size: 20px;
    font-weight: bold;
    color: #e47911;
}

.aps-buy-button {
    display: inline-block;
    background-color: #ff9900;
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin: 12px 0;
    font-size: 14px;
}

.aps-buy-button:hover {
    background-color: #e8860e;
    text-decoration: none;
    color: white;
}

.aps-affiliate-notice {
    font-size: 12px;
    color: #666;
    margin: 10px 0 0 0;
    line-height: 1.4;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.aps-error {
    background-color: #fee;
    border: 1px solid #fcc;
    color: #c00;
    padding: 10px;
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 600px) {
    .aps-product-container {
        max-width: 100%;
    }

    .aps-product-title {
        font-size: 14px;
    }

    .aps-price-value {
        font-size: 18px;
    }

    .aps-buy-button {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }

    .single-amazon_product .aps-product-container {
        flex-direction: column;
        align-items: stretch;
        margin: 20px 10px;
    }

    .single-amazon_product .aps-product-image {
        min-height: 250px;
    }
}

/* ========================================
   Elementor Gallery Styles (v1.3.0)
   ======================================== */

/* Gallery Container */
.aps-gallery-container {
    width: 100%;
    margin: 20px 0;
}

/* Grid Layout */
.aps-gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
}

/* Elementor specific - ensure grid works in Elementor */
.elementor-widget-amazon_product_gallery .aps-gallery-grid,
div.aps-gallery-grid {
    display: grid !important;
    grid-auto-flow: row;
}

/* Ensure product items take full height */
.aps-gallery-grid>.aps-product-item {
    display: flex !important;
    flex-direction: column !important;
    height: 100%;
}


/* List Layout */
.aps-gallery-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* Product Item */
.aps-product-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.aps-product-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* List Layout - Product Item */
.aps-gallery-list .aps-product-item {
    flex-direction: row;
    align-items: center;
    gap: 20px;
}

/* Product Image */
.aps-product-item .aps-product-image {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    overflow: hidden;
    border-radius: 4px;
    background-color: #f5f5f5;
    min-height: 200px;
    flex-shrink: 0;
}

.aps-gallery-list .aps-product-item .aps-product-image {
    width: 200px;
    min-height: 150px;
    margin-bottom: 0;
}

.aps-product-item .aps-product-image img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Product Content */
.aps-product-item .aps-product-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.aps-gallery-list .aps-product-item .aps-product-content {
    text-align: left;
}

.aps-product-item .aps-product-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
    line-height: 1.4;
    color: #333;
    letter-spacing: normal !important;
    font-stretch: normal !important;
    text-transform: none;
}

.aps-product-item .aps-product-price {
    margin: 12px 0;
    line-height: 1;
}

.aps-product-item .aps-price-value {
    font-size: 20px;
    font-weight: bold;
    color: #e47911;
    letter-spacing: normal !important;
}

.aps-product-item .aps-buy-button {
    display: inline-block;
    background-color: #ff9900;
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin: 12px 0;
    font-size: 14px;
    align-self: center;
    letter-spacing: normal !important;
    text-transform: none;
}

.aps-gallery-list .aps-product-item .aps-buy-button {
    align-self: flex-start;
}

.aps-product-item .aps-buy-button:hover {
    background-color: #e8860e;
    text-decoration: none;
    color: white;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .aps-gallery-container[data-columns-tablet="1"] .aps-gallery-grid {
        grid-template-columns: repeat(1, 1fr);
    }

    .aps-gallery-container[data-columns-tablet="2"] .aps-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .aps-gallery-container[data-columns-tablet="3"] .aps-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .aps-gallery-container[data-columns-mobile="1"] .aps-gallery-grid {
        grid-template-columns: repeat(1, 1fr);
    }

    .aps-gallery-container[data-columns-mobile="2"] .aps-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .aps-gallery-list .aps-product-item {
        flex-direction: column;
    }

    .aps-gallery-list .aps-product-item .aps-product-image {
        width: 100%;
        margin-bottom: 12px;
    }

    .aps-gallery-list .aps-product-item .aps-product-content {
        text-align: center;
    }

    .aps-gallery-list .aps-product-item .aps-buy-button {
        align-self: center;
        width: 100%;
    }

    .aps-product-item .aps-product-title {
        font-size: 14px;
    }

    .aps-product-item .aps-price-value {
        font-size: 18px;
    }

    .aps-product-item .aps-buy-button {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }
}

/* ========================================
   Horizontal Layout (v1.3.1)
   ======================================== */

.aps-gallery-horizontal {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* Default fallback */
    grid-auto-flow: column;
    gap: 20px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #ddd #f5f5f5;
}

.aps-gallery-horizontal::-webkit-scrollbar {
    height: 8px;
}

.aps-gallery-horizontal::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 4px;
}

.aps-gallery-horizontal::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.aps-gallery-horizontal::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

.aps-gallery-horizontal .aps-product-item {
    scroll-snap-align: start;
    min-width: 0;
    /* Prevent overflow */
}

/* Responsive for Horizontal Layout */
@media (max-width: 768px) {
    .aps-gallery-horizontal {
        grid-template-columns: repeat(2, 1fr);
    }
}