/* Importa a fonte Poppins do Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

/* Variáveis de Cores para o Tema Escuro */
:root {
    --bg-dark: #121212;
    --bg-dark-secondary: #181818;
    --bg-dark-card: #282828;
    --text-light: #f1f1f1;
    --text-light-muted: #b3b3b3;
    --primary-color: #0d6efd;
    --primary-color-hover: #0b5ed7;
    --secondary-border-dark: #383838;
    --badge-bg-dark: #484848;
    --btn-dark-outline-border: #666;
    --btn-dark-outline-hover-bg: #444;
}

/* Configurações Globais */
body.dark-theme { 
    font-family: 'Poppins', sans-serif; 
    background-color: var(--bg-dark); 
    color: var(--text-light); 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
    overflow-x: hidden;
}

/* Navbar */
.navbar { transition: background-color 0.3s ease; }
.navbar.scrolled { background-color: rgba(24, 24, 24, 0.95) !important; backdrop-filter: blur(5px); }
.navbar-brand .fa-sun { color: #ffd700 !important; }

/* Seção de Destaques (Hero Carousel) */
.featured-container { 
    height: 70vh; 
    min-height: 450px;
    position: relative; 
    width: 100vw;
    overflow: hidden;
    left: 50%;
    transform: translateX(-50%);
}

.carousel-item-featured { height: 70vh; min-height: 450px; position: relative; overflow: hidden; }
.featured-background { 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    z-index: 0; 
    transform: translate(-50%, -50%); 
    background-size: cover; 
    background-position: top; 
    background-repeat: no-repeat; 
    filter: brightness(0.6); 
    width: 100%;
    height: 100%;
}
.featured-background.iframe-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw;
    min-height: 100%;
    min-width: 177.777vh;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

.featured-background.iframe-bg.align-top {
    top: 0; /* Alinha o ponto de origem no topo do container */
    transform: translate(-50%, 0); /* Translada horizontalmente, mas não verticalmente */
}

.featured-background.iframe-bg.align-center {
    top: 50%;
    transform: translate(-50%, -50%); /* Comportamento padrão/centralizado */
}

.featured-background.iframe-bg.align-bottom {
    top: 100%; /* Alinha o ponto de origem na base do container */
    transform: translate(-50%, -100%); /* Translada 100% da altura do iframe para cima */
}

.carousel-caption-featured { position: absolute; bottom: 10%; left: 5%; right: 5%; padding: 2rem; z-index: 1; text-align: left; max-width: 90%; }
.carousel-item-featured::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 50%; background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%); z-index: 0; }
.carousel-caption-featured h1 { font-size: 3.5rem; font-weight: 700; text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8); }
.carousel-caption-featured .lead { font-size: 1.2rem; max-width: 50%; text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.7); }
.carousel-indicators [data-bs-target] { width: 10px; height: 10px; border-radius: 50%; background-color: rgba(255, 255, 255, 0.5); }
.carousel-indicators .active { background-color: #fff; }

/* Seções e Carrosséis */
.video-section { position: relative; }
.section-title { font-weight: 700; font-size: 1.6rem; }
.video-carousel-container { 
    position: relative; 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
    margin-bottom: 25px; 
    padding-top: 15px; 
    padding-bottom: 15px;
    overflow-y: visible; 
    cursor: grab; 
    user-select: none;
}
.video-carousel-container.active-dragging { cursor: grabbing; }
.video-carousel-container::-webkit-scrollbar { height: 8px; margin-top: 10px; }
.video-carousel-container::-webkit-scrollbar-track { 
    background: var(--bg-dark-secondary); 
    border-radius: 10px; 
    margin-top: 10px;
}
.video-carousel-container::-webkit-scrollbar-thumb { 
    background-color: var(--secondary-border-dark); 
    border-radius: 10px; 
    border: 2px solid var(--bg-dark-secondary); 
}
.video-carousel { 
    display: flex; 
    gap: 1.5rem; 
    padding-left: 1rem; 
    padding-right: 1rem; 
    padding-bottom: 10px;
}

/* Card de Conteúdo */
.video-item { 
    flex: 0 0 auto; 
    width: 320px; 
    position: relative; 
    cursor: pointer; 
    transition: transform 0.3s ease, box-shadow 0.3s ease; 
    z-index: 5; 
}

.video-item:hover { 
    transform: translateY(-10px); 
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5); 
    z-index: 10; 
}

.video-card-link { 
    text-decoration: none; 
    color: inherit; 
    display: flex; 
    flex-direction: column; 
    /* Removemos a cor sólida e deixamos transparente para ver o fundo desfocado */
    background-color: var(--bg-dark-card); 
    border-radius: 12px; /* Arredondamento um pouco maior */
    overflow: hidden; 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); 
    height: 100%; 
    position: relative; /* Necessário para o posicionamento absoluto do fundo */
    border: 2px solid rgb(18 18 18 / 76%);
}

.video-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* A imagem vem da variável CSS definida via JS */
    background-image: var(--card-bg);
    background-size: cover;
    background-position: center;
    /* O segredo: Desfoque alto + Escurecimento + Saturação para cores vivas */
    filter: blur(25px) brightness(0.4) saturate(1.5);
    z-index: 0;
    transform: scale(1.2); /* Aumenta para evitar bordas brancas causadas pelo blur */
    pointer-events: none;
}

.video-card-link::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(30,30,30,0.2) 0%, rgba(15,15,15,0.95) 100%);
    z-index: 1;
    pointer-events: none;
}

.playlist-icon-overlay { position: absolute; top: 10px; left: 10px; z-index: 3; background-color: rgba(0, 0, 0, 0.7); color: #fff; padding: 5px 10px; border-radius: 5px; font-size: 0.8rem; font-weight: 600; display: flex; align-items: center; pointer-events: none; }
.playlist-icon-overlay .fa-layer-group { margin-right: 6px; }

.video-wrapper { 
    position: relative; 
    width: 100%; 
    aspect-ratio: 16 / 9; 
    background-color: #000;
    overflow: hidden; 
    z-index: 2; /* Garante que a thumb nítida fique acima do fundo borrado */
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.video-thumbnail-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}
.video-item:hover .video-thumbnail-img { 
    transform: scale(1.1); 
}
.video-thumbnail { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-size: cover; 
    background-position: center; 
    transition: transform 0.3s ease; 
}
.video-item:hover .video-thumbnail { 
    transform: scale(1.1); 
}

.play-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.4); display: flex; justify-content: center; align-items: center; opacity: 1; transition: opacity 0.3s ease; pointer-events: none; z-index: 2; }
.video-item:hover .play-overlay { opacity: 0; }

.card-body-custom { 
    padding: 1.2rem; 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
    position: relative;
    z-index: 2; /* Texto acima do fundo */
}

.card-title-custom { 
    font-weight: 600; 
    font-size: 1.05rem; 
    margin-bottom: 0.5rem; 
    color: #fff; /* Força branco puro */
    text-shadow: 0 2px 4px rgba(0,0,0,0.8); /* Sombra para leitura */
    white-space: normal; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; 
    min-height: 2.1em; 
}

.video-preview-iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.iframe-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 2; }
.text-thumbnail { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; padding: 1rem; color: white; font-size: 1.8rem; font-weight: 600; text-shadow: 1px 1px 3px rgba(0,0,0,0.5); }

/* Página "Ver Tudo" (secao.php) e páginas de listagem */
.section-grid { 
    display: grid; 
    /* **** ALTERAÇÃO FINAL E DEFINITIVA **** */
    /* Cria colunas responsivas com tamanho mínimo e máximo, evitando que os cards fiquem grandes demais. */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem; 
    padding: 1rem 0;
    align-items: start;
    max-width: 1400px;
    margin: 0 auto;
}
/* A classe .video-item usada dentro do .section-grid não precisa mais de regras de largura, pois o grid controla isso. */
/* As regras antigas de responsividade para o .section-grid podem ser removidas pois esta nova linha já faz todo o trabalho. */
.section-grid .video-item { 
    width: 100%; /* Garante que o item ocupe a célula do grid */
    display: flex;
    flex-direction: column;
}
.section-grid .video-card-link {
    height: 100%;
    display: flex;
    flex-direction: column;
}
.section-grid .card-body-custom {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 120px;
}
.section-grid .card-title-custom {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
    color: var(--text-light);
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    height: 2.6em;
    line-height: 1.3em;
}
.section-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* --- Refatoração Coleção (Glassmorphism Avançado) --- */

/* 1. Toolbar dentro do Card Padrão */
.collection-controls-card {
    margin-bottom: 2rem;
}

.control-label-small {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: block;
    text-align: center;
}

/* 2. Accordion Item - O Container Principal do Glassmorphism */
.collection-accordion-item {
    position: relative;
    background-color: transparent !important; /* Remove fundo padrão do Bootstrap */
    border: 2px solid rgb(18 18 18 / 76%); /* Borda única e definitiva */
    border-radius: 12px !important;
    margin-bottom: 1rem;
    overflow: hidden;
    z-index: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Remove a borda padrão do Bootstrap entre itens adjacentes para evitar borda dupla */
.accordion-item + .accordion-item {
    border-top: 2px solid rgb(18 18 18 / 76%) !important;
}

/* Fundo Desfocado (Glassmorphism) */
.collection-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--card-bg);
    background-size: cover;
    background-position: center;
    filter: blur(25px) brightness(0.4) saturate(1.5);
    z-index: -1; /* Fica atrás de todo o conteúdo */
    transform: scale(1.2); /* Evita bordas brancas do blur */
    pointer-events: none;
}

/* Overlay escuro para legibilidade */
.collection-accordion-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(30,30,30,0.3) 0%, rgba(15,15,15,0.8) 100%);
    z-index: -1; /* Fica acima da imagem borrada, mas atrás do texto */
    pointer-events: none;
}

/* 3. Botão do Accordion (Header) - Limpeza Total */
.collection-accordion-button {
    background-color: transparent !important; /* Transparente para ver o glassmorphism */
    color: var(--text-light) !important;
    font-weight: 600;
    padding: 1.2rem;
    border: none !important; /* Remove bordas internas */
    box-shadow: none !important; /* Remove o anel de foco azul do Bootstrap */
    z-index: 2;
}

/* Remove a borda inferior que o Bootstrap coloca quando expandido */
.collection-accordion-button:not(.collapsed) {
    background-color: rgba(255, 255, 255, 0.05) !important; /* Leve destaque ao expandir */
    color: #fff !important;
    box-shadow: none !important; /* Garante que não apareça borda extra */
}

/* Ícone da seta do accordion */
.collection-accordion-button::after {
    filter: invert(1);
}

/* 4. Container Interno dos Itens (Collapse Body) */
.collection-items-wrapper {
    background-color: rgba(0, 0, 0, 0.4);
    margin: 0 12px 12px 12px;
    border-radius: 8px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 2;
}

/* 5. Itens da Lista */
.collection-queue-item {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: transform 0.2s ease, background-color 0.2s ease;
    border: none !important;
    background: transparent;
}

.collection-queue-item:last-child {
    margin-bottom: 0;
}

.collection-queue-item:hover {
    transform: translateX(5px);
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.collection-queue-item.active {
    background-color: var(--primary-color);
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.collection-queue-item.active small {
    color: rgba(255, 255, 255, 0.8) !important;
}

.collection-queue-item img {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background-color: #000;
    margin-right: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.collection-item-info {
    flex-grow: 1;
    min-width: 0;
}

.collection-item-title {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.active-playlist-tag {
    background-color: var(--primary-color) !important;
    margin-left: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Página de Playlist e Sugestões */
.video-player-wrapper { background-color: #000; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4); }
.bg-dark-card { background-color: var(--bg-dark-card) !important; border: 1px solid var(--secondary-border-dark); }
.bg-dark-card p { color: var(--text-light-muted) !important; }
.playlist-queue { max-height: 80vh; overflow-y: auto; padding-right: 10px; }
.playlist-item, .suggested-video-dark { text-decoration: none; color: var(--text-light); border-radius: 8px; padding: 10px; margin-bottom: 10px; transition: background-color 0.2s ease; display: flex; align-items: center; }
.playlist-item:hover, .suggested-video-dark:hover { background-color: var(--bg-dark-card); }
.playlist-item.active { background-color: var(--primary-color); }
.playlist-item img, .suggested-video-dark img { width: 120px; height: 68px; object-fit: cover; border-radius: 6px; flex-shrink: 0; background-color: #000; }
.playlist-item div, .suggested-video-dark div { margin-left: 1rem; }

/* Responsividade Geral */
@media (max-width: 991.98px) { .search-bar-desktop { display: none !important; } .navbar-toggler { margin-right: 1rem; } .navbar-collapse { background-color: var(--bg-dark-secondary); padding: 0.5rem 1rem; } .navbar-nav .nav-item:first-child.d-lg-none { display: block !important; } .carousel-caption-featured .lead { max-width: 80%; } }
@media (max-width: 768px) { .section-title { font-size: 1.4rem; } .carousel-caption-featured h1 { font-size: 2rem; } .carousel-caption-featured .lead { display: none; } }
@media (max-width: 576px) { .video-item { width: 80vw; } .btn-outline-secondary-dark-custom .fa-arrow-right { display: none; } }

/* Botões e Badges Customizados */
.btn-outline-secondary-dark-custom { color: #ffffff !important; border-color: #666666 !important; background-color: rgba(255, 255, 255, 0.1) !important; transition: all 0.3s ease; }
.btn-outline-secondary-dark-custom:hover { color: #ffffff !important; background-color: rgba(255, 255, 255, 0.2) !important; border-color: #888888 !important; transform: translateY(-2px); }

.badge.bg-secondary-dark {
    background-color: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary-custom { background-color: var(--primary-color) !important; border-color: var(--primary-color) !important; color: #ffffff !important; transition: all 0.3s ease; }
.btn-primary-custom:hover { background-color: var(--primary-color-hover) !important; border-color: var(--primary-color-hover) !important; color: #ffffff !important; transform: translateY(-2px); }
.btn-outline-secondary-custom { color: #ffffff !important; border-color: #666666 !important; background-color: rgba(255, 255, 255, 0.1) !important; transition: all 0.3s ease; }
.btn-outline-secondary-custom:hover { color: #ffffff !important; background-color: rgba(255, 255, 255, 0.2) !important; border-color: #888888 !important; transform: translateY(-2px); }

/* Melhorias Visuais */
.suggested-video-dark img, .playlist-item img { border: 1px solid rgba(255, 255, 255, 0.1); background-color: #1a1a1a !important; }
.suggested-video-dark h6, .playlist-item h6 { color: #ffffff !important; }
.suggested-video-dark small, .playlist-item small { color: #b3b3b3 !important; }
.bg-dark-custom { background-color: rgba(18, 18, 18, 0.95) !important; backdrop-filter: blur(10px); }
.bg-darkgradient-custom { background: linear-gradient(180deg,rgba(18, 18, 18, 1) 0%, rgba(255, 255, 255, 0) 100%); }
.search-form-custom .form-control { background-color: rgba(255, 255, 255, 0.1) !important; border-color: rgba(255, 255, 255, 0.2) !important; color: #ffffff !important; }
.search-form-custom .form-control:focus { background-color: rgba(255, 255, 255, 0.15) !important; border-color: var(--primary-color) !important; color: #ffffff !important; box-shadow: 0 0 0 0.2rem rgba(122, 101, 232, 0.25); }
.search-form-custom .form-control::placeholder { color: rgba(255, 255, 255, 0.6) !important; }
.search-btn-custom { background-color: var(--primary-color) !important; border-color: var(--primary-color) !important; color: #ffffff !important; }
.search-btn-custom:hover { background-color: var(--primary-color-hover) !important; border-color: var(--primary-color-hover) !important; }
.text-light-muted { color: #b3b3b3 !important; }
.video-card-link:hover { text-decoration: none !important; color: inherit !important; }
.play-overlay i { font-size: 3rem; color: rgba(255, 255, 255, 0.9); text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8); }

/* Player de Áudio Customizado */
.audio-player-wrapper { background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%); border: 1px solid rgba(255, 255, 255, 0.1); }
.audio-player-custom { position: relative; width: 100%; padding-top: 56.25%; background-size: cover; background-position: center; display: flex; align-items: flex-end; justify-content: center; border-radius: 8px; overflow: hidden; }
.audio-player-controls { display: flex; align-items: center; width: 95%; background-color: rgba(0, 0, 0, 0.7); backdrop-filter: blur(10px); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; gap: 1rem; }
#play-pause-button { flex-shrink: 0; }
.audio-progress-bar { flex-grow: 1; display: flex; align-items: center; gap: 0.5rem; }
#audio-seek-bar { width: 100%; cursor: pointer; }
.audio-time { color: #fff; font-size: 0.9rem; white-space: nowrap; }
.audio-volume-control { display: flex; align-items: center; gap: 0.5rem; color: #fff; }
#audio-volume-bar { width: 80px; cursor: pointer; }
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { background: rgba(255, 255, 255, 0.3); height: 6px; border-radius: 3px; }
input[type=range]::-moz-range-track { background: rgba(255, 255, 255, 0.3); height: 6px; border-radius: 3px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; margin-top: -5px; background-color: #fff; height: 16px; width: 16px; border-radius: 50%; box-shadow: 0 0 5px rgba(0,0,0,0.5); }
input[type=range]::-moz-range-thumb { border: none; border-radius: 50%; background-color: #fff; height: 16px; width: 16px; box-shadow: 0 0 5px rgba(0,0,0,0.5); }
.audio-player-wrapper.ratio::before { display: none !important; }

/* --- Refatoração do Header (Novo Padrão UX) --- */

/* Descrição Hero mais suave e legível */
.hero-description {
    font-size: 0.95rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    color: var(--text-light-muted);
}

/* Ajuste para o Dropdown de Ordenação no Tema Dark */
.dropdown-menu-dark-custom {
    background-color: var(--bg-dark-card);
    border: 1px solid var(--secondary-border-dark);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.dropdown-item-custom {
    color: var(--text-light-muted);
    transition: all 0.2s ease;
    font-size: 0.9rem;
    padding: 8px 16px;
}

.dropdown-item-custom:hover, 
.dropdown-item-custom:focus {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.dropdown-item-custom.active {
    background-color: var(--primary-color);
    color: #fff;
}

/* Utilitário para divisor sutil */
.divider-sutil {
    border-color: var(--text-light-muted);
    opacity: 0.15;
    width: 80px;
    margin: 0 auto;
}
