/* Trang video: khung player + tiêu đề + dải video (Swiper) */

/* Khung nằm ngoài .container-fluid nên tự chừa lề 12px hai bên */
.video-section {
    width: min(1200px, calc(100% - 24px));
    margin: 8px auto 0;
    padding: 14px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    background: var(--surface-glass);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(6px);
}

.box-video-media {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 14px;
    background: #000;
}

.media-player {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

.media-player iframe,
.media-player video {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.media-player video {
    object-fit: contain;
}

.media-player-message {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 18px;
    text-align: center;
}

.box-title-cmt {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 4px;
}

.title-video-meida {
    color: var(--ink);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
}

.box-comment-video {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--brand-gradient);
    box-shadow: var(--brand-glow);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.box-comment-video:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(12, 145, 66, 0.45);
}

.icon-comment {
    display: flex;
}

.icon-comment svg {
    width: 20px;
    height: auto;
}

.icon-comment svg path {
    fill: currentColor;
}

/* Swiper 10 chỉ style class .swiper, markup dùng tên cũ .swiper-container nên tự đặt mốc định vị */
.silde-media {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

/* "center" làm danh sách dài tràn đều 2 bên và cắt video đầu; "safe center" tràn thì dồn về đầu */
.swiper-media {
    display: flex;
    justify-content: flex-start;
    justify-content: safe center;
}

/* Thumbnail: Swiper đặt width/margin inline; giá trị dưới chỉ là dự phòng khi Swiper chưa chạy */
.item-media-y {
    position: relative;
    width: calc((100% - 3 * 30px) / 4);
    margin-right: 30px;
    overflow: hidden;
    border-radius: 12px;
    background: #0b1b12;
    cursor: pointer;
}

.item-media-y img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* Video chưa phát bị phủ tối, rê chuột hoặc đang phát thì sáng lên */
.item-media-y::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgba(0, 0, 0, 0.35);
    transition: opacity 0.2s ease;
}

.item-media-y:hover::before,
.item-media-y.active_video::before {
    opacity: 0;
}

/* Viền video đang phát vẽ bằng lớp trên cùng để không bị ảnh và tiêu đề đè */
.item-media-y::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    border-radius: inherit;
    box-shadow: inset 0 0 0 3px transparent;
    pointer-events: none;
    transition: box-shadow 0.2s ease;
}

.item-media-y.active_video::after {
    box-shadow: inset 0 0 0 3px var(--accent);
}

.item-media-y .slide-title {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    /* Lề dưới dùng border: overflow cắt ở mép padding, padding-bottom sẽ để lộ dòng thứ 3 */
    padding: 18px 10px 0;
    border-bottom: 8px solid transparent;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78), transparent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

/* Nút chuyển video; Swiper tự ẩn khi đủ chỗ hiện hết (.swiper-button-lock) */
.gallery-thumbs .media-nav {
    width: 38px;
    height: 38px;
    margin-top: -19px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    color: var(--brand);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.gallery-thumbs .media-nav:hover {
    background: var(--brand);
    color: #fff;
}

.gallery-thumbs .media-nav::after {
    font-size: 15px;
    font-weight: 700;
}

.gallery-thumbs .swiper-button-prev.media-nav {
    left: 8px;
}

.gallery-thumbs .swiper-button-next.media-nav {
    right: 8px;
}

.gallery-thumbs .swiper-button-disabled.media-nav {
    opacity: 0;
}

/* Mobile: media-player.js bỏ class gallery-thumbs (danh sách dọc) nên không cần nút */
.silde-media:not(.gallery-thumbs) .media-nav {
    display: none;
}

@media (max-width: 1024px) {
    .item-media-y .slide-title {
        padding: 14px 8px 0;
        border-bottom-width: 6px;
        font-size: 13px;
    }
}

/* Mobile: dải video thành danh sách dọc, video đang phát được ẩn khỏi danh sách như bản gốc */
@media (max-width: 768px) {
    .video-section {
        padding: 10px;
        border-radius: 18px;
    }

    .box-video-media {
        border-radius: 12px;
    }

    .box-title-cmt {
        padding: 12px 2px 10px;
    }

    .title-video-meida {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        font-size: 17px;
    }

    .swiper-media {
        flex-direction: column;
        gap: 8px;
        max-height: 460px;
        overflow-y: auto;
    }

    .item-media-y {
        display: flex;
        flex-shrink: 0;
        align-items: center;
        gap: 12px;
        width: 100%;
        margin-right: 0;
        padding: 6px;
        background: transparent;
    }

    .item-media-y:hover {
        background: rgba(12, 145, 66, 0.08);
    }

    .item-media-y::before,
    .item-media-y::after {
        content: none;
    }

    .item-media-y img {
        flex: 0 0 44%;
        width: 44%;
        border-radius: 10px;
    }

    .item-media-y .slide-title {
        position: static;
        flex: 1 1 auto;
        padding: 0;
        border: 0;
        background: none;
        color: var(--ink);
        font-size: 14px;
        -webkit-line-clamp: 3;
    }

    .item-media-y.active_video {
        display: none;
    }
}

@media (max-width: 576px) {
    .text-comment-title {
        display: none;
    }

    .box-comment-video {
        padding: 9px;
    }
}
