/* YouTube Playlist Plugin Styles */

.youtube-playlist-container {
    max-width: 100%;
    margin: 20px 0;
    font-family: Arial, sans-serif;
}

.youtube-player-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.youtube-playlist-container[data-position="top"] .youtube-player-wrapper,
.youtube-playlist-container[data-position="bottom"] .youtube-player-wrapper {
    flex-direction: column;
}

.youtube-playlist-container[data-position="left"] .youtube-player-wrapper {
    flex-direction: row;
}

.youtube-playlist-container[data-position="right"] .youtube-player-wrapper {
    flex-direction: row-reverse;
}

.youtube-playlist-container[data-position="over"] .youtube-player-wrapper {
    flex-direction: column;
}

.youtube-main-player {
    flex: 1;
    min-width: 0;
}

.youtube-main-player iframe {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
}

/* YouTube-like format for overlay position */
.youtube-playlist-container[data-position="over"] .youtube-main-player {
    width: 100%;
    position: relative;
}

.youtube-like-container {
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.video-and-playlist {
    display: flex;
    height: 500px;
    width: 100%;
}

.main-video-section {
    flex: 2;
    background: #000;
    position: relative;
}

.main-video-section iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.youtube-style-playlist {
    flex: 1;
    background: #212121;
    border-left: 1px solid #333;
    display: flex;
    flex-direction: column;
    max-width: 400px;
    min-width: 350px;
}

.playlist-header {
    padding: 16px;
    background: #181818;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.playlist-header h3 {
    color: white;
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.playlist-counter {
    color: #aaa;
    font-size: 14px;
}

.youtube-style-list {
    width: 100%;
    margin: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    overflow: hidden;
    height: 100%;
}

.youtube-playlist-scroll {
    height: 100%;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #666 #333;
}

.youtube-playlist-scroll::-webkit-scrollbar {
    width: 8px;
}

.youtube-playlist-scroll::-webkit-scrollbar-track {
    background: #333;
}

.youtube-playlist-scroll::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 4px;
}

.youtube-playlist-scroll::-webkit-scrollbar-thumb:hover {
    background: #888;
}

.youtube-item {
    padding: 8px 12px;
    border-bottom: 1px solid #333;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
    position: relative;
}

.youtube-item:hover {
    background: #333;
}

.youtube-item.active {
    background: #065fd4;
    border-left: none;
}

.youtube-item-number {
    color: #aaa;
    font-size: 14px;
    font-weight: 500;
    min-width: 20px;
    text-align: center;
}

.youtube-item.active .youtube-item-number {
    color: white;
}

.youtube-thumb {
    width: 100px;
    height: 56px;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.youtube-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.youtube-play {
    background: rgba(0,0,0,0.8);
    color: white;
    width: 20px;
    height: 20px;
    font-size: 8px;
    border-radius: 2px;
}

.youtube-item:hover .youtube-play {
    background: rgba(255,255,255,0.9);
    color: #000;
}

.youtube-info {
    flex: 1;
    min-width: 0;
}

.youtube-title {
    color: white;
    font-size: 13px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    font-weight: 400;
}

.youtube-item.active .youtube-title {
    color: white;
    font-weight: 500;
}

.now-playing-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.playing-text {
    background: #ff0000;
    color: white;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.video-info-section {
    background: #181818;
    padding: 16px;
    border-top: 1px solid #333;
}

.video-info-section h4 {
    color: white;
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.3;
}

/* Mobile responsive for YouTube-like format */
@media (max-width: 1024px) {
    .video-and-playlist {
        flex-direction: column;
        height: auto;
    }
    
    .main-video-section {
        height: 350px;
    }
    
    .youtube-style-playlist {
        max-width: 100%;
        min-width: 100%;
        max-height: 300px;
    }
    
    .youtube-item {
        padding: 6px 8px;
    }
    
    .youtube-thumb {
        width: 80px;
        height: 45px;
    }
    
    .youtube-title {
        font-size: 12px;
        -webkit-line-clamp: 1;
    }
}

@media (max-width: 768px) {
    .video-and-playlist {
        height: auto;
    }
    
    .main-video-section {
        height: 250px;
    }
    
    .youtube-style-playlist {
        max-height: 250px;
    }
    
    .playlist-header {
        padding: 12px;
    }
    
    .playlist-header h3 {
        font-size: 14px;
    }
    
    .youtube-item {
        padding: 4px 6px;
        gap: 6px;
    }
    
    .youtube-thumb {
        width: 60px;
        height: 34px;
    }
    
    .youtube-item-number {
        font-size: 12px;
        min-width: 15px;
    }
    
    .video-info-section {
        padding: 12px;
    }
    
    .video-info-section h4 {
        font-size: 16px;
    }
}

.current-video-title {
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 5px;
}

.current-video-title h4 {
    margin: 0;
    color: #333;
    font-size: 16px;
}

.youtube-playlist-list {
    width: 300px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.youtube-playlist-container[data-position="top"] .youtube-playlist-list,
.youtube-playlist-container[data-position="bottom"] .youtube-playlist-list {
    width: 100%;
    max-width: 800px;
}

/* Overlay Styles */
.playlist-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
}

.playlist-toggle-btn {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.playlist-toggle-btn:hover {
    background: rgba(255, 0, 0, 0.9);
}

.playlist-icon {
    font-size: 16px;
}

.playlist-overlay-content {
    position: relative;
    top: 0px;
    right: 0;
    width: 100%;
    max-height: 400px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 101;
}

.playlist-overlay-content.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Auto-show for overlay position */
.youtube-playlist-container[data-position="over"] .playlist-overlay-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.playlist-overlay-content .youtube-playlist-list {
    width: 100%;
    margin: 0;
    border-radius: 8px;
}

.playlist-overlay-content ul {
    max-height: 350px;
}

.youtube-playlist-list h3 {
    margin: 0;
    padding: 15px 20px;
    background: #ff0000;
    color: white;
    font-size: 16px;
    font-weight: bold;
}

.youtube-playlist-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
}

.playlist-item {
    display: flex;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: all 0.3s ease;
    align-items: center;
    gap: 12px;
}

.playlist-item:hover {
    background-color: #f5f5f5;
}

.playlist-item.active {
    background-color: #e3f2fd;
    border-left: 4px solid #ff0000;
}

.video-thumbnail {
    position: relative;
    width: 80px;
    height: 45px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    background: rgba(0,0,0,0.7);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.3s ease;
}

.playlist-item:hover .play-overlay {
    background: rgba(255,0,0,0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-info {
    flex: 1;
    min-width: 0;
}

.video-title {
    display: block;
    font-weight: 500;
    color: #333;
    font-size: 14px;
    line-height: 1.3;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-number {
    display: block;
    font-size: 12px;
    color: #666;
}

.playlist-item.active .video-title {
    color: #1976d2;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .youtube-player-wrapper {
        flex-direction: column !important;
    }
    
    .youtube-playlist-list {
        width: 100% !important;
    }
    
    .youtube-main-player iframe {
        height: 250px;
    }
    
    .youtube-playlist-container[data-position="over"] .youtube-main-player iframe {
        min-height: 300px;
    }
    
    .playlist-overlay-content {
        width: 300px;
        right: -10px;
    }
    
    .playlist-overlay {
        top: 5px;
        right: 5px;
    }
}

@media (max-width: 480px) {
    .playlist-overlay-content {
        width: 280px;
        right: -20px;
    }
    
    .youtube-playlist-container[data-position="over"] .youtube-main-player iframe {
        min-height: 250px;
    }
}