/**
 * Emergency Fix for Card Grids Visibility
 * ONLY applies to dedicated pages (speaking, videos, articles)
 * Does NOT affect homepage carousels
 */

/* FORCE GRID TO BE VISIBLE - ONLY on dedicated pages */
body.page-speaking .events-grid,
body.page-videos .videos-grid,
body.page-articles .articles-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    gap: 24px !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    transform: none !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
}

/* FORCE CARDS TO BE VISIBLE - ONLY on dedicated pages */
body.page-speaking .event-thumbnail,
body.page-videos .video-thumbnail {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    width: 100% !important;
    height: 320px !important;
    cursor: pointer !important;
    transition: transform 0.3s ease !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
}

body.page-articles .article-thumbnail {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    width: 100% !important;
    height: 320px !important;
    cursor: pointer !important;
    transition: transform 0.3s ease !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1) !important;
    background: white !important;
    border: 2px solid rgba(93, 167, 231, 0.3) !important;
}

/* ORIGINAL HOVER EFFECTS - ONLY on dedicated pages */
body.page-speaking .event-thumbnail:hover,
body.page-videos .video-thumbnail:hover {
    transform: translateY(-5px) !important;
    border: 2px solid var(--primary-color) !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4) !important;
}

body.page-articles .article-thumbnail:hover {
    transform: translateY(-5px) !important;
    border: 2px solid var(--primary-color) !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15) !important;
}

/* FORCE IMAGES TO BE VISIBLE - ONLY on dedicated pages */
body.page-speaking .event-thumbnail img,
body.page-videos .video-thumbnail img,
body.page-articles .article-thumbnail img {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* ORIGINAL OVERLAY STYLES - Events & Videos - ONLY on dedicated pages */
body.page-speaking .event-overlay,
body.page-videos .video-overlay {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: rgba(0, 0, 0, 0.8) !important;
    padding: 15px 15px 10px 15px !important;
    color: var(--text-white) !important;
    transition: all 0.4s ease !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
}

body.page-speaking .event-thumbnail:hover .event-overlay,
body.page-videos .video-thumbnail:hover .video-overlay {
    top: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.9) !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 40px 20px !important;
}

/* ORIGINAL OVERLAY STYLES - Articles - ONLY on dedicated pages */
body.page-articles .article-overlay {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    padding: 15px 15px 10px 15px !important;
    color: var(--text-dark) !important;
    transition: all 0.4s ease !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
}

body.page-articles .article-thumbnail:hover .article-overlay {
    top: 0 !important;
    bottom: 0 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 40px 20px !important;
}

/* ORIGINAL TEXT STYLES - ONLY on dedicated pages - INCREASED FONT SIZES */
body.page-speaking .event-date,
body.page-videos .video-duration {
    font-size: 12px !important;
    font-weight: 500 !important;
    opacity: 0.9 !important;
    margin-bottom: 5px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    transition: all 0.4s ease !important;
}

body.page-speaking .event-thumbnail:hover .event-date,
body.page-videos .video-thumbnail:hover .video-duration {
    font-size: 16px !important;
    margin-bottom: 15px !important;
    opacity: 1 !important;
}

/* Title styles for BOTH dedicated pages AND homepage carousels */
body.page-speaking .event-name,
body.page-videos .video-title,
body.page-home .event-name,
body.page-home .video-title {
    font-size: 18px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    transition: all 0.4s ease !important;
}

body.page-speaking .event-thumbnail:hover .event-name,
body.page-videos .video-thumbnail:hover .video-title,
body.page-home .event-thumbnail:hover .event-name,
body.page-home .video-thumbnail:hover .video-title {
    font-size: 20px !important;
    margin-bottom: 25px !important;
    line-height: 1.4 !important;
}

body.page-articles .article-date,
body.page-home .article-date {
    font-size: 12px !important;
    font-weight: 500 !important;
    opacity: 0.7 !important;
    margin-bottom: 5px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    transition: all 0.4s ease !important;
    color: var(--text-muted) !important;
}

body.page-articles .article-thumbnail:hover .article-date,
body.page-home .article-thumbnail:hover .article-date {
    font-size: 14px !important;
    margin-bottom: 15px !important;
    opacity: 1 !important;
}

body.page-articles .article-title,
body.page-home .article-title {
    font-size: 18px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    transition: all 0.4s ease !important;
    color: var(--text-dark) !important;
    margin-bottom: 6px !important;
}

body.page-articles .article-thumbnail:hover .article-title,
body.page-home .article-thumbnail:hover .article-title {
    font-size: 20px !important;
    margin-bottom: 8px !important;
    line-height: 1.3 !important;
}

/* ORIGINAL BUTTON STYLES - ONLY on dedicated pages */
body.page-speaking .event-details-btn,
body.page-videos .video-play-btn {
    background: transparent !important;
    color: var(--text-white) !important;
    border: 2px solid white !important;
    padding: 10px 20px !important;
    border-radius: 25px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    margin-top: 10px !important;
    align-self: center !important;
    display: none !important;
    cursor: pointer !important;
}

body.page-speaking .event-thumbnail:hover .event-details-btn,
body.page-videos .video-thumbnail:hover .video-play-btn {
    display: inline-block !important;
    animation: slideUpFade 0.3s ease forwards !important;
}

body.page-articles .article-read-btn {
    background: var(--primary-color) !important;
    color: var(--text-white) !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 25px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    margin-top: 10px !important;
    align-self: center !important;
    display: none !important;
    cursor: pointer !important;
}

body.page-articles .article-thumbnail:hover .article-read-btn {
    display: inline-block !important;
    animation: slideUpFade 0.3s ease forwards !important;
}

/* Remove any animation delays that might hide cards - ONLY on dedicated pages */
body.page-speaking .event-thumbnail,
body.page-videos .video-thumbnail,
body.page-articles .article-thumbnail {
    animation: none !important;
    animation-delay: 0s !important;
}

/* Responsive - ONLY on dedicated pages */
@media (max-width: 1200px) {
    body.page-speaking .events-grid,
    body.page-videos .videos-grid,
    body.page-articles .articles-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    body.page-speaking .events-grid,
    body.page-videos .videos-grid,
    body.page-articles .articles-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important;
    }
}

@media (max-width: 480px) {
    body.page-speaking .events-grid,
    body.page-videos .videos-grid,
    body.page-articles .articles-grid {
        grid-template-columns: 1fr !important;
    }
}


/* ========================================
   LIST VIEW OVERRIDES - Ensure list view works correctly
   ======================================== */

/* When in list view, override grid layout */
body.page-speaking .events-grid.list-view,
body.page-videos .videos-grid.list-view,
body.page-articles .articles-grid.list-view {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    grid-template-columns: unset !important;
}

/* List view cards should be horizontal */
body.page-speaking .events-grid.list-view .event-thumbnail,
body.page-videos .videos-grid.list-view .video-thumbnail,
body.page-articles .articles-grid.list-view .article-thumbnail {
    width: 100% !important;
    height: auto !important;
    display: flex !important;
    flex-direction: row !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    border: 2px solid #e2e8f0 !important;
    transform: translateY(0px) !important;
}

/* List view hover - only border color changes */
body.page-speaking .events-grid.list-view .event-thumbnail:hover,
body.page-videos .videos-grid.list-view .video-thumbnail:hover,
body.page-articles .articles-grid.list-view .article-thumbnail:hover {
    border-color: var(--primary-color, #0066cc) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    transform: translateY(0px) !important;
}

/* List view images - smaller and on the left */
body.page-speaking .events-grid.list-view .event-thumbnail img,
body.page-videos .videos-grid.list-view .video-thumbnail img,
body.page-articles .articles-grid.list-view .article-thumbnail img {
    width: 200px !important;
    height: 140px !important;
    object-fit: cover !important;
    flex-shrink: 0 !important;
}

/* List view overlay - static position, no expansion */
body.page-speaking .events-grid.list-view .event-overlay,
body.page-videos .videos-grid.list-view .video-overlay,
body.page-articles .articles-grid.list-view .article-overlay {
    position: static !important;
    background: transparent !important;
    padding: 20px !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    opacity: 1 !important;
    transform: none !important;
    text-align: left !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
}

/* List view overlay on hover - no changes */
body.page-speaking .events-grid.list-view .event-thumbnail:hover .event-overlay,
body.page-videos .videos-grid.list-view .video-thumbnail:hover .video-overlay,
body.page-articles .articles-grid.list-view .article-thumbnail:hover .article-overlay {
    position: static !important;
    background: transparent !important;
    padding: 20px !important;
    justify-content: space-between !important;
    text-align: left !important;
}

/* List view text colors - dark for readability */
body.page-speaking .events-grid.list-view .event-overlay *,
body.page-videos .videos-grid.list-view .video-overlay *,
body.page-articles .articles-grid.list-view .article-overlay * {
    color: #333 !important;
}

body.page-speaking .events-grid.list-view .event-name,
body.page-videos .videos-grid.list-view .video-title,
body.page-articles .articles-grid.list-view .article-title {
    color: #1a202c !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
}

/* List view buttons - always visible */
body.page-speaking .events-grid.list-view .event-details-btn,
body.page-videos .videos-grid.list-view .video-play-btn,
body.page-articles .articles-grid.list-view .article-read-btn {
    display: inline-flex !important;
    align-self: flex-start !important;
    background: var(--primary-color, #0066cc) !important;
    color: var(--text-white) !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 6px !important;
    margin-top: 12px !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* List view buttons hover */
body.page-speaking .events-grid.list-view .event-details-btn:hover,
body.page-videos .videos-grid.list-view .video-play-btn:hover,
body.page-articles .articles-grid.list-view .article-read-btn:hover {
    background: var(--primary-color-dark, #0052a3) !important;
}

/* List view - hide duration/date badges that overlap */
body.page-videos .videos-grid.list-view .video-duration {
    display: none !important;
}

/* List view - show metadata inline */
body.page-speaking .events-grid.list-view .event-date,
body.page-speaking .events-grid.list-view .event-location,
body.page-videos .videos-grid.list-view .video-date,
body.page-articles .articles-grid.list-view .article-date {
    color: #666 !important;
    font-size: 14px !important;
    display: inline-block !important;
    opacity: 1 !important;
    visibility: visible !important;
    text-transform: none !important;
    margin-bottom: 8px !important;
}

/* List view mobile responsive */
@media (max-width: 768px) {
    body.page-speaking .events-grid.list-view .event-thumbnail img,
    body.page-videos .videos-grid.list-view .video-thumbnail img,
    body.page-articles .articles-grid.list-view .article-thumbnail img {
        width: 120px !important;
        height: 100px !important;
    }

    body.page-speaking .events-grid.list-view .event-overlay,
    body.page-videos .videos-grid.list-view .video-overlay,
    body.page-articles .articles-grid.list-view .article-overlay {
        padding: 12px !important;
    }
}
