/* ============================================
   Video Testimonials Styles
   ============================================ */

/* Video Wrapper */
.video-wrapper {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    /* Prevent layout shift */
    contain: layout;
}

/* Video Thumbnail */
.video-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 127%; /* 283/360 aspect ratio for vertical videos */
    cursor: pointer;
    overflow: hidden;
    background: #000;
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-thumbnail:hover img {
    transform: scale(1.05);
}

/* Play Button */
.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    transition: all 0.3s ease;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.video-thumbnail:hover .play-button {
    transform: translate(-50%, -50%) scale(1.1);
}

.play-button svg {
    display: block;
}

/* Video Duration Badge */
.video-duration {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
}

/* Loading Overlay */
.video-thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.4));
    z-index: 1;
    transition: opacity 0.3s ease;
}

.video-thumbnail:hover::before {
    opacity: 0.7;
}

/* Responsive Iframe Container */
.video-iframe-container {
    width: 100%;
}

.responsive-iframe {
    position: relative;
    width: 100%;
    padding-bottom: 127%; /* 283/360 aspect ratio for vertical videos */
    height: 0;
    overflow: hidden;
}

.responsive-iframe iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* Loading Spinner */
.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.video-loading::after {
    content: '';
    display: block;
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error State */
.video-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #fff;
    padding: 20px;
    z-index: 2;
}

.video-error svg {
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
    opacity: 0.7;
}

.video-error p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .play-button svg {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 768px) {
    .play-button svg {
        width: 60px;
        height: 60px;
    }

    .video-duration {
        font-size: 11px;
        padding: 3px 6px;
        bottom: 8px;
        right: 8px;
    }
}

@media (max-width: 480px) {
    .play-button svg {
        width: 50px;
        height: 50px;
    }

    .video-duration {
        font-size: 10px;
        padding: 2px 5px;
        bottom: 6px;
        right: 6px;
    }
}

/* Carousel Adjustments */
.project-block-one .inner-box {
    margin-bottom: 0;
}

.project-block-one .image {
    margin-bottom: 0;
}

/* Smooth Transitions */
.video-wrapper * {
    transition: all 0.3s ease;
}

/* Prevent scroll behavior */
html.video-playing {
    scroll-behavior: auto !important;
}

/* Ensure carousel doesn't cause scroll */
.project-section {
    overflow: hidden;
}

.five-item-carousel {
    overflow: visible;
}

/* ============================================
   Video Modal Popup Styles
   ============================================ */

/* Modal Z-Index */
#videoModal {
    z-index: 10000 !important;
}

/* Modal Dialog */
#videoModal .modal-dialog {
    max-width: 900px;
    margin: 30px auto;
    position: relative;
}

/* Modal Content */
.video-modal-content {
    background: #000;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Modal Header */
.video-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px 12px 0 0;
}

/* Close Button - inside header */
.video-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    flex-shrink: 0;
    margin-left: 15px;
}

.video-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.video-modal-close:focus {
    outline: none;
}

.video-modal-close svg {
    display: block;
    pointer-events: none;
}

/* Modal Body */
.video-modal-body {
    padding: 0;
    background: #000;
}

/* Video Title - inside header */
.video-modal-title {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

/* Responsive Video Container */
.responsive-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    background: #000;
}

.responsive-video-container iframe {
    position: absolute;
    top: -60px; /* Hide YouTube top bar */
    left: 0;
    width: 100%;
    height: calc(100% + 120px); /* Compensate for top/bottom offset */
    border: none;
    display: none; /* Hidden initially, shown after load */
    pointer-events: auto;
}

/* Overlay to block "More videos" suggestions on pause */
.responsive-video-container::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40%;
    height: 100%;
    background: transparent;
    pointer-events: none;
    z-index: 10;
}

/* Loading State */
.responsive-video-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Modal Backdrop */
#videoModal .modal-backdrop {
    background-color: rgba(0, 0, 0, 0.85);
}

/* Modal Animation */
#videoModal.fade .modal-dialog {
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.3s ease;
}

#videoModal.show .modal-dialog {
    transform: scale(1);
    opacity: 1;
}

/* Responsive Modal */
@media (max-width: 992px) {
    #videoModal .modal-dialog {
        max-width: 90%;
        margin: 20px auto;
    }

    .video-modal-title {
        font-size: 16px;
        padding: 16px 20px;
    }
}

@media (max-width: 768px) {
    #videoModal .modal-dialog {
        max-width: 95%;
        margin: 15px auto;
    }

    .video-modal-header {
        padding: 12px 16px;
    }

    .video-modal-close {
        width: 30px;
        height: 30px;
    }

    .video-modal-close svg {
        width: 20px;
        height: 20px;
    }

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

@media (max-width: 480px) {
    #videoModal .modal-dialog {
        max-width: 100%;
        margin: 10px;
    }

    .video-modal-header {
        padding: 10px 14px;
    }

    .video-modal-close {
        width: 28px;
        height: 28px;
    }

    .video-modal-close svg {
        width: 18px;
        height: 18px;
    }

    .video-modal-title {
        font-size: 14px;
    }
}

