/**
 * Polanger VideoHub - Video Details Page Styles
 * Single video page (watch page) styles
 *
 * @since 1.0.0
 */

/* CSS Variables (shared) */
:root {
    --pvh-primary: #ff0000;
    --pvh-primary-hover: #cc0000;
    --pvh-primary-light: rgba(255, 0, 0, 0.1);
    --pvh-dark: #0f0f0f;
    --pvh-darker: #030303;
    --pvh-gray: #606060;
    --pvh-light-gray: #aaaaaa;
    --pvh-border: #e5e5e5;
    --pvh-border-light: #f0f0f0;
    --pvh-bg: #f2f2f2;
    --pvh-bg-elevated: #ffffff;
    --pvh-card-bg: #ffffff;
    --pvh-text: #0f0f0f;
    --pvh-text-secondary: #606060;
    --pvh-text-muted: #909090;
    --pvh-radius: 12px;
    --pvh-radius-sm: 8px;
    --pvh-radius-lg: 16px;
    --pvh-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --pvh-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --pvh-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --pvh-transition: 0.2s ease;
}

/* =====================================================
   SINGLE VIDEO PAGE - Modern YouTube-like Design
   ===================================================== */

.pvh-single-video-page {
    max-width: 100%;
    margin: 0 auto;
    padding: 24px 24px;
    min-height: 100vh;
    width: 100%;
    box-sizing: border-box;
}

.pvh-video-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 24px;
    align-items: start;
    max-width: 1920px;
    margin: 0 auto;
}

.pvh-video-main {
    min-width: 0;
    background: var(--pvh-bg-elevated);
    border-radius: var(--pvh-radius-lg);
    overflow: hidden;
    box-shadow: var(--pvh-shadow);
}

/* Player Section */
.pvh-player-section {
    margin-bottom: 0;
    background: #000;
}

.pvh-video-player-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    background: #000;
    overflow: hidden;
}

.pvh-video-player-wrapper iframe,
.pvh-video-player-wrapper video,
.pvh-video-player-wrapper object,
.pvh-video-player-wrapper embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Self-hosted video player */
.pvh-video-player-wrapper video.pvh-video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pvh-embed-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.pvh-embed-container iframe,
.pvh-embed-container object,
.pvh-embed-container embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Video Details */
.pvh-video-details {
    padding: 20px 24px;
}

.pvh-video-details .pvh-video-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 16px;
    -webkit-line-clamp: unset;
    color: var(--pvh-darker);
    line-height: 1.3;
    letter-spacing: -0.3px;
}

.pvh-video-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--pvh-border-light);
    margin-bottom: 0;
    flex-wrap: wrap;
    gap: 12px;
}

.pvh-meta-left {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--pvh-text-secondary);
    font-size: 14px;
    font-weight: 400;
}

.pvh-meta-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pvh-author-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--pvh-text);
    padding: 8px 16px 8px 8px;
    background: var(--pvh-bg);
    border-radius: 24px;
    transition: all var(--pvh-transition);
    font-weight: 500;
}

.pvh-author-link:hover {
    background: var(--pvh-border);
    transform: translateY(-1px);
}

.pvh-author-avatar {
    display: flex;
    align-items: center;
}

.pvh-author-avatar img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--pvh-border-light);
}

.pvh-author-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--pvh-text);
}

.pvh-separator {
    color: var(--pvh-text-muted);
    font-weight: 300;
}

/* Channel Info */
.pvh-channel-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--pvh-border);
}

.pvh-channel-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.pvh-channel-details {
    flex: 1;
}

.pvh-channel-name {
    display: block;
    font-weight: 500;
    color: var(--pvh-text);
    text-decoration: none;
}

.pvh-channel-name:hover {
    color: var(--pvh-primary);
}

/* Video Description */
.pvh-video-description {
    padding: 16px 0;
    line-height: 1.6;
    color: var(--pvh-text);
}

/* Categories & Tags */
.pvh-video-categories,
.pvh-video-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.pvh-category-badge {
    display: inline-block;
    padding: 6px 12px;
    background: var(--pvh-bg);
    border-radius: 20px;
    font-size: 13px;
    color: var(--pvh-text);
    text-decoration: none;
    transition: background 0.2s;
}

.pvh-category-badge:hover {
    background: var(--pvh-border);
}

.pvh-tag-badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 13px;
    color: var(--pvh-primary);
    text-decoration: none;
}

.pvh-tag-badge:hover {
    text-decoration: underline;
}

/* Sidebar */
.pvh-video-sidebar {
    position: sticky;
    top: 24px;
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-self: start;
}

.pvh-sidebar-section {
    background: var(--pvh-bg-elevated);
    border-radius: var(--pvh-radius-lg);
    overflow: hidden;
    box-shadow: var(--pvh-shadow);
}

.pvh-sidebar-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    padding: 16px 20px;
    color: var(--pvh-text);
    border-bottom: 1px solid var(--pvh-border-light);
    background: var(--pvh-bg);
}

/* Related Videos */
.pvh-related-videos {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pvh-related-video-card {
    background: var(--pvh-bg-elevated);
    overflow: hidden;
    transition: background var(--pvh-transition);
}

.pvh-related-video-card:hover {
    background: var(--pvh-bg);
}

.pvh-related-link {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
}

.pvh-related-thumbnail {
    position: relative;
    width: 168px;
    min-width: 168px;
    aspect-ratio: 16 / 9;
    border-radius: var(--pvh-radius-sm);
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
}

.pvh-related-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.pvh-related-video-card:hover .pvh-related-thumbnail img {
    transform: scale(1.05);
}

.pvh-related-info {
    flex: 1;
    padding: 2px 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.pvh-related-title {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--pvh-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pvh-related-author,
.pvh-related-meta {
    display: block;
    font-size: 12px;
    color: var(--pvh-text-muted);
    line-height: 1.4;
}

/* Categories List */
.pvh-categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pvh-category-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--pvh-bg);
    border-radius: var(--pvh-radius);
    text-decoration: none;
    color: var(--pvh-text);
    transition: background 0.2s;
}

.pvh-category-item:hover {
    background: var(--pvh-border);
}

.pvh-category-name {
    font-weight: 500;
}

.pvh-category-count {
    font-size: 12px;
    color: var(--pvh-text-secondary);
}

/* No Videos */
.pvh-no-videos {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--pvh-text-secondary);
}

/* Comments Section */
.pvh-comments-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--pvh-border);
}

/* =====================================================
   SIDEBAR PLAYLIST STYLES (YouTube-like)
   ===================================================== */

.pvh-sidebar-playlist {
    background: var(--pvh-bg);
    border-radius: var(--pvh-radius);
    overflow: hidden;
    margin-bottom: 20px;
}

.pvh-playlist-header-sidebar {
    padding: 16px;
	background: linear-gradient(135deg, #8e0707, #720691);
    color: #fff;
}

.pvh-playlist-label {
    display: inline-block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
    margin-bottom: 4px;
}

.pvh-playlist-header-sidebar .pvh-sidebar-title {
    color: #000;
    font-size: 15px;
    margin: 0 0 4px;
}

.pvh-playlist-meta {
    font-size: 12px;
    opacity: 0.7;
}

.pvh-playlist-videos-list {
    max-height: 400px;
    overflow-y: auto;
}

.pvh-playlist-video-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.pvh-playlist-video-item:hover {
    background: var(--pvh-border);
}

.pvh-playlist-video-item.active {
    background: rgba(255, 0, 0, 0.08);
    border-left-color: var(--pvh-primary);
}

.pvh-item-number {
    width: 20px;
    text-align: center;
    font-size: 12px;
    color: var(--pvh-text-secondary);
    flex-shrink: 0;
}

.pvh-playlist-video-item.active .pvh-item-number {
    color: var(--pvh-primary);
    font-weight: 600;
}

.pvh-item-thumb {
    position: relative;
    width: 100px;
    min-width: 100px;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}

.pvh-item-thumb img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

.pvh-no-thumbnail-sm {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a1a, #333);
    color: #666;
}

.pvh-no-thumbnail-sm .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.pvh-duration-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
}

.pvh-item-details {
    flex: 1;
    min-width: 0;
}

.pvh-item-title {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--pvh-text);
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pvh-item-channel {
    display: block;
    font-size: 11px;
    color: var(--pvh-text-secondary);
}

.pvh-sidebar-related {
    margin-top: 0;
}

.pvh-sidebar-related .pvh-sidebar-title {
    margin-bottom: 0;
}

/* Sidebar Header with Autoplay Toggle */
.pvh-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--pvh-bg);
    border-bottom: 1px solid var(--pvh-border-light);
}

.pvh-sidebar-header .pvh-sidebar-title {
    padding: 0;
    border: none;
    background: none;
    font-size: 15px;
}

/* Autoplay Toggle */
.pvh-autoplay-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pvh-autoplay-label {
    font-size: 13px;
    color: var(--pvh-text-secondary);
    font-weight: 500;
}

/* Toggle Switch */
.pvh-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.pvh-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.pvh-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--pvh-border);
    transition: 0.3s;
    border-radius: 20px;
}

.pvh-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.pvh-switch input:checked + .pvh-slider {
    background-color: var(--pvh-primary);
}

.pvh-switch input:checked + .pvh-slider:before {
    transform: translateX(16px);
}

/* Autoplay Countdown Overlay */
.pvh-autoplay-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: pvh-fade-in 0.3s ease;
}

@keyframes pvh-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pvh-autoplay-content {
    text-align: center;
    color: #fff;
}

.pvh-autoplay-text {
    display: block;
    font-size: 16px;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.8);
}

.pvh-autoplay-countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    font-size: 36px;
    font-weight: 700;
    background: var(--pvh-primary);
    border-radius: 50%;
    animation: pvh-pulse 1s infinite;
}

@keyframes pvh-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pvh-autoplay-cancel {
    padding: 10px 24px;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pvh-autoplay-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
}

/* =====================================================
   DESCRIPTION BOX - Modern YouTube Style
   ===================================================== */

.pvh-description-box {
    background: var(--pvh-bg);
    border-radius: var(--pvh-radius);
    padding: 16px 20px;
    margin: 16px 24px 24px;
    cursor: pointer;
    transition: background var(--pvh-transition);
}

.pvh-description-box:hover {
    background: var(--pvh-border);
}

.pvh-description-box.expanded {
    cursor: default;
}

.pvh-description-box.expanded:hover {
    background: var(--pvh-bg);
}

.pvh-description-content {
    position: relative;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.pvh-description-content.collapsed {
    max-height: 80px;
}

.pvh-description-content.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--pvh-bg));
    pointer-events: none;
}

.pvh-description-box:hover .pvh-description-content.collapsed::after {
    background: linear-gradient(transparent, var(--pvh-border));
}

.pvh-description-content.expanded {
    max-height: none;
}

.pvh-description-content.expanded::after {
    display: none;
}

.pvh-description-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--pvh-text);
    white-space: pre-line;
    word-wrap: break-word;
    text-align: left;
}

.pvh-description-text * {
    text-align: left !important;
    white-space: pre-line !important;
}

.pvh-description-text p {
    margin: 0 0 12px;
}

.pvh-description-text p:last-child {
    margin-bottom: 0;
}

.pvh-description-meta {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--pvh-border-light);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pvh-description-toggle {
    display: block !important;
    padding: 0 !important;
    margin-top: 16px;
    margin-left: auto;
    background: transparent !important;
    border: none  !important;
    color: var(--pvh-text-secondary) !important;
    font-size: 14px  !important;
    font-weight: 600  !important;
    cursor: pointer  !important;
    text-align: right  !important;
}

.pvh-description-toggle:hover,
.pvh-description-toggle:focus,
.pvh-description-toggle:active {
    background: transparent !important;
    color: var(--pvh-text) !important;
    outline: none;
    box-shadow: none !important;
}

/* =====================================================
   RESPONSIVE - Single Video Page
   ===================================================== */

@media screen and (max-width: 1400px) {
    .pvh-single-video-page {
        padding: 20px 16px;
    }
    
    .pvh-video-container {
        grid-template-columns: minmax(0, 1fr) 340px;
    }
}

@media screen and (max-width: 1200px) {
    .pvh-video-container {
        grid-template-columns: 1fr;
    }

    .pvh-video-sidebar {
        position: static;
    }

    .pvh-related-videos {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 0;
    }

    .pvh-related-link {
        padding: 12px;
    }

    .pvh-single-video-page {
        padding: 16px;
    }

    /* Sidebar playlist responsive */
    .pvh-sidebar-playlist {
        margin-bottom: 16px;
    }

    .pvh-playlist-videos-list {
        max-height: 300px;
    }
}

@media screen and (max-width: 768px) {
    .pvh-video-details {
        padding: 16px;
    }

    .pvh-video-details .pvh-video-title {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .pvh-related-thumbnail {
        width: 140px;
        min-width: 140px;
    }

    .pvh-sidebar-title {
        padding: 12px 16px;
        font-size: 15px;
    }

    /* Sidebar playlist mobile */
    .pvh-playlist-header-sidebar {
        padding: 12px;
    }

    .pvh-playlist-video-item {
        padding: 6px 10px;
    }

    .pvh-item-thumb {
        width: 80px;
        min-width: 80px;
    }

    .pvh-item-title {
        font-size: 12px;
    }
}

@media screen and (max-width: 576px) {
    .pvh-related-thumbnail {
        width: 120px;
        min-width: 120px;
    }

    .pvh-single-video-page {
        padding: 16px 0 0 0;
        background: var(--pvh-bg-elevated);
    }

    .pvh-video-main {
        border-radius: 0;
        box-shadow: none;
    }

    .pvh-video-details {
        padding: 16px;
    }

    /* Mobile video meta */
    .pvh-video-meta-bar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .pvh-meta-right {
        width: auto;
        justify-content: flex-end;
    }

    .pvh-channel-info {
        flex-wrap: wrap;
    }

    .pvh-video-details .pvh-video-title {
        font-size: 16px;
        line-height: 1.35;
    }

    .pvh-related-link {
        padding: 10px 12px;
    }

    .pvh-related-title {
        font-size: 13px;
    }

    .pvh-sidebar-section {
        border-radius: 0;
        box-shadow: none;
        margin-top: 8px;
    }

    .pvh-description-box {
        margin: 0;
        border-radius: 0;
        padding: 16px;
    }
}

@media screen and (max-width: 400px) {
    .pvh-related-thumbnail {
        width: 100px;
        min-width: 100px;
    }
}
