
/* Enhanced Video Playlist Styles */
/* ================================ */

/* CSS Variables for consistent theming */
:root {
    --presto-primary: #be0002;
    --presto-primary-light: rgba(190, 0, 2, 0.1);
    --presto-primary-medium: rgba(190, 0, 2, 0.3);
    --presto-primary-dark: #9a0001;
    --presto-black: #000000;
    --presto-white: #ffffff;
    --presto-gray-50: #fafafa;
    --presto-gray-100: #f5f5f5;
    --presto-gray-200: #e5e5e5;
    --presto-gray-300: #d4d4d4;
    --presto-gray-600: #525252;
    --presto-gray-800: #262626;
    --presto-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --presto-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --presto-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
    --presto-shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.16);
    --presto-radius-sm: 8px;
    --presto-radius-md: 12px;
    --presto-radius-lg: 16px;
    --presto-radius-xl: 20px;
    --presto-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main Layout Container */
.presto-playlist-template {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    margin: 0 0 5px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
    font-feature-settings: 'rlig' 1, 'calt' 1;
    line-height: 1.5;
}

/* Video Player Container */
.presto-player-container {
    flex: 1;
    min-width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.presto-player-container::before {
    display: none; /* Remove the overlay effect */
}

/* Video Element Styling - This is where the magic happens */
.presto-player-container video,
.presto-player-container iframe,
.presto-player-container .video-wrapper,
.presto-player-container .presto-player {
    width: 100%;
    height: auto;
    display: block;
    background: var(--presto-black);
    border-radius: var(--presto-radius-lg);
    box-shadow: var(--presto-shadow-lg);
    transition: var(--presto-transition);
    overflow: hidden;
}

/* Hover effect on video itself */
.presto-player-container:hover video,
.presto-player-container:hover iframe,
.presto-player-container:hover .video-wrapper,
.presto-player-container:hover .presto-player {
    box-shadow: var(--presto-shadow-xl);
    transform: translateY(-4px);
}

/* Aspect Ratio Container (16:9 default) */
.presto-player-container .video-aspect-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: var(--presto-radius-lg);
    box-shadow: var(--presto-shadow-lg);
    transition: var(--presto-transition);
}

.presto-player-container:hover .video-aspect-wrapper {
    box-shadow: var(--presto-shadow-xl);
    transform: translateY(-4px);
}

.presto-player-container .video-aspect-wrapper video,
.presto-player-container .video-aspect-wrapper iframe,
.presto-player-container .video-aspect-wrapper .presto-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--presto-radius-lg);
    box-shadow: none; /* Remove duplicate shadow */
    transform: none; /* Remove duplicate transform */
}

/* For Presto Player specifically */
.presto-block-video:not(.presto-sticky-parent) {
    border-radius: var(--presto-radius-lg) !important;
    overflow: hidden;
    box-shadow: var(--presto-shadow-lg) !important;
    transition: var(--presto-transition) !important;
}

.presto-player-container:hover .presto-player-wrapper {
    box-shadow: var(--presto-shadow-xl) !important;
    transform: translateY(-4px) !important;
}

.presto-player-container::before {
    display: none; /* Removed - no longer needed */
}

.presto-player-container:hover {
    /* Remove container hover effects since we're styling the video directly */
}

.presto-player-container:hover::before {
    display: none; /* Remove overlay effect */
}

/* Playlist Wrapper */
.presto-playlist-wrapper {
    width: 100%;
    background: var(--presto-white);
    padding: 28px;
    border-radius: var(--presto-radius-xl);
    border: 1px solid var(--presto-gray-200);
    box-shadow: var(--presto-shadow-md);
    position: relative;
    backdrop-filter: blur(10px);
}

.presto-playlist-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--presto-primary), transparent);
    border-radius: 0 0 var(--presto-radius-sm) var(--presto-radius-sm);
}

/* Playlist Header (optional) */
.presto-playlist-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--presto-gray-100);
}

.presto-playlist-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--presto-black);
    display: flex;
    align-items: center;
    gap: 8px;
}

.presto-playlist-header .play-icon {
    width: 18px;
    height: 18px;
    background: var(--presto-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Playlist Styles */
.presto-playlist {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--presto-primary-medium) transparent;
}

/* Custom Scrollbar */
.presto-playlist::-webkit-scrollbar {
    width: 6px;
}

.presto-playlist::-webkit-scrollbar-track {
    background: var(--presto-gray-100);
    border-radius: 3px;
}

.presto-playlist::-webkit-scrollbar-thumb {
    background: var(--presto-primary-medium);
    border-radius: 3px;
    transition: background 0.2s ease;
}

.presto-playlist::-webkit-scrollbar-thumb:hover {
    background: var(--presto-primary);
}

/* Playlist Items */
.presto-playlist li {
    padding: 18px 20px;
    margin-bottom: 10px;
    background: var(--presto-gray-50);
    border-radius: var(--presto-radius-md);
    cursor: pointer;
    transition: var(--presto-transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
    user-select: none;
}

.presto-playlist li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(135deg, var(--presto-primary-light), var(--presto-primary-medium));
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

/* Hover States */
.presto-playlist li:hover {
    background: var(--presto-white);
    transform: translateX(6px);
    box-shadow: var(--presto-shadow-sm);
    border-color: var(--presto-gray-200);
}

.presto-playlist li:hover::before {
    width: 100%;
}

/* Active State */
.presto-playlist li.active {
    background: var(--presto-black);
    color: var(--presto-white);
    border-color: var(--presto-black);
    box-shadow: 0 7px 5px rgba(0, 0, 0, 0.2);
    transform: translateX(4px);
}

.presto-playlist li.active::before {
    background: linear-gradient(135deg, var(--presto-primary), var(--presto-primary-dark));
    width: 4px;
}

.presto-playlist li.active .presto-playlist-title {
    color: var(--presto-white);
}

.presto-playlist li.active .presto-playlist-duration {
    background: var(--presto-primary);
    color: var(--presto-white);
}

/* Title Section */
.presto-playlist-title {
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    z-index: 1;
    flex: 1;
    min-width: 0;
    color: var(--presto-gray-800);
}

.presto-playlist-title .video-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--presto-gray-200);
    color: var(--presto-gray-600);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
    transition: var(--presto-transition);
}

.presto-playlist li:hover .presto-playlist-title .video-number {
    background: var(--presto-primary);
    color: var(--presto-white);
    transform: scale(1.1);
}

.presto-playlist li.active .presto-playlist-title .video-number {
    background: var(--presto-primary);
    color: var(--presto-white);
    transform: scale(1.15);
}

.presto-playlist-title .title-text {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Duration Badge */
.presto-playlist-duration {
    color: var(--presto-gray-600);
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--presto-gray-200);
    padding: 6px 10px;
    border-radius: var(--presto-radius-sm);
    position: relative;
    z-index: 1;
    transition: var(--presto-transition);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.presto-playlist li:hover .presto-playlist-duration {
    background: var(--presto-primary-light);
    color: var(--presto-primary);
    transform: scale(1.05);
}

/* Loading and Error States */
.presto-loading, .presto-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    border-radius: var(--presto-radius-lg);
    font-weight: 500;
    font-size: 1rem;
    flex-direction: column;
    gap: 12px;
}

.presto-loading {
    background: var(--presto-gray-50);
    color: var(--presto-gray-600);
}

.presto-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--presto-gray-200);
    border-top: 3px solid var(--presto-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.presto-error {
    background: #fef2f2;
    color: var(--presto-primary);
    border: 1px solid var(--presto-primary-light);
}

/* Tablet Styles (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .presto-playlist-template {
        gap: 24px;
    }
    
    .presto-player-container {
        min-width: 320px;
        min-height: 240px;
    }
    
    .presto-playlist-wrapper {
        width: 340px;
        padding: 24px;
    }
    
    .presto-playlist {
        max-height: 360px;
    }
}

/* Mobile Styles (up to 768px) */
@media (max-width: 768px) {
    .presto-playlist-template {
        flex-direction: column;
        gap: 20px;
        margin: 0 0 5px 0;
    }
    
    .presto-player-container {
        min-width: 100%;
        order: 1;
        height: auto;
        min-height: 25px;
    }
    
    .presto-player-container .video-aspect-wrapper {
        padding-bottom: 56.25%; /* Maintain 16:9 on mobile */
    }
    
    .presto-playlist-wrapper {
        width: 100%;
        order: 2;
        padding: 20px;
        border-radius: var(--presto-radius-lg);
        box-shadow: var(--presto-shadow-sm);
    }
    
    .presto-playlist {
        max-height: 300px;
    }
    
    .presto-playlist li {
        padding: 16px 18px;
        margin-bottom: 8px;
        border-radius: 10px;
    }
    
    .presto-playlist-title {
        font-size: 0.9rem;
        gap: 12px;
    }
    
    .presto-playlist-title .video-number {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }
    
    .presto-playlist-duration {
        font-size: 0.75rem;
        padding: 5px 8px;
    }
}

/* Small Mobile (up to 480px) */
@media (max-width: 480px) {
    .presto-playlist-wrapper {
        padding: 16px;
        margin: 0;
    }
    
    .presto-playlist li {
        padding: 14px 16px;
    }
    
    .presto-playlist-title {
        font-size: 0.85rem;
        gap: 10px;
    }
    
    .presto-playlist-title .video-number {
        width: 20px;
        height: 20px;
        font-size: 0.65rem;
    }
    
    .presto-playlist-duration {
        font-size: 0.7rem;
        padding: 4px 6px;
    }
}

/* Enhanced Accessibility */
.presto-playlist li:focus {
    outline: 2px solid var(--presto-primary);
    outline-offset: 2px;
    z-index: 10;
}

.presto-playlist li:focus:not(:focus-visible) {
    outline: none;
}

/* Smooth Entrance Animations */
.presto-playlist li {
    opacity: 0;
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation delays */
.presto-playlist li:nth-child(1) { animation-delay: 0.1s; }
.presto-playlist li:nth-child(2) { animation-delay: 0.15s; }
.presto-playlist li:nth-child(3) { animation-delay: 0.2s; }
.presto-playlist li:nth-child(4) { animation-delay: 0.25s; }
.presto-playlist li:nth-child(5) { animation-delay: 0.3s; }
.presto-playlist li:nth-child(6) { animation-delay: 0.35s; }
.presto-playlist li:nth-child(n+7) { animation-delay: 0.4s; }