/**
 * ISSCA YouTube Grid - Styles
 *
 * @package ISSCA_YouTube_Grid
 * @since 2.0.0
 */

/* Container Styles */
.ISSCA-homepage-courses-container {
    width: 100%;
    max-width: 1920px;
}

/* YouTube Play Overlay */
.youtube-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.9;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 2;
    width: 80px;
    height: 56px;
}

.ISSCA-homepage-course-card:hover .youtube-play-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15);
}

/* Remove margin-top from section */
.ISSCA-homepage-courses-section {
    margin-top: 0 !important;
}

/* Desktop and Mobile View Control */
.ISSCA-homepage-desktop-view {
    display: block;
}

.ISSCA-homepage-mobile-view {
    display: none;
}

@media (max-width: 768px) {
    .ISSCA-homepage-desktop-view {
        display: none;
    }

    .ISSCA-homepage-mobile-view {
        display: block;
    }
}

/* Larger Thumbnails and Better Spacing */
.ISSCA-homepage-course-grid {
    display: block;
}

.ISSCA-homepage-course-card {
    margin-bottom: 20px;
    padding-right: 0;
}

.ISSCA-homepage-course-image {
    margin-bottom: 8px !important;
    border-radius: 8px;
    overflow: hidden;
}

.ISSCA-homepage-image-wrapper {
    padding-bottom: 56.25% !important; /* 16:9 aspect ratio */
    background-size: cover !important;
    background-position: center !important;
    position: relative;
}

.ISSCA-homepage-course-info {
    padding-top: 8px !important;
    margin-top: 0 !important;
}

.ISSCA-homepage-instructor-name {
    font-size: 16px !important;
    line-height: 1.4 !important;
    margin-bottom: 4px !important;
    display: block;
    font-weight: 600 !important;
}

.ISSCA-homepage-course-category {
    margin-top: 4px !important;
    font-size: 14px !important;
    opacity: 0.7;
}

/* Desktop Carousel Styles for Interviews and Highlights */
@media (min-width: 769px) {
    .ISSCA-homepage-course-section .ISSCA-homepage-course-grid {
        display: flex !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-behavior: smooth;
        gap: 20px;
        padding-bottom: 20px;
        padding-top: 5px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        scrollbar-color: rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.1);
        scroll-snap-type: x proximity;
        position: relative;
    }

    .ISSCA-homepage-course-section
        .ISSCA-homepage-course-grid::-webkit-scrollbar {
        height: 0px;
        display: none;
    }

    .ISSCA-homepage-course-section
        .ISSCA-homepage-course-grid::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.05);
        border-radius: 10px;
        margin: 0 10px;
    }

    .ISSCA-homepage-course-section
        .ISSCA-homepage-course-grid::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 10px;
        transition: background 0.3s ease;
    }

    .ISSCA-homepage-course-section
        .ISSCA-homepage-course-grid::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.4);
    }

    .ISSCA-homepage-course-section .ISSCA-homepage-course-card {
        flex: 0 0 380px !important;
        min-width: 380px !important;
        max-width: 380px !important;
        scroll-snap-align: start;
        transition:
            transform 0.3s ease,
            box-shadow 0.3s ease;
    }

    .ISSCA-homepage-course-section .ISSCA-homepage-course-card:hover {
        transform: translateY(-5px);
    }

    .ISSCA-homepage-course-section .ISSCA-homepage-section-title {
        margin-bottom: 20px;
        position: relative;
    }

    /* Fade effect on carousel edges */
    .ISSCA-homepage-course-section {
        position: relative;
    }

    .ISSCA-homepage-course-section::after {
        content: "";
        position: absolute;
        top: 0;
        right: 0;
        bottom: 20px;
        width: 80px;
        background: linear-gradient(to left, white, transparent);
        pointer-events: none;
        z-index: 1;
    }
}

/* YouTube Modal Styles */
.youtube-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.youtube-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.youtube-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    cursor: pointer;
}

.youtube-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    z-index: 1000000;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.youtube-modal-close {
    position: absolute;
    top: -45px;
    right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
    opacity: 0.8;
}

.youtube-modal-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

.youtube-modal-video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.youtube-modal-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .youtube-modal-content {
        width: 95%;
    }

    .youtube-modal-close {
        top: -40px;
        font-size: 35px;
    }

    /* Mobile heading and CTA section */
    .ISSCA-homepage-mobile-intro {
        margin-bottom: 30px;
        text-align: center;
        padding: 0 20px;
    }

    .ISSCA-homepage-mobile-intro .ISSCA-homepage-main-heading {
        margin-bottom: 1.5rem;
    }

    /* Ensure 16:9 ratio on mobile without min-height constraint */
    .ISSCA-homepage-image-wrapper {
        min-height: 0 !important;
    }

    .ISSCA-homepage-mobile-intro .ISSCA-homepage-cta-buttons {
        margin-top: 20px;
    }

    /* Mobile button - removed custom styles to inherit from theme */
}

/* Prevent body scroll when modal is open */
body.youtube-modal-open {
    overflow: hidden;
}
