/**
 * Irmanha Products Module Styles
 *
 * Uses design tokens from tokens.css
 */

.irmanha-products {
    width: 100%;
}

/* ==========================================================================
   All Products Grid Mode
   ========================================================================== */

.irmanha-products-grid {
    display: grid;
    gap: var(--irmanha-space-8);
    width: 100%;
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
}

.irmanha-products-grid[data-products-per-row="1"] {
    grid-template-columns: 1fr;
}

.irmanha-products-grid[data-products-per-row="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.irmanha-products-grid[data-products-per-row="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.irmanha-products-grid[data-products-per-row="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.irmanha-products-grid[data-products-per-row="6"] {
    grid-template-columns: repeat(6, 1fr);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .irmanha-products-grid[data-products-per-row="6"] {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .irmanha-products-grid[data-products-per-row="3"],
    .irmanha-products-grid[data-products-per-row="4"],
    .irmanha-products-grid[data-products-per-row="6"] {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .irmanha-products-grid {
        padding: 0 15px;
    }
}

@media (max-width: 640px) {
    .irmanha-products-grid {
        grid-template-columns: 1fr;
        gap: var(--irmanha-space-4);
        padding: 0 15px;
    }
}

.irmanha-product-item {
    display: flex;
    flex-direction: column;
}

.irmanha-product-item__link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.irmanha-product-item__image {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
    background: var(--irmanha-white);
}

.irmanha-product-item__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transition: transform var(--irmanha-transition-base);
}

.irmanha-product-item__link:hover .irmanha-product-item__image img {
    transform: scale(1.05);
}

.irmanha-product-item__info {
    padding: var(--irmanha-space-4);
    text-align: center;
}

.irmanha-product-item__title {
    font-size: var(--irmanha-body);
    font-weight: var(--irmanha-font-weight-regular);
    color: var(--irmanha-black);
    margin: 0 0 var(--irmanha-space-2) 0;
    line-height: var(--irmanha-leading-snug);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.irmanha-product-item__price {
    font-size: var(--irmanha-body);
    color: var(--irmanha-grey);
    font-weight: var(--irmanha-font-weight-normal);
}

.irmanha-product-item__price .woocommerce-Price-amount {
    color: var(--irmanha-black);
    font-weight: var(--irmanha-font-weight-semibold);
}

.irmanha-product-item__price .woocommerce-Price-amount bdi,
.irmanha-product-card__price .woocommerce-Price-amount bdi {
    font-size: 0.9em;
}

/* ==========================================================================
   Tablet Typography Adjustments
   ========================================================================== */

@media (max-width: 1024px) {
    .irmanha-product-item__info .irmanha-product-item__title,
    .irmanha-product-card__info .irmanha-product-card__title {
        font-size: var(--irmanha-body-tablet) !important; /* 22px */
        line-height: var(--irmanha-leading-snug) !important;
    }

    .irmanha-product-item__info .irmanha-product-item__price,
    .irmanha-product-card__info .irmanha-product-card__price {
        font-size: var(--irmanha-body-tablet) !important; /* 22px */
    }

    .irmanha-product-card__info .irmanha-product-card__price .woocommerce-Price-amount,
    .irmanha-product-item__info .irmanha-product-item__price .woocommerce-Price-amount {
        font-size: var(--irmanha-body-tablet-lg) !important; /* 22px */
    }
}

.irmanha-products__no-products {
    text-align: center;
    padding: var(--irmanha-space-12);
    color: var(--irmanha-grey);
}

/* ==========================================================================
   Product Highlight Mode (Slider)
   ========================================================================== */

.irmanha-products-highlight {
    position: relative;
}

.irmanha-products-highlight__divider {
    height: 1px;
    margin-bottom: var(--irmanha-space-6);
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.irmanha-products-highlight__divider::before {
    content: '';
    display: block;
    height: 1px;
    background: rgba(0, 0, 0, 0.5);
    width: 100%;
}

.irmanha-products-highlight__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--irmanha-space-6);
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
}

.irmanha-products-highlight__title {
    margin: 0;
}

.irmanha-products-highlight__title p,
.irmanha-products-highlight__title-text {
    margin: 0;
    font-size: var(--irmanha-body);
    font-weight: var(--irmanha-font-weight-normal);
    color: var(--irmanha-black);
}

@media (max-width: 768px) {
    .irmanha-products-highlight__title p,
    .irmanha-products-highlight__title-text {
        font-size: var(--irmanha-text-mobile-lg) !important;
    }
}

.irmanha-products-highlight__navigation {
    display: flex;
    gap: var(--irmanha-space-3);
}

.irmanha-products-highlight__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    outline: none;
    background: var(--irmanha-beige);
    color: var(--irmanha-black);
    border-radius: 0;
    cursor: pointer;
    transition: var(--irmanha-transition-fast);
}

.irmanha-products-highlight__nav:hover,
.irmanha-products-highlight__nav:focus {
    background: var(--irmanha-black);
    color: var(--irmanha-white);
    outline: none;
}

.irmanha-products-highlight__nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.irmanha-products-highlight__nav svg {
    width: 24px;
    height: 24px;
}

/* Swiper Container */
.irmanha-products-highlight__swiper {
    overflow: hidden;
    padding: var(--irmanha-space-4) 0;
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
    width: 100%;
    box-sizing: border-box;
}

.irmanha-products-highlight__swiper .swiper-wrapper {
    display: flex;
    align-items: stretch;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
}

.irmanha-products-highlight__swiper .swiper-slide {
    height: auto;
}

/* Product Card for Slider */
.irmanha-product-card {
    height: 100%;
}

.irmanha-product-card__link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.irmanha-product-card__image {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
    background: var(--irmanha-white);
    display: flex;
    align-items: center;
    justify-content: center;
}

.irmanha-product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transition: transform var(--irmanha-transition-base);
}

.irmanha-product-card__link:hover .irmanha-product-card__image img {
    transform: scale(1.05);
}

.irmanha-product-card__info {
    padding: var(--irmanha-space-4);
    text-align: center;
}

.irmanha-product-card__title {
    font-size: var(--irmanha-body);
    font-weight: var(--irmanha-font-weight-medium);
    color: var(--irmanha-black);
    margin: 0 0 var(--irmanha-space-2) 0;
    line-height: var(--irmanha-leading-snug);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.irmanha-product-card__price {
    font-size: var(--irmanha-body);
    color: var(--irmanha-grey);
    font-weight: var(--irmanha-font-weight-regular);
}

.irmanha-product-card__price .woocommerce-Price-amount {
    color: var(--irmanha-black);
    font-weight: var(--irmanha-font-weight-semibold);
}

/* Swiper Navigation Overrides */
.irmanha-products-highlight .swiper-button-next,
.irmanha-products-highlight .swiper-button-prev {
    display: none;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
    .irmanha-products-highlight__header {
        flex-direction: column;
        gap: var(--irmanha-space-4);
        align-items: flex-start;
        padding: 0 15px;
    }

    .irmanha-products-highlight__divider {
        padding: 0 15px;
    }

    .irmanha-products-highlight__swiper {
        padding-left: 20px;
        padding-right: 20px;
    }

    .irmanha-products-highlight__swiper .swiper-wrapper {
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .irmanha-products-highlight__navigation {
        align-self: flex-end;
    }

    .irmanha-products-highlight__nav {
        width: 36px;
        height: 36px;
    }

    .irmanha-products-highlight__nav svg {
        width: 20px;
        height: 20px;
    }

    .irmanha-product-card__image {
        height: 400px;
    }
}

@media (max-width: 480px) {
    .irmanha-products-highlight__swiper {
        padding-left: 8px;
        padding-right: 8px;
    }

    .irmanha-products-highlight__swiper .swiper-wrapper {
        margin-left: -8px;
        margin-right: -8px;
        padding-left: 8px;
        padding-right: 8px;
    }

    .irmanha-product-card__image {
        height: 350px;
    }
}

@media (max-width: 768px) {
    .irmanha-product-item__image,
    .irmanha-product-card__image {
        height: 400px;
        max-width: 280px;
        background: var(--irmanha-white);
    }
}

@media (max-width: 640px) {
    .irmanha-products-grid {
        gap: var(--irmanha-space-6);
    }

    .irmanha-product-item__image,
    .irmanha-product-card__image {
        height: 350px;
        max-width: 250px;
        background: var(--irmanha-white);
    }

    .irmanha-product-item__info,
    .irmanha-product-card__info {
        padding: var(--irmanha-space-2); /* Reduce padding from 12px to 8px for tighter spacing */
    }

    .irmanha-product-item__info .irmanha-product-item__title,
    .irmanha-product-card__info .irmanha-product-card__title {
        font-size: var(--irmanha-body-mobile) !important; /* 16px */
        line-height: 1.4 !important;
    }

    .irmanha-product-item__info .irmanha-product-item__price,
    .irmanha-product-card__info .irmanha-product-card__price {
        font-size: var(--irmanha-body-mobile) !important; /* 16px */
    }

}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .irmanha-product-item__info .irmanha-product-item__title,
    .irmanha-product-card__info .irmanha-product-card__title {
        font-size: var(--irmanha-body-mobile) !important;
        line-height: 1.3 !important;
    }

    .irmanha-product-item__info .irmanha-product-item__price,
    .irmanha-product-card__info .irmanha-product-card__price {
        font-size: var(--irmanha-body-mobile-sm) !important; /* 18px */
    }

    .irmanha-product-item__info,
    .irmanha-product-card__info {
        padding: var(--irmanha-space-4);
    }
}

/* ==========================================================================
   Beaver Builder Editor Styles
   ========================================================================== */

.fl-builder .irmanha-product-item,
.fl-builder .irmanha-product-card {
    /* Prevent builder interactions from interfering */
    pointer-events: none;
}

.fl-builder .irmanha-product-item__link,
.fl-builder .irmanha-product-card__link {
    pointer-events: auto;
}
