/* ============================================
   Playlist YouTube - Style dla kafelków i odtwarzacza
   ============================================ */

/* Kontener wrapper - obejmuje odtwarzacz i playlistę */
.youtube-playlist-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    width: 100%;
}

/* Kontener playlisty - po lewej stronie */
.youtube-playlist {
    flex: 0 0 280px;
    max-width: 280px;
}

/* Kontener kafelków - układ pionowy */
.youtube-playlist-tiles {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px; /* Przesunięcie przycisków w dół */
}

/* Wskaźnik ładowania playlisty */
.youtube-playlist-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
    color: #666;
    font-size: 16px;
    font-weight: 500;
}

.youtube-playlist-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* Odtwarzacz wideo - po prawej stronie */
#youtube-player {
    flex: 1;
    min-width: 0;
    min-height: 500px; /* Zwiększona minimalna wysokość odtwarzacza */
    width: 100%;
    height: 100%;
    border-radius: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Pojedynczy kafelek - układ pionowy */
.youtube-playlist-tile {
    width: 100%;
    height: 80px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0 15px;
    text-align: left;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Gradient overlay dla lepszej czytelności */
.youtube-playlist-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 100%);
    z-index: 1;
}

/* Stan aktywny - wyróżnienie wybranego kafelka */
.youtube-playlist-tile.active {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.youtube-playlist-tile.active::before {
    background: linear-gradient(90deg, rgba(240, 147, 251, 0.8) 0%, rgba(245, 87, 108, 0.8) 100%);
}

/* Efekt hover */
.youtube-playlist-tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.youtube-playlist-tile:hover::before {
    background: linear-gradient(90deg, rgba(240, 147, 251, 0.6) 0%, rgba(245, 87, 108, 0.6) 100%);
}

/* Numer kafelka */
.youtube-playlist-tile-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    border-radius: 50%;
    font-weight: bold;
    font-size: 16px;
    z-index: 2;
    flex-shrink: 0;
    margin-right: 15px;
}

/* Nazwa kafelka */
.youtube-playlist-tile-name {
    display: block;
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    z-index: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* Dostępność - focus state */
.youtube-playlist-tile:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(76, 0, 130, 0.5);
}

/* Responsywność - tablet */
@media (max-width: 1024px) {
    .youtube-playlist-wrapper {
        gap: 15px;
    }

    .youtube-playlist {
        flex: 0 0 240px;
        max-width: 240px;
    }

    #youtube-player {
        min-height: 450px; /* Wysokość na tabletach */
    }

    .youtube-playlist-tile {
        height: 70px;
        padding: 0 12px;
    }

    .youtube-playlist-tile-number {
        width: 35px;
        height: 35px;
        font-size: 14px;
        margin-right: 12px;
    }

    .youtube-playlist-tile-name {
        font-size: 14px;
    }
}

/* Responsywność - mobile */
@media (max-width: 768px) {
    .youtube-playlist-wrapper {
        flex-direction: column;
        gap: 15px;
    }

    #youtube-player {
        width: 100%;
        min-height: 350px; /* Wysokość na mobile */
        order: -1; /* Odtwarzacz na górze na mobile */
    }

    .youtube-playlist {
        flex: 1;
        width: 100%;
        max-width: 100%;
    }

    .youtube-playlist-tiles {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-top: 20px; /* Przesunięcie przycisków w dół na mobile */
    }

    .youtube-playlist-tile {
        height: 80px;
        padding: 0 10px;
    }

    .youtube-playlist-tile-number {
        width: 35px;
        height: 35px;
        font-size: 14px;
        margin-right: 10px;
    }

    .youtube-playlist-tile-name {
        font-size: 13px;
    }
}

/* Responsywność - małe mobile */
@media (max-width: 480px) {
    .youtube-playlist-wrapper {
        gap: 10px;
    }

    #youtube-player {
        min-height: 280px; /* Wysokość na małych mobile */
    }

    .youtube-playlist-tiles {
        grid-template-columns: 1fr;
        margin-top: 20px; /* Przesunięcie przycisków w dół na małych mobile */
    }

    .youtube-playlist-tile {
        height: 70px;
        padding: 0 8px;
    }

    .youtube-playlist-tile-number {
        width: 32px;
        height: 32px;
        font-size: 12px;
        margin-right: 8px;
    }

    .youtube-playlist-tile-name {
        font-size: 12px;
    }
}
