/**
 * Videohub360 Plugin Integration Styles
 * 
 * Custom styling for Videohub360 video player and components
 * 
 * @package Videohub360_Theme
 * @since 1.0.0
 */

/* ==========================================================================
   Video Player Container
   ========================================================================== */

.videohub360-video-player {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
    aspect-ratio: 16/9;
}

/* ==========================================================================
   Agora Interactive Mode - Aspect Ratio Adaptation
   ========================================================================== */

/* Desktop: 4:3 aspect ratio for Agora Interactive Mode */
.videohub360-video-player:has(.vh360-agora-interactive-container) {
    aspect-ratio: 4/3;
}

/* Mobile/Tablet: 2:3 aspect ratio for Agora Interactive Mode */
@media (max-width: 1024px) {
    .videohub360-video-player:has(.vh360-agora-interactive-container) {
        aspect-ratio: 2/3;
    }
}

/* ==========================================================================
   Video Grid Layout
   ========================================================================== */

.video-archive-layout .video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem 1.5rem;
    padding: 2rem 0;
}

@media (max-width: 768px) {
    .video-archive-layout .video-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* ==========================================================================
   Video Card Styling
   ========================================================================== */

.video-item {
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.video-item:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
}

.video-thumbnail {
    position: relative;
    display: block;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

/* Live Badge */
.live-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.25rem 0.75rem;
    background: #e53935;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
    z-index: 10;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
}

/* Support for custom badge colors via data attribute */
.live-badge[data-badge-color] {
    background: var(--badge-color, #e53935);
}

/* Set custom badge color from data attribute via inline style override if needed */
.live-badge {
    background-color: var(--badge-color, #e53935);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* Play Button */
.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.9;
    transition: var(--transition);
    pointer-events: none;
}

.video-item:hover .play-button {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

/* Video Info */
.video-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.video-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.video-title a {
    color: var(--text-color);
    text-decoration: none;
}

.video-title a:hover {
    color: var(--primary-color);
}

.video-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.video-meta > span:not(:last-child)::after {
    content: '•';
    margin-left: 0.75rem;
    color: var(--border-color);
}

/* ==========================================================================
   Video Sidebar (Related Videos)
   ========================================================================== */

.videohub360-sidebar {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: var(--border-radius);
}

.videohub360-sidebar h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.videohub360-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.videohub360-sidebar li {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.videohub360-sidebar li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.videohub360-sidebar-thumbnail {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.videohub360-sidebar-info {
    flex: 1;
    min-width: 0;
}

.videohub360-sidebar-title {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
    line-height: 1.4;
    margin-bottom: 0.25rem;
}

.videohub360-sidebar-title:hover {
    color: var(--primary-color);
}

.videohub360-sidebar-meta {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ==========================================================================
   Video Meta Container
   ========================================================================== */

.videohub360-meta-container {
    padding: 1.5rem 0;
}

.videohub360-title {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.videohub360-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.videohub360-views-info {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

/* ==========================================================================
   Chat Integration
   ========================================================================== */

.videohub360-live-chat {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.videohub360-chat-header {
    padding: 1rem;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.videohub360-chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 1rem;
}

.videohub360-chat-input-container {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .videohub360-title {
        font-size: 1.5rem;
    }
    
    .videohub360-meta-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .videohub360-sidebar-thumbnail {
        width: 100px;
        height: 56px;
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.videohub360-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--text-light);
}

.videohub360-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Video Quality Enhancement
   ========================================================================== */

.videohub360-video-player video,
.videohub360-video-player iframe,
.videohub360-video-player embed,
.videohub360-video-player object {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Ensure video fills container properly */
.videohub360-custom-embed-container,
.videohub360-custom-embed-container iframe {
    width: 100%;
    height: 100%;
}


/* ==========================================================================
   Live Room Layout (Community Live Rooms)
   ========================================================================== */

.vh360-live-room-page {
    background: var(--page-background, #050816);
    padding: 2rem 1rem 3rem;
}

.vh360-live-room-main {
    width: 100%;
}

.vh360-live-room-inner {
    background: #030712;
    border-radius: 1.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
    padding: 1.5rem;
    color: #e5e7eb;
}

.vh360-live-room-layout {
    display: grid;
    grid-template-columns: minmax(0, 2.1fr) minmax(280px, 1fr);
    gap: 1.75rem;
    align-items: flex-start;
    margin-top: 1.5rem;
}

.vh360-live-room-main-column {
    min-width: 0;
}

.vh360-live-room-sidebar {
    min-width: 0;
}

.vh360-live-room-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.vh360-live-room-title-wrap {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.vh360-live-room-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.vh360-live-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
}

.vh360-live-room-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: #9ca3af;
}

.vh360-live-room-player {
    margin-bottom: 1.25rem;
}

/* Make the livestream look more like a video stage, not full-page */
.vh360-live-room-player .videohub360-video-player {
    border-radius: 1rem;
    background: #000;
}

/* Chat column styling */
.vh360-live-room-sidebar .vh360-live-room-chat {
    background: #020617;
    border-radius: 1.25rem;
    padding: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    max-height: calc(100vh - 220px);
    display: flex;
    flex-direction: column;
}

/* Let inner chat container fill column */
.vh360-live-room-sidebar .videohub360-live-chat,
.vh360-live-room-sidebar #vh360-chat-inline,
.vh360-live-room-sidebar #vh360-chat-popup {
    height: 100%;
}

/* Responsive: stack on smaller screens */
@media (max-width: 1024px) {
    .vh360-live-room-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .vh360-live-room-sidebar {
        order: 2;
    }

    .vh360-live-room-main-column {
        order: 1;
    }

    .vh360-live-room-sidebar .vh360-live-room-chat {
        max-height: none;
    }
}


/* Live Room host row layout */
.vh360-live-room-host {
    margin-top: 1rem;
}

.vh360-host-link {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: inherit;
}

.vh360-host-link:hover .vh360-host-name {
    text-decoration: underline;
}

.vh360-host-avatar img,
.vh360-host-avatar {
    border-radius: 999px;
    overflow: hidden;
    display: inline-flex;
}

.vh360-host-name-row {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}


/* Scoped container for Live Room page (match community templates width) */
.vh360-live-room-area .vh360-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}
