/* ===================================
   GALERÍA
   =================================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    aspect-ratio: 1 / 1;
}

.gallery-link {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.9), rgba(156, 39, 176, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.gallery-overlay i {
    color: white;
    font-size: 48px;
}

.gallery-link:hover img {
    transform: scale(1.1);
}

.gallery-link:hover .gallery-overlay {
    opacity: 1;
}

/* ===================================
   VIDEOS
   =================================== */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

.videos-grid iframe,
.videos-grid video {
    width: 100%;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

/* ===================================
   NAVEGACIÓN
   =================================== */
.festival-navigation {
    margin-top: 80px;
    padding-top: 40px;
    border-top: 2px solid #eee;
}

.nav-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.nav-link {
    display: flex;
    flex-direction: column;
    padding: 30px;
    background: var(--light-color);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-color);
    transition: var(--transition);
    border: 2px solid transparent;
}

.nav-link:hover {
    background: white;
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.nav-label {
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark-color);
}

.next-post {
    text-align: right;
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 1024px) {
    .festival-sidebar-floating {
        display: none;
    }
}

@media (max-width: 768px) {
    .festival-hero {
        height: 60vh;
        min-height: 500px;
    }
    
    .festival-meta-bar {
        gap: 15px;
    }
    
    .meta-item {
        font-size: 14px;
        padding: 10px 18px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
    
    .videos-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-links {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .festival-content-wrapper {
        padding: 40px 0;
    }
    
    .festival-section {
        margin-bottom: 50px;
    }
    
    .section-header {
        margin-bottom: 30px;
    }
    
    .description-content {
        font-size: 16px;
    }
}

/* Video Gallery styles */
.video-gallery-container {
    width: 100%;
    position: relative;
    /* Add a border and shadow to visually separate the video gallery */
    border: 1px solid var(--light-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.video-gallery-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.video-gallery-content .aiovg {
    width: 100% !important;
}

/* Isolate pagination elements to prevent page-level conflicts */
.video-gallery-content .aiovg-pagination-links,
.video-gallery-content .pagination {
    z-index: 10;
    position: relative;
    /* Ensure pagination works within the gallery */
    clear: both;
    text-align: center;
    padding: 20px 0;
}

/* Override any conflicting styles from the main page */
.video-gallery-content div[id*="aiovg"] {
    all: initial;
    font-family: inherit;
    width: 100%;
}

/* Specific styles for video gallery to ensure proper functioning */
.video-gallery-content .aiovg-grid {
    margin: -15px !important;
}

.video-gallery-content .aiovg-thumbnail {
    margin: 15px !important;
}

/* Timeline styles */
.festival-timeline {
    position: relative;
    padding: 50px 0;
    text-align: center;
}

.festival-timeline h2 {
    font-size: 2.5rem;
    color: var(--dark-color);
    margin-bottom: 40px;
}

.timeline-container {
    position: relative;
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    height: 200px; /* Increased height to accommodate top-positioned tooltips */
}

.timeline-line {
    position: absolute;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

.timeline-dots-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2;
}

.timeline-dot {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: var(--primary-color);
    border-radius: 50%;
    transform: translateX(-50%);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 0 0 2px var(--primary-color);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
}

.timeline-dot:hover {
    background-color: var(--secondary-color);
    box-shadow: 0 0 0 2px var(--secondary-color);
    transform: translateX(-50%) scale(1.2);
}

.timeline-dot .dot-year {
    position: absolute;
    top: -30px; /* Position year above the dot */
    white-space: nowrap;
    color: var(--dark-color);
    font-size: 0.9rem;
}

.timeline-dot.dot-top {
    top: calc(50% - 50px); /* Adjust vertical position for top dots */
}

.timeline-dot.dot-bottom {
    top: calc(50% + 50px); /* Adjust vertical position for bottom dots */
}

.timeline-tooltip {
    position: absolute;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    width: 300px; /* Fixed width for the tooltip card */
    transform: translateX(-50%); /* Center horizontally */
}

.timeline-tooltip.show {
    opacity: 1;
    visibility: visible;
}

.tooltip-card {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tooltip-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.tooltip-content h3,
.tooltip-content h4 {
    margin: 0;
    color: var(--dark-color);
}

.tooltip-content h3 {
    font-size: 1.4rem;
}

.tooltip-content h4 {
    font-size: 1.1rem;
    color: var(--primary-color);
}

.tooltip-content p {
    font-size: 0.9rem;
    color: #666;
    margin: 10px 0;
}

.tooltip-more .btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.tooltip-more .btn:hover {
    background-color: var(--secondary-color);
}

/* Arrow for tooltip */
.timeline-tooltip.tooltip-top::after {
    content: '';
    position: absolute;
    bottom: -10px; /* Position the arrow below the tooltip */
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 20px;
    height: 20px;
    background: white;
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
    z-index: -1; /* Behind the tooltip content */
}

/* Responsive adjustments for timeline */
@media (max-width: 768px) {
    .timeline-container {
        height: auto;
        min-height: 250px; /* Ensure enough space for dots and tooltips */
    }

    .timeline-line {
        display: none; /* Hide horizontal line on small screens */
    }

    .timeline-dots-wrapper {
        flex-direction: column;
        align-items: flex-start;
        padding-left: 20px;
    }

    .timeline-dot {
        position: relative;
        left: 0 !important;
        top: auto !important;
        margin-bottom: 40px; /* Space between vertical dots */
        transform: none;
    }

    .timeline-dot .dot-year {
        top: 0;
        left: 30px;
        transform: translateY(-50%);
    }

    .timeline-tooltip {
        position: relative;
        width: 90%;
        max-width: 300px;
        margin: 20px auto;
        left: auto !important;
        top: auto !important;
        transform: none;
    }

    .timeline-tooltip.tooltip-top::after {
        display: none; /* Hide arrow on small screens */
    }
}