/**
 * Stylesheet cho Frontend - Plugin Video Dạy Học
 * Phối màu theo tông chủ đề "Hồng Anh" (Hồng/Rose & Cam đào ấm áp)
 * Thiết kế Glassmorphism hiện đại, responsive hoàn hảo và trực quan trên di động
 */

:root {
    --vdh-primary: #db2777; /* Hồng đậm chủ đề Hồng Anh */
    --vdh-primary-hover: #be185d;
    --vdh-secondary: #fb7185; /* Hồng đào ấm áp */
    --vdh-secondary-hover: #f43f5e;
    --vdh-youtube: #ff0000;
    --vdh-youtube-hover: #cc0000;
    --vdh-card-bg: rgba(255, 255, 255, 0.9); /* Nền các box con màu trắng đục rõ ràng */
    --vdh-card-border: rgba(219, 39, 119, 0.12); /* Viền hồng mảnh tinh tế */
    --vdh-text-color: #0f172a; /* Slate 900 - Chữ đen rõ nét */
    --vdh-text-muted: #334155; /* Slate 700 - Chữ sẫm rõ ràng */
    --vdh-shadow: 0 8px 30px 0 rgba(0, 0, 0, 0.05); /* Shadow nhẹ tự nhiên */
    --vdh-radius: 16px;
    --vdh-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Container chính trong suốt, tiệp vào nền trang web, chiều rộng tối đa 1150px trên Desktop */
.vdh-container {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--vdh-text-color);
    background: transparent; /* Loại bỏ hoàn toàn nền background */
    border: none; /* Loại bỏ viền ngoài */
    box-shadow: none; /* Loại bỏ shadow ngoài */
    backdrop-filter: none; /* Loại bỏ filter mờ */
    -webkit-backdrop-filter: none;
    max-width: 1150px; /* Thiết lập chiều rộng tối đa 1150px trên Desktop */
    margin: 20px auto;
    padding: 0; /* Mặc định trên desktop không padding ngoài */
    box-sizing: border-box;
}

.vdh-container * {
    box-sizing: border-box;
}

/* Bố cục chính Grid */
.vdh-main-layout {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
}

/* Phần trình phát video */
.vdh-player-section {
    display: flex;
    flex-direction: column;
}

.vdh-player-wrapper {
    background: #000;
    border-radius: var(--vdh-radius);
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    transition: var(--vdh-transition);
    width: 100%;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Tối ưu tỉ lệ co giãn responsive cho Video 16:9 */
.vdh-player-wrapper.vdh-view-video {
    aspect-ratio: 16/9;
}

/* Tối ưu tỉ lệ co giãn responsive cho Short 9:16 */
.vdh-player-wrapper.vdh-view-short {
    max-width: 320px;
    width: 100%;
    aspect-ratio: 9/16;
    margin-left: auto;
    margin-right: auto;
    border: 8px solid #2d3748; /* Viền điện thoại giả lập */
    border-radius: 36px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    position: relative;
}

.vdh-player-wrapper.vdh-view-short::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 12px;
    background: #2d3748;
    border-radius: 10px;
    z-index: 10;
}

.vdh-iframe-container {
    width: 100%;
    height: 100%;
}

.vdh-iframe-container iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: none;
}

.vdh-player-wrapper.vdh-view-short .vdh-iframe-container iframe {
    border-radius: 26px;
}

/* Thanh Meta thông tin Video */
.vdh-video-meta {
    background: var(--vdh-card-bg);
    border: 1px solid var(--vdh-card-border);
    border-radius: var(--vdh-radius);
    padding: 20px;
    box-shadow: var(--vdh-shadow);
}

.vdh-video-title {
    font-size: 1.4rem;
    margin: 0 0 10px 0;
    color: var(--vdh-text-color);
    font-weight: 700;
    line-height: 1.3;
}

.vdh-video-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--vdh-text-muted);
    opacity: 1;
}

/* Cột danh sách video */
.vdh-list-section {
    background: var(--vdh-card-bg);
    border: 1px solid var(--vdh-card-border);
    border-radius: var(--vdh-radius);
    padding: 20px;
    box-shadow: var(--vdh-shadow);
    display: flex;
    flex-direction: column;
    height: fit-content;
}

/* Header của cột danh sách chứa tiêu đề và nút */
.vdh-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.vdh-section-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    color: var(--vdh-text-color);
    border-left: 4px solid var(--vdh-primary);
    padding-left: 10px;
    line-height: 1.2;
}

/* Nút bấm xem Kênh YouTube phiên bản mini đặt ở góc nhỏ */
.vdh-channel-btn-mini {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #f43f5e 0%, #db2777 100%);
    color: #fff !important;
    text-decoration: none !important;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 20px;
    box-shadow: 0 3px 10px rgba(219, 39, 119, 0.25);
    transition: var(--vdh-transition);
    white-space: nowrap;
}

.vdh-channel-btn-mini:hover {
    background: linear-gradient(135deg, #e11d48 0%, #be185d 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(219, 39, 119, 0.4);
}

.vdh-channel-btn-mini .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Container danh sách video */
.vdh-videos-lists-container {
    position: relative;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Tùy chỉnh thanh cuộn */
.vdh-videos-lists-container::-webkit-scrollbar {
    width: 6px;
}
.vdh-videos-lists-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
}
.vdh-videos-lists-container::-webkit-scrollbar-thumb {
    background: rgba(219, 39, 119, 0.15);
    border-radius: 10px;
}
.vdh-videos-lists-container::-webkit-scrollbar-thumb:hover {
    background: rgba(219, 39, 119, 0.3);
}

/* Panels của danh sách */
.vdh-video-list-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Từng dòng item video */
.vdh-video-item {
    display: flex;
    gap: 12px;
    padding: 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: var(--vdh-transition);
}

.vdh-video-item:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(219, 39, 119, 0.05);
}

.vdh-video-item.active {
    background: #fff;
    border-color: var(--vdh-primary);
    box-shadow: 0 4px 15px rgba(219, 39, 119, 0.12);
}

/* Thumbnail của item */
.vdh-item-thumb {
    position: relative;
    width: 100px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.vdh-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--vdh-transition);
}

.vdh-video-item:hover .vdh-item-thumb img {
    transform: scale(1.05);
}

/* Nút play nhỏ trên thumbnail */
.vdh-play-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(219, 39, 119, 0.9);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: var(--vdh-transition);
}

.vdh-play-badge .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-left: 2px;
}

.vdh-video-item:hover .vdh-play-badge {
    transform: translate(-50%, -50%) scale(1.15);
    background: var(--vdh-secondary-hover);
}

/* Badge chỉ kiểu hiển thị (Short / Video) */
.vdh-type-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    padding: 2px 6px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #fff;
    border-radius: 4px;
    text-transform: uppercase;
}

.vdh-type-badge.video {
    background: #475569;
}

.vdh-type-badge.short {
    background: var(--vdh-primary);
}

/* Thông tin video nhỏ */
.vdh-item-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.vdh-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.3;
    color: var(--vdh-text-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vdh-video-item.active .vdh-item-title {
    color: var(--vdh-primary);
}

.vdh-item-desc {
    font-size: 0.8rem;
    color: var(--vdh-text-muted);
    margin: 0;
    opacity: 1;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === PHIÊN BẢN MỚI V2 STYLES === */
.vdh-v2-container {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    gap: 60px; /* Khoảng cách rõ ràng giữa 2 phần ngang/dọc */
    max-width: 1150px;
    margin: 30px auto;
    box-sizing: border-box;
}

.vdh-v2-section {
    width: 100%;
}

.vdh-v2-section-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px dashed rgba(219, 39, 119, 0.15);
}

.vdh-v2-main-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--vdh-primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.vdh-v2-main-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 24px;
    background: linear-gradient(to bottom, var(--vdh-secondary), var(--vdh-primary));
    border-radius: 4px;
}

/* === RESPONSIVE TỐI ƯU CHO MOBILE & TABLET === */
@media (max-width: 991px) {
    .vdh-main-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .vdh-player-wrapper.vdh-view-short {
        max-width: 300px;
    }
}

@media (max-width: 576px) {
    .vdh-container {
        padding: 0 15px; /* Thêm padding trái, phải 15px giúp container không bị dính sát lề mobile */
        margin: 10px auto;
    }

    .vdh-v2-container {
        padding: 0 15px; /* Áp dụng padding trái, phải cho bản V2 trên mobile */
        gap: 45px;
    }
    
    .vdh-v2-main-title {
        font-size: 1.25rem;
    }

    .vdh-player-wrapper {
        margin-bottom: 12px;
    }
    
    .vdh-player-wrapper.vdh-view-short {
        max-width: 250px;
        border-width: 6px;
        border-radius: 28px;
    }
    
    .vdh-player-wrapper.vdh-view-short .vdh-iframe-container iframe {
        border-radius: 20px;
    }

    .vdh-video-meta {
        padding: 15px;
    }
    
    .vdh-video-title {
        font-size: 1.15rem;
    }
    
    .vdh-video-description {
        font-size: 0.9rem;
    }
    
    .vdh-list-section {
        padding: 15px;
    }

    .vdh-list-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .vdh-section-title {
        font-size: 1.1rem;
    }

    .vdh-channel-btn-mini {
        width: 100%;
        justify-content: center;
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .vdh-item-thumb {
        width: 80px;
        height: 56px;
    }
    
    .vdh-item-title {
        font-size: 0.85rem;
    }
}

@media (max-width: 360px) {
    .vdh-player-wrapper.vdh-view-short {
        max-width: 210px;
    }
    
    .vdh-item-thumb {
        width: 70px;
        height: 50px;
    }
}

/* CSS dự phòng khi không có video */
.vdh-no-videos {
    background: #fff5f5;
    border: 1px dashed #feb2b2;
    padding: 30px;
    text-align: center;
    border-radius: 8px;
    color: #c53030;
    font-size: 0.95rem;
}
