/* YouTube Enhanced Styles - Integrated with Centralized Theme */

/* Note: This file uses centralized theme CSS variables defined in theme_styles.php
   All colors, shadows, and spacing now respect the site's theme settings */

/* Video Player Container */
.youtube-video-container {
    position: relative;
    width: 100%;
    background: var(--theme-text);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--theme-shadow-xl);
    margin-bottom: 2rem;
}

.youtube-video-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Video Info Section */
.video-info-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--spacing-6);
    margin-bottom: var(--spacing-6);
    box-shadow: var(--theme-shadow-md);
    position: relative;
    z-index: 1;
}

.video-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--theme-text);
    margin-bottom: var(--spacing-4);
    line-height: 1.4;
}

.video-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-4);
    padding-bottom: var(--spacing-4);
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: var(--spacing-4);
}

.video-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.video-stat {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    color: #64748b;
    font-size: var(--text-sm);
}

.video-stat i {
    color: var(--theme-primary);
}

/* Subscribe Button */
.subscribe-button-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.subscribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.subscribe-btn.subscribed {
    background: #e2e8f0;
    color: #64748b;
}

.subscribe-btn.subscribed:hover {
    background: #64748b;
    color: white;
}

.subscribe-btn:not(.subscribed) {
    background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-secondary) 100%);
    color: var(--theme-text-on-primary) !important;
    box-shadow: 0 4px 6px -1px rgba(var(--theme-primary-rgb), 0.3);
}

.subscribe-btn:not(.subscribed):hover {
    transform: translateY(-2px);
    color: var(--theme-text-on-primary) !important;
    box-shadow: 0 10px 15px -3px rgba(var(--theme-primary-rgb), 0.4);
}

.subscribe-btn:not(.subscribed):active {
    transform: translateY(0);
}

.subscribe-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.subscribe-btn i {
    font-size: 1rem;
}

/* Ensure all buttons with theme backgrounds have visible text */
button.bg-theme-primary,
a.bg-theme-primary,
button.bg-theme-primary.text-white,
a.bg-theme-primary.text-white {
    color: white !important;
}

button.bg-theme-primary:hover,
a.bg-theme-primary:hover,
button.bg-theme-primary.text-white:hover,
a.bg-theme-primary.text-white:hover {
    color: white !important;
}

button.bg-theme-secondary,
a.bg-theme-secondary,
button.bg-theme-secondary.text-white,
a.bg-theme-secondary.text-white {
    color: white !important;
}

button.bg-theme-secondary:hover,
a.bg-theme-secondary:hover,
button.bg-theme-secondary.text-white:hover,
a.bg-theme-secondary.text-white:hover {
    color: white !important;
}

/* Video Description */
.video-description {
    background: var(--theme-background);
    border-radius: var(--radius-lg);
    padding: var(--spacing-6);
    margin-top: var(--spacing-4);
    position: relative;
    z-index: 2;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.description-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.description-toggle {
    background: none;
    border: none;
    color: var(--theme-primary);
    font-weight: 600;
    cursor: pointer;
    padding: var(--spacing-2);
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.description-toggle:hover {
    background: #e2e8f0;
}

.description-content {
    color: #64748b;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.description-content.collapsed {
    max-height: 100px;
    overflow: hidden;
    position: relative;
}

.description-content.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(to bottom, transparent, var(--theme-background));
}

/* Related Videos Sidebar */
.related-videos {
    display: flex !important;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    position: relative;
    z-index: 10;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Ensure sidebar container is visible */
#sidebar-videos-container {
    display: flex !important;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    position: relative;
    z-index: 10;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Sidebar wrapper - ensure visibility */
div[class*="lg:col-span-1"] {
    position: relative !important;
    z-index: 10 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
}

/* Ensure grid layout works correctly */
.grid.grid-cols-1.lg\:grid-cols-3 {
    display: grid !important;
    grid-template-columns: 1fr !important;
}

@media (min-width: 1024px) {
    .grid.grid-cols-1.lg\:grid-cols-3 {
        grid-template-columns: 2fr 1fr !important;
    }
}

.related-video-card {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 12px;
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.related-video-card:hover {
    background: var(--theme-background);
    transform: translateX(4px);
    box-shadow: var(--theme-shadow-md);
}

.related-video-thumbnail {
    width: 168px;
    height: 94px;
    min-width: 168px;
    min-height: 94px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    background: #e2e8f0;
    overflow: hidden;
    position: relative;
}

.related-video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.related-video-info {
    flex: 1;
    min-width: 0;
}

.related-video-title {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--theme-text);
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.related-video-channel {
    font-size: var(--text-xs);
    color: #64748b;
    margin-bottom: 0.25rem;
}

.related-video-date {
    font-size: var(--text-xs);
    color: #64748b;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem 0;
}

.video-card {
    background: white;
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--theme-shadow-md);
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--theme-shadow-xl);
}

.video-card-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: var(--theme-text);
    overflow: hidden;
}

.video-card-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover .video-card-thumbnail img {
    transform: scale(1.05);
}

.video-card-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.video-card-info {
    padding: 1rem;
}

.video-card-title {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--theme-text);
    margin-bottom: var(--spacing-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.video-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: var(--text-xs);
    color: #64748b;
}

/* YouTube Comments Container */
.youtube-comments-container {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--spacing-6);
    margin-top: var(--spacing-8);
    box-shadow: var(--theme-shadow-md);
    position: relative;
    z-index: 3;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.youtube-comments-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--theme-text);
    margin-bottom: var(--spacing-6);
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.youtube-comments-title i {
    color: var(--theme-primary);
}

.youtube-comments-iframe {
    width: 100%;
    min-height: 600px;
    border: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Channel Banner */
.channel-banner {
    background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-secondary) 50%, var(--theme-accent) 100%);
    border-radius: var(--radius-xl);
    padding: var(--spacing-8);
    margin-bottom: var(--spacing-8);
    color: var(--theme-text-on-primary);
    box-shadow: 0 10px 15px -3px rgba(var(--theme-primary-rgb), 0.3);
}

.channel-banner-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.channel-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.channel-avatar i {
    font-size: 2.5rem;
    color: var(--theme-primary);
}

.channel-info h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.channel-info p {
    opacity: 0.9;
    font-size: 1rem;
}

/* Loading States */
.video-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: var(--theme-background);
    border-radius: var(--radius-xl);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--theme-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .video-meta {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .video-stats {
        width: 100%;
    }
    
    .subscribe-button-container {
        width: 100%;
    }
    
    .subscribe-btn {
        width: 100%;
        justify-content: center;
    }
    
    .related-video-card {
        flex-direction: column;
    }
    
    .related-video-thumbnail {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
    }
    
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .channel-banner-content {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 640px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
    
    .video-title {
        font-size: 1.25rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-card,
.related-video-card,
.video-info-section {
    animation: fadeIn 0.5s ease-out;
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-lg {
    box-shadow: var(--theme-shadow-lg);
}

.rounded-xl {
    border-radius: var(--radius-xl);
}

