/* YouTube Playlist Player Styles - Horizontal Compact Design */

/* Main YouTube Playlist Container */
.youtube-playlist-container {
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(74, 144, 226, 0.12);
    box-shadow: 0 16px 50px rgba(0,0,0,0.08);
    border-radius: 22px;
    overflow: hidden;
}

/* Playlist Header */
.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #e9ecef;
    flex-wrap: wrap;
    gap: 1rem;
}

.playlist-header h3 {
    font-size: 1.3rem;
    color: #333;
    font-weight: 600;
    margin: 0;
}

.video-count {
    background: rgba(74, 144, 226, 0.1);
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0;
}

/* Playlist Layout - Horizontal Design */
.playlist-layout {
    display: flex;
    flex-direction: row;
    max-height: 590px;
}

/* Main Player Section - Left side of horizontal layout */
.main-player-section {
    flex: 1;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.player-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 100%);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 15px;
}

.player-wrapper .placeholder-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #cccccc;
    font-size: 1.1rem;
    z-index: 1;
}

.player-wrapper .placeholder-content i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

/* Current Video Info - Compact horizontal info */
.current-video-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    min-height: 50px;
}

.current-video-info.no-video {
    opacity: 0.7;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 50%);
}

.current-video-thumbnail {
    width: 60px;
    height: 34px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f0f0f0;
}

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

.current-video-details {
    flex: 1;
    min-width: 0;
}

.current-video-info h4 {
    font-size: 1rem;
    color: #333;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    line-height: 1.2;
}

.video-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #666;
    margin: 0;
}

.video-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Playlist Sidebar - Right side horizontal section */
.playlist-sidebar {
    width: 320px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.playlist-sidebar-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.playlist-sidebar-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #333;
    font-weight: 600;
}

.playlist-header-sidebar {
    display: none; /* Hide duplicate header */
}

/* Playlist Items - Full height scrollable list */
.playlist-items {
    background-color: #e9ecef;
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
    padding: 1rem;
}

.playlist-items::-webkit-scrollbar {
    width: 6px;
}

.playlist-items::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.playlist-items::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #4A90E2 0%, #667eea 100%);
    border-radius: 3px;
}

.playlist-items::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #3a7bc8 0%, #5a6fd8 100%);
}

/* Playlist Item - Column-based design with background image */
.playlist-item {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
}

.playlist-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.85);
}

.playlist-item.current {
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.25);
    border: 2px solid var(--primary-color);
    background: rgba(255, 255, 255, 0.9);
}

.video-thumbnail-bg {
    width: 100%;
    height: 120px;
    background-size: cover;
    background-position: center 10%;
    background-repeat: no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.7) 100%);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0.75rem;
}

.playlist-item .video-number {
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    background: rgba(0,0,0,0.5);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    align-self: flex-start;
}

.play-overlay {
    background: rgba(74, 144, 226, 0.9);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    transition: all 0.3s ease;
    align-self: center;
}

.playlist-item:hover .play-overlay {
    background: rgba(74, 144, 226, 1);
    transform: scale(1.1);
}

.video-info {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(5px);
    border-radius: 0 0 12px 12px;
}

.video-title {
    display: block;
    font-weight: 600;
    color: #333;
    font-size: 0.85rem;
    margin: 0 0 0.25rem 0;
    line-height: 1.3;
}

.video-channel {
    display: block;
    color: #666;
    font-size: 0.75rem;
    margin: 0;
    opacity: 0.8;
}

/* Loading States */
.loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
    width: 100%;              /* take full row width so centering works */
    min-height: 140px;        /* ensure visible centered area */
    text-align: center;       /* center any text inside */
    margin: 0 auto;           /* guard against grid/flex parent offset */
}

.loading-placeholder::before {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* Skeleton Loader */
.skeleton-rect,
.skeleton-line {
    position: relative;
    overflow: hidden;
    background: #e9ecef;
    border-radius: 6px;
}

.skeleton-line {
    height: 12px;
    margin: 8px 0;
}

.skeleton-fill { /* fill its positioned parent */
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}

/* Shimmer effect */
.skeleton-rect::after,
.skeleton-line::after {
    content: "";
    position: absolute;
    top: 0; left: -150%;
    height: 100%; width: 150%;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.6) 50%, rgba(255,255,255,0) 100%);
    animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(0); }
    100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton-rect::after,
    .skeleton-line::after {
        animation: none;
    }
}

/* Utility sizes for skeletons */
.w-20 { width: 20%; }
.w-40 { width: 40%; }
.w-50 { width: 50%; }
.w-60 { width: 60%; }
.w-80 { width: 80%; }
.w-90 { width: 90%; }
.h-20 { height: 20px; }
.h-120 { height: 120px; }

/* Responsive Design */
@media (max-width: 768px) {
    .youtube-playlist-container {
        border-radius: 18px;
        margin: 0 0.5rem;
        max-width: none;
    }
    
    .playlist-header {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        padding: 1rem;
        text-align: center;
    }
    
    .playlist-header h3 {
        font-size: 1.2rem;
    }
    
    .main-player-section {
        padding: 1rem;
    }
    
    .player-wrapper {
        border-radius: 12px;
        margin-bottom: 1rem;
    }
    
    .current-video-info {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .current-video-thumbnail {
        width: 80px;
        height: 45px;
        margin: 0 auto;
    }
    
    .current-video-info h4 {
        font-size: 0.95rem;
        white-space: normal;
        line-height: 1.3;
    }
    
    .video-meta {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .player-controls {
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
    
    .control-btn.play-btn {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }
    
    .playlist-items {
        max-height: 200px;
    }
    
    .playlist-item {
        padding: 0.9rem 1rem;
        gap: 0.8rem;
    }
    
    .video-thumbnail {
        width: 42px;
        height: 24px;
    }
    
    .playlist-item .video-number {
        min-width: 22px;
        font-size: 0.85rem;
    }
    
    .video-title {
        font-size: 0.9rem;
    }
    
    .video-channel {
        font-size: 0.8rem;
    }
}

/* Responsive Design for Horizontal Layout */
@media (max-width: 1024px) {
    .youtube-playlist-container {
        max-width: 95%;
    }
    
    .playlist-sidebar {
        width: 320px;
    }
}

@media (max-width: 768px) {
    /* Switch to vertical layout on mobile */
    .playlist-layout {
        flex-direction: column;
        min-height: auto;
        max-height: none; /* remove desktop cap so list can grow */
    }
    
    .main-player-section {
        padding: 1rem;
    }
    
    .playlist-sidebar {
        width: 100%;
    }
    
    .playlist-items {
        max-height: 330px; /* increased for better visibility on mobile */
        padding: 0.5rem;
    }
    
    .video-thumbnail-bg {
        height: 100px;
    }
    
    .playlist-item {
        margin-bottom: 0.5rem;
    }
    
    .playlist-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .youtube-playlist-container {
        border-radius: 15px;
        margin: 0 0.25rem;
    }
    .playlist-layout { max-height: none; }
    
    .playlist-header {
        padding: 0.8rem;
        gap: 0.4rem;
    }
    
    .playlist-header h3 {
        font-size: 1.05rem;
    }
    
    .main-player-section {
        padding: 0.8rem;
    }
    
    .player-wrapper {
        border-radius: 10px;
        margin-bottom: 0.8rem;
    }
    
    .current-video-info {
        padding: 0.6rem;
        gap: 0.5rem;
    }
    
    .current-video-thumbnail {
        width: 70px;
        height: 39px;
    }
    
    .current-video-info h4 {
        font-size: 0.9rem;
    }
    
    .video-meta {
        font-size: 0.8rem;
    }
    
    .player-controls {
        gap: 0.5rem;
        padding: 0.6rem;
    }
    
    .control-btn {
        width: 38px;
        height: 38px;
        font-size: 0.85rem;
    }
    
    .control-btn.play-btn {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }
    
    .playlist-items {
        max-height: 260px; /* increased for small phones */
        padding: 0.5rem;
    }
    
    .video-thumbnail-bg {
        height: 80px;
    }
    
    .playlist-item {
        margin-bottom: 0.5rem;
    }
    
    .video-info {
        padding: 0.75rem;
    }

    .video-title {
        font-size: 0.85rem;
    }
    
    .video-channel {
        font-size: 0.7rem;
    }
}

/* Integration with existing video modal */
.video-modal .modal-content {
    max-width: 1000px;
    width: 95%;
}

.video-modal .youtube-playlist-container {
    box-shadow: none;
    border-radius: 0;
    border: none;
}

/* Dark mode support to match site theme (scoped to video tab) */
@media (prefers-color-scheme: dark) {
    #video-tab .youtube-playlist-container {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
        border-color: rgba(74, 144, 226, 0.2);
    }
    
    #video-tab .playlist-header {
        background: linear-gradient(135deg, #2d2d2d 0%, #404040 100%);
        border-bottom-color: #404040;
    }
    
    #video-tab .playlist-header h3 {
        color: white;
    }
    
    #video-tab .playlist-description {
        color: #cccccc;
    }
    
    #video-tab .main-player-section {
        background: linear-gradient(135deg, #2d2d2d 0%, #404040 100%);
        border-bottom-color: #404040;
    }
    
    #video-tab .current-video-info {
        background: #1a1a1a;
    }
    
    #video-tab .current-video-info h4 {
        color: white;
    }
    
    #video-tab .video-meta {
        color: #aaaaaa;
    }
    /* Override global pill background from sections.css */
    #video-tab .video-meta span {
        background: rgba(255, 255, 255, 0.08) !important;
        color: #dddddd !important;
        border-radius: 12px;
    }
    
    #video-tab .playlist-sidebar {
        background: linear-gradient(135deg, #2d2d2d 0%, #404040 100%);
    }
    
    #video-tab .playlist-sidebar-header {
        background: linear-gradient(135deg, #404040 0%, #4a4a4a 100%);
        border-bottom-color: #404040;
    }
    
    #video-tab .playlist-sidebar-header h4 {
        color: white;
    }
    
    #video-tab .playlist-item {
        border-bottom-color: #404040;
    }
    
    #video-tab .playlist-item:hover {
        background: linear-gradient(135deg, #404040 0%, #4a5568 100%);
    }
    
    #video-tab .video-title {
        color: white;
    }
    
    #video-tab .video-channel {
        color: #ffffff;
    }

    /* Ensure the scrolling list uses a dark background */
    #video-tab .playlist-items {
        background-color: #262626;
    }
    #video-tab .video-info {
        background: rgba(0, 0, 0, 0.9);
    }
}
