/**
 * Public styles for Video Playlist Manager
 */

/* Main container */
.vpm-playlist-container {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.vpm-playlist-title {
    font-size: 22px;
    margin-bottom: 15px;
}

/* Flex layout for player and playlist */
.vpm-flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* Video player */
.vpm-player-container {
    flex: 1;
    min-width: 300px;
}

.vpm-video-wrapper {
    position: relative;
    width: 100%;
}

.vpm-video-wrapper iframe,
.vpm-video-wrapper video {
    display: block;
    max-width: 100%;
    border: none;
}

/* Playlist */
.vpm-playlist {
    flex: 0 0 300px;
    max-width: 100%;
    max-height: 500px;
    overflow-y: auto;
    background: #f7f7f7;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
}

/* Playlist items */
.vpm-playlist-item {
    display: flex;
    flex-wrap: wrap;
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #e5e5e5;
    transition: background-color 0.2s;
}

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

.vpm-playlist-item:hover {
    background-color: #f0f0f0;
}

.vpm-playlist-item.vpm-active {
    background-color: #e6f0f5;
    border-left: 3px solid #0073aa;
}

/* Thumbnail */
.vpm-thumbnail {
    flex: 0 0 80px;
    height: 60px;
    margin-right: 10px;
    overflow: hidden;
    position: relative;
}

.vpm-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vpm-no-thumbnail {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #eee;
    color: #666;
}

/* Video info */
.vpm-video-info {
    flex: 1;
    min-width: 0;
}

.vpm-video-title {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vpm-video-description {
    font-size: 12px;
    color: #666;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Watched status */
.vpm-watched-badge {
    display: inline-block;
    font-size: 11px;
    background: #0073aa;
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    margin-top: 5px;
}

.vpm-playlist-item.vpm-watched {
    opacity: 0.7;
}

.vpm-playlist-item.vpm-watched .vpm-thumbnail:after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 115, 170, 0.8);
    color: #fff;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
}

/* Watch toggle button */
.vpm-watch-toggle {
    width: 100%;
    margin-top: 8px;
    text-align: right;
}

.vpm-toggle-watched {
    background: none;
    border: none;
    font-size: 12px;
    color: #0073aa;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.vpm-toggle-watched:hover {
    background-color: #f0f0f0;
    text-decoration: underline;
}

.vpm-mark-watched,
.vpm-mark-unwatched {
    display: none;
}

.vpm-playlist-item:not(.vpm-watched) .vpm-mark-watched {
    display: inline;
}

.vpm-playlist-item.vpm-watched .vpm-mark-unwatched {
    display: inline;
}

/* Responsive styles */
@media (max-width: 768px) {
    .vpm-flex-container {
        flex-direction: column;
    }
    
    .vpm-player-container,
    .vpm-playlist {
        flex: 1 1 100%;
        width: 100%;
    }
    
    .vpm-player-container {
        margin-bottom: 15px;
    }
}

/* Themes */
.vpm-theme-dark {
    color: #fff;
}

.vpm-theme-dark .vpm-playlist {
    background: #222;
    border-color: #333;
}

.vpm-theme-dark .vpm-playlist-item {
    border-color: #333;
}

.vpm-theme-dark .vpm-playlist-item:hover {
    background-color: #333;
}

.vpm-theme-dark .vpm-playlist-item.vpm-active {
    background-color: #2c3e50;
    border-left-color: #3498db;
}

.vpm-theme-dark .vpm-video-title {
    color: #fff;
}

.vpm-theme-dark .vpm-video-description {
    color: #aaa;
}

.vpm-theme-dark .vpm-no-thumbnail {
    background-color: #333;
    color: #aaa;
}

.vpm-theme-dark .vpm-watched-badge {
    background: #3498db;
}

.vpm-theme-dark .vpm-toggle-watched {
    color: #3498db;
}

.vpm-theme-dark .vpm-toggle-watched:hover {
    background-color: #333;
}
