/* YouTube Widget Styling */

.youtube-widget {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.widget-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.widget-header .fab.fa-youtube {
    color: #ff0000;
}

.channel-link {
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    transition: color 0.3s ease;
}

.channel-link:hover {
    color: #ff0000;
}

.videos-list {
    max-height: 600px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.videos-list::-webkit-scrollbar {
    width: 6px;
}

.videos-list::-webkit-scrollbar-track {
    background: transparent;
}

.videos-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.video-item {
    display: flex;
    gap: 12px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.video-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(5px);
}

.video-item:last-child {
    border-bottom: none;
}

.video-thumbnail {
    position: relative;
    flex-shrink: 0;
    width: 120px;
    height: 68px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}

.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);
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background: rgba(255, 0, 0, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    opacity: 0.8;
    transition: all 0.3s ease;
}

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

.video-duration {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.8);
    color: #ff0000;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.video-content {
    flex: 1;
    min-width: 0;
}

.video-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 8px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-description {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 10px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.video-time {
    display: flex;
    align-items: center;
    gap: 4px;
}

.video-channel {
    font-weight: 600;
    color: #ff0000;
}

.widget-footer {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.view-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.view-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3);
    background: linear-gradient(135deg, #ff1a1a 0%, #e60000 100%);
}

.error-message {
    padding: 40px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
}

.error-message i {
    font-size: 24px;
    color: #fbbf24;
    margin-bottom: 15px;
}

.error-message p {
    margin: 0 0 15px 0;
    font-size: 14px;
}

.retry-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Loading state */
.youtube-widget.loading {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: rgba(255, 255, 255, 0.7);
}

.spinner-ring {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #ff0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .video-item {
        padding: 12px 15px;
        gap: 12px;
    }
    
    .video-thumbnail {
        width: 100px;
        height: 56px;
    }
    
    .video-title {
        font-size: 13px;
        -webkit-line-clamp: 3;
    }
    
    .video-description {
        font-size: 11px;
        -webkit-line-clamp: 1;
    }
    
    .widget-header {
        padding: 15px;
    }
    
    .widget-header h3 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .video-item {
        flex-direction: column;
        gap: 10px;
    }
    
    .video-thumbnail {
        width: 100%;
        height: 180px;
    }
    
    .video-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* Integration with existing video gallery */
.youtube-widget.in-sidebar {
    border-radius: 12px;
    margin-bottom: 20px;
}

.youtube-widget.in-sidebar .videos-list {
    max-height: 400px;
}

.youtube-widget.in-sidebar .video-item {
    padding: 12px 15px;
}

.youtube-widget.in-sidebar .video-thumbnail {
    width: 70px;
    height: 40px;
}

/* Dark theme optimization */
.youtube-widget {
    color: #fff;
}

.video-item:hover {
    background: rgba(255, 0, 0, 0.05);
}

/* Smooth animations */
.video-item {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom scrollbar for better UX */
.videos-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 0, 0, 0.3) transparent;
}

.videos-list::-webkit-scrollbar {
    width: 6px;
}

.videos-list::-webkit-scrollbar-track {
    background: transparent;
}

.videos-list::-webkit-scrollbar-thumb {
    background: rgba(255, 0, 0, 0.3);
    border-radius: 3px;
}

.videos-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 0, 0, 0.5);
}
