.tavo-fvg-wrapper {
    width: 100%;
}

.tavo-filters {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    /* La alineación por defecto se maneja via clases de Elementor */
}

/* Alineación inyectada por Elementor */
.tavo-filter-align-left .tavo-filters {
    justify-content: flex-start;
}

.tavo-filter-align-center .tavo-filters {
    justify-content: center;
}

.tavo-filter-align-right .tavo-filters {
    justify-content: flex-end;
}

.tavo-filter-align-justify .tavo-filters {
    justify-content: space-between;
}

/* Ancho completo (Justificado real) */
.tavo-filter-full-yes .tavo-filters li {
    flex-grow: 1;
    text-align: center;
}

.tavo-filters li {
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 4px;
    background: #f0f0f0;
    /* Border controlado por Elementor */
    transition: all 0.3s ease;
    font-weight: 500;
    /* Evitar que se encojan demasiado */
    flex-shrink: 0;
}

.tavo-filters li.active {
    background: #333;
    color: #fff;
}

/* Grid Layout */
.tavo-gallery-grid {
    width: 100%;
    /* Isotope handles positioning */
    /* El margen negativo se maneja dinámicamente desde el control de Elementor */
}

/* Clearfix for Isotope */
.tavo-gallery-grid:after {
    content: '';
    display: block;
    clear: both;
}

.tavo-video-item {
    float: left;
    /* Fallback */
    padding: 0;
    /* El padding se inyecta desde Elementor */
    margin: 0;
    box-sizing: border-box;
    /* Width is handled by inline styles from Elementor controls */
}

.tavo-video-item-inner {
    position: relative;
    /* Bottom gap */
    /* Right gap is handled by padding/margin logic or Isotope gutter */
    background: transparent;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    /* Asegurar altura completa */
}

.tavo-video-item-inner:hover {
    transform: translateY(-5px);
}

.tavo-thumb-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    /* La altura se controla via JS para el masonry perfecto o aspect-ratio nativo */
}

.tavo-thumb-wrapper.ratio-16x9 {
    aspect-ratio: 16 / 9;
}

.tavo-thumb-wrapper.ratio-9x16 {
    aspect-ratio: 9 / 16;
    /* Limitar altura máxima para que no sea gigante en desktop */
    max-height: 720px;
    min-height: 480px;
    height: 100%;
}

.tavo-thumb {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: block;
    transition: transform 0.5s ease;
    will-change: transform;
}

/* Zoom específico para Shorts para eliminar barras negras laterales */
.tavo-thumb-wrapper.ratio-9x16 .tavo-thumb {
    transform: scale(1.35);
    /* Escala para llenar el frame vertical */
    transform-origin: center center;
}

.tavo-video-item-inner:hover .tavo-thumb {
    transform: scale(1.05);
}

/* Mantener el zoom extra en hover para shorts */
.tavo-video-item-inner:hover .tavo-thumb-wrapper.ratio-9x16 .tavo-thumb {
    transform: scale(1.45);
}

.tavo-play-btn {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    cursor: pointer;
    z-index: 2;
    transition: all 0.3s ease;
}

.tavo-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(204, 0, 0, 0.9);
}

.tavo-play-btn svg,
.tavo-play-btn i {
    width: 40%;
    height: 40%;
}

.tavo-iframe-container {
    position: relative;
    width: 100%;
    /* Padding bottom se calcula dinámicamente en JS según el ratio */
    display: none;
}

.tavo-iframe-container iframe {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.tavo-video-title {
    padding: 12px 15px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

/* --- Pagination --- */
.tavo-pagination-container {
    width: 100%;
    clear: both;
    padding-top: 20px;
    text-align: center;
}

/* Load More Button */
.tavo-load-more-btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #333;
    color: #fff;
    /* Border controlado por Elementor */
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    border-radius: 4px;
}

.tavo-load-more-btn:hover {
    background-color: #555;
    color: #fff;
}

/* Numeric Pagination */
.tavo-numeric-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tavo-page-btn,
.tavo-page-number {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    padding: 0 12px;
}

.tavo-page-btn:hover:not(:disabled),
.tavo-page-number:hover:not(.active) {
    background-color: #e0e0e0;
    border-color: #ccc;
}

.tavo-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tavo-page-number.active {
    background-color: #333;
    color: #fff;
    border-color: #333;
}

.tavo-page-numbers {
    display: flex;
    gap: 4px;
    align-items: center;
}

.tavo-page-dots {
    padding: 0 4px;
    color: #999;
    user-select: none;
}

/* Ensure filters are visible */
.tavo-filters {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0 auto 20px auto !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* --- Lightbox --- */
.tavo-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.tavo-lightbox.open {
    opacity: 1;
    visibility: visible;
}

.tavo-lb-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    aspect-ratio: 16 / 9;
    background: #000;
}

.tavo-lb-frame {
    width: 100%;
    height: 100%;
}

.tavo-lb-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.tavo-lb-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}