/*
Theme Name: StreamTube Child
Description: Video WordPress Theme.
Author: phpface
Theme URI: https://1.envato.market/qny3O5
Author URI: https://1.envato.market/mgXE4y
Version: 1.0.0
Requires at least: 5.3
Tested up to: 5.8
Requires PHP: 5.6
License: Themeforest Licence
License URI: http://themeforest.net/licenses
Text Domain: streamtube-child
Template:  streamtube
Tags: two-columns, one-column, custom-menu, custom-logo, featured-images, rtl-language-support, sticky-post, threaded-comments, translation-ready
*/

/* Alternative Embed Source Styles */
.player-wrapper .embed-responsive {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    overflow: hidden;
}

.player-wrapper .embed-responsive iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
}

/* Bootstrap ratio classes for responsive embed */
.player-wrapper .ratio {
    position: relative;
    width: 100%;
    height: 0;
}

.player-wrapper .ratio::before {
    display: block;
    content: "";
    width: 100%;
}

/* Post likes display styling */
.post-meta__likes {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--bs-secondary);
    margin-right: 1rem;
}

.post-meta__likes .icon-thumbs-up {
    margin-right: 0.25rem;
    color: #28a745;
    font-size: 0.875rem;
}

/* Grid layout adjustments for likes */
.post-grid .d-flex.gap-3 .post-meta__likes {
    margin-right: 0;
}

/* List layout adjustments for likes */
.post-grid-list .post-meta__items .post-meta__likes {
    display: inline-flex;
    margin-right: 1rem;
}

/* Flat layout adjustments for likes */
.post-meta__items .post-meta__likes {
    display: inline-flex;
    align-items: center;
}

/* Ensure proper spacing in meta items */
.post-meta__items > * {
    margin-right: 1rem;
}

.post-meta__items > *:last-child {
    margin-right: 0;
}

/* Dark theme support for likes */
html[data-theme=dark] .post-meta__likes {
    color: #f9f9f9;
}

html[data-theme=dark] .post-meta__likes .icon-thumbs-up {
    color: #28a745;
}

/* Web Share API Toast Notifications */
.streamtube-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    z-index: 10000;
    max-width: 300px;
    font-size: 14px;
    font-family: inherit;
}

.streamtube-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.streamtube-toast.toast-success { 
    background: #28a745; 
}

.streamtube-toast.toast-error { 
    background: #dc3545; 
}

.streamtube-toast.toast-info { 
    background: #17a2b8; 
}

.streamtube-toast i {
    margin-right: 8px;
}

/* Responsive toast for mobile */
@media (max-width: 768px) {
    .streamtube-toast {
        left: 20px;
        right: 20px;
        max-width: none;
        transform: translateY(-100%);
    }
    
    .streamtube-toast.show {
        transform: translateY(0);
    }
}

.player-wrapper .ratio-16x9::before {
    padding-top: 56.25%; /* 16:9 aspect ratio */
}

.player-wrapper .ratio-4x3::before {
    padding-top: 75%; /* 4:3 aspect ratio */
}

.player-wrapper .ratio-21x9::before {
    padding-top: 42.857143%; /* 21:9 aspect ratio */
}

.player-wrapper .ratio-1x1::before {
    padding-top: 100%; /* 1:1 aspect ratio */
}

.player-wrapper .embed-responsive-item {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Ensure player wrapper and container work properly with iframe */
.player-wrapper .player-wrapper-ratio,
.player-wrapper .player-container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Force proper dimensions for ratio containers */
.player-wrapper .player-wrapper-ratio.ratio {
    position: relative;
    width: 100%;
    height: auto;
    max-height: 540px;
}

.player-wrapper .player-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Override any conflicting styles */
.player-wrapper.bg-black .embed-responsive {
    background: transparent !important;
}

.player-wrapper.bg-black .embed-responsive iframe {
    background: transparent !important;
    z-index: 10;
}

/* Fallback minimum height for iframe */
.player-wrapper .player-container {
    min-height: 315px; /* Standard YouTube embed height */
}

@media (min-width: 768px) {
    .player-wrapper .player-container {
        min-height: 400px;
    }
}

@media (min-width: 1200px) {
    .player-wrapper .player-container {
        min-height: 500px;
    }
}

/* Mobile responsive improvements */
@media (max-width: 768px) {
    .player-wrapper .ratio-16x9::before {
        padding-top: 56.25%;
    }
    
    .player-wrapper .embed-responsive iframe,
    .player-wrapper .player-container iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

/* Critical: Ensure iframe is positioned correctly within ratio container */
.player-wrapper .ratio .player-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

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

/* Fix for YouTube embeds specifically */
.player-wrapper iframe[src*="youtube.com"],
.player-wrapper iframe[src*="youtu.be"] {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
}

/* Remove any overlay or blocking elements */
.player-wrapper .ratio::after,
.player-wrapper .embed-responsive::after {
    display: none !important;
}

/* Ensure iframe is visible and not blocked */
.player-wrapper iframe {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Clear any transform that might hide iframe */
.player-wrapper .player-container,
.player-wrapper .embed-responsive,
.player-wrapper iframe {
    transform: none !important;
}

/* Additional fixes for black iframe issue */
.player-wrapper.bg-black {
    background: #000 !important;
}

.player-wrapper .ratio {
    background: transparent !important;
}

.player-wrapper .player-container iframe {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Force iframe to be on top */
.player-wrapper iframe {
    z-index: 999 !important;
    position: absolute !important;
}

/* Alternative Embed Source Switcher Styles */
.embed-switcher-controls {
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    backdrop-filter: blur(10px);
}

.embed-source-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.embed-source-btn {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #495057;
    border: 2px solid #dee2e6;
    padding: 10px 18px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    position: relative;
    overflow: hidden;
    min-width: 80px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.embed-source-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.embed-source-btn:hover::before {
    left: 100%;
}

.embed-source-btn:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    border-color: #adb5bd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.embed-source-btn.active {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #fff;
    border-color: #004085;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.embed-source-btn.active:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4);
}

/* Dark theme adjustments */
.type-video .single-body .embed-switcher-controls {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

.type-video .single-body .embed-source-info {
    color: rgba(255, 255, 255, 0.8);
}

/* Loading State */
.player-wrapper.embed-loading {
    position: relative;
}

.embed-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 1000;
    border-radius: 8px;
}

.embed-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .embed-switcher-controls {
        padding: 10px;
        margin-top: 10px;
    }
    
    .embed-source-controls {
        gap: 6px;
    }
    
    .embed-source-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .embed-switcher-controls {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .embed-source-controls {
        justify-content: center;
        max-width: 100%;
    }
    
    .embed-source-btn {
        flex: 0 0 auto;
        min-width: 70px;
    }
}

/* =========================
   Web Share API Styles  
   ========================= */

/* Toast Notifications */
.streamtube-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 9999;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.streamtube-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.streamtube-toast.toast-success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.streamtube-toast.toast-error {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
}

.streamtube-toast.toast-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
}

/* Responsive Toast for Mobile */
@media (max-width: 576px) {
    .streamtube-toast {
        right: 10px;
        left: 10px;
        transform: translateY(-100%);
    }
    
    .streamtube-toast.show {
        transform: translateY(0);
    }
}

/* Like/Dislike buttons without login requirement */ 

.wppl-like-button[disabled],
.wppl-dislike-button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}*/

/* Remove any modal trigger styles for guest users */
body:not(.logged-in) .wppl-like-button[data-bs-toggle],
body:not(.logged-in) .wppl-dislike-button[data-bs-toggle] {
    pointer-events: auto !important;
}


/* ===================================
   Task 7: Comment Button Styles
   =================================== */

/* Hide comment from meta area and show in button group area instead */
.post-meta .post-meta__comment {
    display: none !important;
}

/* Comment button in button group style */
.button-group-comment {
    position: relative;
}

.button-group-comment .btn {
    position: relative;
    transition: all 0.2s ease;
}

.button-group-comment .btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.button-group-comment .btn__icon {
    font-size: 1.1em;
    color: #6c757d;
    transition: color 0.2s ease;
}

.button-group-comment .btn:hover .btn__icon {
    color: #007bff;
}

.button-group-comment .btn__badge {
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0 4px;
}

/* Ensure comment button integrates well with like/dislike buttons */
.post-options .d-flex {
    align-items: center;
    flex-wrap: wrap;
}

.post-options .button-group {
    margin: 0 2px;
}

/* Responsive design for comment button */
@media (max-width: 576px) {
    .button-group-comment .btn__badge {
        font-size: 10px;
        min-width: 16px;
        height: 16px;
        border-radius: 8px;
    }
}

/* ===== Related Episodes Widget Styles ===== */
.streamtube-related-episodes-widget {
    margin-bottom: 2rem;
}

.related-episodes-list {
    margin-top: 1rem;
}

.related-episodes-list article {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.related-episodes-list article:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #dee2e6;
}

.related-episodes-list .post-main {
    flex-shrink: 0;
}

.related-episodes-list .post-thumbnail {
    border-radius: 6px;
    overflow: hidden;
}

.related-episodes-list .post-title {
    font-size: 0.9rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.related-episodes-list .post-title a {
    color: inherit;
    text-decoration: none;
}

.related-episodes-list .post-title a:hover {
    color: var(--bs-primary);
}

.related-episodes-list .post-meta__items {
    font-size: 0.8rem;
    opacity: 0.8;
}

.related-episodes-list .post-meta__items .btn {
    font-size: 0.75rem;
    padding: 0.1rem 0.3rem;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .related-episodes-list article {
        border-color: #495057;
        background-color: rgba(255,255,255,0.05);
    }
    
    .related-episodes-list article:hover {
        background-color: rgba(255,255,255,0.08);
        border-color: #6c757d;
    }
}