/**
 * Frontend Premium Dark UI Styles for VeloDeck Grid Playlist
 */

/* Grid Wrapper & Container */
.velodeck-wrapper {
    --vd-bg-primary: #141414;
    --vd-bg-secondary: #1a1a1a;
    --vd-bg-card-hover: #262626;
    --vd-bg-card-active: #2d2d2d;
    --vd-accent-color: #e50914;
    /* Premium brand Netflix red */
    --vd-text-primary: #ffffff;
    --vd-text-secondary: #aaaaaa;
    --vd-text-accent: #ff4d4d;
    --vd-border-color: #333333;
    --vd-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    background-color: var(--vd-bg-primary);
    border-radius: 12px;
    padding: 24px;
    color: var(--vd-text-primary);
    font-family: var(--vd-font-family);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    margin: 20px 0;
    box-sizing: border-box;
}

.velodeck-wrapper * {
    box-sizing: border-box;
}

.velodeck-container {
    display: flex;
    gap: 24px;
    align-items: stretch;
}

/* Empty Playlist Style */
.velodeck-empty-playlist {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 40px;
    text-align: center;
    border-radius: 8px;
    color: #aaa;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Left Column: Player Viewport */
.velodeck-player-col {
    flex: 1 1 65%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.velodeck-embed-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--vd-border-color);
}

.velodeck-video-element {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    object-fit: contain;
}

/* Details Overlay below player */
.velodeck-playing-details {
    margin-top: 18px;
}

.velodeck-badge-playing {
    display: inline-block;
    background-color: var(--vd-accent-color);
    color: #fff;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    letter-spacing: 0.8px;
    animation: pulse 2s infinite ease-in-out;
}

.velodeck-playing-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--vd-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Right Column: Playlist queue list */
.velodeck-playlist-col {
    flex: 0 0 35%;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    background-color: var(--vd-bg-secondary);
    border: 1px solid var(--vd-border-color);
    padding: 16px;
}

.velodeck-playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--vd-border-color);
    margin-bottom: 12px;
}

.velodeck-playlist-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--vd-text-primary);
}

.velodeck-video-count {
    font-size: 12px;
    color: var(--vd-text-secondary);
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 8px;
    border-radius: 12px;
}

.velodeck-playlist-scrollable {
    flex: 1;
    overflow-y: auto;
    max-height: 480px;
    /* Custom limit matching 16:9 standard preview height */
}

/* Sleek Scrollbar */
.velodeck-playlist-scrollable::-webkit-scrollbar {
    width: 6px;
}

.velodeck-playlist-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.velodeck-playlist-scrollable::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.velodeck-playlist-scrollable::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.35);
}

.velodeck-playlist-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Playlist Card */
.velodeck-playlist-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.velodeck-playlist-card:last-child {
    margin-bottom: 0;
}

.velodeck-playlist-card:hover {
    background-color: var(--vd-bg-card-hover);
}

/* Active card styles */
.velodeck-playlist-card.is-active {
    background-color: var(--vd-bg-card-active);
    border-left: 3px solid var(--vd-accent-color);
    padding-left: 5px;
    /* Compenses for the border width */
}

.velodeck-playlist-card.is-active .velodeck-card-title {
    color: var(--vd-text-accent);
}

.velodeck-playlist-card.is-active .velodeck-card-index {
    color: var(--vd-accent-color);
    font-weight: 700;
}

/* Card Elements */
.velodeck-card-index {
    font-size: 12px;
    color: var(--vd-text-secondary);
    font-weight: 500;
    min-width: 16px;
    text-align: center;
}

.velodeck-card-thumb {
    position: relative;
    width: 96px;
    height: 54px;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.velodeck-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Card media fallback */
.velodeck-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0.8;
}

.velodeck-card-placeholder .dashicons {
    font-size: 20px;
    width: auto;
    height: auto;
}

/* Play button overlay */
.velodeck-card-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.velodeck-playlist-card:hover .velodeck-card-play-overlay,
.velodeck-playlist-card.is-active .velodeck-card-play-overlay {
    opacity: 1;
}

.velodeck-play-icon {
    color: #fff;
    background: var(--vd-accent-color);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    transform: scale(0.85);
    transition: transform 0.2s ease-in-out;
}

.velodeck-playlist-card:hover .velodeck-play-icon {
    transform: scale(1);
}

/* Card details text info */
.velodeck-card-info {
    flex: 1;
    min-width: 0;
    /* Important for line-clamping */
}

.velodeck-card-title {
    margin: 0 0 4px 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--vd-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.velodeck-card-type {
    font-size: 10px;
    color: var(--vd-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Animations */
@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }

    100% {
        opacity: 1;
    }
}

/* --- MOBILE RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 991px) {
    .velodeck-container {
        flex-direction: column;
        gap: 20px;
    }

    .velodeck-player-col {
        flex: 1 1 auto;
    }

    .velodeck-playlist-col {
        flex: 1 1 auto;
        width: 100%;
        min-width: 100%;
    }

    .velodeck-playlist-scrollable {
        max-height: 380px;
        /* Reduced scrollable viewport height on smaller screens */
    }
}

@media (max-width: 480px) {
    .velodeck-wrapper {
        padding: 12px;
    }

    .velodeck-playing-title {
        font-size: 18px;
    }

    .velodeck-card-index {
        display: none;
        /* Hide card indices on very narrow screens for compactness */
    }

    .velodeck-playlist-card {
        gap: 10px;
        padding: 8px 4px;
    }

    .velodeck-card-thumb {
        width: 80px;
        height: 45px;
    }

    .velodeck-card-title {
        font-size: 12px;
    }
}