/**
 * Frontend Premium Dark UI Styles for NDNR VeloDeck Grid Playlist (CPT & Tabs Refactored)
 */

/* Grid Wrapper & Container */
.ndnr-velodeck-wrapper {
    --vd-bg-primary: #0577bd;
    /* User custom background color */
    --vd-bg-secondary: #1a1a1a73;
    --vd-bg-card-hover: #262626;
    --vd-bg-card-active: #2d2d2d;
    --vd-accent-color: #9fcf67c2;
    /* Brand accent Netflix-style red */
    --vd-text-primary: #ffffff;
    --vd-text-secondary: #aaaaaa;
    --vd-text-accent: #9fcf67;
    --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;
}

.ndnr-velodeck-wrapper * {
    box-sizing: border-box;
}

.ndnr-velodeck-container {
    display: flex;
    gap: 24px;
    align-items: stretch;
}

/* Empty Playlist Style */
.ndnr-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 */
.ndnr-velodeck-player-col {
    flex: 1 1 65%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ndnr-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);
}

.ndnr-velodeck-video-element {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    object-fit: contain;
}

/* Details Overlay below player */
.ndnr-velodeck-playing-details {
    margin-top: 18px;
}

.ndnr-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: ndnr_pulse 2s infinite ease-in-out;
}

.ndnr-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;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Right Column: Playlist queue list */
.ndnr-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;
    height: 500px;
}

.ndnr-velodeck-playlist-header {
    display: flex;
    flex-direction: column;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--vd-border-color);
    margin-bottom: 12px;
}

/* Tabs switcher styling */
.ndnr-velodeck-public-tabs {
    display: flex;
    gap: 12px;
    width: 100%;
}

.ndnr-velodeck-tab-btn {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--vd-text-secondary);
    transition: color 0.2s ease-in-out, border-color 0.2s ease-in-out;
    text-align: center;
}

.ndnr-velodeck-tab-btn:hover {
    color: var(--vd-text-primary);
}

.ndnr-velodeck-tab-btn.active {
    color: var(--vd-text-primary);
    border-bottom-color: var(--vd-accent-color);
}

.ndnr-velodeck-playlist-scrollable {
    display: none;
    /* Hidden by default */
    overflow-y: auto;
    max-height: 480px;
    /* Custom limit matching 16:9 standard preview height */
}

.ndnr-velodeck-playlist-scrollable.active {
    display: block;
    /* Show active tab */
}

/* Sleek Scrollbar */
.ndnr-velodeck-playlist-scrollable::-webkit-scrollbar {
    width: 6px;
}

.ndnr-velodeck-playlist-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.ndnr-velodeck-playlist-scrollable::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.ndnr-velodeck-playlist-scrollable::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.35);
}

.ndnr-velodeck-playlist-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Playlist Card */
.ndnr-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;
}

.ndnr-velodeck-playlist-card:last-child {
    margin-bottom: 0;
}

.ndnr-velodeck-playlist-card:hover {
    background-color: var(--vd-bg-card-hover);
}

/* Active card styles */
.ndnr-velodeck-playlist-card.is-active {
    background-color: var(--vd-bg-card-active);
    border-left: 3px solid var(--vd-accent-color);
    padding-left: 5px;
}

.ndnr-velodeck-playlist-card.is-active .ndnr-velodeck-card-title {
    color: var(--vd-text-accent);
}

.ndnr-velodeck-playlist-card.is-active .ndnr-velodeck-card-index {
    color: var(--vd-accent-color);
    font-weight: 700;
}

/* Card Elements */
.ndnr-velodeck-card-index {
    font-size: 12px;
    color: var(--vd-text-secondary);
    font-weight: 500;
    min-width: 16px;
    text-align: center;
}

.ndnr-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);
}

.ndnr-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Card media fallback */
.ndnr-velodeck-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #111111 0%, #1c1c1c 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--vd-text-accent);
    border-radius: 4px;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.85);
}

.ndnr-velodeck-card-placeholder .dashicons {
    font-size: 20px;
    width: auto;
    height: auto;
    color: var(--vd-text-accent);
}

/* Play button overlay */
.ndnr-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;
}

.ndnr-velodeck-playlist-card:hover .ndnr-velodeck-card-play-overlay,
.ndnr-velodeck-playlist-card.is-active .ndnr-velodeck-card-play-overlay {
    opacity: 1;
}

.ndnr-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;
}

.ndnr-velodeck-playlist-card:hover .ndnr-velodeck-play-icon {
    transform: scale(1);
}

/* Card details text info */
.ndnr-velodeck-card-info {
    flex: 1;
    min-width: 0;
}

.ndnr-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;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ndnr-velodeck-card-type {
    font-size: 10px;
    color: var(--vd-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Animations */
@keyframes ndnr_pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }

    100% {
        opacity: 1;
    }
}

/* --- MOBILE RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 991px) {
    .ndnr-velodeck-container {
        flex-direction: column;
        gap: 20px;
    }

    .ndnr-velodeck-player-col {
        flex: 1 1 auto;
    }

    .ndnr-velodeck-playlist-col {
        flex: 1 1 auto;
        width: 100%;
        min-width: 100%;
    }

    .ndnr-velodeck-playlist-scrollable {
        max-height: 380px;
    }
}

@media (max-width: 480px) {
    .ndnr-velodeck-wrapper {
        padding: 12px;
    }

    .ndnr-velodeck-playing-title {
        font-size: 18px;
    }

    .ndnr-velodeck-card-index {
        display: none;
    }

    .ndnr-velodeck-playlist-card {
        gap: 10px;
        padding: 8px 4px;
    }

    .ndnr-card-thumb {
        width: 80px;
        height: 45px;
    }

    .ndnr-velodeck-card-title {
        font-size: 12px;
    }
}

/* --- B: Short-Form Reels Slider Layout --- */
.ndnr-velodeck-reels-layout {
    display: flex;
    flex-direction: row;
    gap: 20px;
    width: 100%;
}

.ndnr-velodeck-reels-left {
    flex: 0 0 30%;
    width: 30%;
    aspect-ratio: 9 / 16;
}

.ndnr-velodeck-reels-right {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.ndnr-velodeck-reels-header {
    text-align: left;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--vd-border-color);
    padding-bottom: 16px;
}

.ndnr-velodeck-reels-header .ndnr-velodeck-main-title {
    font-size: 24px;
    font-weight: 700;
    margin: 8px 0 0 0;
    color: var(--vd-text-primary);
}

.ndnr-velodeck-reels-player-viewport {
    aspect-ratio: 9 / 16;
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    border: 2px solid var(--vd-border-color);
    overflow: hidden;
}

.ndnr-velodeck-reels-slider {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--vd-bg-secondary);
    border: 1px solid var(--vd-border-color);
    padding: 16px;
    border-radius: 8px;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.ndnr-velodeck-slider-arrow {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--vd-text-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
    flex-shrink: 0;
    font-size: 14px;
}

.ndnr-velodeck-slider-arrow:hover {
    background-color: var(--vd-accent-color);
    border-color: var(--vd-accent-color);
}

.ndnr-velodeck-slider-arrow:active {
    transform: scale(0.95);
}

.ndnr-velodeck-slider-track {
    flex: 1;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding: 4px 0;
    scroll-snap-type: x mandatory;
}

/* Hide scrollbar for slider track */
.ndnr-velodeck-slider-track::-webkit-scrollbar {
    display: none;
}

.ndnr-velodeck-slider-track {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.ndnr-velodeck-reels-slider .ndnr-velodeck-playlist-list {
    display: flex;
    flex-direction: row !important;
    gap: 12px;
    margin: 0;
    padding: 0;
}

.ndnr-velodeck-reels-slider .ndnr-velodeck-playlist-card {
    flex: 0 0 170px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0px;
    padding: 0px;
    transition: all 0.2s ease-in-out;
    background: transparent;
    border: none;
    scroll-snap-align: start;
}

.ndnr-velodeck-reels-slider .ndnr-velodeck-playlist-card:hover {
    transform: translateY(-2px);
}

.ndnr-velodeck-reels-slider .ndnr-velodeck-playlist-card.is-active .ndnr-card-thumb {
    border-color: var(--vd-accent-color);
}

.ndnr-velodeck-reels-slider .ndnr-card-thumb {
    width: 170px;
    height: 250px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 6px;
    position: relative;
    flex-shrink: 0;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.ndnr-velodeck-reels-slider .ndnr-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ndnr-velodeck-reels-slider .ndnr-velodeck-card-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #111111 0%, #1c1c1c 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.85);
}

.ndnr-velodeck-reels-slider .ndnr-velodeck-card-placeholder .dashicons {
    color: var(--vd-text-accent);
    font-size: 24px;
    width: auto;
    height: auto;
}

.ndnr-velodeck-reels-slider .ndnr-velodeck-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
    padding: 24px 6px 8px 6px;
    text-align: center;
    pointer-events: none;
    z-index: 2;
}

.ndnr-velodeck-reels-slider .ndnr-velodeck-card-title {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Responsive grid changes for reels layout */
@media (max-width: 768px) {
    .ndnr-velodeck-reels-layout {
        flex-direction: column;
        gap: 20px;
    }

    .ndnr-velodeck-reels-left {
        width: 100%;
        max-width: 100%;
        flex: 0 0 auto;
        aspect-ratio: 9 / 16;
    }

    .ndnr-velodeck-reels-right {
        width: 100%;
    }

    .ndnr-velodeck-reels-header {
        text-align: center;
    }
}