/**
 * YouTube Playlist Gallery - Styles v2.1
 */

.ytpg-wrapper {
    max-width: 900px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    direction: rtl;
}

/* =============================================
   PLAYER - Fixed aspect ratio
   ============================================= */
.ytpg-player {
    position: relative;
    width: 100%;
    /* Slightly taller to show full video including bottom captions */
    padding-bottom: 58%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.ytpg-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* =============================================
   LIST VIEW - Small thumbnails in rows
   ============================================= */
.ytpg-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ytpg-list .ytpg-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ytpg-list .ytpg-item:hover {
    background: #e8e8e8;
}

.ytpg-list .ytpg-item.active {
    background: #e0e7ff;
    border-right: 4px solid #6366f1;
}

.ytpg-list .ytpg-thumb {
    position: relative;
    width: 120px;
    min-width: 120px;
    height: 68px;
    border-radius: 6px;
    overflow: hidden;
}

.ytpg-list .ytpg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ytpg-list .ytpg-number {
    display: none;
}

.ytpg-list .ytpg-info {
    flex: 1;
}

.ytpg-list .ytpg-title {
    font-size: 14px;
    line-height: 1.4;
    color: #333;
}

.ytpg-list .ytpg-item.active .ytpg-title {
    color: #4f46e5;
    font-weight: 600;
}

/* =============================================
   GRID VIEW - Large squares
   ============================================= */
.ytpg-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.ytpg-grid .ytpg-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 2px solid transparent;
}

.ytpg-grid .ytpg-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.ytpg-grid .ytpg-item.active {
    border-color: #6366f1;
}

.ytpg-grid .ytpg-thumb {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    overflow: hidden;
}

.ytpg-grid .ytpg-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ytpg-grid .ytpg-item:hover .ytpg-thumb img {
    transform: scale(1.05);
}

.ytpg-grid .ytpg-number {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.ytpg-grid .ytpg-item.active .ytpg-number {
    background: #6366f1;
}

.ytpg-grid .ytpg-info {
    padding: 12px;
}

.ytpg-grid .ytpg-title {
    font-size: 13px;
    line-height: 1.4;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ytpg-grid .ytpg-item.active .ytpg-title {
    color: #4f46e5;
    font-weight: 600;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    .ytpg-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .ytpg-wrapper {
        margin: 10px;
    }

    .ytpg-grid {
        grid-template-columns: 1fr;
    }

    .ytpg-list .ytpg-thumb {
        width: 100px;
        min-width: 100px;
        height: 56px;
    }

    .ytpg-list .ytpg-title {
        font-size: 13px;
    }
}