/* --- Gallery Component Styles --- */

.gallery_image_gallery {
    width:660px;
}
@media (max-width: 1000px) {

    .gallery_image_gallery {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "right"
            "left";
        width: 660px;
        margin: auto;
    }

}

@media (max-width: 660px) {

    .gallery_image_gallery {
        width: 502px;
    }

}

@media (max-width: 510px) {

    .gallery_image_gallery {
        width: 345px;
    }

}

/* Gallery Container */
.gallery_container {
    /* Removed background, assuming parent provides it */
    /* Removed padding, assuming parent provides it or it's handled differently */
    /* Removed box-shadow, assuming parent styles */
    /* Keep max-width specific to the gallery's needs */
    max-width: 700px; /* Adjust based on main image width + padding (if any) */
    width: 100%;
    margin: 20px auto; /* Add some margin for spacing within the page */
    position: relative; /* Needed for positioning elements like arrows if they overlap */
}

/* Main Image Area */
.gallery_main_image_wrapper {
    position: relative;
    margin-bottom: 15px;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-drag: none;
}

#gallery_main_image {
    display: block;
    width: 100%;
    max-width: 660px;
    height: auto;
    margin: 0 auto; /* Center if container is wider */
    cursor: pointer;
}

.gallery_star_rating {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 8px;
    color: gold;
    font-size: 1.2em;
    z-index: 5; /* Ensure it's above the image */
}

.gallery_view_large_btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 8px 15px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
    z-index: 5; /* Ensure it's above the image */
}

.gallery_view_large_btn:hover {
    background-color: rgba(0, 0, 0, 0.9);
}

/* Thumbnail Rail */
.gallery_thumbnail_rail_container {
    display: flex;
    align-items: center;
    position: relative; /* Relative to gallery_container */

}

.gallery_nav_arrow {
    background-color: #ddd;
    border: none;
    color: #333;
    font-size: 1.5em;
    font-weight: bold;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    z-index: 10;
    flex-shrink: 0;
    /* Position arrows slightly outside the wrapper if needed */
    /* position: absolute; top: 50%; transform: translateY(-50%); */
}
/* Example positioning if needed: */
/* .gallery_left_arrow { left: -25px; } */
/* .gallery_right_arrow { right: -25px; } */


.gallery_nav_arrow:hover:not(:disabled) {
    background-color: #ccc;
}

.gallery_nav_arrow:disabled {
    opacity: 0.4;
    cursor: default;
}

.gallery_thumbnail_wrapper {
    overflow: hidden;
    flex-grow: 1;
    margin: 0 10px; /* Adjust margin if arrows are inside */
    /* margin: 0; */ /* Use if arrows are positioned absolutely */
}

.gallery_thumbnail_track {
    display: flex;
    transition: transform 0.3s ease-in-out;
    padding-bottom: 5px;
}

.gallery_thumbnail_image {
    width: 100px;
    height: auto;
    margin-right: 10px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    border: 2px solid transparent;
    transition: opacity 0.3s ease, border-color 0.3s ease;
    flex-shrink: 0;
}

.gallery_thumbnail_image:last-child {
    margin-right: 0;
}

.gallery_thumbnail_image:hover {
    opacity: 1;
}

.gallery_thumbnail_image.active {
    opacity: 1;
    border-color: #007bff; /* Active border color - consider using CSS variables from parent project */
}

/* --- Modal Styles --- */
.gallery_modal_overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Ensure modal is on top */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.gallery_modal_overlay.visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.gallery_modal_content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#gallery_modal_image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.gallery_close_modal_btn {
    position: absolute;
    top: -35px;
    right: -15px;
    background: none;
    border: none;
    color: #fff; /* Consider contrast with potential page background */
    font-size: 2.5rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
}

.gallery_modal_nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 4px;
    z-index: 1010; /* Above modal image */
    transition: background-color 0.2s ease;
}

.gallery_modal_nav:hover {
     background-color: rgba(0, 0, 0, 0.8);
}

.gallery_modal_nav.gallery_prev {
    left: 10px;
}

.gallery_modal_nav.gallery_next {
    right: 10px;
}

/* Accessibility helper */
.gallery_visually_hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Star Rating Specific Styles (Keep these) --- */
.gallery_star_rating {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 4px 8px;
    
    z-index: 5;
    font-size: 1.2em;
    line-height: 1;
    white-space: nowrap;
}

/* Base style for ALL star spans */
.gallery_rating_star {
    display: inline-block;
    position: relative; /* Needed for half-star overlay */
    color: #ccc; /* Default color */
    margin: 0 1px;
    /* Use ::before for the visual star character */
}

/* Default state (empty) - applied via .gallery_rating_star_empty */
.gallery_rating_star_empty::before,
.gallery_rating_star_half::before { /* Half also needs empty base */
    content: '☆'; /* Empty star character */
    color: #ccc; /* Explicitly set empty color */
}

/* State: Full */
.gallery_rating_star_full::before {
    content: '⭐'; /* Full star character */
    color: gold;
}

/* State: Half (Overlay) */
/* The ::before rule above gives the empty background */
.gallery_rating_star_half::after {
    content: '⭐'; /* Full star character, clipped */
    color: gold;
    position: absolute;
    left: 0;
    top: 0;
    width: 50%;
    overflow: hidden;
    z-index: 1;
}

/* --- Media Queries (Keep these) --- */
@media (max-width: 768px) {
    .gallery_star_rating {
        font-size: 1em;
        padding: 3px 6px;
    }
}

@media (max-width: 480px) {
     .gallery_star_rating { display: none; }
}




/* --- Mobile Friendliness (using prefixed classes) --- */
@media (max-width: 768px) {
    /* Adjust container max-width if needed for mobile */
    /* .gallery_container { max-width: 95%; } */

    .gallery_star_rating {
        font-size: 1em;
        padding: 3px 6px;
    }
    .gallery_view_large_btn {
        padding: 6px 12px;
        font-size: 0.8em;
        bottom: 5px;
        right: 5px;
    }
    .gallery_thumbnail_image {
        width: 80px;
        margin-right: 8px;
    }
    .gallery_nav_arrow {
        font-size: 1.2em;
        padding: 4px 8px;
         /* Adjust absolute positioning if used */
         /* &.gallery_left_arrow { left: -20px; } */
         /* &.gallery_right_arrow { right: -20px; } */
    }
     .gallery_thumbnail_wrapper {
         margin: 0 8px; /* Adjust margin */
     }

    .gallery_modal_nav {
        font-size: 1.5rem;
        padding: 8px 12px;
    }
     .gallery_modal_nav.gallery_prev { left: 5px; }
     .gallery_modal_nav.gallery_next { right: 5px; }

    .gallery_close_modal_btn {
         top: -30px;
         right: 0px;
         font-size: 2rem;
    }
}

@media (max-width: 480px) {
     .gallery_thumbnail_image {
        width: 65px;
        margin-right: 5px;
    }
     .gallery_thumbnail_wrapper {
         margin: 0 5px; /* Adjust margin */
     }
     /* Consider hiding stars completely on very small screens */
     .gallery_star_rating { display: none; }
}