/* Stream Grid */
.race-streams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
    max-width: 1400px;
    margin: 0 auto;
}

/* Stream Card Styles */
.stream-card {
    display: none;
    opacity: 0;
    background: rgba(157, 157, 157, 0.2);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    overflow: hidden;
    transition: transform 0.2s ease;
    width: 100%;
    min-height: 345.75px;
}

.stream-card:hover {
    transform: translateY(-5px);
}

.stream-card .stream-title {
    padding: 1rem;
    margin: 0;
    font-size: 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Stream Player */
.hls-stream-player-wrapper {
    margin-bottom: 2rem;
    background: #000;
    border-radius: 4px;
    overflow: visible !important;
    position: relative !important;
    width: 100%;
    aspect-ratio: 16/9;
}

/* Video Player */
.hls-stream {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16/9;
    position: relative !important;
}

.hls-stream .vjs-big-play-button {
    background-color: rgba(0,0,0,0.6) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 80px !important;
    height: 80px !important;
    line-height: 80px !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
}

/* Stream Status */
.hls-stream-status {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 99999;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex !important;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.hls-stream-status::before {
    content: "●";
    color: #ff0000;
    font-size: 0.8em;
    margin-right: 2px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.view-stream {
    display: block;
    padding: 1rem;
    text-align: center;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.view-stream:hover {
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .race-streams-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
        padding: 1rem;
    }

    .stream-card .stream-title {
        font-size: 1rem;
    }
}

/* Fix for status overlay in fullscreen */
.hls-stream.vjs-fullscreen .hls-stream-status {
    z-index: 999999 !important;
    top: 2rem;
    right: 2rem;
    background: rgba(0, 0, 0, 0.85);
}

/* YouTube Video Grid */
.youtube-video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 1200px) {
    .youtube-video-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.youtube-video-card {
    margin: 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    overflow: hidden;
    transition: transform 0.2s ease;
}

.youtube-video-card:hover {
    transform: translateY(-5px);
}

.video-thumbnail {
    position: relative;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-title {
    padding: 0.5rem;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.2;
}

.video-meta {
    padding: 0 0.5rem 0.5rem;
    color: #666;
    font-size: 0.8rem;
}

/* Single Stream Page */
.single-stream-page {
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: transparent !important;
}

.single-stream-page .stream-container {
    background: transparent !important;
    box-shadow: none !important;
    overflow: hidden;
}

.single-stream-page .stream-title {
    padding: 1.5rem;
    margin: 0;
    font-size: 1.8rem;
    border-bottom: none !important;
}

.single-stream-page .hls-stream-player-wrapper {
    margin: 0;
    background: #000;
}

.single-stream-page .stream-meta {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
    color: #666;
}

.single-stream-page .stream-content {
    padding: 1.5rem;
}

/* Make sure video player is visible */
.single-stream-page .hls-stream {
    display: block !important;
    opacity: 1 !important;
}

.single-stream-page .hls-stream-player-wrapper {
    display: block !important;
    opacity: 1 !important;
}

/* Hide next/previous post navigation on stream pages */
.single-race_stream .post-navigation,
.single-race_stream .navigation,
.single-race_stream .nav-links,
.single-race_stream .nav-previous,
.single-race_stream .nav-next,
.single-race_stream .posts-navigation,
.single-race_stream .pagination,
.single-hls_stream .post-navigation,
.single-hls_stream .navigation,
.single-hls_stream .nav-links,
.single-hls_stream .nav-previous,
.single-hls_stream .nav-next,
.single-hls_stream .posts-navigation,
.single-hls_stream .pagination,
/* Common theme-specific classes */
.single-race_stream .entry-navigation,
.single-race_stream .adjacent-entry-pagination,
.single-race_stream .prev-next-posts,
.single-race_stream .prev-next-navigation,
.single-hls_stream .entry-navigation,
.single-hls_stream .adjacent-entry-pagination,
.single-hls_stream .prev-next-posts,
.single-hls_stream .prev-next-navigation {
    display: none !important;
}

/* Hide any elements with "previous" or "next" in their class/id */
.single-race_stream [class*="previous"],
.single-race_stream [class*="next"],
.single-race_stream [id*="previous"],
.single-race_stream [id*="next"],
.single-hls_stream [class*="previous"],
.single-hls_stream [class*="next"],
.single-hls_stream [id*="previous"],
.single-hls_stream [id*="next"] {
    display: none !important;
}

.stream-card.loading {
    position: relative;
    min-height: 200px;
    background: rgba(0,0,0,0.1);
}

.stream-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 2px solid rgba(0,0,0,0.1);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Reset blog post styling */
.race-stream-article {
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
}

.race-stream-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    width: 100%;
    background: transparent !important;
}

.stream-content-wrapper {
    width: 100%;
}

.stream-info-section {
    width: 100%;
}

.stream-title {
    font-size: 2em;
    margin-bottom: 1em;
    width: 100%;
}

.stream-description {
    width: 100%;
}

/* Ensure video player takes full width */
.single-stream-page {
    width: 100%;
    max-width: 100%;
}

.stream-container {
    width: 100%;
    margin: 0 auto;
}

.hls-stream-player-wrapper {
    width: 100%;
    position: relative;
    margin-bottom: 2em;
}

.video-js {
    width: 100% !important;
    max-width: 100% !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .race-stream-container {
        padding: 10px;
    }
}

/* Builder Compatibility */
.elementor-page .race-stream-container,
.divi-builder .race-stream-container,
.fl-builder .race-stream-container {
    width: 100%;
    max-width: none;
}

/* Stream specific styles that don't affect theme */
.stream-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.stream-content {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.stream-content .entry-header,
.stream-content .entry-meta,
.stream-content .entry-footer,
.stream-content .post-navigation,
.stream-content .comments-area {
    display: none !important;
}

/* Hide blog elements ONLY on stream pages */
body.single-race_stream .entry-meta:not(.wp-block-social-links):not(.social-share):not(.share-buttons),
body.single-race_stream .entry-footer:not(.wp-block-social-links):not(.social-share):not(.share-buttons),
body.single-race_stream .post-meta:not(.wp-block-social-links):not(.social-share):not(.share-buttons),
body.single-race_stream .post-navigation,
body.single-race_stream .comments-area,
body.single-race_stream .entry-header:not(.wp-block-social-links):not(.social-share):not(.share-buttons),
body.single-race_stream .post-thumbnail,
body.single-race_stream .nav-links,
body.single-race_stream .navigation,
body.single-race_stream .post-author,
body.single-race_stream .author-bio,
body.single-race_stream .related-posts,
body.single-race_stream .wp-block-group-is-layout-flex.wp-container-core-group-is-layout-8.is-layout-flex.is-nowrap.wp-block-group > p,
body.single-race_stream .wp-block-group-is-layout-flex.wp-container-core-group-is-layout-8.is-layout-flex.is-nowrap.wp-block-group,
body.single-race_stream .wp-block-group-is-layout-flex.wp-container-core-group-is-layout-10.is-layout-flex.is-nowrap.wp-block-group,
body.single-race_stream .wp-block-columns-is-layout-flex.wp-container-core-columns-is-layout-2.is-layout-flex.are-vertically-aligned-center.wp-block-columns,
body.single-race_stream .has-x-large-font-size.has-text-align-center.wp-block-heading,
body.single-race_stream .wp-block-group-is-layout-flow.wp-container-core-group-is-layout-14.is-layout-flow.wp-block-group {
    display: none !important;
}

/* Hide admin author block on stream pages */
body.single-race_stream .wp-block-post-author-name,
body.single-race_stream .wp-block-post-author,
body.single-race_stream .wp-block-post-author *,
body.single-race_stream [class*="post-author"],
body.single-race_stream [class*="author-name"] {
    display: none !important;
}
/* Single Stream Page - Keep transparent */
body.single-race_stream .site-content,
body.single-race_stream .content-area,
body.single-race_stream .entry-content,
body.single-race_stream article,
body.single-race_stream .post,
body.single-race_stream .page,
body.single-race_stream .stream-container,
body.single-race_stream .stream-content,
body.single-race_stream .single-stream-page {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* No streams message */
.no-streams-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    margin: 2rem auto;
    max-width: 600px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.no-streams-message p {
    font-size: 1.2rem;
    margin: 0;
    color: #666;
}