@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@400;500;600;700&display=swap');

/* Container */
.apy-playlist-wrapper {
    display: grid;
    grid-template-columns: 65% 35%;
    gap: 20px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    font-family: 'Prompt', sans-serif;
    /* User requested Prompt font */
    /* Use theme font if available */
    margin-bottom: 30px;
    margin-bottom: 30px;
}

/* Global Classic Style (Flat & Clean) - No Frame */
.apy-playlist-wrapper.apy-style-classic {
    box-shadow: none !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
}

/* Ensure children in classic style don't look weird without container bg */
.apy-playlist-wrapper.apy-style-classic .apy-playlist-sidebar {
    background: transparent !important;
    border: none !important;
}

.apy-playlist-wrapper.apy-style-classic .apy-list-header {
    background: transparent !important;
    border-bottom: 1px solid #eee;
    /* Keep separator */
    padding-left: 0;
}

.apy-playlist-wrapper.apy-style-classic .apy-item {
    background: transparent !important;
    border-bottom: 1px solid #eee;
}

/* Playlist Title Heading */
.apy-playlist-heading {
    grid-column: 1 / -1 !important;
    /* Span full width */
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: 700;
    color: #222;
    padding: 0 5px;
    width: 100%;
}

/* Ensure side-by-side layout flows correctly after the title */
.apy-playlist-wrapper:not(.apy-layout-bottom):not(.apy-layout-latest-only):not(.apy-layout-premium) .apy-main-stage {
    grid-column: 1;
}

.apy-playlist-wrapper:not(.apy-layout-bottom):not(.apy-layout-latest-only):not(.apy-layout-premium) .apy-playlist-sidebar {
    grid-column: 2;
}

/* Latest Only Layout & Premium Layout */
.apy-layout-latest-only,
.apy-layout-premium {
    grid-template-columns: 1fr !important;
}

/* Premium Layout Specifics */
.apy-layout-premium {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    /* Deeper shadow */
    background: #fff;
}

.apy-layout-premium .apy-main-info {
    padding: 30px;
    /* More breathing room */
    background: linear-gradient(to bottom, #fff 0%, #fcfcfc 100%);
    border-top: 1px solid #f0f0f0;
}

.apy-layout-premium .apy-main-title {
    font-size: 26px;
    /* Bigger Title */
    margin-bottom: 15px;
    color: #1a1a1a;
}

.apy-layout-premium .apy-meta {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.apy-layout-premium .apy-date,
.apy-layout-premium .apy-views {
    background: #f0f2f5;
    padding: 6px 12px;
    border-radius: 20px;
    /* Pill shape */
    font-size: 12px;
    font-weight: 600;
    color: #444;
}

.apy-layout-premium .apy-views {
    background: #fff0f0;
    /* Slight red tint for views */
    color: #d00;
}

/* Classic Style for Premium Layout */
.apy-playlist-wrapper.apy-layout-premium.apy-style-classic {
    box-shadow: none !important;
    background: transparent;
    border-radius: 0;
}

.apy-playlist-wrapper.apy-layout-premium.apy-style-classic .apy-main-info {
    padding: 20px 0 0 0;
    /* Remove side padding, keep top gap */
    background: transparent;
    border-top: none;
}

/* Playlist Bottom Layout */
/* Use higher specificity to override default or Elementor styles in editor */
.apy-playlist-wrapper.apy-layout-bottom {
    grid-template-columns: 1fr !important;
}

.apy-layout-bottom .apy-main-stage {
    padding-bottom: 10px;
    /* Add slight breather before the list */
}

.apy-layout-bottom .apy-playlist-sidebar {
    border-left: none;
    border-top: none;
    background: transparent;
    max-height: none;
    padding: 0 15px 30px 15px;
    /* 15px + 5px (list items) = 20px (matches main stage) */
}

.apy-layout-bottom .apy-list-header {
    display: none;
}

.apy-layout-bottom .apy-list-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 5px;
    /* Keep 5px for box-shadow overflowing */
}

/* Card Style for Bottom Layout */
/* Base Item Style for Bottom Layout (Shared) */
.apy-layout-bottom .apy-item {
    display: flex;
    flex-direction: column;
    border: none;
    border-radius: 8px;
    background: #fff;
    padding: 0;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Card Style (Adds Shadow) */
.apy-layout-bottom.apy-style-card .apy-item {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.apy-layout-bottom.apy-style-card .apy-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Classic Style (Flat) for Bottom Layout */
.apy-layout-bottom.apy-style-classic .apy-list-items {
    gap: 30px;
    /* More breathing room for clean layout */
    padding: 0;
    /* No shadow padding needed */
}

.apy-layout-bottom.apy-style-classic .apy-item {
    display: flex;
    flex-direction: column;
    border: none;
    background: transparent;
    padding: 0;
    box-shadow: none !important;
    /* Force remove shadow */
    transition: opacity 0.2s;
}

.apy-layout-bottom.apy-style-classic .apy-item:hover {
    transform: none;
    opacity: 0.8;
}

.apy-layout-bottom.apy-style-classic .apy-thumb {
    border-radius: 8px;
    /* Slight radius on image only */
    margin-bottom: 10px;
}

.apy-layout-bottom.apy-style-classic .apy-item-info {
    padding: 0;
    /* Remove internal padding */
}

/* Force remove active border */
.apy-layout-bottom .apy-item.active,
.apy-layout-bottom .apy-item.active:hover {
    border-left: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    /* Reset shadow logic if overwritten */
    background: #fff !important;
}

.apy-layout-bottom .apy-thumb {
    width: 100%;
    min-width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    border-radius: 0;
}

.apy-layout-bottom .apy-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.apy-layout-bottom .apy-item-info {
    padding: 15px;
}

.apy-layout-bottom .apy-item-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 0;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* Limit to 2 lines for uniformity */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 768px) {
    .apy-layout-bottom .apy-list-items {
        grid-template-columns: 1fr;
        /* Stack on mobile */
        gap: 10px;
        /* Reduce gap */
    }

    /* Switch to compact list style on mobile */
    .apy-layout-bottom .apy-item {
        flex-direction: row;
        /* Thumbnail left, Text right */
        align-items: center;
        max-height: 90px;
    }

    .apy-layout-bottom .apy-thumb {
        width: 120px;
        min-width: 120px;
        height: 68px;
        /* Fixed height for list view */
        padding-bottom: 0;
        /* Remove 16:9 hack */
        margin: 10px 0 10px 10px;
        /* Add spacing */
        border-radius: 4px;
    }

    .apy-layout-bottom .apy-thumb img {
        position: relative;
        height: 100%;
        width: 100%;
    }

    .apy-layout-bottom .apy-item-info {
        padding: 10px;
    }

    .apy-layout-bottom .apy-item-title {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }
}

/* Main Stage */
.apy-main-stage {
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.apy-video-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio */
    height: 0;
    width: 100%;
    /* Force width */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.apy-video-container iframe,
.apy-video-container div {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.apy-main-info {
    color: #333;
}

.apy-main-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.apy-meta {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.apy-meta i {
    margin-right: 4px;
}

.apy-desc {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

/* Hide Description for Bottom Layout */
.apy-layout-bottom .apy-desc {
    display: none;
}

/* Playlist Sidebar */
.apy-playlist-sidebar {
    background: #f9f9f9;
    border-left: 1px solid #eee;
    display: flex;
    flex-direction: column;
    max-height: 500px;
    /* Limit height to match video approx */
}

.apy-list-header {
    padding: 15px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.apy-list-header h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.apy-list-items {
    overflow-y: auto;
    flex: 1;
}

/* Scrollbar Style */
.apy-list-items::-webkit-scrollbar {
    width: 6px;
}

.apy-list-items::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.apy-list-items::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Playlist Item */
.apy-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s ease;
}

.apy-item:hover {
    background: #fff;
}

.apy-item.active {
    background: #eef2f5;
    border-left: 3px solid #ff0000;
    /* YouTube Red */
}

.apy-thumb {
    position: relative;
    width: 100px;
    /* Fixed width */
    min-width: 100px;
    height: 56px;
    /* 16:9 approx */
    border-radius: 4px;
    overflow: hidden;
}

.apy-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.apy-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s;
}

.apy-item:hover .apy-overlay,
.apy-item.active .apy-overlay {
    opacity: 1;
}

.apy-item-info {
    flex: 1;
    overflow: hidden;
}

.apy-item-title {
    font-size: 14px;
    margin: 0 0 5px 0;
    color: #333;
    line-height: 1.3;
    /* Truncate text */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.apy-item.active .apy-item-title {
    color: #000;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .apy-playlist-wrapper {
        grid-template-columns: 1fr;
    }

    .apy-playlist-sidebar {
        max-height: 300px;
        border-left: none;
        border-top: 1px solid #eee;
    }
}