/* General Dark Mode Variables & Base */
:root {
    --dark-bg-primary: #1a1a1a;
    --dark-bg-secondary: #222222;
    --dark-card-bg: #282828;
    --dark-border-color: #333;
    --dark-text-primary: #e0e0e0;
    --dark-text-secondary: #b0b0b0;
    --dark-text-muted: #888;
    --dark-accent-green: #58d68d;
    --dark-accent-green-hover: #4ac77c;
    --dark-input-bg: #282828;
    --dark-input-border: #444;
    --dark-input-placeholder: #888;
    --dark-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    --dark-card-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    --dark-hover-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* 1. Body & Global Background/Text */
body {
    background-color: var(--dark-bg-primary) !important;
    color: var(--dark-text-primary) !important;
}

h1, h2, h3, h4 {
    color: var(--dark-text-primary) !important;
}

a {
    color: var(--dark-accent-green) !important;
}
a:hover {
    color: var(--dark-accent-green-hover) !important;
}

/* 2. Header & Navigation */
.navbar {
    background: var(--dark-bg-secondary) !important;
    border-bottom: 1px solid var(--dark-border-color) !important;
    box-shadow: var(--dark-shadow) !important;
}

.navbar-logo {
    color: var(--dark-accent-green) !important;
}

.navbar-links a {
    color: var(--dark-text-secondary) !important;
}

.navbar-links a:hover {
    background-color: #2f6f35 !important;
    color: white !important;
}

.nav {
    background-color: var(--dark-bg-secondary) !important;
    border-top: 1px solid var(--dark-border-color) !important;
    border-bottom: 1px solid var(--dark-border-color) !important;
}

.nav-item {
    background-color: var(--dark-card-bg) !important;
    border: 1px solid var(--dark-border-color) !important;
    color: var(--dark-text-primary) !important;
}

.nav-item:hover {
    background-color: var(--dark-accent-green) !important;
    color: var(--dark-bg-primary) !important;
    border-color: var(--dark-accent-green) !important;
}

.nav-item.selected {
    background-color: var(--dark-accent-green) !important;
    color: var(--dark-bg-primary) !important;
    border-color: var(--dark-accent-green) !important;
}

/* 3. Headings & Main Wrapper */
.wrapper { /* New/Modified for this page */
    background-color: var(--dark-bg-primary) !important; /* Ensure content wrapper is dark */
    color: var(--dark-text-primary) !important; /* Ensure text is light */
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 2rem 1rem !important; /* Ensure padding is kept */
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}

.channel-header {
    text-align: center !important;
    width: 100% !important;
    max-width: 1200px !important;
    margin: 40px auto 24px auto !important;
    padding: 0 20px !important;
}

#channelName { /* Specific to channel.html */
    font-family: 'Merriweather', serif !important; /* Keep the font family */
    font-size: 2.2rem !important;
    color: var(--dark-accent-green) !important;
    text-align: center !important;
    display: block !important;
    width: 100% !important;
    margin: 0 auto 1rem auto !important;
}

.page-heading,
.main-heading,
.channel-header h1,
.channel-header h2 {
    color: var(--dark-accent-green) !important;
    text-align: center !important;
}

.sub-heading,
.channel-header p {
    color: var(--dark-text-secondary) !important;
}

/* 4. Search Bar */
.search-bar { /* From index.css */
    /* No background-color needed directly on .search-bar as it's transparent. */
    display: flex !important; /* Ensure flex layout */
    justify-content: center !important;
    align-items: center !important;
    gap: 0.5rem !important;
    max-width: 500px !important;
    margin: 0 auto 1rem auto !important; /* Adjust margin-bottom for search bar */
    width: 100% !important;
    padding: 0 1rem !important;
}

.search-input { /* Also covers #searchBox on channel.html */
    background-color: var(--dark-input-bg) !important;
    color: var(--dark-text-primary) !important;
    border: 1px solid var(--dark-input-border) !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}
.search-input::placeholder {
    color: var(--dark-input-placeholder) !important;
}
.search-input:focus {
    border-color: var(--dark-accent-green) !important;
    box-shadow: 0 0 0 3px rgba(88, 214, 141, 0.4) !important;
}

/* Specific to channel.html search button */
#searchBox + button { /* Targets button directly after searchBox */
    background-color: var(--dark-accent-green) !important;
    color: var(--dark-bg-primary) !important;
    border: none !important;
    padding: 0.5rem 1rem !important; /* Adjust padding for better look with input */
    font-size: 1rem !important; /* Match input font size */
    border-radius: 6px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}
#searchBox + button:hover:not(:disabled) {
    background-color: var(--dark-accent-green-hover) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
}
#searchBox + button:disabled {
    background-color: #2f6f35 !important;
    color: var(--dark-text-muted) !important;
    box-shadow: none !important;
}


/* 5. Channel Content Cards - NEW/MODIFIED FOR channel.html LAYOUT */
#channelContent {
    display: flex !important;
    flex-direction: column !important; /* Stack video cards vertically */
    gap: 24px !important; /* Space between video cards */
    width: 100% !important;
    max-width: 1200px !important; /* Match wrapper max-width */
    margin: 0 auto !important;
}

.video-card { /* Main container for each video + info section */
    display: flex !important;
    flex-wrap: nowrap !important; /* Keep video and info side-by-side on desktop */
    flex-direction: row !important; /* <--- NEW/FIXED: ROW for desktop */
    gap: 24px !important; /* Space between video section and info section */
    max-width: none !important; /* Override 90vw from channel-style.css */
    width: 100% !important; /* Ensure it takes full width of #channelContent */
    margin: 0 auto 0 !important; /* No bottom margin, let #channelContent gap handle it */
    padding: 1rem 24px !important;
    background-color: var(--dark-card-bg) !important;
    border-radius: 12px !important;
    box-shadow: var(--dark-card-shadow) !important;
    align-items: flex-start !important; /* Align sections to the top */
    transition: all 0.3s ease !important; /* Keep transition */
}
.video-card:hover {
    box-shadow: var(--dark-hover-shadow) !important;
}

.video-section, .info-section { /* Direct children of .video-card */
    flex: 1 1 0 !important; /* Allow sections to grow/shrink based on content */
    min-width: 0 !important; /* Prevent content overflow */
    background-color: transparent !important; /* Let .video-card handle background */
    border: none !important; /* Remove individual borders */
    box-shadow: none !important; /* Remove individual shadows */
    padding: 0 !important; /* Remove individual padding from these sections */
    transition: none !important; /* Remove transition, handled by parent */
}

/* Specific styling for video iframe */
.video-section iframe {
    width: 100% !important;
    height: 315px !important;
    border: none !important;
    border-radius: 8px !important;
    background-color: #000 !important; /* Fallback for iframe background */
}

/* Summary section below video */
.summary {
    margin-top: 18px !important;
    font-size: 1.05rem !important;
    line-height: 1.7 !important;
    color: var(--dark-text-secondary) !important; /* Light text for summary */
}
.summary strong {
    color: var(--dark-accent-green) !important; /* Bolded "Summary:" text */
    font-weight: 600 !important;
}

/* Tags below summary */
.tags {
    margin-top: 16px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
}
.tag {
    background-color: #2f6f35 !important; /* Darker green for tags */
    color: white !important;
    padding: 8px 16px !important;
    border-radius: 999px !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
    transition: background-color 0.3s ease !important;
}
.tag:hover {
    background-color: #3a8a3a !important;
    color: white !important;
}

/* Info Section - Details/Summary (Ingredients, Devices) */
details {
    background-color: var(--dark-card-bg) !important; /* Already set by .video-card but explicitly here */
    border-radius: 8px !important;
    padding: 1rem !important;
    margin: 0 !important; /* Remove top/bottom margin, let gap handle it */
    box-shadow: none !important; /* Remove redundant shadow */
    border: 1px solid var(--dark-border-color) !important;
}
summary {
    font-family: 'Merriweather', serif !important;
    font-weight: 600 !important;
    font-size: 1.1rem !important;
    color: var(--dark-accent-green) !important; /* Green summary text */
    padding: 0.5rem !important;
    cursor: pointer !important;
    list-style: none !important;
    outline: none !important;
}
summary::-webkit-details-marker,
summary::marker {
    display: none !important;
    content: none !important;
}

/* Specific heading for Ingredients/Devices */
.ingredients-heading { /* Used for summary on channel.html */
    font-family: 'Merriweather', serif !important;
    font-size: 1.4rem !important;
    font-weight: 600 !important;
    color: var(--dark-accent-green) !important; /* Green heading */
    margin-bottom: 0.5rem !important;
    margin-top: 0 !important; /* Remove top margin, handled by details padding */
    margin-left: 0 !important; /* Remove left margin */
    padding-left: 0 !important; /* Ensure no padding on summary content */
}

/* Scrollable lists (ingredients, devices) */
.scrollable-list {
    max-height: 200px !important;
    overflow-y: auto !important;
    padding: 0.5rem !important; /* Keep padding inside scrollable area */
    margin-left: 0 !important; /* Remove specific margin-left */
    color: var(--dark-text-secondary) !important;
    font-size: 1rem !important; /* Consistent font size */
}
.scrollable-list ul {
    list-style-type: disc !important; /* Default disc for these lists */
    padding-left: 1.2em !important; /* Indent bullets */
    margin: 0 !important;
}
.scrollable-list li {
    margin-bottom: 0.5rem !important;
    color: var(--dark-text-secondary) !important;
}
.scrollable-list li::marker { /* Ensure these markers are styled */
    color: var(--dark-accent-green) !important;
}

/* Category list (if used here, from base.html context) */
.category-list li {
    background-color: #2f6f35 !important;
    color: var(--dark-text-primary) !important;
}

/* Product/device lists - also used for ingredients/devices lists */
.product-section h4,
.device-section h4 {
    font-size: 1rem !important;
    margin-bottom: 0.5rem !important;
    margin-top: 1rem !important;
    color: var(--dark-text-primary) !important;
}
.ingredient-scroll ul,
.device-list { /* These might be the same as .scrollable-list ul li, ensure consistency */
    display: flex !important;
    flex-wrap: nowrap !important;
    list-style: none !important; /* Remove default list style for horizontal items */
    padding: 0 !important;
    margin: 0 !important;
    gap: 0.5rem !important;
}
.ingredient-scroll li,
.device-list li {
    flex: 0 0 auto !important;
    background-color: var(--dark-card-bg) !important;
    padding: 0.4rem 0.8rem !important;
    border: 1px solid var(--dark-border-color) !important;
    border-radius: 8px !important; /* Adjust if needed */
    font-size: 0.9rem !important;
    color: var(--dark-text-primary) !important;
}

/* Pagination buttons */
#paginationControls { /* New: Ensure pagination container is centered */
    display: flex !important;
    justify-content: center !important;
    margin-top: 1rem !important;
    gap: 10px !important; /* Space between buttons */
}
#paginationControls button { /* Target the button directly */
    background-color: var(--dark-accent-green) !important;
    color: var(--dark-bg-primary) !important;
    padding: 0.6rem 1.2rem !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
}
#paginationControls button:disabled {
    background-color: #2f6f35 !important;
    cursor: not-allowed !important;
}
#paginationControls button:hover:not(:disabled) {
    background-color: var(--dark-accent-green-hover) !important;
}


/* Loader */
.loader {
    border-color: var(--dark-border-color) !important;
    border-top-color: var(--dark-accent-green) !important;
}

/* Empty state */
.empty-state {
    background-color: var(--dark-card-bg) !important;
    color: var(--dark-text-primary) !important;
    border: 1px dashed var(--dark-accent-green) !important;
}

/* Focus Styles for Accessibility */
input:focus,
button:focus,
.summary:focus, /* If summary is focusable */
details summary:focus { /* For focus on details/summary elements */
    outline: 3px solid rgba(88, 214, 141, 0.4) !important;
    outline-offset: 2px !important;
}

/* Responsive */
@media (max-width: 768px) {
    .video-card {
        flex-direction: column !important; /* FIX: Stack video and info on mobile */
        flex-wrap: nowrap !important; /* or auto */
        gap: 16px !important; /* Reduce gap on mobile */
        padding: 1rem !important; /* Adjust padding on mobile */
    }
    .video-section, .info-section {
        padding: 0 !important; /* Ensure no padding */
    }
    .video-section iframe {
        height: 200px !important; /* Smaller video size on mobile */
    }
    .summary {
        font-size: 0.9rem !important;
        margin-top: 1rem !important;
    }
    .tags {
        margin-top: 1rem !important;
    }
    .ingredients-heading {
        font-size: 1.2rem !important;
    }
    .scrollable-list {
        padding: 0.3rem !important;
        font-size: 0.9rem !important;
    }
    .scrollable-list ul {
        padding-left: 1em !important;
    }
    .scrollable-list li {
        font-size: 0.9rem !important;
    }
    .pagination-btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem !important;
    }
    .search-bar {
        margin-bottom: 0.8rem !important;
    }
    #searchBox + button {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.9rem !important;
    }
    .channel-header {
        margin: 20px auto 16px auto !important;
    }
    #channelName {
        font-size: 1.8rem !important;
        margin-bottom: 0.8rem !important;
    }
}
@media (max-width: 480px) {
    .video-card {
        padding: 0.8rem !important;
    }
    .video-section iframe {
        height: 180px !important;
    }
    .summary {
        font-size: 0.85rem !important;
    }
    .tag {
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
    }
    .ingredients-heading {
        font-size: 1.1rem !important;
    }
    .scrollable-list {
        font-size: 0.85rem !important;
    }
    .scrollable-list ul {
        padding-left: 0.8em !important;
    }
    .pagination-btn {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.85rem !important;
    }
}
