/**
 * TechHub Video Learning Hub - YouTube Style Interface Styles
 * Tối ưu trải nghiệm xem video chuẩn YouTube, Dark Mode, Responsive
 */

/* Container & Layout 2 Cột Chuẩn YouTube */
.th-single-video-main,
.th-single-video-page-main {
    width: 100% !important;
    max-width: 1360px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
    padding-top: 2rem !important;
    padding-bottom: 4.5rem !important;
    box-sizing: border-box !important;
}

.th-yt-watch-container {
    width: 100% !important;
    max-width: 1360px !important;
    margin: 0 auto !important;
    position: relative !important;
    box-sizing: border-box !important;
}

.th-yt-watch-layout {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 380px !important;
    gap: 2rem !important;
    align-items: start !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.th-yt-main-column {
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.th-yt-sidebar-column {
    width: 380px !important;
    min-width: 300px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* 1. Trình Phát Video YouTube 16:9 Rạp Chiếu */
.th-yt-player-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 16px;
    background: #000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    margin-bottom: 1.25rem;
}

.th-yt-player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* 2. Tiêu Đề Video */
.th-yt-title {
    font-size: clamp(1.35rem, 2.5vw, 1.75rem);
    font-weight: 800;
    color: var(--wp--preset--color--navy-primary);
    line-height: 1.35;
    margin: 0 0 1rem 0;
}

/* 3. Thanh Thông Tin Kênh & Các Nút Tương Tác (Channel Bar) */
.th-yt-channel-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--wp--preset--color--border-light);
}

.th-yt-channel-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.th-yt-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--wp--preset--color--border-light);
    display: block;
}

.th-yt-channel-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.th-yt-channel-title {
    font-size: 0.975rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.th-yt-channel-title a {
    color: var(--wp--preset--color--navy-primary);
    text-decoration: none;
}

.th-yt-channel-title a:hover {
    color: var(--wp--preset--color--blue-electric);
}

.th-yt-badge-check {
    font-size: 0.75rem;
}

.th-yt-sub-count {
    font-size: 0.75rem;
    color: var(--wp--preset--color--text-muted);
}

.th-yt-btn-subscribe {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.15rem;
    background: #cc0000;
    color: #ffffff !important;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-left: 0.5rem;
    box-shadow: 0 2px 8px rgba(204, 0, 0, 0.25);
}

.th-yt-btn-subscribe:hover {
    background: #b30000;
    transform: scale(1.03);
}

/* Các Nút Hành Động Bên Phải */
.th-yt-actions-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.th-yt-action-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.95rem;
    background: var(--wp--preset--color--surface-light);
    border: 1px solid var(--wp--preset--color--border-light);
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--wp--preset--color--navy-primary);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.th-yt-action-pill:hover {
    background: var(--wp--preset--color--border-light);
    transform: translateY(-1px);
}

.th-yt-action-pill.is-active {
    background: #ef4444 !important;
    color: #ffffff !important;
    border-color: #ef4444 !important;
}

.th-yt-cat-pill {
    background: rgba(37, 99, 235, 0.08);
    color: var(--wp--preset--color--blue-electric);
    border-color: rgba(37, 99, 235, 0.2);
}

.th-yt-btn-code {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #0284c7 !important;
}

.th-yt-btn-code:hover {
    background: #0369a1 !important;
}

/* 4. Hộp Mô Tả Chuẩn YouTube (Description Box) */
.th-yt-description-box {
    background: var(--wp--preset--color--surface-light);
    border: 1px solid var(--wp--preset--color--border-light);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.th-yt-description-box:hover {
    border-color: rgba(37, 99, 235, 0.25);
}

.th-yt-description-box.is-expanded {
    cursor: default;
}

.th-yt-desc-meta {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--wp--preset--color--navy-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}

.th-yt-hashtag {
    color: var(--wp--preset--color--blue-electric);
    font-weight: 500;
}

.th-yt-desc-body {
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--wp--preset--color--navy-primary);
    max-height: 160px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.3s ease;
}

.th-yt-description-box.is-expanded .th-yt-desc-body {
    max-height: none !important;
    overflow: visible !important;
}

.th-yt-desc-expand-btn {
    display: inline-block;
    margin-top: 0.75rem;
    background: none;
    border: none;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--wp--preset--color--blue-electric);
    cursor: pointer;
    padding: 0.25rem 0.5rem 0.25rem 0;
    outline: none;
    user-select: none;
}

.th-yt-desc-expand-btn:hover {
    text-decoration: underline;
}

/* 5. Cột Video Đề Xuất (Sidebar Up Next) */
.th-yt-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.15rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--wp--preset--color--border-light);
}

.th-yt-sidebar-heading {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
    color: var(--wp--preset--color--navy-primary);
}

.th-yt-sidebar-badge {
    font-size: 0.7rem;
    background: rgba(37, 99, 235, 0.1);
    color: var(--wp--preset--color--blue-electric);
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-weight: 600;
}

.th-yt-sidebar-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
    margin: 0 !important;
    padding: 0 !important;
}

.th-yt-sidebar-list p,
.th-yt-sidebar-list br {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.th-yt-rel-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 0.65rem !important;
    text-decoration: none !important;
    border-radius: 8px !important;
    padding: 0.25rem 0.35rem !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    background: transparent !important;
    transition: all 0.15s ease !important;
}

.th-yt-rel-card:hover {
    background: var(--wp--preset--color--surface-light) !important;
    transform: translateX(2px) !important;
}

.th-yt-rel-thumb-link {
    display: block !important;
    flex: 0 0 136px !important;
    width: 136px !important;
    max-width: 136px !important;
    min-width: 136px !important;
    height: 76px !important;
    flex-shrink: 0 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

.th-yt-rel-thumb-box {
    display: block !important;
    position: relative !important;
    width: 136px !important;
    max-width: 136px !important;
    min-width: 136px !important;
    height: 76px !important;
    flex-shrink: 0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    background: #0f172a !important;
}

.th-yt-rel-img {
    display: block !important;
    width: 136px !important;
    max-width: 136px !important;
    min-width: 136px !important;
    height: 76px !important;
    object-fit: cover !important;
}

.th-yt-rel-badge-time {
    position: absolute !important;
    bottom: 4px !important;
    right: 4px !important;
    background: rgba(0, 0, 0, 0.85) !important;
    color: #ffffff !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    padding: 0.1rem 0.35rem !important;
    border-radius: 4px !important;
}

.th-yt-rel-play-overlay {
    position: absolute !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.4) !important;
    color: #ef4444 !important;
    font-size: 1.25rem !important;
    opacity: 0 !important;
    transition: opacity 0.2s ease !important;
}

.th-yt-rel-card:hover .th-yt-rel-play-overlay {
    opacity: 1 !important;
}

.th-yt-rel-details {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.15rem !important;
    min-width: 0 !important;
    flex: 1 !important;
}

.th-yt-rel-video-title {
    font-size: 0.835rem !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    color: var(--wp--preset--color--navy-primary) !important;
    margin: 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

.th-yt-rel-video-title a {
    color: inherit !important;
    text-decoration: none !important;
    transition: color 0.15s ease !important;
}

.th-yt-rel-card:hover .th-yt-rel-video-title a {
    color: var(--wp--preset--color--blue-electric) !important;
}

.th-yt-rel-channel-name {
    font-size: 0.72rem !important;
    color: var(--wp--preset--color--text-muted) !important;
    margin-top: 0.15rem !important;
    line-height: 1.2 !important;
}

.th-yt-rel-meta-line {
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    font-size: 0.7rem !important;
    color: var(--wp--preset--color--text-muted) !important;
    line-height: 1.2 !important;
    margin-top: 0.1rem !important;
}

.th-yt-rel-meta-line br {
    display: none !important;
}

.th-yt-rel-cat-tag {
    align-self: flex-start !important;
    font-size: 0.62rem !important;
    font-weight: 700 !important;
    color: var(--wp--preset--color--blue-electric) !important;
    background: rgba(37, 99, 235, 0.08) !important;
    padding: 0.08rem 0.35rem !important;
    border-radius: 4px !important;
    text-transform: uppercase !important;
    margin-top: 0.15rem !important;
}

/* Toast Thông Báo Khi Copy Link */
.th-yt-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #0f172a;
    color: #ffffff;
    padding: 0.85rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 999999;
}

/* =========================================================================
   LƯỚI VIDEO (VIDEO CARDS GRID) CHO TRANG ARCHIVE & TAXONOMY
   ========================================================================= */
.th-video-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.75rem;
    width: 100%;
    margin-top: 1rem;
}

.th-video-grid-card {
    display: flex;
    flex-direction: column;
    background: var(--wp--preset--color--surface-white);
    border: 1px solid var(--wp--preset--color--border-light);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.th-video-grid-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.08);
    border-color: var(--wp--preset--color--blue-electric);
}

.th-video-card-thumb-link {
    text-decoration: none;
    display: block;
}

.th-video-card-thumb-wrap {
    position: relative;
    aspect-ratio: 16/9;
    background: #0f172a;
    overflow: hidden;
}

.th-video-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.th-video-grid-card:hover .th-video-card-thumb {
    transform: scale(1.04);
}

.th-video-badge-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

.th-video-badge-cat {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.th-video-play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #ef4444;
    opacity: 0;
    transform: scale(0.85);
    transition: all 0.2s ease;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.th-video-grid-card:hover .th-video-play-btn {
    opacity: 1;
    transform: scale(1);
}

.th-video-card-content {
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.th-video-card-header {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.th-video-card-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--wp--preset--color--border-light);
    margin-top: 0.1rem;
}

.th-video-card-meta-right {
    min-width: 0;
    flex: 1;
}

.th-video-card-title {
    font-size: 0.975rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 0.35rem 0;
}

.th-video-card-title a {
    color: var(--wp--preset--color--navy-primary);
    text-decoration: none;
    transition: color 0.15s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.th-video-card-title a:hover {
    color: var(--wp--preset--color--blue-electric);
}

.th-video-card-channel {
    font-size: 0.78rem;
    color: var(--wp--preset--color--text-muted);
    font-weight: 500;
    margin-bottom: 0.2rem;
}

.th-video-card-stats {
    font-size: 0.72rem;
    color: var(--wp--preset--color--text-muted);
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

/* =========================================================================
   HỖ TRỢ DARK MODE (TƯƠNG THÍCH CHẾ ĐỘ TỐI CỦA YOUTUBE)
   ========================================================================= */
.dark .th-yt-title {
    color: #f8fafc;
}

.dark .th-yt-channel-title a {
    color: #f8fafc;
}

.dark .th-yt-channel-bar {
    border-bottom-color: #334155;
}

.dark .th-yt-description-box {
    background: #1e293b;
    border-color: #334155;
}

.dark .th-yt-desc-meta {
    color: #f8fafc;
}

.dark .th-yt-desc-body {
    color: #cbd5e1;
}

.dark .th-yt-action-pill {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

.dark .th-yt-action-pill:hover {
    background: #334155;
}

.dark .th-yt-cat-pill {
    background: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
    border-color: rgba(37, 99, 235, 0.4);
}

.dark .th-yt-sidebar-heading {
    color: #f8fafc;
}

.dark .th-yt-sidebar-header {
    border-bottom-color: #334155;
}

.dark .th-yt-rel-card:hover {
    background: #1e293b;
}

.dark .th-yt-rel-video-title {
    color: #f8fafc;
}

.dark .th-video-grid-card {
    background: #1e293b;
    border-color: #334155;
}

.dark .th-video-card-title a {
    color: #f8fafc;
}

.dark .th-video-card-title a:hover {
    color: #60a5fa;
}

/* =========================================================================
   RESPONSIVE CHO TABLET & MOBILE
   ========================================================================= */
@media (max-width: 1024px) {
    .th-yt-watch-layout {
        grid-template-columns: 1fr;
    }

    .th-video-cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .th-video-cards-grid {
        grid-template-columns: 1fr;
    }

    .th-yt-channel-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .th-yt-actions-right {
        width: 100%;
        justify-content: flex-start;
    }

    .th-yt-rel-thumb-link {
        flex: 0 0 120px !important;
        width: 120px !important;
        max-width: 120px !important;
        min-width: 120px !important;
        height: 68px !important;
    }

    .th-yt-rel-thumb-box {
        width: 120px !important;
        max-width: 120px !important;
        min-width: 120px !important;
        height: 68px !important;
    }

    .th-yt-rel-img {
        width: 120px !important;
        max-width: 120px !important;
        min-width: 120px !important;
        height: 68px !important;
    }
}
