/**
 * Product Gallery Styles
 */

.product-gallery-section {
    width: 100%;
}

.product-gallery__inner {
    width: 100%;
    position: relative;

    &::before {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 999%;
        height: 100%;
        background: var(--color-gray-50);
    }
}

.product-gallery__main {
    padding-bottom: var(--spacing-fluid-l);
    padding-top: var(--spacing-fluid-l);
}

.product-gallery__main-wrapper {
    position: relative;
    width: 100%;
}

.product-gallery__main .swiper {
    width: 100%;
}

.product-gallery__main-navigation {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.product-gallery__main-nav-button {
    pointer-events: auto;
    z-index: 10;
    position: absolute;
}

.product-gallery__main-nav-button--prev {
    left: 1rem;
    transform: translateY(-50%);
}

.product-gallery__main-nav-button--next {
    right: 1rem;
    transform: translateY(-50%);
}

.product-gallery__image {
    width: 100%;
    height: 500px;
    width: auto;
    margin-left: auto;
    margin-right: auto;
    display: block;
    object-fit: contain;
}

/* Single image (no slider): taller height */
.product-gallery__main .swiper-slide:only-child .product-gallery__image {
    height: 550px;
}

.product-gallery__placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-gray-50);
    color: #999;
}

.product-gallery__thumbnails {
    width: 100%;
    padding-bottom: 40px;
}

.product-gallery__thumbnails-navigation {
    display: flex;
    align-items: center;
    gap: var(--spacing-fluid-xs);
    width: 100%;
}

.product-gallery__thumbnails-nav-button {
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

.product-gallery__thumbnails .swiper {
    width: 100%;
    overflow: hidden;
    min-width: 0; /* Allow flex item to shrink */
}

.product-gallery__thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: block;
    object-fit: contain;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
    border: 2px solid transparent;
}

.product-gallery__thumbnail:hover {
    opacity: 1;
}

.product-gallery__thumbnail.swiper-slide-thumb-active {
    opacity: 1;
    border-color: currentColor;
}

.product-gallery__thumbnail-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background-color: #f5f5f5;
}

/* Product Info Styles - overflow: visible so absolute dropdown list is not clipped */
.product-info-section {
    width: 100%;
    min-width: 0; /* Allow flex item to shrink */
    overflow: visible;
}

.product-info__inner {
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word; /* Break long words if needed */
}

.product-info__title {
    margin-bottom: 1rem;
}

.product-info__description {
    margin-bottom: 1.5rem;
}

.product-info__variations {
    margin-bottom: 1.5rem;
    cursor: pointer;
}

.product-info__variation-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* Custom Dropdown Styles */
.product-info__variation-dropdown {
    position: relative;
    width: 100%;
    cursor: pointer;
}

.product-info__variation-button {
    width: 100%;
    padding: 0;
    padding-bottom: 0.5rem;
    border: none;
    border-bottom: 1px solid #ddd;
    border-radius: 0;
    font-size: 1rem;
    background-color: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    transition: border-color 0.2s;
}

.product-info__variation-button:hover {
    border-bottom-color: var(--color-primary-800);
}

.product-info__variation-button:focus {
    outline: none;
    border-bottom-color: var(--color-primary-800);
    box-shadow: none;
}

.product-info__variation-button:focus-visible {
    outline: 2px solid var(--color-primary-600);
    outline-offset: 2px;
    border-radius: 4px;
    z-index: 1;
}

.product-info__variation-button[aria-expanded="true"] {
    border-bottom-color: var(--color-primary-800);
}

.product-info__variation-button-text {
    flex: 1;
}

.product-info__variation-button-icon {
    margin-left: 0.5rem;
    display: flex;
    align-items: center;
    height: 1.125rem; /* Match text-18 line height */
    flex-shrink: 0;
}

.product-info__variation-button-icon svg {
    transition: transform 0.2s;
}

.product-info__variation-button[aria-expanded="true"] .product-info__variation-button-icon svg {
    transform: rotate(180deg);
}

.product-info__variation-list {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    background-color: #fff;
    border: 1px solid #ddd;
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: min(70vh, 360px);
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.product-info__variation-dropdown.is-open .product-info__variation-list {
    display: block;
}

.product-info__variation-item {
    padding: 20px 30px;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
    position: relative;
}

.product-info__variation-item:hover {
    background-color: #F4F6FC;
}

.product-info__variation-item.is-active {
    background-color: #F4F6FC;
    border-left-color: var(--color-secondary-700);
    color: var(--color-primary-800);
}

.product-info__variation-item-text {
    flex: 1;
}

.product-info__variation-select-hidden {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    height: 0;
    width: 0;
}

.product-info__actions {
    margin-top: 1.5rem;
}

/* Product Single Wrapper */
.product-single__wrapper {
    width: 100%;
}

.product-single__row {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-fluid-3xl);
}

/* Responsive Layout */
@media (min-width: 768px) {
    .product-single__row {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .product-gallery-section {
        flex: 0 0 52%;
        max-width: 52%;
        min-width: 0;
    }
    
    .product-info-section {
        flex: 1 1 48%;
        min-width: 0; /* Allow flex item to shrink */
        max-width: 485%;
    }
}

