/* Main container */
#ypg-gallery-root {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* Controls row */
.ypg-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
}

.ypg-controls select,
.ypg-controls input {
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid #ccc;
    height: 40px;
    line-height: 20px;
    box-sizing: border-box;
    flex: 1 1 auto;
    min-width: 150px;
}

/* Main content area */
.ypg-container {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Info sections */
.ypg-info-container {
    display: flex;
    gap: 20px; /* Match gallery-player gap */
    width: 100%;
    margin-bottom: 10px;
}

.ypg-player-info {
    flex: 1; /* Match player width */
    background-color: #ddd;
    padding: 10px;
    border-radius: 12px;
    font-weight: bold;
}

.ypg-gallery-info {
    width: 400px; /* Match gallery width */
    background-color: #ddd;
    padding: 10px;
    border-radius: 12px;
    font-weight: bold;
}

/* Player and gallery container */
.ypg-player-and-gallery {
    display: flex;
    gap: 20px;
    width: 100%;
}

/* Player section */
.ypg-player-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ypg-player-container {
    width: 100%;
    position: relative;
}

/* Gallery section */
.ypg-gallery-wrapper {
    width: 400px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ypg-video-gallery {
    height: 370px; /* 16:9 height (600px - info sections) */
    overflow-y: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ypg-player-and-gallery {
        flex-direction: column;
        height: auto;
    }
    
    .ypg-info-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .ypg-player-info,
    .ypg-gallery-info {
        width: 100%;
    }
    
    .ypg-gallery-wrapper {
        width: 100%;
    }
    
    .ypg-video-gallery {
        height: auto;
    }
}
    grid-template-rows: min-content 1fr;
    gap: 15px;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.ypg-controls {
    grid-area: controls;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.ypg-player-container {
    grid-area: player;
    width: 100%;
    aspect-ratio: 16/9; /* Changed from 9/16 to standard video ratio */
    position: relative;
}

@media (max-width: 768px) {
    #ypg-gallery-root {
        grid-template-areas:
            "controls"
            "player"
            "gallery";
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 8px; /* Reduced gap for mobile */
    }
    
    .ypg-video-item img {
        width: 80px; /* Smaller thumbnails for mobile */
        margin-right: 8px;
    }
}

/* Added mobile-first media query */
@media (min-width: 480px) and (max-width: 768px) {
    .ypg-video-gallery {
        max-height: 60vh;
    }
}
.ypg-video-gallery {
    grid-area: gallery;
    max-width: 400px;
    overflow-y: auto;
    justify-self: end;
}

.ypg-player-info {
    margin-bottom: 10px;
    background-color: #ddd;
    padding: 10px;
    border-radius: 12px;
    font-weight: bold;
}

.ypg-gallery-info {
    margin-bottom: 10px;
    background-color: #ddd;
    padding: 10px;
    border-radius: 12px;
    font-weight: bold;
    max-width: 400px;
}

#ypg-youtube-player {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}

.elementor-widget-container {
    display: contents !important;
}

@media (max-width: 768px) {
    #ypg-gallery-root {
        grid-template-areas:
            "controls"
            "player"
            "gallery";
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 10px;
    }
    
    .ypg-video-gallery {
        max-width: none;
        justify-self: stretch;
    }
}

/* Video Items */
.ypg-video-item {
    display: flex;
    align-items: center;
    background-color: #fff;
    border-radius: 12px;
    padding: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ypg-video-item:hover {
    background-color: #e6f7ff;
    transform: translateY(-2px);
}

.ypg-video-item.selected {
    background-color: #d0ebff;
}

.ypg-video-item img {
    width: 100px;
    max-width: 30%;
    border-radius: 8px;
    margin-right: 10px;
    flex-shrink: 0;
}

.ypg-video-item span {
    flex: 1;
    word-break: break-word;
}

/* Controls */
.ypg-controls select,
.ypg-controls input {
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid #ccc;
    height: 40px;
    line-height: 20px;
    box-sizing: border-box;
    flex: 1 1 150px;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.ypg-controls select:focus,
.ypg-controls input:focus {
    outline: none;
    border-color: #3399ff;
    box-shadow: 0 0 0 3px rgba(51, 153, 255, 0.2);
}

/* Scrollbar Styling */
.ypg-video-gallery::-webkit-scrollbar {
    width: 8px;
}

.ypg-video-gallery::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.ypg-video-gallery::-webkit-scrollbar-thumb {
    background-color: #bbb;
    border-radius: 4px;
    border: 2px solid #f0f0f0;
}

.ypg-video-gallery::-webkit-scrollbar-thumb:hover {
    background-color: #999;
}

/* Firefox Scrollbar */
.ypg-video-gallery {
    scrollbar-width: thin;
    scrollbar-color: #bbb #f0f0f0;
}

/* Video Items */
.ypg-video-item {
    display: flex;
    align-items: center;
    background-color: #fff;
    border-radius: 12px;
    padding: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ypg-video-item:hover {
    background-color: #e6f7ff;
    transform: translateY(-2px);
}

.ypg-video-item.selected {
    background-color: #d0ebff;
}

.ypg-video-item img {
    width: 100px;
    max-width: 30%;
    border-radius: 8px;
    margin-right: 10px;
    flex-shrink: 0;
}

.ypg-video-item span {
    flex: 1;
    word-break: break-word;
}

/* Controls */
.ypg-controls select,
.ypg-controls input {
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid #ccc;
    height: 40px;
    line-height: 20px;
    box-sizing: border-box;
    flex: 1 1 150px;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.ypg-controls select:focus,
.ypg-controls input:focus {
    outline: none;
    border-color: #3399ff;
    box-shadow: 0 0 0 3px rgba(51, 153, 255, 0.2);
}

/* Scrollbar Styling */
.ypg-video-gallery::-webkit-scrollbar {
    width: 8px;
}

.ypg-video-gallery::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.ypg-video-gallery::-webkit-scrollbar-thumb {
    background-color: #bbb;
    border-radius: 4px;
    border: 2px solid #f0f0f0;
}
