/**
* @websima-wc-gallery/assets/css/style.css
* Styles scoped only to the popup, loading states, and mobile swiper.
* The main gallery structure (product-gallery-row, single-product-slider, thumbnails)
* is already styled by the theme's single-product.css — we don't touch those.
*/

/* ===================================
   ICON FONT
=================================== */
:root {
    --ff-icon-wcgl: 'galleryIcon';
}

@font-face {
    font-family: 'galleryIcon';
    src:
        url('../fonts/galleryIcon.ttf') format('truetype'),
        url('../fonts/galleryIcon.woff') format('woff'),
        url('../fonts/galleryIcon.svg') format('svg');
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

[class^="gl-"],
[class*=" gl-"] {
    font-family: var(--ff-icon-wcgl) !important;
    speak: never;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.gl-starFill:before { content: "\e908"; }
.gl-playSimple:before { content: "\e900"; }
.gl-image:before { content: "\e901"; }
.gl-chevronLeft:before { content: "\e902"; }
.gl-chevronRight:before { content: "\e903"; }
.gl-profile:before { content: "\e904"; }
.gl-video:before { content: "\e905"; }
.gl-moreHoriz:before { content: "\e906"; }
.gl-close:before { content: "\e91b"; }

/* ===================================
   VIDEO SLIDE (inside the theme's swiper)
=================================== */

/* Video slide wrapper — matches the theme's .product_gallery_item sizing */
.product_gallery_item.wbs-video-slide {
    border-radius: 38px;
    background-color: #F5F5F5;
    height: clamp(288px, 40vw, 522px) !important;
    max-height: clamp(288px, 40vw, 522px) !important;
    padding: 0 !important;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wbs-video-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wbs-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 38px;
    display: block;
}

/* ===================================
   VIDEO THUMBNAIL (inside the theme's #single-product-thumbnail)
=================================== */

/* Video thumbnail: same size/style as .item-thumbnail but with play icon overlay */
.item-thumbnail.wbs-video-thumb {
    position: relative;
}

.item-thumbnail.wbs-video-thumb .wbs-video-thumb-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    pointer-events: none;
    z-index: 4;
}

/* ===================================
   MOBILE GALLERY
=================================== */
.wbs-wc-gallery-mobile {
    border-radius: 8px;
    position: relative;
}

.wbs-wc-gallery-mobile .mobile-swiper-container {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.mobile-video-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(6, 115, 140, 0.28);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 10px rgba(6, 115, 140, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color1, #06738C);
    font-size: 1.125rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-video-btn:hover,
.mobile-video-btn:focus-visible {
    background: var(--color1, #06738C);
    color: #fff;
    border-color: var(--color1, #06738C);
    box-shadow: 0 4px 14px rgba(6, 115, 140, 0.25);
    outline: none;
}

.mobile-gallery__item {
    mix-blend-mode: multiply;
    width: 250px;
    height: 250px;
}

.mobile-gallery__video-item {
    width: 100%;
    height: 250px;
    mix-blend-mode: normal;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-gallery__video-item video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mobile-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mobile-gallery-swiper .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f1;
    height: auto;
}

.mobile-gallery-pagination {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--color2, #333);
    width: auto;
    left: 8px;
    right: auto;
    bottom: 8px;
    z-index: 3;
    line-height: 1.2;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-family: var(--main_font, inherit);
    pointer-events: none;
    border: 1px solid rgba(6, 115, 140, 0.15);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.mobile-gallery-pagination .swiper-pagination-current,
.mobile-gallery-pagination .swiper-pagination-total {
    color: var(--color1, #06738C);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.mobile-gallery-pagination::after {
    content: '\e901';
    font-family: var(--ff-icon-wcgl);
    font-size: 1rem;
    color: var(--color1, #06738C);
    margin-inline-start: 6px;
    opacity: 0.85;
}

/* Thumbnail row under main swiper — align with theme single-product thumbnails */
.wbs-mobile-gallery-thumbs {
    margin-top: 0.75rem;
    width: 100%;
}

.wbs-mobile-gallery-thumbs .wrap-thumbnail-single-vertical {
    margin-top: 0;
}

.wbs-mobile-gallery-thumbs .wbs-mobile-thumbs-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--color1, #06738C) rgba(6, 115, 140, 0.12);
}

.wbs-mobile-gallery-thumbs .wbs-mobile-thumbs-scroll::-webkit-scrollbar {
    height: 5px;
}

.wbs-mobile-gallery-thumbs .wbs-mobile-thumbs-scroll::-webkit-scrollbar-track {
    background: rgba(6, 115, 140, 0.08);
    border-radius: 999px;
    margin: 0 4px;
}

.wbs-mobile-gallery-thumbs .wbs-mobile-thumbs-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(
        90deg,
        rgba(6, 115, 140, 0.35),
        var(--color1, #06738C)
    );
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 1px 2px rgba(6, 115, 140, 0.2);
}

.wbs-mobile-gallery-thumbs .wbs-mobile-thumbs-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--color1, #06738C);
    box-shadow: 0 1px 4px rgba(6, 115, 140, 0.35);
}

.wbs-mobile-gallery-thumbs .wbs-mobile-thumbs-inner {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 2px 0;
    min-height: 90px;
    align-items: stretch;
}

@media (min-width: 480px) {
    .wbs-mobile-gallery-thumbs .wbs-mobile-thumbs-inner {
        gap: 12px;
    }
}

/* Fade main swiper: active slide must receive clicks (video / lightbox) */
.wbs-wc-gallery-mobile .mobile-gallery-swiper.swiper-fade .swiper-slide {
    pointer-events: none;
}

.wbs-wc-gallery-mobile .mobile-gallery-swiper.swiper-fade .swiper-slide-active {
    pointer-events: auto;
}

.wbs-mobile-gallery-thumbs .item-thumbnail {
    position: relative;
    overflow: hidden;
    border-radius: 1rem;
    cursor: pointer;
    height: 86px !important;
    min-height: 86px;
    flex-shrink: 0;
    background-color: #F5F5F5;
    padding: 0.75rem;
    box-sizing: border-box;
    width: 86px !important;
    min-width: 86px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid transparent;
}

.wbs-mobile-gallery-thumbs .item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 5px;
}

.wbs-mobile-gallery-thumbs .item-thumbnail.swiper-slide-thumb-active {
    border-color: rgba(6, 115, 140, 0.4);
    box-shadow: 0 0 0 2px rgba(6, 115, 140, 0.15);
}

.wbs-mobile-gallery-thumbs .item-thumbnail.wbs-video-thumb .wbs-video-thumb-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background: rgba(6, 115, 140, 0.55);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    pointer-events: none;
    z-index: 4;
}

.gallery-tabs-slide__grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: 60% 40px;
    gap: 10px;
    padding: 10px;
    height: 90%;
}

.gallery-tabs-slide__item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.2), rgba(0,0,0,.8));
    pointer-events: none;
    border-radius: 8px;
}

.gallery-tabs-slide__item {
    background-size: cover;
    background-repeat: no-repeat;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.gallery-tabs-slide__content {
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 10px;
    line-height: 1.5;
    z-index: 5;
    color: #fff;
}

.gallery-tabs-slide__content small {
    margin-right: 4px;
}

.gallery-tabs-slide__all {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-gallery, #5100ff);
}

.gallery-tabs-slide__all .gallery-tabs-slide__content {
    position: static;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.gallery-tabs-slide__all .gallery-tabs-slide__content i {
    font-size: 20px;
}

.gallery-tabs-slide__all::before {
    display: none;
}

/* ===================================
   GALLERY POPUP — BASE
=================================== */
.gallery-popup * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-drag: none;
    -webkit-user-drag: none;
}

.gallery-popup img {
    display: inline-block;
}

.jsThumbOpen {
    cursor: pointer;
}

.gallery-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.6;
}

.gallery-popup__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    cursor: pointer;
}

.gallery-popup__container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gallery-popup__header {
    display: grid;
    grid-template-columns: 20px 1fr 20px;
    gap: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
    margin-left: 15px;
    margin-right: 15px;
    position: relative;
    z-index: 12;
}

.gallery-popup__close {
    all: unset;
    padding: 10px;
    line-height: 1;
    font-size: 12px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    grid-column: 3;
}

.gallery-popup__close:hover {
    background: rgba(0,0,0,0.7);
}

.gallery-popup__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ===================================
   POPUP — MAIN CONTENT
=================================== */
.gallery-popup__main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    justify-content: center;
    position: relative;
}

.gallery-popup__main-swiper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.gallery-popup__main-swiper .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.gallery-popup__media {
    width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-popup__media img,
.gallery-popup__media video {
    object-fit: contain;
    height: 100%;
}

/* ===================================
   POPUP — REVIEW PANEL
=================================== */
.gallery-popup__review-panel {
    font-size: 12.5px;
}

.gallery-popup__review-info {
    margin: 0.75em 1em 0;
    color: #fff;
}

.gallery-popup__author {
    display: flex;
    align-items: center;
    gap: 1.067em;
    font-size: 0.9375em;
    font-weight: bold;
    font-variation-settings: "wght" 600;
}

.gallery-popup__attributes {
    display: flex;
    flex-direction: column;
    gap: 0.333em;
    font-size: 0.75em;
    opacity: .8;
    margin-top: 1em;
}

.gallery-popup__attributes li {
    display: flex;
    align-items: center;
    gap: 0.333em;
}

.gallery-popup__date {
    font-size: 0.75em;
    margin: 0.583em 0 0;
    opacity: .6;
    direction: ltr;
}

.gallery-popup__rating {
    font-size: 1.25em;
    display: flex;
    align-items: center;
}

.gallery-popup__rating .gl-star { color: #A1A3AD; font-size: 1em; margin: 0 0.05em; }
.gallery-popup__rating .filled  { color: #f39c12; }

.gallery-popup__review-content {
    line-height: 1.6;
    margin: 0.857em 0 0;
    font-size: 0.875em;
}

/* ===================================
   POPUP — NAVIGATION ARROWS
=================================== */
.wc-gallery-prev,
.swiper-rtl .wc-gallery-next { left: 10px; right: auto; }

.wc-gallery-next,
.swiper-rtl .wc-gallery-prev { right: 10px; left: auto; }

.wc-gallery-next::after,
.swiper-rtl .wc-gallery-prev::after { content: '\e903'; }

.wc-gallery-prev::after,
.swiper-rtl .wc-gallery-next::after { content: '\e902'; }

.wc-gallery-next,
.wc-gallery-prev {
    display: flex;
    position: absolute;
    color: #424750;
    background: hsla(0,0%,100%,.5);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all .3s;
    box-shadow: 0px 1px 5px rgba(0,0,0,.2);
}

.wc-gallery-next.swiper-button-disabled,
.wc-gallery-prev.swiper-button-disabled { display: none; }

.wc-gallery-next::after,
.wc-gallery-prev::after {
    font-size: 24px;
    font-family: var(--ff-icon-wcgl);
    text-transform: none !important;
    letter-spacing: 0;
    font-variant: initial;
    line-height: 1;
}

/* ===================================
   POPUP — THUMBNAILS & TABS
=================================== */
.gallery-popup__thumbnails {
    background: rgba(0,0,0,.8);
    position: relative;
    padding: 15px 0;
    z-index: 3;
}

.gallery-popup__tabs {
    display: flex;
    grid-column: 2;
    justify-self: center;
    background: rgba(0,0,0,.5);
    border: 1px solid hsla(0,0%,100%,.25);
    overflow: hidden;
    padding: 2px 6px;
    border-radius: 8px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.gallery-popup__tab {
    all: unset;
    padding: 0 10px;
    font-size: 12px;
    display: flex;
    line-height: 2.15;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.gallery-popup__tab:hover { opacity: .7; }

.gallery-popup__tab::after {
    content: "";
    position: absolute;
    display: block;
    width: 16px;
    border-radius: 8px;
    opacity: 0;
    right: 50%;
    transform: translate(50%, -50%);
    transition: .3s;
    height: 6px;
    outline: 4px solid rgba(0,0,0,.5);
    background: #fff;
    top: calc(100% + 2px);
}

.gallery-popup__tab--active::after { opacity: 1; }

.gallery-popup__tab[data-group-type="buyer"]:before {
    content: "";
    position: absolute;
    display: block;
    height: 20px;
    width: 1px;
    background-color: hsla(0,0%,100%,.25);
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 4px;
}

[dir="ltr"] .gallery-popup__tab[data-group-type="buyer"]:before {
    right: auto;
    left: 0;
}

.gallery-popup__thumb-swiper .swiper-slide {
    width: auto !important;
    height: 100%;
}

.gallery-popup__thumb-item:last-child  { border-top-left-radius: 8px; border-bottom-left-radius: 8px; overflow: hidden; }
.gallery-popup__thumb-item:first-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; overflow: hidden; }

[dir="ltr"] .gallery-popup__thumb-item:last-child  { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
[dir="ltr"] .gallery-popup__thumb-item:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }

.gallery-popup__thumb-group {
    display: flex;
    height: 100%;
    align-items: center;
    margin: 0 8px;
    padding: 1px;
    border-radius: 8px;
    gap: 1px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.gallery-popup__thumb-group:has(.gallery-popup__thumb-item--active) {
    background: #fff;
}

.gallery-popup__thumb-item--active::before {
    content: "";
    position: absolute;
    display: block;
    width: 16px;
    height: 5px;
    border-radius: 8px;
    outline: 4px solid rgba(0,0,0,.5);
    background: #fff;
    right: 50%;
    top: 100%;
    transform: translate(50%, -50%);
    transition: .3s;
    z-index: 3;
}

.gallery-popup__thumb-item {
    width: 70px;
    height: 70px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.gallery-popup__thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #fff;
}

.gallery-popup__video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,.467);
    font-size: 24px;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===================================
   POPUP — BUTTONS & LABELS
=================================== */
.gallery-popup__section-label {
    width: 60px;
    min-width: 60px;
}

.gallery-popup__section-button {
    all: unset;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    font-family: var(--main_font);
    text-align: center;
    font-weight: bold;
    line-height: 1.2;
}

.gallery-popup__section-button i { font-size: 24px; }

/* ===================================
   LOADING STATES
=================================== */
.gallery-popup__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.gallery-popup__loading-dots {
    display: flex;
    gap: 8px;
}

.gallery-popup__loading-dots div {
    width: 5px;
    height: 5px;
    background: #fff;
    border-radius: 50%;
    animation: wbs-bounce 1.4s infinite ease-in-out both;
}

.gallery-popup__loading-dots .dot1 { animation-delay: -0.32s; }
.gallery-popup__loading-dots .dot2 { animation-delay: -0.16s; }

@keyframes wbs-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40%           { transform: scale(1); }
}

@keyframes wbs-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.variation-image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    border-radius: 50%;
}

.variation-image-loading div {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--color1, #06738C);
    border-radius: 50%;
    animation: wbs-spin 1s linear infinite;
}

/* ===================================
   UTILITY
=================================== */
.gallery-popup-open { overflow: hidden; }

.gallery-popup__container.no-thumbnails .gallery-popup__thumbnails { display: none; }

/* ===================================
   DESKTOP OVERRIDES (1024px+)
=================================== */
@media (min-width: 1024px) {
    .gallery-popup__header {
        grid-template-columns: 28px 1fr 28px;
        padding-top: 16px;
        padding-bottom: 16px;
        margin-left: 20px;
        margin-right: 20px;
    }

    .gallery-popup__main-container { padding: 20px; }

    .gallery-popup__main-swiper {
        width: calc(100vh - 230px);
        max-width: 75vw;
    }

    .has-review .gallery-popup__main-swiper {
        width: 600px;
        height: 75vh;
        max-width: unset;
        margin: 0;
    }

    .gallery-popup__review-panel {
        font-size: 16px;
        width: 400px;
        min-width: 400px;
        color: #fff;
    }

    .gallery-popup__close { font-size: 16px; }

    .gallery-popup__tabs {
        border-radius: 12px;
        padding: 4px 8px;
    }

    .gallery-popup__tab {
        padding: 0 16px;
        font-size: 14px;
    }

    .gallery-popup__tab::after { top: calc(100% + 5px); }

    .gallery-popup__media img,
    .gallery-popup__media video {
        border-radius: 4px;
        max-height: 75vh;
    }

    .gallery-popup__main-container { flex-direction: row; }

    .gallery-popup__review-content {
        max-height: 50vh;
        overflow-y: auto;
    }

    .wc-gallery-next,
    .wc-gallery-prev {
        width: 40px;
        height: 40px;
    }

    .wc-gallery-next:hover,
    .wc-gallery-prev:hover { background: #fff; }

    .gallery-popup__loading-dots div {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 1023.98px) {
    .gallery-popup__main-container {
        position: absolute;
        inset: 0;
    }

    .gallery-popup__review-panel {
        position: absolute;
        bottom: 100px;
        width: 100%;
        background: rgba(0,0,0,.8);
        z-index: 2;
        max-height: 50vh;
        overflow-y: auto;
    }

    .gallery-popup__thumbnails { margin-top: auto; }
}
