/* 
 * Video Testimonials Masonry - Premium Styling
 */

.ri-masonry-container {
    padding: 20px 0;
    width: 100%;
    margin: 0 auto;
}

.ri-masonry-grid {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

/* Items Container */
.ri-masonry-items {
    width: 100%;
    position: relative;
}

/* Masonry Item */
.ri-masonry-item {
    width: 100%;
    margin-bottom: var(--ri-gutter, 20px);
    box-sizing: border-box;
    display: block;
    float: left;
}

/* Card Styling */
.ri-masonry-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    background: #111;
}

.ri-masonry-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    z-index: 5;
}

/* Video Wrapper */
.ri-video-wrapper {
    position: relative;
    line-height: 0;
    width: 100%;
    height: auto;
}

.ri-hover-video {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.ri-external-thumb {
    width: 100%;
    aspect-ratio: 9/16;
    /* Default vertical look */
    background-size: cover;
    background-position: center;
}

/* Card Overlay */
.ri-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 40%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 25px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.ri-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    transition: all 0.3s ease;
}

.ri-masonry-card:hover .ri-play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.ri-card-info {
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

.ri-masonry-card:hover .ri-card-info {
    transform: translateY(0);
}

.ri-masonry-tag {
    display: inline-block;
    background: #fed800ad;
    backdrop-filter: blur(5px);
    padding: 12px 12px;
    border-radius: 50px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 10px 0;
}

.ri-masonry-card-name {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

/* Modal Styling */
.ri-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(15px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    animation: fadeIn 0.4s ease;
}

.ri-modal-content {
    background: #1a1a1a;
    width: 100%;
    max-width: 1000px;
    height: 80vh;
    border-radius: 30px;
    overflow: hidden;
    position: relative;
    display: flex;
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ri-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 100;
}

.ri-modal-body {
    display: flex;
    width: 100%;
}

.ri-modal-video-container {
    flex: 1.5;
    background: black;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ri-modal-video-container video,
.ri-modal-video-container iframe {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ri-modal-details {
    flex: 1;
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: white;
}

.ri-modal-name {
    font-size: 32px;
    margin-bottom: 10px;
}

.ri-modal-tag {
    opacity: 0.6;
    margin-bottom: 25px;
    display: block;
}

.ri-modal-text {
    font-size: 18px;
    line-height: 1.6;
    opacity: 0.9;
}

/* Filters */
.ri-masonry-filters {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.ri-filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px 25px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.ri-filter-btn:hover,
.ri-filter-btn.active {
    background: white;
    color: black;
    transform: translateY(-2px);
}

/* Stars */
.ri-card-rating,
.ri-modal-rating {
    margin-bottom: 5px;
    display: flex;
    gap: 2px;
}

.ri-star {
    font-size: 14px;
    color: #ffd700;
}

.ri-star.empty {
    color: rgba(255, 255, 255, 0.2);
}

.ri-modal-rating .ri-star {
    font-size: 20px;
}

.ri-masonry-grid {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

/* Items Container */
.ri-masonry-items {
    width: 100%;
    position: relative;
    /* Required for Masonry absolute positioning */
}

/* Masonry Item */
.ri-masonry-item {
    width: 100%;
    margin-bottom: var(--ri-gutter, 20px);
    box-sizing: border-box;
    display: block;
    float: left;
}

/* Specific Widths (Desktop) - High Precision calc() */
.ri-masonry-cols-1 .ri-masonry-item { width: 100% !important; }
.ri-masonry-cols-2 .ri-masonry-item { width: calc(50% - (var(--ri-gutter, 20px) * 1 / 2)) !important; }
.ri-masonry-cols-3 .ri-masonry-item { width: calc(33.333% - (var(--ri-gutter, 20px) * 2 / 3)) !important; }
.ri-masonry-cols-4 .ri-masonry-item { width: calc(25% - (var(--ri-gutter, 20px) * 3 / 4)) !important; }
.ri-masonry-cols-5 .ri-masonry-item { width: calc(20% - (var(--ri-gutter, 20px) * 4 / 5)) !important; }

/* Tablet Overrides */
@media (max-width: 1024px) {
    .ri-masonry-cols-tablet-1 .ri-masonry-item { width: 100% !important; }
    .ri-masonry-cols-tablet-2 .ri-masonry-item { width: calc(50% - (var(--ri-gutter, 20px) * 1 / 2)) !important; }
    .ri-masonry-cols-tablet-3 .ri-masonry-item { width: calc(33.333% - (var(--ri-gutter, 20px) * 2 / 3)) !important; }
    .ri-masonry-cols-tablet-4 .ri-masonry-item { width: calc(25% - (var(--ri-gutter, 20px) * 3 / 4)) !important; }
    .ri-masonry-cols-tablet-5 .ri-masonry-item { width: calc(20% - (var(--ri-gutter, 20px) * 4 / 5)) !important; }
}

/* Mobile Overrides */
@media (max-width: 767px) {
    .ri-masonry-cols-mobile-1 .ri-masonry-item { width: 100% !important; }
    .ri-masonry-cols-mobile-2 .ri-masonry-item { width: calc(50% - (var(--ri-gutter, 20px) * 1 / 2)) !important; }
    .ri-masonry-cols-mobile-3 .ri-masonry-item { width: calc(33.333% - (var(--ri-gutter, 20px) * 2 / 3)) !important; }
    .ri-masonry-cols-mobile-4 .ri-masonry-item { width: calc(25% - (var(--ri-gutter, 20px) * 3 / 4)) !important; }
    .ri-masonry-cols-mobile-5 .ri-masonry-item { width: calc(20% - (var(--ri-gutter, 20px) * 4 / 5)) !important; }
}

/* Gutter Sizer */
.ri-gutter-sizer {
    width: var(--ri-gutter, 20px);
}



/* Video Wrapper (Pinterest Style - Variable Height) */
.ri-video-wrapper {
    position: relative;
    width: 100%;
    /* aspect-ratio removed here - controlled by Elementor if fixed, otherwise 'auto' */
    background: #000;
    overflow: hidden;
    cursor: pointer;
}

.ri-video-wrapper video,
.ri-video-wrapper .ri-external-thumb {
    width: 100%;
    height: auto;
    min-height: 150px;
    display: block;
    object-fit: cover;
}

/* Container Logic */
.ri-masonry-grid {
    width: 100%;
    margin: 0 auto;
    position: relative;
    overflow: visible;
    /* Masonry needs visibility for absolute items */
}

.ri-masonry-items {
    width: 100% !important;
    position: relative;
    clear: both;
}

.ri-masonry-items::after {
    content: "";
    display: table;
    clear: both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .ri-modal-content {
        flex-direction: column;
        height: auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    .ri-modal-body {
        flex-direction: column;
    }

    .ri-modal-video-container {
        aspect-ratio: 16/9;
    }

    .ri-modal-overlay {
        padding: 20px;
    }
}