/**
 * Video Testimonials Widget Styles
 */

/* Wrapper */
.vtw-wrapper {
    position: relative;
    width: 100%;
}

/* Cards Container */
.vtw-cards-container {
    display: grid;
    margin: 0 auto;
}

/* Card */
.vtw-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.vtw-card:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Media Container */
.vtw-card__media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.vtw-card__img,
.vtw-card__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transition: opacity 0.3s ease;
}

/* Override Elementor default image styles */
.elementor-widget-csw_video_testimonials .vtw-card__img,
.vtw-wrapper .vtw-card__img {
    height: 100% !important;
    max-width: none !important;
    border-radius: 0 !important;
}

.vtw-card__img {
    opacity: 1;
    z-index: 1;
}

.vtw-card__video {
    opacity: 0;
    z-index: 2;
}

/* Hover states - only on devices that support hover */
@media (hover: hover) and (pointer: fine) {
    .vtw-card:hover .vtw-card__img {
        opacity: 0;
    }

    .vtw-card:hover .vtw-card__video {
        opacity: 1;
    }
}

/* Card Info */
.vtw-card__info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 20px;
    z-index: 2;
}

.vtw-card__quote {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 12px 0;
}

.vtw-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

/* Play Button */
.vtw-card__play {
    position: absolute;
    bottom: 24px;
    right: 20px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: background 0.2s ease, transform 0.2s ease;
}

.vtw-card__play svg {
    width: 12px;
    height: 12px;
    fill: #fff;
    margin-left: 2px;
}

.vtw-card:hover .vtw-card__play {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Modal */
.vtw-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 99999;
    padding: 20px;
}

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

.vtw-modal__content {
    position: relative;
    width: 100%;
    max-width: 900px;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.vtw-modal__video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.vtw-modal__close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.vtw-modal__close:hover {
    transform: scale(1.1);
}

.vtw-modal__close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.vtw-modal__close svg {
    width: 20px;
    height: 20px;
}

/* Mobile adjustments */
@media (max-width: 767px) {
    .vtw-card__info {
        padding: 16px;
    }

    .vtw-card__quote {
        font-size: 1rem;
    }

    .vtw-card__meta {
        font-size: 0.75rem;
    }

    .vtw-card__play {
        bottom: 16px;
        right: 16px;
        width: 32px;
        height: 32px;
    }

    .vtw-card__play svg {
        width: 10px;
        height: 10px;
    }

    .vtw-modal__content {
        border-radius: 8px;
    }

    .vtw-modal__close {
        top: -45px;
        width: 36px;
        height: 36px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .vtw-card,
    .vtw-card__img,
    .vtw-card__video,
    .vtw-card__play,
    .vtw-modal,
    .vtw-modal__close {
        transition: none;
    }
}

/* Loading state for videos */
.vtw-card__video[data-loading="true"] {
    opacity: 0;
}

/* Fallback for aspect-ratio */
@supports not (aspect-ratio: 3 / 4) {
    .vtw-card {
        padding-bottom: 133.33%; /* 4:3 fallback */
        height: 0;
    }
}
