/**
 * YouTube Carousel Styles
 * 
 * @package YouTube_Carousel
 */

.yt-carousel-module {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Main Video Player */
.yt-main-video {
    margin-bottom: 20px;
}

.yt-video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.yt-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.yt-play-overlay:hover {
    background: rgba(0, 0, 0, 0.5);
}

.yt-play-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.yt-play-button {
    transition: transform 0.2s ease;
}

.yt-play-button:hover {
    transform: scale(1.1);
}

.yt-video-title {
    margin: 15px 0 0 0;
    font-size: 1.4em;
    font-weight: 600;
    line-height: 1.3;
    color: #333;
}

/* Thumbnail List */
.yt-thumbnail-list {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 0;
    scroll-behavior: smooth;
}

.yt-thumbnail-list::-webkit-scrollbar {
    height: 6px;
}

.yt-thumbnail-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.yt-thumbnail-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.yt-thumbnail-list::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.yt-thumbnail-item {
    flex: 0 0 auto;
    width: 200px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.yt-thumbnail-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.yt-thumbnail-item.active {
    box-shadow: 0 4px 16px rgba(255, 0, 0, 0.3);
    transform: translateY(-2px);
}

.yt-thumbnail {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: #000;
}

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

.yt-thumbnail-item:hover .yt-thumbnail img {
    transform: scale(1.05);
}

.yt-thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.yt-thumbnail-item:hover .yt-thumbnail-overlay {
    opacity: 1;
}

.yt-play-icon {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.yt-thumbnail-item:hover .yt-play-icon {
    transform: scale(1.1);
}

.yt-thumbnail-title {
    padding: 12px;
    margin: 0;
    font-size: 0.9em;
    font-weight: 500;
    line-height: 1.3;
    color: #333;
    height: 60px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Error Messages */
.ytc-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 20px 0;
}

/* Loading State */
.yt-carousel-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.yt-carousel-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #ff0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .yt-carousel-module {
        margin: 15px 0;
    }
    
    .yt-video-title {
        font-size: 1.2em;
    }
    
    .yt-thumbnail-item {
        width: 160px;
    }
    
    .yt-thumbnail-title {
        font-size: 0.85em;
        padding: 10px;
        height: 55px;
    }
    
    .yt-thumbnail-list {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .yt-thumbnail-item {
        width: 140px;
    }
    
    .yt-thumbnail-title {
        font-size: 0.8em;
        padding: 8px;
        height: 50px;
    }
    
    .yt-video-title {
        font-size: 1.1em;
    }
}

/* Admin Styles */
.ytc-usage-info {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.ytc-usage-info h2,
.ytc-usage-info h3 {
    margin-top: 0;
    color: #333;
}

.ytc-usage-info code {
    background: #fff;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    display: inline-block;
    margin: 5px 0;
    font-family: 'Courier New', monospace;
}

.ytc-usage-info ul,
.ytc-usage-info ol {
    margin-left: 20px;
}

.ytc-usage-info li {
    margin-bottom: 5px;
}

/* Template Styles */

/* Grid Template */
.yt-carousel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.yt-carousel-grid .yt-grid-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.yt-carousel-grid .yt-grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.yt-carousel-grid .yt-grid-thumbnail {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    overflow: hidden;
    background: #000;
}

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

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

.yt-carousel-grid .yt-grid-content {
    padding: 15px;
}

.yt-carousel-grid .yt-grid-title {
    margin: 0 0 8px 0;
    font-size: 1em;
    font-weight: 600;
    line-height: 1.3;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.yt-carousel-grid .yt-grid-description {
    margin: 0;
    font-size: 0.85em;
    color: #666;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* List Template */
.yt-carousel-list {
    margin: 20px 0;
}

.yt-carousel-list .yt-list-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    margin-bottom: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.yt-carousel-list .yt-list-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.yt-carousel-list .yt-list-thumbnail {
    flex: 0 0 160px;
    height: 90px;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
    position: relative;
}

.yt-carousel-list .yt-list-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.yt-carousel-list .yt-list-item:hover .yt-list-thumbnail img {
    transform: scale(1.05);
}

.yt-carousel-list .yt-list-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.yt-carousel-list .yt-list-title {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    font-weight: 600;
    line-height: 1.3;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.yt-carousel-list .yt-list-description {
    margin: 0;
    font-size: 0.9em;
    color: #666;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Compact Template */
.yt-carousel-compact {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 15px 0;
    margin: 20px 0;
    scroll-behavior: smooth;
}

.yt-carousel-compact::-webkit-scrollbar {
    height: 6px;
}

.yt-carousel-compact::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.yt-carousel-compact::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.yt-carousel-compact .yt-compact-item {
    flex: 0 0 auto;
    width: 120px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.yt-carousel-compact .yt-compact-item:hover {
    transform: translateY(-2px);
}

.yt-carousel-compact .yt-compact-thumbnail {
    width: 100%;
    height: 68px;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
    margin-bottom: 8px;
    position: relative;
}

.yt-carousel-compact .yt-compact-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.yt-carousel-compact .yt-compact-item:hover .yt-compact-thumbnail img {
    transform: scale(1.05);
}

.yt-carousel-compact .yt-compact-title {
    margin: 0;
    font-size: 0.75em;
    font-weight: 500;
    line-height: 1.2;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 28px;
}

/* Play Icon for Templates */
.yt-template-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.yt-grid-item:hover .yt-template-play-icon,
.yt-list-item:hover .yt-template-play-icon,
.yt-compact-item:hover .yt-template-play-icon {
    opacity: 1;
}

/* Responsive Design for Templates */
@media (max-width: 768px) {
    .yt-carousel-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 15px;
    }
    
    .yt-carousel-list .yt-list-item {
        flex-direction: column;
        gap: 10px;
    }
    
    .yt-carousel-list .yt-list-thumbnail {
        flex: none;
        width: 100%;
        height: 180px;
    }
    
    .yt-carousel-compact .yt-compact-item {
        width: 100px;
    }
    
    .yt-carousel-compact .yt-compact-thumbnail {
        height: 56px;
    }
}

@media (max-width: 480px) {
    .yt-carousel-grid {
        grid-template-columns: 1fr;
    }
    
    .yt-carousel-compact .yt-compact-item {
        width: 90px;
    }
    
    .yt-carousel-compact .yt-compact-thumbnail {
        height: 50px;
    }
    
    .yt-carousel-compact .yt-compact-title {
        font-size: 0.7em;
    }
}