.uicore-summary-gallery {
    width: 100%;
}

.woocommerce div.product div.images {
    margin-bottom: 0;
}
.gp-gallery.single-image {
    margin-bottom: 0;
}

@media (max-width: 767px) {
    .gp-gallery.single-image {
        margin-bottom: 0;
        max-width: 100%;
        width: auto;
        min-width: 300px;
    }
}

.gp-gallery {
    width: 100%;
    max-width: none !important;
    margin: 0 auto 40px;
    position: relative;
    overflow: hidden;
    background-color: #f9f9f9;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.07);
    box-sizing: border-box;
    display: block;
    visibility: visible;
    min-height: 250px;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);

}

.gp-progress-bar {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 16px;
    z-index: 10;
    width: 100%;
    position: absolute;
    top: 10px;
    left: 0;
    box-sizing: border-box;
}

.gp-progress-segment {
    height: 3px;
    background-color: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    flex: 1;
    position: relative;
    overflow: hidden;
    min-width: 10px;
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.gp-progress-segment:hover {
    background-color: rgba(255, 255, 255, 0.35);
    transform: scaleY(1.15);
}

.gp-progress-segment.active {
    background-color: rgba(255, 255, 255, 0.4);
    position: relative;
    z-index: 2;
    height: 4px;
    box-shadow: none;
    animation: none;
}

/* Remove unnecessary animation */
@keyframes subtleGlow {
    0% { opacity: 1; }
    100% { opacity: 1; }
}

.gp-progress-segment.completed {
    background-color: rgba(255, 255, 255, 0.65);
    box-shadow: none;
}

.gp-progress-segment.completed .gp-progress-fill {
    width: 100%;
}

/* Animation keyframes are now set dynamically in JavaScript */

.gp-gallery-main {
    position: relative;
    padding-bottom: 100%;
    box-sizing: border-box;
    display: block;
    visibility: visible;
    min-height: 250px;
    background-color: transparent;
    overflow: hidden;
    width: 100% !important;
    border-radius: 16px;
}

#gp-main-image {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    visibility: visible;
    min-height: 250px;
    will-change: opacity, transform;
    border-radius: 16px;
}

.gp-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) scale(0.95);
    width: 42px;
    height: 42px;
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer !important;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: none;
    overflow: hidden;
    pointer-events: auto !important;
}

.gp-gallery:hover .gp-nav-btn {
    opacity: 0;
}

/* Show navigation buttons only when hovering the respective sides */
.gp-gallery-left-hover-area,
.gp-gallery-right-hover-area {
    position: absolute;
    top: 0;
    height: 100%;
    width: 35%;
    z-index: 5;
    cursor: pointer;
    transition: background-color 0.3s ease;
    pointer-events: auto;
}

.gp-gallery-left-hover-area {
    left: 0;
}

.gp-gallery-right-hover-area {
    right: 0;
}

/* Add subtle gradient indicators on hover */
.gp-gallery-left-hover-area:hover {
    background: linear-gradient(to right, rgba(255,255,255,0.1), rgba(255,255,255,0));
}

.gp-gallery-right-hover-area:hover {
    background: linear-gradient(to left, rgba(255,255,255,0.1), rgba(255,255,255,0));
}

/* Show buttons ONLY when hovering over their respective areas */
.gp-gallery-left-hover-area:hover ~ .gp-nav-prev,
.gp-nav-prev:hover {
    opacity: 0.9 !important;
    transform: translateY(-50%) scale(1);
}

.gp-gallery-right-hover-area:hover ~ .gp-nav-next,
.gp-nav-next:hover {
    opacity: 0.9 !important;
    transform: translateY(-50%) scale(1);
}

.gp-nav-prev {
    left: 16px;
}

.gp-nav-next {
    right: 16px;
}

/* Remove the old arrow implementation */
.gp-nav-btn:before {
    display: none;
}

/* New clean arrow icons */
.gp-nav-prev:after,
.gp-nav-next:after {
    content: '';
    display: block;
    width: 9px;
    height: 9px;
    position: relative;
    border-style: solid;
    border-width: 2px 2px 0 0;
    border-color: white;
    box-shadow: none;
}

.gp-nav-prev:after {
    transform: rotate(-135deg);
    margin-left: 3px;
}

.gp-nav-next:after {
    transform: rotate(45deg);
    margin-right: 3px;
}

/* Enhanced focus styles */
.gp-nav-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

/* Improve button appearance on hover */
.gp-nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-50%) scale(1.05) !important;
}

.gp-nav-btn:hover:after {
    animation: none;
    filter: none;
}

/* Remove the pulse animation for cleaner look */
@keyframes pulse {
    0% { opacity: 1; }
    100% { opacity: 1; }
}

@keyframes pulse-next {
    0% { opacity: 1; }
    100% { opacity: 1; }
}

/* Autoplay button - only show on hover */
.gp-autoplay-btn {
    position: absolute;
    bottom: 15px;
    left: 15px;
    width: 44px;
    height: 44px;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: white;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    cursor: pointer;
}

.gp-gallery:hover .gp-autoplay-btn {
    opacity: 0.9;
    transform: scale(1);
}

/* Hide counter by default, show on hover */
.gp-counter {
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.gp-gallery:hover .gp-counter {
    opacity: 0.9;
}

/* Play/Pause Icon - Improved styling */
.gp-autoplay-btn i {
    font-size: 18px;
    color: white;
}

.gp-autoplay-btn.playing {
    background-color: rgb(235, 81, 20,.2);
}

/* Custom play/pause icons */
.gp-autoplay-btn .play-icon,
.gp-autoplay-btn .pause-icon {
    position: absolute;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gp-autoplay-btn .play-icon {
    display: flex;
}

.gp-autoplay-btn .pause-icon {
    display: none;
}

.gp-autoplay-btn.playing .play-icon {
    display: none;
}

.gp-autoplay-btn.playing .pause-icon {
    display: flex;
}

.gp-autoplay-btn .play-icon:before {
    content: '';
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-left: 10px solid white;
    border-bottom: 6px solid transparent;
    margin-left: 2px;
}

.gp-autoplay-btn .pause-icon:before,
.gp-autoplay-btn .pause-icon:after {
    content: '';
    width: 3px;
    height: 12px;
    background-color: white;
    margin: 0 2px;
    border-radius: 1px;
}

/* Mobile specific styles */
@media (max-width: 767px) {
    .gp-nav-btn {
        width: 44px;
        height: 44px;
    }
    
    .gp-nav-btn:before {
        width: 8px;
        height: 8px;
    }
    
    .gp-gallery:hover .gp-nav-btn {
        opacity: 0.95;
    }
}

/* Touch-friendly improvements */
@media (hover: none) {
    .gp-nav-btn {
        opacity: 0.8;
        /* Larger touch area beyond visible button */
        padding: 10px;
        margin: -10px;
    }
    
    .gp-nav-prev {
        left: 25px;
    }
    
    .gp-nav-next {
        right: 25px;
    }
    
    /* Ensure buttons have clear active states on mobile */
    .gp-nav-btn:active, 
    .gp-autoplay-btn:active {
        transform: scale(0.92);
        background-color: rgba(255, 255, 255, 0.35);
    }
}

/* Ensure gallery fills parent container width */
.woocommerce-product-gallery .gp-gallery,
.summary-gallery .gp-gallery,
.woocommerce-product-gallery__wrapper .gp-gallery {
    max-width: none !important;
    width: 100% !important;
}

/* Mobile specific styles */
@media (max-width: 767px) {
    .gp-gallery {
        width: 100% !important;
        max-width: none !important;
        border-radius: 16px !important;
        margin: 0 auto 20px;
        box-shadow: none;
    }
    
    .gp-gallery-main {
        padding-bottom: 100% !important;
        border-radius: 16px !important;
        width: 100% !important;
        background: white;
    }
    
    .gp-nav-btn {
        opacity: 0.9;
        width: 42px;
        height: 42px;
        background-color: rgba(255,255,255,0.2);
    }
    
    .gp-progress-bar {
        padding: 10px 8px 4px;
    }
    
    .gp-progress-segment {
        height: 3px;
    }
    
    .gp-counter {
        bottom: 12px;
        right: 12px;
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Touch Device Optimization */
@media (hover: none) {
    .gp-gallery-prev,
    .gp-gallery-next {
        opacity: 0.85;
    }
    
    .gp-gallery-counter {
        opacity: 1;
    }
    
    .gp-gallery:hover {
        transform: none;
        box-shadow: 0 8px 30px rgba(0,0,0,0.07);
    }
    
    .gp-gallery:hover .gp-gallery-counter {
        transform: translateY(0);
    }
}

/* Match parent container width */
.summary-gallery .gp-gallery {
    width: 100%;
}

/* Loading Indicator */
.gp-gallery::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    z-index: 4;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gp-gallery.loading::before {
    opacity: 1;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Hover/Focus Effects */
.gp-nav-btn:focus, 
.gp-autoplay-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.gp-progress-segment {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.gp-progress-segment:hover {
    cursor: pointer;
}

/* Transitions for all elements */
.gp-gallery * {
    transition-property: opacity, transform, background-color, box-shadow;
    transition-duration: 0.3s;
    transition-timing-function: ease;
}

.gp-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    transform-origin: left;
    will-change: width;
    transition: width 0ms linear;
    z-index: 3;
}

/* Add glow only to the filling part using a pseudo-element that follows the fill width */
.gp-progress-fill.filling {
    background-color: rgba(255, 255, 255, 0.95);
    position: relative;
}

/* Remove the glowing after pseudo-element */
.gp-progress-fill.filling::after {
    display: none;
}

/* Remove the glow animation */
@keyframes fillGlow {
    from {
        opacity: 1;
    }
    to {
        opacity: 1;
    }
}
