/*
Theme Name: CineStream
Theme URI: https://example.com/cinestream
Author: Your Name (with AI Assistant)
Author URI: https://example.com/
Description: A companion theme for The Cinematheque and The Stream plugins, featuring a dynamic dark/light mode and a responsive, modern layout.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cinestream
Tags: two-column, left-sidebar, right-sidebar, custom-header, custom-menu, social, movies
*/


        /* 1. Use a more-intuitive box-sizing model */
        *, *::before, *::after {
          box-sizing: border-box;
        }
        /* 2. Remove default margin */
        * {
          margin: 0;
          box-sizing: border-box;
        }
        /* 3. Enable keyword animations */
        @media (prefers-reduced-motion: no-preference) {
          html {
            interpolate-size: allow-keywords;
          }
        }
        body {
          /* 4. Add accessible line-height */
          line-height: 1.5;
          /* 5. Improve text rendering */
          -webkit-font-smoothing: antialiased;
        }
        /* 6. Improve media defaults */
        img, picture, video, canvas, svg {
          display: block;
          max-width: 100%;
        }
        /* 7. Inherit fonts for form controls */
        input, button, textarea, select {
          font: inherit;
        }
        /* 8. Avoid text overflows */
        p, h1, h2, h3, h4, h5, h6 {
          overflow-wrap: break-word;
        }
        /* 9. Improve line wrapping */
        p {
          text-wrap: pretty;
        }
        h1, h2, h3, h4, h5, h6 {
          text-wrap: balance;
        }
        /*
          10. Create a root stacking context
        */
        #root, #__next {
          isolation: isolate;
        }
        
        /* --- THEME COLOR VARIABLES --- */
        :root {
            --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        }

        .theme-light {
            --bg-primary: #f0f2f5; /* Light grey */
            --bg-secondary: #ffffff; /* White */
            --text-primary: #050505; /* Black */
            --text-secondary: #65676b; /* Grey */
            --border-color: #ced0d4;
            --accent-color: #1877f2; /* Blue */
            --header-bg: #ffffff;
        }

        .theme-dark {
            --bg-primary: #202020; /* Almost black */
            --bg-secondary: #242526; /* Lighter black */
            --text-primary: #e4e6eb; /* Light grey */
            --text-secondary: #b0b3b8; /* Darker grey */
            --border-color: #3e4042;
            --accent-color: #2374e1; /* Brighter blue */
            --header-bg: #242526;
        }

        .nowrap { text-wrap: nowrap; }
        
        /* --- BASE STYLES --- */
        body {
            background-color: var(--bg-primary);
            color: var(--text-primary);
            font-family: var(--font-sans);
            margin: 0;
            padding-top: 56px; /* Space for the fixed header */
        }
        
        /* --- LAYOUT & CONTENT STYLES --- */
        .site-content {
            padding: 0; /* 24px vertical, 10px horizontal padding */
        }
        
        /* UPDATED: Constrain width on non-Stream (dark theme) pages */
        body:not(.theme-light) .site-content {
            max-width: 1280px;
            margin-left: auto;
            margin-right: auto;
        }

        @media (min-width: 768px) {
            .site-content {
                padding: 0; /* 32px vertical, 16px horizontal */
            }
        }

        /* --- HEADER STYLES --- */
        .site-header {
            background-color: var(--header-bg);
            border-bottom: 1px solid var(--border-color);
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 56px;
            z-index: 100;
            padding: 0 10px; /* Max 10px padding on small screens */
            width: 100%;
        }

        .header-inner {
            display: flex;
            align-items: center;
            justify-content: space-between;
            height: 100%;
            width: 100%;
            margin: 0 auto;
        }

        /* Header Sections */
        .header-left, .header-right {
            display: flex;
            align-items: center;
            flex-shrink: 0;
        }
        .header-center {
            flex-grow: 1;
            display: flex;
            justify-content: center;
        }

        /* Logo */
        .site-logo .custom-logo {
            height: 40px;
            width: auto;
            display: block;
        }
        .site-logo .text-logo {
            color: var(--accent-color);
            font-weight: 800;
            font-size: 1.75rem;
            text-decoration: none;
            line-height: 1;
        }

        /* Search Bar */
        .header-search-container {
            display: flex;
            align-items: center;
            margin-left: 10px;
            position: relative;
        }
        #live-search-input {
            background-color: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: 20px;
            padding: 7px 15px;
            color: var(--text-primary);
            width: 240px;
            box-sizing: border-box;
        }
        #live-search-input::placeholder { color: var(--text-secondary); }
        .search-toggle-icon { display: none; }
        #live-search-results {
            position: absolute;
            top: 100%;
            left: 0;
            width: 100%;
            min-width: 280px;
            background-color: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            margin-top: 8px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            max-height: 400px;
            overflow-y: auto;
            display: none;
        }
        .live-search-item {
            display: flex;
            align-items: center;
            padding: 8px;
            border-bottom: 1px solid var(--bg-primary);
            text-decoration: none;
        }
        .live-search-item:last-child { border-bottom: none; }
        .live-search-item:hover { background-color: var(--bg-primary); }
        .live-search-item .result-image { width: 40px; height: 60px; object-fit: cover; border-radius: 4px; margin-right: 10px; flex-shrink: 0; }
        .live-search-item .result-details { display: flex; flex-direction: column; }
        .live-search-item .result-title { font-weight: 600; color: var(--text-primary); }
        .live-search-item .result-context { font-size: 0.8rem; color: var(--text-secondary); font-style: italic; }
        .live-search-item .result-type { font-size: 0.75rem; color: var(--text-secondary); text-transform: capitalize; }


        /* Main Navigation (Cinematheque) */
        .main-navigation { width: 100%; }
        .main-navigation ul {
            display: flex;
            justify-content: center;
            margin: 0;
            padding: 0;
            list-style: none;
        }
        .main-navigation li a {
            color: var(--text-secondary);
            text-decoration: none;
            font-weight: 600;
            padding: 16px;
            display: block;
            border-bottom: 3px solid transparent;
        }
        .main-navigation li.current-menu-item a,
        .main-navigation li a:hover {
            color: var(--accent-color);
            border-bottom-color: var(--accent-color);
        }

        /* Stream Icon Menu Wrapper */
        .ts-icon-menu-wrapper {
            width: 100%;
            max-width: 680px; /* Max width on desktop */
            margin: 0 auto; /* Center it */
        }

        /* Right-side Icons */
        .header-right .ts-dropdown, .header-right .ts-mobile-menu-container {
            margin-left: 8px;
        }
        .header-right .ts-dropdown-toggle, .header-right .ts-mobile-menu-toggle {
            background-color: var(--bg-primary);
            color: var(--text-primary);
            border-radius: 50%;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: none;
            cursor: pointer;
        }

        /* --- MOBILE RESPONSIVENESS (Mobile First Approach) --- */
        .main-navigation, .ts-icon-menu-wrapper { display: none; }
        .ts-mobile-menu-container { display: block; }
        .header-search-container #live-search-input { display: none; }
        .search-toggle-icon {
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: var(--bg-primary);
            color: var(--text-primary);
            border-radius: 50%;
            width: 40px;
            height: 40px;
            cursor: pointer;
            border: none;
        }

        /* Desktop & Tablet View */
        @media (min-width: 768px) {
            .site-header { padding: 0 16px; }
            .main-navigation, .ts-icon-menu-wrapper { display: block; }
            .ts-mobile-menu-container { display: none; }
            .search-toggle-icon { display: none !important; }
            .header-search-container #live-search-input { display: block; }
        }

        /* Mobile View Specifics */
        @media (max-width: 767px) {
            .header-center {
                flex-grow: 0; /* Don't let it take up space */
            }
            
            .header-search-container.is-active {
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 56px;
                background-color: var(--header-bg);
                padding: 8px;
                z-index: 101;
                box-sizing: border-box;
                display: flex;
                align-items: center;
            }
            .header-search-container.is-active #live-search-input {
                display: block;
                width: 100%;
            }
            .header-search-container.is-active .search-toggle-icon {
                display: none;
            }

            body.theme-light .ts-icon-menu-wrapper {
                display: block;
                position: fixed;
                bottom: 0;
                left: 0;
                right: 0;
                background-color: var(--header-bg);
                border-top: 1px solid var(--border-color);
                z-index: 100;
                box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
            }
        }
        
/*--------------------------------------------------------------
# Responsive Hamburger Menu
--------------------------------------------------------------*/

/* Hamburger Toggle Button Styles */
.primary-menu-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0;
    margin-right: 8px; /* Space between hamburger and logo */
    line-height: 0;
    z-index: 101;
}
.primary-menu-toggle .icon-close {
    display: none;
}
.primary-menu-toggle.is-active .icon-menu {
    display: none;
}
.primary-menu-toggle.is-active .icon-close {
    display: block;
}

/* Mobile Menu Styles */
@media (max-width: 767px) {
    .primary-menu-toggle {
        display: block; /* Show the hamburger button */
    }

    /* Style the mobile dropdown menu */
    .main-navigation {
        display: none; /* Hide the nav by default */
        position: absolute;
        top: 56px; /* Position below the header */
        left: 0;
        right: 0;
        background-color: var(--header-bg);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        z-index: 99;
    }
    
    .main-navigation.is-active {
        display: block; /* Show the nav when active */
    }
    
    .main-navigation ul {
        flex-direction: column; /* Stack menu items vertically */
    }

    .main-navigation li a {
        padding: 16px 20px;
        border-bottom: 1px solid var(--border-color);
    }
    .main-navigation li:last-child a {
        border-bottom: none;
    }
    .main-navigation li.current-menu-item a,
    .main-navigation li a:hover {
        border-bottom: 1px solid var(--border-color); /* Remove the thick underline on mobile */
        color: var(--text-primary);
        background-color: var(--bg-primary);
    }
}

        /* Stream Icon Menu Wrapper */
        .ts-icon-menu-wrapper {
            width: 100%;
            max-width: 680px; /* Max width on desktop */
            margin: 0 auto; /* Center it */
        }

        /* Right-side Icons */
        .header-right .ts-dropdown, .header-right .ts-mobile-menu-container {
            margin-left: 8px;
        }
        .header-right .ts-dropdown-toggle, .header-right .ts-mobile-menu-toggle {
            background-color: var(--bg-primary);
            color: var(--text-primary);
            border-radius: 50%;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: none;
            cursor: pointer;
        }

        /* --- MOBILE RESPONSIVENESS (Mobile First Approach) --- */
        .main-navigation, .ts-icon-menu-wrapper { display: none; }
        .ts-mobile-menu-container { display: block; }
        .header-search-container #live-search-input { display: none; }
        .search-toggle-icon {
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: var(--bg-primary);
            color: var(--text-primary);
            border-radius: 50%;
            width: 40px;
            height: 40px;
            cursor: pointer;
            border: none;
        }

        /* Desktop & Tablet View */
        @media (min-width: 768px) {
            .site-header { padding: 0 16px; }
            .main-navigation, .ts-icon-menu-wrapper { display: block; }
            .ts-mobile-menu-container { display: none; }
            .search-toggle-icon { display: none !important; }
            .header-search-container #live-search-input { display: block; }
        }

        /* Mobile View Specifics */
        @media (max-width: 767px) {
            /* CORRECTED: Removed `display: none` from .header-center */
            .header-center { 
                display: block; /* Ensure the container is visible */
                position: static; /* Let it be part of the flow */
                flex-grow: 0;
            }
            
            .header-search-container.is-active {
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 56px;
                background-color: var(--header-bg);
                padding: 8px;
                z-index: 101;
                box-sizing: border-box;
                display: flex;
                align-items: center;
            }
            .header-search-container.is-active #live-search-input {
                display: block;
                width: 100%;
            }
            .header-search-container.is-active .search-toggle-icon {
                display: none;
            }

            body.theme-light .ts-icon-menu-wrapper {
                display: block;
                position: fixed;
                bottom: 0;
                left: 0;
                right: 0;
                background-color: var(--header-bg);
                border-top: 1px solid var(--border-color);
                z-index: 100;
                box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
            }
        }
        
        

/*--------------------------------------------------------------
# Dynamic Carousel & Results Grid
--------------------------------------------------------------*/

/* FIX: Use a poster aspect ratio for dynamic carousel cards */
.dynamic-carousel .episode-card-image {
    aspect-ratio: 2 / 3;
}

/* Page header for the results page */
.archive-header {
    padding: 30px 40px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}
.archive-title {
    margin: 0;
    font-size: 36px;
}

/* Grid for single-carousel.php */
.results-grid-container {
    padding: 24px 40px;
}
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
}
.result-card a {
    text-decoration: none;
}
.result-card-image {
    aspect-ratio: 2 / 3;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--bg-secondary);
}
.result-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.result-card a:hover .result-card-image img {
    transform: scale(1.05);
}
.card-item-title {
    font-size: 15px;
    color: var(--text-primary);
    margin: 8px 0 0;
    font-weight: 600;
}

/*--------------------------------------------------------------
# Pagination
--------------------------------------------------------------*/
.pagination-container {
    margin-top: 48px;
    text-align: center;
}

/* FIX: Target the UL element correctly */
.pagination-container ul.page-numbers {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    padding: 0;
    gap: 8px;
}

.pagination-container .page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.pagination-container .page-numbers.current {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
    font-weight: 700;
    cursor: default;
}

.pagination-container .page-numbers.dots {
    border: none;
    background-color: transparent;
}

/*Stream Icon Menu*/
.header-center .ts-icon-menu-wrapper {
    box-shadow: none;
    padding: 0;
}

.ts-dropdown-menu {
    z-index: 40;
}
















                .cr-rating-widget {
                    color: #F9FAFB; /* gray-50 */
                    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
                    overflow: hidden;
                    max-width: 100%;
                }
                .cr-widget-section {
                    padding: 12px 16px;
                }
                .cr-widget-section:first-child {
                    border-bottom: 1px solid #374151; /* gray-700 */
                }
                .cr-widget-label {
                    font-size: 11px;
                    font-weight: 600;
                    color: #9CA3AF; /* gray-400 */
                    letter-spacing: 0.05em;
                    text-align: left;
                    display: block;
                    margin-bottom: 8px;
                }
                .cr-widget-main-line {
                    display: flex;
                    align-items: center;
                    justify-content: flex-start;
                    gap: 12px;
                    text-decoration: none;
                    color: inherit;
                }
                .cr-widget-details {
                    display: flex;
                    flex-direction: column;
                    align-items: flex-start;
                    line-height: 1.2;
                }
                .cr-widget-score-line {
                    display: flex;
                    align-items: baseline;
                }
                .cr-widget-icon {
                    width: 32px;
                    height: 32px;
                    flex-shrink: 0;
                }
                .cr-widget-icon.star-filled { color: #FBBF24; /* amber-400 */ }
                .cr-widget-icon.star-user-rated { color: #60A5FA; /* blue-400 */ }
                .cr-widget-icon.star-outline { color: #60A5FA; /* blue-400 */ }
                .cr-widget-score {
                    font-size: 28px;
                    font-weight: 700;
                }
                .cr-widget-score.user-rated { color: #60A5FA; /* blue-400 */ }
                .cr-widget-outof {
                    font-size: 16px;
                    color: #6B7280; /* gray-500 */
                    font-weight: 600;
                    margin-left: 2px;
                }
                .cr-widget-subtext {
                    font-size: 14px;
                    color: #6B7280; /* gray-500 */
                }
                .cr-widget-rate-link:hover {
                    opacity: 0.8;
                }
                .cr-widget-rate-text {
                    font-size: 24px;
                    font-weight: 700;
                    color: #60A5FA; /* blue-400 */
                }
                
                .cv-popularity-widget {
                    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
                    color: #cbd5e1; /* gray-300 */
                    text-align: left;
                }
                .cv-widget-label {
                    font-size: 12px;
                    font-weight: 600;
                    color: #94a3b8; /* gray-400 */
                    letter-spacing: 0.05em;
                    display: block;
                    margin-bottom: 4px;
                }
                .cv-widget-main-line {
                    display: flex;
                    align-items: baseline; /* FIX: Align to the baseline of the text */
                    gap: 8px;
                    flex-wrap: nowrap; /* FIX: Prevent items from wrapping to a new line */
                }
                .cv-widget-icon {
                    width: 28px;
                    height: 28px;
                    flex-shrink: 0; /* Prevent icon from shrinking */
                }
                .cv-widget-icon.trend-up { color: #4ade80; /* green-400 */ }
                .cv-widget-icon.trend-down { color: #f87171; /* red-400 */ }
                .cv-widget-icon.trend-neutral { color: #94a3b8; /* gray-400 */ }
                .cv-widget-rank {
                    font-size: 2.25rem; /* 36px */
                    font-weight: 700;
                    color: #f8fafc; /* gray-50 */
                    line-height: 1;
                }
                .cv-widget-change {
                    font-size: 1rem; /* 16px */
                    font-weight: 600;
                    color: #94a3b8; /* gray-400 */
                }

}