/*
Theme Name: CloackTube
Author: Webmaaron
Description: A high-performance, video-centric WordPress theme with advanced cloaking and monetization features.
Version: 1.0.0
Text Domain: cloacktube
Tags: video, monetization, dark-mode, responsive
*/

/* 
 * CSS Variables for Modern Design System
 */
:root {
    /* Color Palette - Dark Mode Primary */
    --bg-primary: #0a0a0a;
    --bg-secondary: #161616;
    --bg-tertiary: #202020;
    
    --accent-primary: #e50914; /* Netflix-style red */
    --accent-hover: #ff1f29;
    
    --text-primary: #f5f5f5;
    --text-secondary: #a0a0a0;
    --text-muted: #6b7280;
    
    --border-color: #333333;
    
    /* Spacing & Transitions */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    --transition-fast: 0.2s ease;
    --transition-standard: 0.3s ease;
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* Light Mode Overrides */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f3f4f6;
    --bg-tertiary: #e5e7eb;
    
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    
    --border-color: #d1d5db;
}

/* Global Resets & Typography */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--accent-primary);
}

img, video {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

/* Base Utility Classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-md { gap: var(--spacing-md); }

/* Video Player Section & Constraints */
.video-player-container {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 1200px) {
    .video-player-container {
        max-width: 800px;
    }
}

@media (max-width: 1024px) {
    .video-player-container {
        max-width: 700px;
    }
}

@media (max-width: 768px) {
    .video-player-container {
        max-width: 100%;
    }
}

.player-wrapper {
    max-width: 100%;
    max-height: 75vh; 
    margin: 0 auto;
    background: #000;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    border-radius: var(--radius-lg);
}

.player-wrapper video,
.player-wrapper .plyr {
    max-height: 75vh !important;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: contain;
}

/* Ad Slot General Centering */
.ad-slot {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.video-header-top {
    margin-bottom: var(--spacing-md);
}

.resolution-badge {
    display: inline-block;
    background: var(--accent-primary);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    margin-right: 10px;
    vertical-align: middle;
}

.video-tags-list {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: 20px;
    transition: var(--transition-fast);
}

.tag-item:hover {
    background: var(--accent-primary);
    color: #fff;
}

/* Related Videos Grid Fix */
.related-videos-section {
    margin-top: var(--spacing-xl);
    border-top: 1px solid var(--border-color);
    padding-top: var(--spacing-xl);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

@media (max-width: 480px) {
    .related-grid {
        grid-template-columns: 1fr;
    }
}

/* Pre-roll Overlay Styles */
.ctube-preroll-container {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: var(--spacing-lg);
}

.ctube-preroll-timer {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--accent-primary);
    color: #fff;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.ctube-preroll-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #fff;
    color: #000;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    border: none;
    z-index: 60;
}

.ctube-preroll-content {
    max-width: 100%;
    max-height: 80%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* In-Grid Ad Card styling */
.ad-grid-card {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    height: 100%;
    min-height: 300px;
}

.load-more-container {
    text-align: center;
    margin-top: var(--spacing-xl);
}

.btn-load-more {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 25px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-standard);
}

.btn-load-more:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-load-more:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Details List */
.details-list {
    margin-top: var(--spacing-md);
    line-height: 2;
}

.details-item {
    display: flex;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 8px 0;
}

.details-label {
    min-width: 140px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Responsive Reordering for Single Video */
.video-details-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-xl);
    margin-top: var(--spacing-xl);
}

@media (max-width: 768px) {
    .video-details-section {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    .details-sidebar {
        order: 1; /* Ad first */
    }
    
    .details-content {
        order: 2; /* Description second */
    }
}
