/* --- Navegação e Filtro da Página de Playlists --- */
.playlists-navigation {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.playlist-search-wrapper {
    width: 100%;
}

#playlist-search-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.1em;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
}

.playlist-alphabet-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 6px;
}

/* Esconde a barra de navegação se ela estiver vazia */
.playlist-alphabet-nav:empty {
    display: none;
}

.playlist-alphabet-nav a {
    text-decoration: none;
    font-weight: bold;
    color: #005177;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.playlist-alphabet-nav a:hover {
    background-color: #005177;
    color: #fff;
}

/* Grupos de Playlist por Letra */
.playlist-group {
    margin-bottom: 40px;
}

.playlist-group-title {
    font-size: 2em;
    color: #005177;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

/* Mensagem para quando a busca não retorna resultados */
.playlist-group.hidden, .playlist-card.hidden {
    display: none;
}

/* --- Estilos da Página de Playlists e Modal --- */

/* Grid de Playlists */
.playlists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.playlist-card {
    position: relative;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: #111; /* Fundo escuro para o texto do título */
}

.playlist-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.playlist-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.playlist-card-poster {
    position: relative;
    padding-top: 56.25%; /* Proporção 16:9 */
    background-size: cover;
    background-position: center;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.playlist-card-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.playlist-card-link:hover .playlist-card-overlay {
    opacity: 1;
}

/* Ícone de Play SVG */
.playlist-card-overlay::before {
    content: '';
    display: block;
    width: 60px;
    height: 60px;
    background-color: #fff;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
    transition: transform 0.3s ease;
}

.playlist-card-link:hover .playlist-card-overlay::before {
    transform: scale(1.1);
}

.playlist-card-title {
    padding: 15px;
    margin: 0;
    font-size: 1.1em;
    text-align: center;
    color: #fff;
}

/* Modal do Player */
.playlist-modal-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.playlist-modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.85);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.playlist-modal-content {
    position: relative;
    background-color: #181818;
    color: #fff;
    width: 100%;
    height: 100%;
    max-width: 1400px;
    max-height: 80vh;
    border-radius: 8px;
    display: flex;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* Estilos para o estado de carregamento do modal */
.playlist-modal-container.loading .playlist-modal-content {
    opacity: 0.5; /* Deixa o conteúdo um pouco transparente enquanto carrega */
}

.playlist-modal-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    margin-top: -25px;
    margin-left: -25px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10001; /* Acima do backdrop e do conteúdo */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.playlist-modal-container.loading::after {
    opacity: 1;
    visibility: visible;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.playlist-modal-close-btn {
	position: absolute;
	top: -40px; /* Posiciona o botão ACIMA do modal em telas grandes */
	right: 0;
	background: transparent;
	border: none;
	color: #fff;
	font-size: 3em;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	z-index: 10;
	opacity: 0.8;
	transition: opacity 0.2s, background-color 0.2s;
}
.playlist-modal-close-btn:hover {
	opacity: 1;
}

.playlist-player-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#playlist-player-viewport {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000;
    flex-shrink: 0;
}

.current-video-info {
    padding: 20px;
    background-color: #202020;
    flex-grow: 1;
}

.current-video-info h3 {
    margin: 0 0 15px 0;
    color: #fff;
}

.current-video-info .button {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.current-video-info .button.visible {
    opacity: 1;
    visibility: visible;
}

.playlist-sidebar {
    flex-basis: 350px;
    flex-shrink: 0;
    background-color: #121212;
    overflow-y: auto;
    padding: 20px;
}

.playlist-sidebar h4 {
    margin: 0 0 15px 0;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

#playlist-items-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

#playlist-items-list li {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

#playlist-items-list li:hover, #playlist-items-list li.active {
    background-color: #282828;
}

#playlist-items-list img {
    width: 120px;
    height: 68px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 4px;
}

/* Responsividade do Modal */
@media (max-width: 992px) {
    .playlist-modal-content {
        flex-direction: column;
        max-height: 95vh;
    }
    .playlist-sidebar {
        flex-basis: auto;
        flex-grow: 1;
	}

	/* Reposiciona o botão de fechar para dentro do modal em telas pequenas */
	.playlist-modal-close-btn {
		top: 10px;
		right: 10px;
		font-size: 2.5em;
		background-color: rgba(0, 0, 0, 0.5);
		border-radius: 50%;
		width: 40px;
		height: 40px;
		line-height: 40px;
		text-align: center;
	}
}