/* ==========================================================================
   Galeria de Vídeos YouTube — [yt_gallery]
   Paleta: dark #0D2621, verde #A3E635, Poppins
   ========================================================================== */

/* Container principal */
.ytg-wrap {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 40px 20px;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

/* ========== Filtros por Playlist ========== */
.ytg-filters {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 8px !important;
    margin-bottom: 32px !important;
}

.ytg-filter-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 7px 18px !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 20px !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.6) !important;
    font-family: 'Poppins', sans-serif !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.25s ease !important;
    letter-spacing: 0.3px !important;
    white-space: nowrap !important;
    outline: none !important;
}

.ytg-filter-btn:hover {
    border-color: rgba(163, 230, 53, 0.4) !important;
    color: rgba(255, 255, 255, 0.85) !important;
    background: rgba(163, 230, 53, 0.06) !important;
}

.ytg-filter-btn.active {
    border-color: #A3E635 !important;
    color: #A3E635 !important;
    background: rgba(163, 230, 53, 0.1) !important;
}

/* Contagem de vídeos no filtro */
.ytg-filter-count {
    font-size: 0.65rem !important;
    font-weight: 600 !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.4) !important;
    padding: 1px 6px !important;
    border-radius: 8px !important;
    min-width: 18px !important;
    text-align: center !important;
}

.ytg-filter-btn.active .ytg-filter-count {
    background: rgba(163, 230, 53, 0.2) !important;
    color: #A3E635 !important;
}

/* Dropdown customizado de filtros (oculto no desktop, visível no mobile) */
.ytg-filter-mobile {
    display: none !important;
}

.ytg-dropdown {
    position: relative !important;
    width: 100% !important;
    max-width: 320px !important;
    font-family: 'Poppins', sans-serif !important;
}

.ytg-dropdown-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 100% !important;
    padding: 10px 18px !important;
    border: 1px solid rgba(163, 230, 53, 0.3) !important;
    border-radius: 24px !important;
    background: rgba(163, 230, 53, 0.06) !important;
    color: #A3E635 !important;
    font-family: 'Poppins', sans-serif !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    transition: all 0.25s ease !important;
    outline: none !important;
}

.ytg-dropdown-toggle:active {
    background: rgba(163, 230, 53, 0.12) !important;
}

.ytg-dropdown-count {
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    background: rgba(163, 230, 53, 0.2) !important;
    padding: 2px 8px !important;
    border-radius: 10px !important;
    color: #A3E635 !important;
}

.ytg-dropdown-arrow {
    color: #A3E635 !important;
    transition: transform 0.3s ease !important;
    flex-shrink: 0 !important;
    margin-left: 4px !important;
}

.ytg-dropdown.open .ytg-dropdown-arrow {
    transform: rotate(180deg) !important;
}

.ytg-dropdown.open .ytg-dropdown-toggle {
    border-color: #A3E635 !important;
    border-radius: 16px 16px 0 0 !important;
    background: rgba(163, 230, 53, 0.1) !important;
}

/* Menu de opções */
.ytg-dropdown-menu {
    display: none !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 100 !important;
    background: #0D1F1A !important;
    border: 1px solid rgba(163, 230, 53, 0.25) !important;
    border-top: none !important;
    border-radius: 0 0 16px 16px !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6) !important;
}

.ytg-dropdown.open .ytg-dropdown-menu {
    display: block !important;
    animation: ytgDropdownSlide 0.2s ease-out !important;
}

@keyframes ytgDropdownSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Scrollbar customizado */
.ytg-dropdown-menu::-webkit-scrollbar {
    width: 4px;
}
.ytg-dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
}
.ytg-dropdown-menu::-webkit-scrollbar-thumb {
    background: rgba(163, 230, 53, 0.3);
    border-radius: 4px;
}

/* Item individual */
.ytg-dropdown-item {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 10px 18px !important;
    border: none !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.65) !important;
    font-family: 'Poppins', sans-serif !important;
    font-size: 0.72rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    text-transform: uppercase !important;
    letter-spacing: 0.3px !important;
    text-align: left !important;
    transition: all 0.15s ease !important;
    outline: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
}

.ytg-dropdown-item:last-child {
    border-bottom: none !important;
    border-radius: 0 0 16px 16px !important;
}

.ytg-dropdown-item:active,
.ytg-dropdown-item:hover {
    background: rgba(163, 230, 53, 0.08) !important;
    color: #fff !important;
}

.ytg-dropdown-item.active {
    color: #A3E635 !important;
    background: rgba(163, 230, 53, 0.1) !important;
    font-weight: 600 !important;
}

.ytg-dropdown-item-count {
    font-size: 0.6rem !important;
    font-weight: 600 !important;
    background: rgba(255, 255, 255, 0.06) !important;
    color: rgba(255, 255, 255, 0.4) !important;
    padding: 2px 7px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
    margin-left: 8px !important;
}

.ytg-dropdown-item.active .ytg-dropdown-item-count {
    background: rgba(163, 230, 53, 0.2) !important;
    color: #A3E635 !important;
}

/* ========== Grid de vídeos ========== */
.ytg-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 36px;
    transition: opacity 0.3s ease;
}

/* Card de vídeo */
.ytg-card {
    background: #0D2621 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    transition: border-color 0.3s ease !important;
    display: flex !important;
    flex-direction: column !important;
    transform: none !important;
    box-shadow: none !important;
}

.ytg-card:hover {
    border-color: rgba(255, 255, 255, 0.15) !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Thumbnail */
.ytg-thumb {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    border: 0;
    padding: 0;
    cursor: pointer;
    background: #0a1a15;
    overflow: hidden;
}

.ytg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.ytg-card:hover .ytg-thumb img {
    transform: scale(1.05);
}

/* Botão play sobre a thumb — discreto */
.ytg-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: all 0.3s ease;
}

.ytg-card:hover .ytg-play {
    opacity: 1;
}

/* Título do vídeo */
.ytg-title {
    margin: 0 !important;
    padding: 8px 12px !important;
    color: #fff !important;
    font-size: 0.78rem !important;
    line-height: 1.4 !important;
    font-weight: 500 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden !important;
    flex-grow: 1;
    min-height: 36px !important;
    max-height: 42px !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    background: transparent !important;
    font-family: 'Poppins', sans-serif !important;
}

/* Data de publicação */
.ytg-date {
    padding: 0 12px 8px;
    color: rgba(163, 230, 53, 0.5);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.ytg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    place-items: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ytg-lightbox.ytg-lightbox--open {
    display: grid;
    opacity: 1;
}

.ytg-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.92);
    cursor: pointer;
}

.ytg-lightbox__dialog {
    position: relative;
    width: min(1200px, 92vw);
    background: #111;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0,0,0,.8);
    z-index: 1;
    animation: ytgFadeUp 0.3s ease;
}

@keyframes ytgFadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ytg-lightbox__content {
    aspect-ratio: 16/9;
    position: relative;
}

.ytg-lightbox__iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
}

/* Botão fechar — fixo no canto superior direito do viewport. Mesmo padrão
   do lightbox de fotos (.mmg-lb-close): font-size 0 no botão + ::before
   com glifo × pra centralizar perfeitamente no círculo. */
.ytg-lightbox__close {
    position: fixed;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 0;
    cursor: pointer;
    z-index: 2;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.ytg-lightbox__close::before {
    content: '\00D7';
    font-size: 1.5rem;
    font-weight: 300;
    line-height: 1;
    color: #fff;
    margin-top: -3px;
}
.ytg-lightbox__close:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(163, 230, 53, 0.5);
}
/* Quando logado, o WordPress admin bar fica fixo no topo. Empurra o X
   pra baixo dele pra não ficar coberto. */
body.admin-bar .ytg-lightbox__close { top: calc(16px + 32px); }
@media screen and (max-width: 782px) {
    body.admin-bar .ytg-lightbox__close { top: calc(16px + 46px); }
}

/* Setas de navegação prev/next — discretas nas laterais */
.ytg-lightbox__nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 2;
    padding: 0;
    line-height: 1;
}
.ytg-lightbox__nav--prev { left: 16px; }
.ytg-lightbox__nav--next { right: 16px; }
.ytg-lightbox__nav:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(163, 230, 53, 0.5);
    color: var(--lime-500, #A3E635);
}
.ytg-lightbox__nav[disabled] {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Quando o lightbox de vídeo está aberto, esconde site-header e preheader
   (idêntico ao lightbox de fotos) — dá tela cheia ao player. */
body.ytg-lightbox-open .preheader,
body.ytg-lightbox-open .site-header {
    display: none !important;
}

/* ==========================================================================
   Paginação
   ========================================================================== */

.ytg-pagination {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 16px !important;
    padding: 10px 0 20px !important;
}

.ytg-pagination__btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 24px !important;
    background: transparent !important;
    color: rgba(255,255,255,0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 20px !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.25s ease !important;
    font-family: 'Poppins', sans-serif !important;
    text-decoration: none !important;
    box-shadow: none !important;
    outline: none !important;
    line-height: 1.4 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

.ytg-pagination__btn:hover:not(:disabled) {
    border-color: rgba(163, 230, 53, 0.4) !important;
    color: rgba(255,255,255,0.85) !important;
    background: rgba(163, 230, 53, 0.06) !important;
    transform: none !important;
    box-shadow: none !important;
}

.ytg-pagination__btn:disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
}

.ytg-pagination__info {
    color: rgba(255,255,255,0.5) !important;
    font-size: 0.75rem !important;
    font-weight: 400 !important;
    min-width: 100px !important;
    text-align: center !important;
}

/* ==========================================================================
   Loading
   ========================================================================== */

.ytg-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    color: rgba(255,255,255,0.4);
    font-size: 0.85rem;
    gap: 12px;
}

.ytg-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(163, 230, 53, 0.2);
    border-top-color: #A3E635;
    border-radius: 50%;
    animation: ytgSpin 0.8s linear infinite;
}

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

/* ==========================================================================
   Responsivo
   ========================================================================== */

@media (max-width: 1100px) {
    .ytg-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .ytg-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    .ytg-filters {
        gap: 6px !important;
    }
    .ytg-filter-btn {
        padding: 5px 12px !important;
        font-size: 0.7rem !important;
    }
}

@media (max-width: 640px) {
    .ytg-wrap {
        padding: 20px 6px;
    }

    /* Filtros → dropdown no mobile */
    .ytg-filters {
        display: none !important;
    }
    .ytg-filter-mobile {
        display: flex !important;
        justify-content: center !important;
        margin-bottom: 20px !important;
    }

    .ytg-grid {
        gap: 10px;
    }

    .ytg-play {
        width: 36px;
        height: 36px;
        font-size: 13px;
        opacity: 1;
        transform: translate(-50%, -50%);
    }

    .ytg-title {
        font-size: 0.65rem !important;
        padding: 6px 8px !important;
        line-height: 1.3 !important;
    }

    .ytg-date {
        font-size: 0.55rem;
        padding: 0 8px 6px;
    }

    .ytg-pagination__btn {
        padding: 8px 16px !important;
        font-size: 0.7rem !important;
    }

    .ytg-lightbox__close {
        top: 8px;
        right: 8px;
        z-index: 2;
    }
}

@media (max-width: 400px) {
    .ytg-grid {
        grid-template-columns: 1fr;
    }
}
