/**
 * YayReviews - Media Gallery Styles (Amazon-style Split Lightbox)
 */

/* Body lock when gallery is open */
body.yayrev-gallery-open {
    overflow: hidden;
}

/* Gallery Modal */
.yayrev-gallery {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.yayrev-gallery.is-open {
    opacity: 1;
    visibility: visible;
}

/* Overlay */
.yayrev-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
}

/* Main Container - Split Layout */
.yayrev-gallery-container {
    position: relative;
    z-index: 1;
    display: flex;
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    max-height: 900px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* =====================================================
   Left Panel: Media
   ===================================================== */

.yayrev-gallery-media-panel {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000;
    min-width: 0;
}

/* Close Button */
.yayrev-gallery-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    padding: 0;
}

.yayrev-gallery-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    color: #fff;
    border: none;
}

.yayrev-gallery-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.yayrev-gallery-close-mobile {
    display: none;
}

/* Navigation Arrows */
.yayrev-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    padding: 0;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.yayrev-gallery-prev {
    left: 16px;
}

.yayrev-gallery-next {
    right: 16px;
}

.yayrev-gallery-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
    color: #fff;
    border: none;
}

.yayrev-gallery-nav:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Media Content Area */
.yayrev-gallery-media-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    min-height: 0;
}

/* Image Wrapper */
.yayrev-gallery-image-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
}

.yayrev-gallery-image-wrapper.is-loading::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: yayrev-spin 0.8s linear infinite;
}

@keyframes yayrev-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Gallery Image */
.yayrev-gallery-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.yayrev-gallery-image-wrapper:not(.is-loading) .yayrev-gallery-image {
    opacity: 1;
}

/* Video Wrapper */
.yayrev-gallery-video-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
}

/* Gallery Video */
.yayrev-gallery-video {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    background: #000;
}

/* Media Footer */
.yayrev-gallery-media-footer {
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.5);
}

/* Counter */
.yayrev-gallery-counter {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.yayrev-gallery-separator {
    opacity: 0.5;
}

/* Thumbnails Strip */
.yayrev-gallery-thumbnails {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    max-width: 100%;
    padding: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.yayrev-gallery-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.yayrev-gallery-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.yayrev-gallery-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Thumbnail Button */
.yayrev-gallery-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s ease, transform 0.2s ease;
    position: relative;
}

.yayrev-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.yayrev-gallery-thumb:hover {
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.yayrev-gallery-thumb.is-active {
    border-color: #fff;
}

.yayrev-gallery-thumb:focus {
    outline: none;
    border-color: #fff;
}

/* Thumbnail Video Icon */
.yayrev-gallery-thumb-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 22px;
    height: 22px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.yayrev-gallery-thumb-play svg {
    width: 10px;
    height: 10px;
    margin-left: 2px;
}

/* =====================================================
   Right Panel: Review Info
   ===================================================== */

.yayrev-gallery-review-panel {
    width: 380px;
    flex-shrink: 0;
    background: #fff;
    overflow-y: auto;
    position: relative;
}

.yayrev-gallery-review-content {
    padding: 32px 28px;
}

/* Review Header */
.yayrev-gallery-review-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.yayrev-gallery-review-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.yayrev-gallery-review-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.yayrev-gallery-review-author {
    font-weight: 600;
    font-size: 15px;
    color: #111;
}

.yayrev-gallery-review-date {
    font-size: 13px;
    color: #666;
}

.yayrev-gallery-review-count {
    font-size: 12px;
    color: #888;
    font-weight: 400;
}

/* Avatar wrapper for initials support */
.yayrev-gallery-review-avatar-wrap {
    flex-shrink: 0;
}

/* Rating Stars */
.yayrev-gallery-review-rating {
    display: flex;
    gap: 2px;
    margin-bottom: 12px;
}

.yayrev-gallery-review-rating .yayrev-star {
    color: #f59e0b;
}

.yayrev-gallery-review-rating .yayrev-star.empty {
    color: #d1d5db;
}

/* Custom Rating Icons */
.yayrev-gallery-review-rating .yayrev-rating-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    transition: opacity 0.15s ease;
}

.yayrev-gallery-review-rating .yayrev-rating-icon--empty {
    opacity: 0.25;
    filter: grayscale(100%);
}

.yayrev-gallery-review-rating .yayrev-rating-icon--filled {
    opacity: 1;
}

.yayrev-gallery-review-rating .yayrev-rating-label {
    margin-left: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #666;
}

/* Verified Badge */
.yayrev-gallery-review-verified {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #ecfdf5;
    color: #047857;
    font-size: 11px;
    font-weight: 500;
    border-radius: 20px;
}

.yayrev-gallery-review-verified svg {
    flex-shrink: 0;
}

/* Badges Container */
.yayrev-gallery-review-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.yayrev-gallery-review-badges:empty {
    display: none;
    margin-bottom: 0;
}

/* Pinned/Featured Badge */
.yayrev-gallery-review-pinned {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #fef3c7;
    color: #b45309;
    font-size: 11px;
    font-weight: 500;
    border-radius: 20px;
}

.yayrev-gallery-review-pinned::before {
    content: "\2605";
    font-size: 10px;
}

.yayrev-gallery-review-pinned svg {
    flex-shrink: 0;
}

/* Review Title */
.yayrev-gallery-review-title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 600;
    color: #111;
    line-height: 1.4;
}

/* Review Text */
.yayrev-gallery-review-text {
    font-size: 15px;
    line-height: 1.7;
    color: #333;
}

.yayrev-gallery-review-text p {
    margin: 0 0 1em;
}

.yayrev-gallery-review-text p:last-child {
    margin-bottom: 0;
}

/* =====================================================
   Product Media Gallery (All Customer Photos/Videos)
   ===================================================== */

.yayrev-product-media {
    margin: 2em 0;
    border-radius: 8px;
    max-width: 750px;
}

.yayrev-product-media-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1em;
    gap: 1em;
}

.yayrev-product-media-view-all {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    text-underline-offset: 3px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: underline;
}

.yayrev-product-media-view-all svg {
    transition: transform 0.2s ease;
}

.yayrev-product-media-view-all:hover svg {
    transform: translateX(2px);
}

/* Product Media Grid */
.yayrev-product-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.75em;
}

.yayrev-product-media-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #f3f4f6;
    outline: 1.5px solid #0000000f;
    transition: transform 0.2s ease, outline-color 0.2s ease;
}

.yayrev-product-media-item:hover {
    outline-color: #0000009b;
}

.yayrev-product-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Video indicator */
.yayrev-product-media-video {
    position: relative;
    width: 100%;
    height: 100%;
}

.yayrev-product-media-video img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.yayrev-product-media-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.2s ease, transform 0.2s ease;
}

.yayrev-product-media-item:hover .yayrev-product-media-play {
    background: rgba(0, 0, 0, 0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

.yayrev-product-media-play svg {
    margin-left: 3px;
}

/* More overlay */
.yayrev-product-media-more {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25em;
    font-weight: 600;
    transition: background 0.2s ease;
}

.yayrev-product-media-item:hover .yayrev-product-media-more {
    background: rgba(0, 0, 0, 0.75);
}

/* =====================================================
   Responsive - Tablet
   ===================================================== */

@media (max-width: 1024px) {
    .yayrev-gallery-container {
        width: 98%;
        height: 95vh;
    }

    .yayrev-gallery-review-panel {
        width: 320px;
    }

    .yayrev-gallery-media-content {
        padding: 50px;
    }
}

@media (max-width: 768px) {
    /* Stack layout on mobile */
    .yayrev-gallery-container {
        flex-direction: column;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }

    .yayrev-gallery-media-panel {
        flex: 0 0 55%;
    }

    .yayrev-gallery-review-panel {
        width: 100%;
        flex: 1;
        border-top: 1px solid #e5e5e5;
    }

    .yayrev-gallery-close {
        display: none;
    }

    .yayrev-gallery-close-mobile {
        display: flex;
        position: absolute;
        top: 12px;
        right: 12px;
        background: rgba(0, 0, 0, 0.1);
        color: #333;
    }

    .yayrev-gallery-close-mobile:hover {
        background: rgba(0, 0, 0, 0.15);
    }

    .yayrev-gallery-media-content {
        padding: 40px;
    }

    .yayrev-gallery-nav {
        width: 40px;
        height: 40px;
    }

    .yayrev-gallery-nav svg {
        width: 24px;
        height: 24px;
    }

    .yayrev-gallery-prev {
        left: 8px;
    }

    .yayrev-gallery-next {
        right: 8px;
    }

    .yayrev-gallery-thumb {
        width: 48px;
        height: 48px;
    }

    .yayrev-gallery-review-content {
        padding: 20px;
    }

    .yayrev-gallery-review-title {
        font-size: 16px;
    }

    .yayrev-gallery-review-text {
        font-size: 14px;
    }

    /* Product Media - Tablet */
    .yayrev-product-media {
        padding: 1.25em;
    }
}

/* =====================================================
   Responsive - Mobile
   ===================================================== */

@media (max-width: 480px) {
    .yayrev-gallery-media-panel {
        flex: 0 0 50%;
    }

    .yayrev-gallery-media-content {
        padding: 30px 16px;
    }

    .yayrev-gallery-media-footer {
        padding: 12px;
    }

    .yayrev-gallery-thumb {
        width: 40px;
        height: 40px;
    }

    .yayrev-gallery-thumb-play {
        width: 18px;
        height: 18px;
    }

    .yayrev-gallery-thumb-play svg {
        width: 8px;
        height: 8px;
    }

    .yayrev-gallery-review-content {
        padding: 16px;
    }

    .yayrev-gallery-review-avatar {
        width: 40px;
        height: 40px;
    }

    .yayrev-gallery-review-author {
        font-size: 14px;
    }

    .yayrev-gallery-review-date {
        font-size: 12px;
    }

    /* Product Media - Mobile */
    .yayrev-product-media {
        margin: 1.5em 0;
        padding: 1em;
    }

    .yayrev-product-media-header {
        flex-wrap: wrap;
    }

    .yayrev-product-media-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 0.5em;
    }

    .yayrev-product-media-play {
        width: 28px;
        height: 28px;
    }

    .yayrev-product-media-play svg {
        width: 16px;
        height: 16px;
    }
}

/* =====================================================
   Accessibility - Reduced Motion
   ===================================================== */

@media (prefers-reduced-motion: reduce) {
    .yayrev-gallery,
    .yayrev-gallery-nav,
    .yayrev-gallery-close,
    .yayrev-gallery-thumb,
    .yayrev-gallery-image,
    .yayrev-product-media-item,
    .yayrev-product-media-view-all svg {
        transition: none;
    }

    .yayrev-gallery-image-wrapper.is-loading::after {
        animation: none;
    }
}

/* =====================================================
   Grid Modal (See All Media)
   ===================================================== */

body.yayrev-grid-open {
    overflow: hidden;
}

.yayrev-grid-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.yayrev-grid-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.yayrev-grid-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
}

.yayrev-grid-modal-container {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.yayrev-grid-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.yayrev-grid-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111;
}

.yayrev-grid-modal-close {
    width: 40px;
    height: 40px;
    border: none;
    background: #f3f4f6;
    color: #374151;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    padding: 0;
}

.yayrev-grid-modal-close:hover {
    background: #e5e7eb;
}

.yayrev-grid-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.yayrev-grid-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.yayrev-grid-modal-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #f3f4f6;
    outline: 1.5px solid #0000000f;
    transition: transform 0.2s ease, outline-color 0.2s ease;
}

.yayrev-grid-modal-item:hover {
    outline-color: #0000009b;
}

.yayrev-grid-modal-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.yayrev-grid-modal-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.2s ease, transform 0.2s ease;
}

.yayrev-grid-modal-item:hover .yayrev-grid-modal-play {
    background: rgba(0, 0, 0, 0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

.yayrev-grid-modal-play svg {
    margin-left: 3px;
}

/* Grid Modal - Responsive */
@media (max-width: 768px) {
    .yayrev-grid-modal-container {
        width: 95%;
        max-height: 90vh;
    }

    .yayrev-grid-modal-header {
        padding: 16px 20px;
    }

    .yayrev-grid-modal-title {
        font-size: 16px;
    }

    .yayrev-grid-modal-body {
        padding: 16px;
    }

    .yayrev-grid-modal-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 8px;
    }

    .yayrev-grid-modal-play {
        width: 36px;
        height: 36px;
    }

    .yayrev-grid-modal-play svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .yayrev-grid-modal-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .yayrev-grid-modal-item {
        border-radius: 6px;
    }
}

/* =====================================================
   Print - Hide gallery
   ===================================================== */

@media print {
    .yayrev-gallery,
    .yayrev-grid-modal {
        display: none !important;
    }
}
