/* =========================
   Carousel Container
========================= */
.cvs-carousel-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 40px 0;
    padding: 0 20px;
    box-sizing: border-box;
}

/* =========================
   Carousel Wrapper
========================= */
.cvs-carousel {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    min-height: 200px;
    box-sizing: border-box;
}

/* =========================
   Individual Slide
========================= */
.cvs-item {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.5s ease;
    background: #000;
    pointer-events: none;
    cursor: default;
}

/* Only the active/centered item should be clickable */
.cvs-item.active {
    pointer-events: auto;
    cursor: pointer;
}

.cvs-item.active .cvs-video-link {
    cursor: pointer;
}

/* =========================
   Anchor inside slide
========================= */
.cvs-item a {
    position: relative; /* important for play button */
    display: block;
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
}

/* =========================
   Thumbnail Image
========================= */
.cvs-item img {
    position: relative; /* make it positioned for z-index stacking */
    width: 100%;
    height: auto;
    display: block;
    z-index: 1; /* below play button */
    border-radius: 20px;
}

/* =========================
   Play Button
========================= */
.cvs-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10; /* above image */
}

/* Play button size */
.cvs-play-btn img {
    width: 64px;
    height: 64px;
}

/* Optional hover scale */
.cvs-item:hover .cvs-play-btn img {
    transform: scale(1.08);
    transition: transform 0.3s ease;
}

/* =========================
   Controls
========================= */
.cvs-controls {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 25px;
}

.cvs-btn {
    width: 50px;
    height: 50px;
    background: #f3dbc9;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
}

.cvs-btn:hover {
    background: #e8c9b0;
    transition: background 0.3s ease;
}

/* =========================
   Modal Styles
========================= */
.cvs-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    visibility: hidden;
}

.cvs-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
}

.cvs-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.cvs-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    z-index: 10000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.cvs-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.2s ease;
    opacity: 0;
    pointer-events: none;
}

.cvs-modal.active .cvs-modal-close {
    opacity: 1;
    pointer-events: auto;
}

.cvs-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.cvs-modal-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.cvs-modal-video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.cvs-modal-video-container iframe,
.cvs-modal-video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* =========================
   Responsive Styles
========================= */

/* Tablet and below */
@media (max-width: 768px) {
    .cvs-carousel-container {
        margin: 30px 0;
        padding: 0 15px;
    }

    .cvs-carousel {
        min-height: 150px;
    }

    .cvs-item {
        border-radius: 20px;
    }

    .cvs-item a {
        border-radius: 20px;
    }

    .cvs-item img {
        border-radius: 20px;
    }

    .cvs-play-btn img {
        width: 48px;
        height: 48px;
    }

    .cvs-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }

    .cvs-controls {
        gap: 20px;
        margin-top: 20px;
    }

    .cvs-modal-content {
        width: 95%;
        max-height: 85vh;
        border-radius: 8px;
    }

    .cvs-modal-close {
        width: 35px;
        height: 35px;
        font-size: 24px;
        top: 10px;
        right: 10px;
    }

    .cvs-modal-video-wrapper {
        padding-bottom: 56.25%;
    }
}

/* Mobile devices */
@media (max-width: 480px) {
    .cvs-carousel-container {
        margin: 20px 0;
        padding: 0 10px;
    }

    .cvs-carousel {
        min-height: 120px;
    }

    .cvs-item {
        border-radius: 20px;
    }

    .cvs-item a {
        border-radius: 20px;
    }

    .cvs-item img {
        border-radius: 20px;
    }

    .cvs-play-btn img {
        width: 40px;
        height: 40px;
    }

    .cvs-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .cvs-controls {
        gap: 15px;
        margin-top: 20px;
    }

    .cvs-modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
    }

    .cvs-modal-video-wrapper {
        height: 100%;
        padding-bottom: 0;
    }

    .cvs-modal-video-container {
        height: 100%;
    }

    .cvs-modal-close {
        width: 32px;
        height: 32px;
        font-size: 22px;
        top: 8px;
        right: 8px;
        background: rgba(255, 255, 255, 0.25);
    }
}

/* Very small mobile devices */
@media (max-width: 360px) {
    .cvs-carousel-container {
        padding: 0 8px;
    }

    .cvs-carousel {
        min-height: 100px;
    }

    .cvs-item {
        border-radius: 20px;
    }

    .cvs-item a {
        border-radius: 20px;
    }

    .cvs-item img {
        border-radius: 20px;
    }

    .cvs-play-btn img {
        width: 36px;
        height: 36px;
    }

    .cvs-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

/* Large screens - ensure carousel doesn't get too wide */
@media (min-width: 1400px) {
    .cvs-carousel-container {
        max-width: 1400px;
        margin-left: auto;
        margin-right: auto;
        padding: 0 20px;
    }
}

/* Extra large screens */
@media (min-width: 1920px) {
    .cvs-carousel-container {
        max-width: 1600px;
    }
}

/* Medium screens - tablets in landscape */
@media (min-width: 769px) and (max-width: 1024px) {
    .cvs-carousel-container {
        padding: 0 20px;
    }
}

/* Ensure images maintain aspect ratio and border-radius on all devices */
.cvs-item img {
    max-width: 100%;
    object-fit: cover;
}

/* Prevent image overflow on small screens */
@media (max-width: 480px) {
    .cvs-item {
        max-width: 100%;
    }
    
    .cvs-item img {
        max-width: 100%;
        height: auto;
    }
}