/* Amazon Style Product Gallery CSS */

.amazon-gallery-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%; /* Adjust as needed, e.g., 800px */
    margin: 0 auto 20px auto; /* Center the gallery and add some bottom margin */
    border: 1px solid #ddd;
    padding: 15px;
    box-sizing: border-box;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.amazon-gallery-main-image-wrapper {
    width: 100%;
    max-width: 600px; /* Max width for the main image container */
    padding-bottom: 75%; /* 4:3 Aspect Ratio (height is 75% of width) */
    position: relative; /* Needed for absolute positioning of image */
    margin-bottom: 15px;
    overflow: hidden;
    border-radius: 6px;
    cursor: pointer; /* Indicate clickable for lightbox */
}

.amazon-gallery-main-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain; /* Ensures image fits within the 4:3 box */
    background-color: #f0f0f0; /* Placeholder background for empty space */
}

.amazon-gallery-thumbnails {
    display: flex;
    flex-wrap: wrap; /* Allow thumbnails to wrap to the next line */
    justify-content: center; /* Center thumbnails */
    gap: 10px; /* Space between thumbnails */
    width: 100%;
    max-width: 600px; /* Match main image max-width for alignment */
}

.amazon-gallery-thumbnail {
    width: 80px; /* Fixed width for thumbnails */
    height: 80px; /* Fixed height for thumbnails */
    object-fit: cover; /* Crop to fit, maintaining aspect ratio */
    border: 2px solid #eee;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0; /* Prevent shrinking below 80px */
}

.amazon-gallery-thumbnail:hover {
    border-color: #0073aa; /* WordPress blue on hover */
    transform: translateY(-2px); /* Slight lift on hover */
}

.amazon-gallery-thumbnail.active {
    border-color: #0073aa; /* Active thumbnail border color */
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.3); /* Slight glow for active */
}

/* --- Basic Lightbox Styles --- */
.amazon-gallery-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8); /* Semi-transparent black background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999; /* Ensure it's on top of everything */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.amazon-gallery-lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.amazon-gallery-lightbox-content {
    max-width: 90%;
    max-height: 90%;
    text-align: center;
    position: relative;
}

.amazon-gallery-lightbox-image {
    max-width: 100%;
    max-height: 100%;
    display: block;
    object-fit: contain;
    border-radius: 8px;
}

.amazon-gallery-lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #fff;
    color: #333;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.amazon-gallery-lightbox-close:hover {
    background-color: #f0f0f0;
    color: #000;
}