:root {
    --gallery-primary: #0066cc;
    --gallery-modal-bg: #ffffff;
    --gallery-overlay: rgba(0, 0, 0, 0.55);
    --gallery-border: #e5e7eb;
    --gallery-text: #111827;
    --gallery-muted: #6b7280;
    --gallery-media-bg: #f8f8f8;
}

.product-gallery-shell {
    padding-bottom: 29px;
}

.product-gallery-preview-grid,
.product-gallery-preview-side,
.product-gallery-grid,
.product-gallery-sidebar-thumb-list,
.product-gallery-mobile-thumb-grid {
    min-width: 0;
}

.product-gallery-preview-main,
.product-gallery-preview-side-item,
.product-gallery-preview-action,
.product-gallery-grid-card,
.product-gallery-tab,
.product-gallery-close,
.product-gallery-toggle-info,
.product-gallery-back-link,
.product-gallery-lightbox-nav,
.product-gallery-sidebar-thumb-item,
.product-gallery-mobile-thumb-card {
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    transition: all 0.2s ease;
}

.product-gallery-preview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    gap: 16px;
    height: clamp(360px, 42vw, 520px);
}

.product-gallery-preview-main,
.product-gallery-preview-side-item {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: var(--gallery-media-bg);
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
    cursor: pointer;
}

.product-gallery-preview-main img,
.product-gallery-preview-side-item img,
.product-gallery-grid-card-media img,
.product-gallery-sidebar-thumb-item img,
.product-gallery-mobile-thumb-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: all 0.2s ease;
}

.product-gallery-preview-main:hover img,
.product-gallery-preview-side-item:hover img,
.product-gallery-grid-card:hover .product-gallery-grid-card-media img,
.product-gallery-sidebar-thumb-item:hover img,
.product-gallery-mobile-thumb-card:hover img {
    transform: scale(1.02);
}

.product-gallery-preview-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.product-gallery-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0) 0%, rgba(17, 24, 39, 0.1) 48%, rgba(17, 24, 39, 0.5) 100%);
    pointer-events: none;
}

.product-gallery-badge,
.product-gallery-badge-corner,
.product-gallery-preview-action,
.product-gallery-more,
.product-gallery-play {
    position: absolute;
    z-index: 2;
}

.product-gallery-badge,
.product-gallery-badge-corner,
.product-gallery-preview-action,
.product-gallery-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-weight: 600;
    line-height: 1;
}

.product-gallery-badge {
    top: 14px;
    left: 14px;
    min-height: 28px;
    padding: 0 12px;
    font-size: 11px;
    color: #ffffff;
}

.product-gallery-badge-video {
    background: rgba(17, 24, 39, 0.82);
}

.product-gallery-badge-vr {
    background: var(--gallery-primary);
}

.product-gallery-badge-corner {
    left: 14px;
    bottom: 14px;
    min-width: 56px;
    height: 34px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--gallery-text);
    font-size: 14px;
}

.product-gallery-play {
    top: 50%;
    left: 50%;
    width: 52px;
    height: 52px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--gallery-text);
    font-size: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.product-gallery-preview-action {
    right: 14px;
    bottom: 14px;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--gallery-border);
    background: rgba(255, 255, 255, 0.96);
    color: var(--gallery-text);
    font-size: 14px;
}

.product-gallery-preview-action:hover {
    background: #ffffff;
}

.product-gallery-more {
    right: 14px;
    bottom: 14px;
    min-width: 54px;
    height: 38px;
    padding: 0 14px;
    background: rgba(17, 24, 39, 0.82);
    color: #ffffff;
    font-size: 18px;
}

.product-gallery-empty {
    padding: 32px 20px;
    border: 1px dashed var(--gallery-border);
    border-radius: 12px;
    background: #ffffff;
    color: var(--gallery-muted);
    text-align: center;
    font-size: 14px;
}

.product-gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.product-gallery-modal[hidden] {
    display: none;
}

.product-gallery-modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--gallery-overlay);
}

.product-gallery-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(1240px, calc(100vw - 32px));
    max-height: 90vh;
    margin: 5vh auto;
    background: var(--gallery-modal-bg);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(17, 24, 39, 0.16);
}

.product-gallery-modal-header {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 72px;
    padding: 0 24px;
    border-bottom: 1px solid var(--gallery-border);
    background: var(--gallery-modal-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.product-gallery-modal-header-main {
    min-width: 0;
    flex: 1 1 auto;
}

.product-gallery-modal-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.product-gallery-modal-tabs::-webkit-scrollbar,
.product-gallery-sidebar-thumb-list::-webkit-scrollbar {
    display: none;
}

.product-gallery-tab {
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--gallery-muted);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    padding: 24px 4px 18px;
}

.product-gallery-tab.is-active {
    border-bottom-color: var(--gallery-primary);
    color: var(--gallery-primary);
}

.product-gallery-close {
    width: 40px;
    height: 40px;
    border: 1px solid var(--gallery-border);
    border-radius: 50%;
    background: #ffffff;
    color: var(--gallery-text);
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.product-gallery-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.product-gallery-toggle-info {
    border: 1px solid var(--gallery-border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--gallery-muted);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    height: 36px;
    font-size: 12px;
    font-weight: 500;
}

.product-gallery-toggle-info.is-active {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}

.product-gallery-toggle-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
}

.product-gallery-toggle-info.is-active .product-gallery-toggle-dot {
    background: #0066cc;
}

.product-gallery-close:hover {
    background: #f9fafb;
}

.product-gallery-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
}

.product-gallery-modal-main {
    min-width: 0;
    min-height: 0;
}

.product-gallery-modal-scroll {
    max-height: calc(90vh - 120px);
    overflow-y: auto;
    padding: 24px;
}

.product-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.product-gallery-grid-card {
    border: 0;
    background: transparent;
    padding: 0;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

.product-gallery-grid-card-media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: var(--gallery-media-bg);
}

.product-gallery-grid-card-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: all 0.2s ease;
}

.product-gallery-grid-card:hover .product-gallery-grid-card-media::after {
    background: rgba(0, 0, 0, 0.15);
}

.product-gallery-grid-card-caption {
    display: block;
    margin-top: 10px;
    font-size: 12px;
    color: var(--gallery-muted);
    line-height: 1.5;
}

.product-gallery-lightbox-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-gallery-back-link {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    color: var(--gallery-muted);
    font-size: 13px;
    font-weight: 500;
    padding: 0;
}

.product-gallery-back-link:hover {
    color: var(--gallery-primary);
}

.product-gallery-lightbox-stage {
    position: relative;
    background: var(--gallery-media-bg);
    border: 1px solid var(--gallery-border);
    border-radius: 12px;
    padding: 24px 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    flex: 1 1 auto;
    max-height: calc(90vh - 260px);
}

.product-gallery-lightbox-media {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gallery-media-bg);
}

.product-gallery-lightbox-media img,
.product-gallery-lightbox-media video,
.product-gallery-lightbox-media iframe {
    width: 100%;
    max-height: calc(90vh - 280px);
    border: 0;
    background: var(--gallery-media-bg);
}

.product-gallery-lightbox-media img,
.product-gallery-lightbox-media video {
    object-fit: contain;
}

.product-gallery-lightbox-media iframe {
    min-height: 400px;
}

.product-gallery-lightbox-nav {
    width: 36px;
    height: 36px;
    border: 1px solid var(--gallery-border);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--gallery-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(17, 24, 39, 0.08);
}

.product-gallery-lightbox-nav:hover {
    background: #ffffff;
    box-shadow: 0 10px 22px rgba(17, 24, 39, 0.12);
}

.product-gallery-lightbox-nav[disabled] {
    opacity: 0.5;
    cursor: default;
    box-shadow: none;
}

.product-gallery-lightbox-nav-prev,
.product-gallery-lightbox-nav-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.product-gallery-lightbox-nav-prev {
    left: 12px;
}

.product-gallery-lightbox-nav-next {
    right: 12px;
}

.product-gallery-lightbox-mobile-nav {
    display: none;
    justify-content: center;
    gap: 12px;
}

.product-gallery-lightbox-title {
    color: var(--gallery-text);
    font-size: 15px;
    font-weight: 500;
    text-align: center;
}

.product-gallery-lightbox-counter {
    color: var(--gallery-muted);
    font-size: 13px;
    text-align: center;
}

.product-gallery-lightbox-mobile-counter {
    color: var(--gallery-muted);
    font-size: 13px;
    min-width: 52px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.product-gallery-mobile-type-label {
    font-size: 11px;
    color: var(--gallery-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.product-gallery-mobile-thumb-grid {
    display: none;
}

.product-gallery-sidebar {
    width: 240px;
    min-width: 240px;
    border-left: 1px solid var(--gallery-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
}

.product-gallery-sidebar-content {
    padding: 24px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-gallery-sidebar-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--gallery-text);
    line-height: 1.4;
}

.product-gallery-sidebar-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: #374151;
    font-size: 14px;
    line-height: 1.6;
}

.product-gallery-sidebar-item i {
    color: var(--gallery-muted);
    margin-top: 4px;
}

.product-gallery-sidebar-divider {
    border-top: 1px solid var(--gallery-border);
    margin: 0 12px;
}

.product-gallery-sidebar-thumb-label {
    padding: 12px 12px 0;
    font-size: 11px;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gallery-muted);
}

.product-gallery-sidebar-thumb-list {
    overflow-y: auto;
    flex: 1 1 auto;
    padding: 8px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scrollbar-width: none;
}

.product-gallery-sidebar-thumb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.product-gallery-sidebar-thumb-item:hover {
    background: #f9fafb;
}

.product-gallery-sidebar-thumb-item.is-active {
    background: #eff6ff;
    border-color: #93c5fd;
}

.product-gallery-sidebar-thumb-item img {
    width: 60px;
    height: 46px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
    display: block;
}

.product-gallery-sidebar-thumb-meta {
    min-width: 0;
}

.product-gallery-sidebar-thumb-caption {
    font-size: 12px;
    color: #374151;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-gallery-sidebar-thumb-item.is-active .product-gallery-sidebar-thumb-caption {
    color: #1d4ed8;
    font-weight: 500;
}

.product-gallery-sidebar-thumb-type {
    margin-top: 2px;
    font-size: 10px;
    color: #9ca3af;
    text-transform: uppercase;
}

.product-gallery-modal-body.hide-photo-info .product-gallery-sidebar-thumb-caption,
.product-gallery-modal-body.hide-photo-info .product-gallery-grid-card-caption,
.product-gallery-modal-body.hide-photo-info .product-gallery-lightbox-title,
.product-gallery-modal-body.hide-photo-info .product-gallery-mobile-type-label {
    display: none;
}

.product-gallery-modal-body.hide-photo-info .product-gallery-sidebar-thumb-label {
    padding-top: 0;
}

@media (max-width: 991.98px) {
    .product-gallery-preview-grid {
        grid-template-columns: 1fr;
        height: auto;
    }

    .product-gallery-preview-main {
        aspect-ratio: 16 / 10;
    }

    .product-gallery-preview-side-item {
        aspect-ratio: 4 / 3;
    }

    .product-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .product-gallery-preview-grid,
    .product-gallery-preview-side {
        gap: 10px;
    }

    .product-gallery-preview-main,
    .product-gallery-preview-side-item {
        border-radius: 12px;
    }

    .product-gallery-preview-action {
        right: 10px;
        bottom: 10px;
        height: 36px;
        padding: 0 12px;
        font-size: 12px;
    }

    .product-gallery-badge {
        top: 10px;
        left: 10px;
    }

    .product-gallery-badge-corner,
    .product-gallery-more {
        bottom: 10px;
        left: 10px;
    }

    .product-gallery-more {
        left: auto;
        right: 10px;
    }

    .product-gallery-modal-dialog {
        width: 100vw;
        height: 100dvh;
        max-height: none;
        margin: 0;
        border-radius: 0;
    }

    .product-gallery-modal-body {
        grid-template-columns: 1fr;
    }

    .product-gallery-modal-header {
        min-height: 52px;
        padding: 0 14px;
    }

    .product-gallery-header-actions {
        gap: 8px;
    }

    .product-gallery-toggle-info {
        height: 32px;
        padding: 0 10px;
        font-size: 11px;
    }

    .product-gallery-tab {
        font-size: 13px;
        padding: 16px 4px 13px;
    }

    .product-gallery-close {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    .product-gallery-modal-scroll {
        max-height: calc(100dvh - 52px);
        padding: 16px;
    }

    .product-gallery-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .product-gallery-lightbox-stage {
        min-height: auto;
        padding: 0;
        aspect-ratio: 4 / 3;
        background: #f0f2f5;
        overflow: hidden;
        position: relative;
    }

    .product-gallery-lightbox-media {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
    }

    .product-gallery-lightbox-media img,
    .product-gallery-lightbox-media video,
    .product-gallery-lightbox-media iframe {
        width: 100%;
        height: 100%;
        max-height: none;
        object-fit: contain;
        object-position: center;
    }

    .product-gallery-lightbox-media iframe {
        min-height: unset;
    }

    /* Hide standalone title/counter on mobile - they're shown inside the mobile nav */
    .product-gallery-lightbox-title,
    .product-gallery-lightbox-counter {
        display: none;
    }

    .product-gallery-lightbox-nav-prev,
    .product-gallery-lightbox-nav-next {
        display: none;
    }

    .product-gallery-lightbox-mobile-nav {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 16px;
        padding: 8px 16px;
    }

    .product-gallery-lightbox-mobile-nav .product-gallery-lightbox-nav {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    .product-gallery-mobile-thumb-grid {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 6px;
        padding: 8px 16px;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .product-gallery-mobile-thumb-grid::-webkit-scrollbar {
        display: none;
    }

    .product-gallery-mobile-thumb-card {
        flex-shrink: 0;
        width: 72px;
        height: 72px;
        border: 2px solid transparent;
        border-radius: 8px;
        overflow: hidden;
        background: #1a1a2e;
        padding: 0;
        text-align: left;
        cursor: pointer;
        scroll-snap-align: start;
    }

    .product-gallery-mobile-thumb-card.is-active {
        border-color: var(--gallery-primary);
    }

    .product-gallery-mobile-thumb-card img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .product-gallery-mobile-thumb-label {
        display: none;
    }

    .product-gallery-sidebar {
        display: none !important;
    }
}
