.testimonial-loop-wrapper {
    width: 100%;
    position: relative;
}

.testimonial-loop-container {
    display: flex;
    flex-direction: column;
    gap: 120px; /* Space between testimonial rows on desktop */
    width: 100%;
}

.testimonial-item {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
    box-sizing: border-box;
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Smooth entrance state for AJAX loaded items */
.testimonial-item.is-entering {
    opacity: 0;
    transform: translateY(25px);
}

/* Mobile Specific Refinements: Distinction between items and visual nesting */
@media (max-width: 767px) {
    .testimonial-loop-container {
        gap: 60px; /* Cleaner spacing between rows on mobile */
    }

    .testimonial-item {
        gap: 24px;
        padding-bottom: 50px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08); /* Subtle divider between testimonials */
    }

    .testimonial-item:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    /* Narrow down the text slightly on mobile so it nests cleanly under the video */
    .testimonial-content-col {
        width: 100%;
        max-width: 90%;
        margin: 0 auto;
        padding: 0 10px;
    }

    .testimonial-item.testimonial-item--text-only .testimonial-content-col {
        max-width: 90%;
    }
}

/* Tablet & Desktop Layout */
@media (min-width: 768px) {
    .testimonial-item {
        flex-direction: row;
        align-items: center;
        gap: 30px; /* 30px space between testimonial-item children */
    }
    
    /* Alternating logic: Even items will have the image on the right */
    .testimonial-item:nth-child(even) {
        flex-direction: row-reverse;
    }
    
    .testimonial-media-col,
    .testimonial-content-col {
        flex: 1;
        width: calc(50% - 15px);
        padding: 0 15px; /* Column paddings */
    }
}

/* Text-Only Testimonial (no video / media): Centered with ~50% width */
.testimonial-item.testimonial-item--text-only {
    justify-content: center !important;
    flex-direction: row !important;
}

@media (min-width: 768px) {
    .testimonial-item.testimonial-item--text-only .testimonial-content-col {
        width: 50%;
        max-width: 50%;
        flex: 0 0 50%;
        margin: 0 auto;
    }
}

/* Media Column (Image/Thumbnail) */
.testimonial-media-col {
    position: relative;
}

/* Thumbnail Wrapper with 40px border-radius */
.testimonial-thumbnail-wrapper {
    position: relative;
    border-radius: 40px;
    overflow: hidden; /* Clips iframe, overlay, and thumbnail */
    aspect-ratio: 16 / 9;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transform: translateZ(0); /* Prevents Safari border-radius clipping glitches */
}

.testimonial-thumbnail-wrapper[data-yt-id] {
    cursor: pointer;
}

.testimonial-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    aspect-ratio: 16 / 9;
    border-radius: 40px;
}

.testimonial-thumbnail-wrapper .testimonial-img {
    box-shadow: none;
    height: 100%;
}

/* Content Column (Text & Quote) */
.testimonial-content-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.testimonial-quote-icon {
    width: 35px;
    height: 35px;
    margin-bottom: 20px;
    text-align: center;
    color: #333; /* Default quote icon color */
}

.testimonial-quote-icon svg {
    fill: currentColor;
    width: 100%;
    height: 100%;
}

.testimonial-quote-text {
    font-size: 21px;
    font-style: italic;
    color: #333; /* Text color matching your design */
    margin-bottom: 20px;
    line-height: 1.6;
}

.testimonial-quote-text p {
    margin: 0 0 10px 0;
}
.testimonial-quote-text p:last-child {
    margin-bottom: 0;
}

.testimonial-client-name {
    text-align: right;
    font-style: italic;
    font-weight: bold;
    font-size: 1.1em;
    margin: 0;
    color: #333;
}

/* YouTube Overlay & Play Button Logic */
.testimonial-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 48px;
    color: #212121; /* Dark Youtube button color */
    opacity: 0.8;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 1, 1), color 0.2s cubic-bezier(0.4, 0, 1, 1);
    z-index: 2;
}

.testimonial-thumbnail-wrapper[data-yt-id]:hover .testimonial-play-button {
    color: #ff0000; /* YouTube Red on hover */
    opacity: 1;
}

.testimonial-iframe-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    border-radius: 40px;
    overflow: hidden;
}

.testimonial-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 40px;
}

/* Force SVG visibility in case of Elementor conflicts */
.testimonial-play-button svg {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: 100% !important;
}
.testimonial-play-button svg path:first-child {
    fill: currentColor !important;
}

/* Load More Button Wrapper & Button (High Specificity to override theme/Elementor button resets) */
.testimonial-load-more-wrapper {
    display: flex !important;
    justify-content: center !important;
    margin-top: 60px !important;
    width: 100% !important;
}

html body .testimonial-load-more-wrapper button.testimonial-load-more-btn,
html body .testimonial-load-more-wrapper [type="button"].testimonial-load-more-btn,
.testimonial-load-more-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 56px !important;
    line-height: 56px !important;
    min-width: 260px !important;
    padding: 0 45px !important;
    background-color: var(--e-global-color-primary, #63873b) !important;
    background: var(--e-global-color-primary, #63873b) !important;
    color: #ffffff !important;
    border: none !important;
    border-width: 0 !important;
    border-style: none !important;
    border-color: transparent !important;
    border-radius: 100px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    letter-spacing: 1.5px !important;
    text-transform: uppercase !important;
    cursor: pointer !important;
    text-align: center !important;
    text-decoration: none !important;
    box-shadow: none !important;
    outline: none !important;
    transition: background-color 0.25s ease, opacity 0.25s ease !important;
}

html body .testimonial-load-more-wrapper button.testimonial-load-more-btn:hover,
html body .testimonial-load-more-wrapper [type="button"].testimonial-load-more-btn:hover,
.testimonial-load-more-btn:hover {
    background-color: var(--e-global-color-text, #043140) !important;
    background: var(--e-global-color-text, #043140) !important;
    color: #ffffff !important;
    border: none !important;
    border-width: 0 !important;
    border-radius: 100px !important;
    box-shadow: none !important;
    outline: none !important;
}

html body .testimonial-load-more-wrapper button.testimonial-load-more-btn:active,
html body .testimonial-load-more-wrapper [type="button"].testimonial-load-more-btn:active,
.testimonial-load-more-btn:active {
    background-color: var(--e-global-color-text, #043140) !important;
    background: var(--e-global-color-text, #043140) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 100px !important;
}

html body .testimonial-load-more-wrapper button.testimonial-load-more-btn:focus,
html body .testimonial-load-more-wrapper [type="button"].testimonial-load-more-btn:focus,
.testimonial-load-more-btn:focus {
    color: #ffffff !important;
    outline: none !important;
    border: none !important;
}

.testimonial-load-more-btn.is-loading {
    opacity: 0.75 !important;
    cursor: wait !important;
    pointer-events: none !important;
}
