/**
 * AI YouTube Feed Plugin - Frontend Styles
 * Version: 1.0.0
 * Author: Bitghost Development
 */

/* Container */
.aiytf-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Hero Video Section */
.aiytf-hero-container {
    margin-bottom: 40px;
}

.aiytf-hero-video {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.aiytf-video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.aiytf-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.aiytf-video-info {
    padding: 20px;
    background: #fff;
}

.aiytf-video-title {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.aiytf-video-date {
    margin: 0;
    font-size: 14px;
    color: #666;
}

/* Grid Section */
.aiytf-grid-section {
    margin-top: 50px;
}

.aiytf-grid-title {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 30px 0;
    color: #1a1a1a;
    text-align: center;
}

.aiytf-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.aiytf-grid-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.aiytf-grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.aiytf-thumbnail-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    overflow: hidden;
}

.aiytf-thumbnail-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.aiytf-grid-item:hover .aiytf-thumbnail-container img {
    transform: scale(1.05);
}

.aiytf-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 48px;
    transition: transform 0.2s ease;
}

.aiytf-grid-item:hover .aiytf-play-overlay {
    transform: translate(-50%, -50%) scale(1.1);
}

.aiytf-play-icon {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.aiytf-grid-video-info {
    padding: 15px;
}

.aiytf-grid-video-title {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aiytf-grid-video-date {
    margin: 0;
    font-size: 12px;
    color: #666;
}

/* Load More Button */
.aiytf-load-more-container {
    text-align: center;
    margin-top: 30px;
}

.aiytf-load-more {
    background: var(--aiytf-primary-color, #ff0000);
    color: #fff;
    border: none;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.aiytf-load-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0.9;
}

.aiytf-load-more:active {
    transform: translateY(0);
}

.aiytf-load-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.aiytf-load-more.loading {
    position: relative;
    color: transparent;
}

.aiytf-load-more.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: aiytf-spin 0.8s linear infinite;
}

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

/* Error Message */
.aiytf-error,
.aiytf-no-videos {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    text-align: center;
    margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 992px) {
    .aiytf-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .aiytf-video-title {
        font-size: 20px;
    }
    
    .aiytf-grid-title {
        font-size: 24px;
    }
}

@media (max-width: 768px) {
    .aiytf-container {
        padding: 15px;
    }
    
    .aiytf-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .aiytf-hero-container {
        margin-bottom: 30px;
    }
    
    .aiytf-video-title {
        font-size: 18px;
    }
    
    .aiytf-grid-title {
        font-size: 22px;
        margin-bottom: 20px;
    }
    
    .aiytf-video-info,
    .aiytf-grid-video-info {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .aiytf-video-title {
        font-size: 16px;
    }
    
    .aiytf-grid-title {
        font-size: 20px;
    }
    
    .aiytf-load-more {
        width: 100%;
        padding: 12px 24px;
    }
}

/* Active Video State */
.aiytf-grid-item.active {
    outline: 3px solid var(--aiytf-primary-color, #ff0000);
    outline-offset: 2px;
}

/* Loading State */
.aiytf-container.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Fade-in Animation */
@keyframes aiytf-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aiytf-grid-item {
    animation: aiytf-fade-in 0.3s ease;
}

/* Print Styles */
@media print {
    .aiytf-load-more-container {
        display: none;
    }
    
    .aiytf-play-overlay {
        display: none;
    }
}
