/* =========================================
   STYLE ĐỘC LẬP: LED SUN 3D VIDEO SLIDER
   Desktop First Approach
========================================= */

/* --- Swiper Container --- */
.ledsun-swiper-container {
    width: 100%;
    /*padding-top: 50px;*/
    padding-bottom: 20px;
    overflow: hidden;
    position: relative;
    /*border-bottom-left-radius: 50% 60px;*/
    /*border-bottom-right-radius: 50% 60px;*/
    /*background-color: #f7f7f7; */
}

/* Gradient Fade Trái & Phải */
.ledsun-swiper-container::before,
.ledsun-swiper-container::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 15%;
    /* Độ rộng vùng mờ */
    z-index: 20;
    pointer-events: none;
    /* Không cản tương tác chuột */
}

.ledsun-swiper-container::before {
    left: 0;
    background: linear-gradient(to right, #f7f7f7 0%, transparent 100%);
}

.ledsun-swiper-container::after {
    right: 0;
    background: linear-gradient(to left, #f7f7f7 0%, transparent 100%);
}

/* --- Container Slider (Cho phép cuộn ngang mượt) --- */
.ledsun-slider-wrapper {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 40px 50vw;
    /* Padding lớn để slide đầu và cuối có thể căn giữa màn hình */
    gap: 0;
    -webkit-overflow-scrolling: touch;
    /* Trượt mượt trên iOS */
    scrollbar-width: none;
    /* Ẩn thanh cuộn trên Firefox */
    cursor: grab;
    /* Mặc định là bàn tay mở báo hiệu cho user kéo */
    user-select: none;
    -webkit-user-select: none;
}

.ledsun-slider-wrapper:active {
    cursor: grabbing;
    /* Đổi bàn tay nắm khi kéo */
}

.ledsun-slider-wrapper::-webkit-scrollbar {
    display: none;
    /* Ẩn thanh cuộn trên Chrome/Safari */
}

/* --- Từng Slide --- */
.ledsun-video-slide {
    flex: 0 0 auto;
    width: 280px;
    height: 500px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        opacity 0.4s ease,
        box-shadow 0.4s ease,
        filter 0.4s ease;
    margin: 0 10px;
    /* Tăng khoảng cách ra, không cắn vào nhau nữa để nhìn chân thực */
    transform: scale(0.8);
    /* Các slide không active bị thu nhỏ nhiều để tôn vinh slide giữa */
    opacity: 0.35;
    /* Các slide không active mờ đi nhiều */
    filter: grayscale(70%);
    /* Khử màu slide phụ để user tập trung slide giữa */
    z-index: 1;
}

/* --- Slide đang ở giữa (Active) --- */
.ledsun-video-slide.is-active {
    transform: scale(1.05);
    /* Phóng to hẳn lên */
    opacity: 1;
    /* Sáng rõ 100% */
    filter: grayscale(0%);
    /* Trả lại màu thật */
    z-index: 10;
    /* Nổi lên trên cùng */
    box-shadow: 0 0 0 3px var(--red-brand), 0 25px 50px rgba(0, 0, 0, 0.3);
    /* Viền cam thương hiệu + Bóng đổ sâu */
}

/* Ảnh của Slide Active phải rõ 100% */
.ledsun-video-slide.is-active .ledsun-video-thumbnail {
    opacity: 1;
}

/* --- Ảnh Thumbnail --- */
.ledsun-video-thumbnail {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    /* Đảm bảo che vừa khuôn */
    object-position: center;
    /* Trọng tâm vào giữa ảnh */
    opacity: 0.5;
    /* Mờ nhẹ slide ảo */
    transition: transform 0.5s ease, opacity 0.5s ease;
    display: block;
    pointer-events: none;
    /* Để không vướng khi kéo chuột trên PC */
    background-color: #e5e5e5;
    /* Màu nền chờ phòng khi ảnh lỗi hoặc lệch */
}

/* --- Nút Play Giả --- */
.ledsun-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.6);
    z-index: 2;
    pointer-events: none;
}

.ledsun-play-button i {
    margin-left: 4px;
}

/* Hiệu ứng Pulse nhịp đập thu hút Click cho nút Play */
@keyframes ledsunPlayPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

.ledsun-video-slide.is-active .ledsun-play-button {
    animation: ledsunPlayPulse 2s infinite;
}

/* --- Hiệu ứng Hover (Chỉ áp dụng khi slide ở giữa) --- */
.ledsun-video-slide.is-active:hover .ledsun-video-thumbnail {
    transform: scale(1.05);
    /* Zoom ảnh nhẹ */
    opacity: 1;
}

.ledsun-video-slide.is-active:hover .ledsun-play-button {
    background: var(--red-brand);
    border-color: var(--red-brand);
    box-shadow: 0 0 15px rgba(193, 52, 55, 0.8);
    transform: translate(-50%, -50%) scale(1.1);
    animation: none; /* Tắt nhịp đập khi hover để người dùng tập trung click */
}

/* --- Nút Navigation (Next/Prev) Độc Lập --- */
.ledsun-swiper-container {
    position: relative;
}

.ledsun-slider-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 35px;
    /* Kéo lên gần video hơn một chút do wrapper có padding */
    position: relative;
    z-index: 50;
}

button.ledsun-nav-btn {
    all: unset !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 12px !important;
    /* Squircle hiện đại */
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    color: #333 !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
    pointer-events: auto !important;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    margin: 0 !important;
    padding: 0 !important;
    outline: none !important;
    box-sizing: border-box !important;
}

button.ledsun-nav-btn.is-disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    /* Gỡ bỏ pointer-events: none để JS có thể bắt sự kiện Click cho Toast */
}

button.ledsun-nav-btn i {
    pointer-events: none !important;
    display: block !important;
    line-height: 0 !important;
}

button.ledsun-nav-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(193, 52, 55, 0.3) !important;
    color: #ffffff !important;
    background: #C13437 !important;
    /* Màu Brand Hover */
    border-color: #C13437 !important;
}

button.ledsun-nav-btn:active {
    transform: scale(0.95) !important;
}

/* =========================================
   MODAL POPUP (PHONG CÁCH RẠP PHIM)
========================================= */

body.ledsun-modal-open {
    overflow: hidden !important;
    /* Chặn cuộn trang */
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    overscroll-behavior-x: none;
}

.ledsun-video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overscroll-behavior: none;
    overscroll-behavior-x: none;
    touch-action: none;
}

.ledsun-video-modal.active {
    visibility: visible;
    opacity: 1;
}

/* --- Lớp phủ nền Modal --- */
.ledsun-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.95);
}

/* --- Nội dung Modal (Header + Body) --- */
.ledsun-modal-content {
    position: relative;
    width: auto;
    max-width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* --- Header Modal --- */
.ledsun-modal-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 30px;
    /* Padding phù hợp 2 bên */
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    z-index: 60;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    /* Khóa click khi tàng hình */
}

#ledsun-video-modal.active .ledsun-modal-header {
    opacity: 1;
    pointer-events: auto;
}

/* Logo Nhỏ mờ */
.ledsun-modal-logo {
    display: flex;
    align-items: center;
}

.ledsun-logo-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Nút Close */
button.ledsun-modal-close {
    all: unset !important;
    position: relative !important;
    /* Đi theo Flex layout của cha */
    width: 40px !important;
    height: 40px !important;
    color: rgba(255, 255, 255, 0.6) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 36px !important;
    /* Icon bự ra xíu, mỏng */
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    z-index: 100 !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
}

button.ledsun-modal-close:hover,
button.ledsun-modal-close:focus {
    color: #C13437 !important;
    /* Brand Color Hover */
    transform: scale(1.1) rotate(90deg) !important;
    /* Hiệu ứng xoáy nhẹ hút mắt */
}

/* --- Body Modal (Chứa Video) --- */
.ledsun-modal-body {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Nút Navigation trong Modal */
button.ledsun-modal-prev-btn,
button.ledsun-modal-next-btn {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 100 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, background 0.3s, color 0.3s !important;
}

#ledsun-video-modal.active button.ledsun-modal-prev-btn,
#ledsun-video-modal.active button.ledsun-modal-next-btn {
    opacity: 1;
    visibility: visible;
}

#ledsun-video-modal.active button.ledsun-modal-prev-btn.is-disabled,
#ledsun-video-modal.active button.ledsun-modal-next-btn.is-disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    /* Gỡ bỏ pointer-events: none để bắt click hiện Toast */
}

button.ledsun-modal-prev-btn {
    left: 40px !important;
}

button.ledsun-modal-next-btn {
    right: 40px !important;
}

/* KHÓA HOVER KHIẾN NÚT NHẢY LÊN/XUỐNG CHO NÚT TRÊN MODAL */
button.ledsun-modal-prev-btn:hover:not(.is-disabled),
button.ledsun-modal-next-btn:hover:not(.is-disabled) {
    transform: translateY(-50%) !important;
    /* Cố định vị trí chiều dọc, triệt tiêu -2px của button cha */
    box-shadow: 0 8px 25px rgba(193, 52, 55, 0.3) !important;
    color: #ffffff !important;
    background: #C13437 !important;
    /* Màu Brand Hover */
    border-color: #C13437 !important;
}

/* HIỆU ỨNG HOVER BIỂU TƯỢNG X ĐỎ KHI NÚT BỊ DISABLE (UX/UI Desktop) */
button.ledsun-modal-prev-btn.is-disabled:hover,
button.ledsun-modal-next-btn.is-disabled:hover {
    color: #ff4444 !important;
    border-color: #ff4444 !important;
    background: rgba(255, 68, 68, 0.1) !important;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.4) !important;
    transform: translateY(-50%) scale(1) !important; /* Không phình to để tránh nhầm lẫn */
}

/* --- TOAST THÔNG BÁO VƯỢT QUÁ GIỚI HẠN SLIDE (DÙNG CHUNG CẢ MOBILE & DESKTOP) --- */
.ledsun-mobile-toast {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.ledsun-mobile-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* ANIMATION BOUNCE KHI LƯỚT CHẠM CẠNH (EDGE BOUNCE) */
@keyframes edgeBounceLeft {
    0% { transform: translateX(0); }
    30% { transform: translateX(30px); }
    100% { transform: translateX(0); }
}
@keyframes edgeBounceRight {
    0% { transform: translateX(0); }
    30% { transform: translateX(-30px); }
    100% { transform: translateX(0); }
}
.bounce-left {
    animation: edgeBounceLeft 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}
.bounce-right {
    animation: edgeBounceRight 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

/* --- SWIPE GUIDE (Mặc định ẩn) --- */
.ledsun-mobile-swipe-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    text-align: center;
    z-index: 200;
    pointer-events: none;
    color: #fff;
    background: rgba(0, 0, 0, 0.65);
    padding: 15px 30px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.ledsun-mobile-swipe-guide.show {
    animation: guideFadeInOut 3.5s forwards;
    display: block;
}

@keyframes guideFadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -40%);
    }

    10% {
        opacity: 1;
        transform: translate(-50%, -50%);
    }

    80% {
        opacity: 1;
        transform: translate(-50%, -50%);
    }

    100% {
        opacity: 0;
        visibility: hidden;
    }
}

.swipe-guide-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.swipe-hand {
    font-size: 36px;
    animation: swipeHandAnim 1.5s infinite ease-in-out;
    display: inline-block;
}

@keyframes swipeHandAnim {
    0% {
        transform: translateX(0) scale(1.1);
    }

    25% {
        transform: translateX(-25px) scale(1);
    }

    75% {
        transform: translateX(25px) scale(1);
    }

    100% {
        transform: translateX(0) scale(1.1);
    }
}

.swipe-arrows {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#ledsun-video-container {
    width: 400px;
    max-width: 90vw;
    height: calc(400px * 16 / 9);
    /* Duy trì tỷ lệ dọc TikTok 9:16 */
    max-height: 85vh;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background: #000;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

#ledsun-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}


/* =========================================
   RESPONSIVE (MOBILE)
========================================= */
@media (max-width: 768px) {
    .ledsun-video-slide {
        width: 240px;
        height: 426px;
        /* Giảm tỷ lệ thuận theo 9:16 approx */
    }

    .ledsun-slider-nav {
        margin-top: 20px;
    }

    button.ledsun-nav-btn {
        width: 44px !important;
        height: 44px !important;
        font-size: 18px !important;
        border-radius: 10px !important;
    }

    button.ledsun-modal-prev-btn {
        left: 10px !important;
    }

    button.ledsun-modal-next-btn {
        right: 10px !important;
    }

    /* Mặc định trên Mobile khi mở Modal, ẩn 2 nút next/prev để không che video */
    #ledsun-video-modal.active button.ledsun-modal-prev-btn,
    #ledsun-video-modal.active button.ledsun-modal-next-btn {
        opacity: 0 !important;
        visibility: hidden !important;
    }

    /* Thiết lập vị trí khởi tạo để tạo hiệu ứng translation */
    button.ledsun-modal-prev-btn {
        transform: translate(-30px, -50%) !important;
        transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s ease !important;
    }

    button.ledsun-modal-next-btn {
        transform: translate(30px, -50%) !important;
        transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s ease !important;
    }

    /* Khi tap vào màn hình để hiện nav */
    #ledsun-video-modal.active.show-mobile-nav button.ledsun-modal-prev-btn:not(.is-disabled),
    #ledsun-video-modal.active.show-mobile-nav button.ledsun-modal-next-btn:not(.is-disabled) {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translate(0, -50%) !important;
    }

    /* Nút disabled thì opacity mờ đi một chút khi hiển thị */
    #ledsun-video-modal.active.show-mobile-nav button.ledsun-modal-prev-btn.is-disabled,
    #ledsun-video-modal.active.show-mobile-nav button.ledsun-modal-next-btn.is-disabled {
        opacity: 0.3 !important;
        visibility: visible !important;
        transform: translate(0, -50%) !important;
    }

    /* Vẫn áp dụng CSS disable chung để ko click được trên Mobile (tránh lỗi ngón tay, để user lướt) */
    #ledsun-video-modal.active.show-mobile-nav button.ledsun-modal-prev-btn.is-disabled,
    #ledsun-video-modal.active.show-mobile-nav button.ledsun-modal-next-btn.is-disabled {
        pointer-events: none !important;
    }

    #ledsun-video-container {
        width: auto;
        height: 78vh; /* Fallback for older browsers */
        height: 78dvh;
        max-width: 100vw;
        aspect-ratio: 9/16;
        touch-action: none; /* Khóa thao tác vuốt lùi/tới của trình duyệt để lướt video */
    }

    /* Khi người dùng đã swipe, ẩn luôn hoàn toàn navigation buttons trên điện thoại */
    #ledsun-video-modal.has-swiped button.ledsun-modal-prev-btn,
    #ledsun-video-modal.has-swiped button.ledsun-modal-next-btn {
        display: none !important;
    }

    .ledsun-modal-header {
        padding: 15px 20px;
    }

    button.ledsun-modal-close {
        font-size: 28px !important;
        width: 30px !important;
        height: 30px !important;
    }
}

@media (max-width: 480px) {
    .ledsun-video-slide {
        width: 200px;
        height: 355px;
    }
}