/* Define Color Variables for Light and Dark Mode */
:root {
    /* Light Mode Colors */
    --primary-bg-color: #EFEFED; /* Background color for light mode */
    --primary-alt-bg-color: #A5A4A4; /* Alternate background color for light mode */
    --primary-text-color: #222222;  /* Text color for light mode */

    /* Dark Mode Colors */
    --secondary-bg-color: #222222;   /* Background color for dark mode */
    --secondary-alt-bg-color: #545452; /* Alternate background color for dark mode */
    --secondary-text-color: #f5f5f5; /* Text color for dark mode */

    /* Header and Search Bar Colors */
    --header-color: #ff5700;        /* Header color */
    --light-search-color: #f8f8f6;  /* Light mode search bar background */
    --dark-search-color: #2a2a2a;   /* Dark mode search bar background */
}

/* Basic Reset for Consistent Layout Across Browsers */
* {
    font-family: 'Reddit Sans', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body Styles - Flexbox to Center Content */
body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    transition: background-color 0.3s, color 0.3s; /* Smooth transition for mode change */
}

/* Container that holds the main content */
.container {
    text-align: center;
    width: 800px;
    min-width: 0;
}

/* Header Styles */
h1 {
    font-size: 100px;
    margin-bottom: 20px;
    user-select: none; /* Prevents text selection */
    color: var(--header-color); /* Header color */
}

/* Search Input and Button Styles */
.search-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%; /* Full width container */
    margin: 0 auto; /* Center the container */
    padding: 0 25px; /* Add padding to the left and right */
    box-sizing: border-box; /* Ensure padding is included in the element’s width */
}

.search-bar {
    flex: 1; /* Flexible input that adjusts based on button width */
    padding: 10px;
    font-size: 18px;
    border: 0px;
    border-radius: 4px;
    background-color: var(--light-search-color); /* Light mode search bar background */
    color: var(--primary-text-color); /* Text color */
    margin-right: 10px; /* Space between search input and button */
    min-width: 250px;
}

.search-button {
    padding: 10px 15px;
    font-size: 18px;
    border: 0px;
    border-radius: 4px;
    cursor: pointer;
    background-color: var(--primary-alt-bg-color); /* Button background */
    color: var(--primary-text-color); /* Button text color */
    white-space: nowrap; /* Prevents text wrapping in the button */
}

/* Marquee Styles - For RSS Feed Ticker */
.rss-marquee-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 5px 26px; /* Center the container */
    box-sizing: border-box; /* Ensure padding is included in the element’s width */
    min-width: 300px;
}

.rss-marquee {
    --gap: 1rem; /* Gap between marquee items */
    display: flex; /* Flexbox for scrolling items */
    overflow: hidden; /* Hide anything outside the marquee */
    user-select: none; /* Prevents text selection */
    height: 30px; /* Marquee height */
    gap: var(--gap); /* Gap between items */
    color: var(--header-color); /* Text color */
}

/* The ticker content that will scroll */
.marquee-content {
    flex-shrink: 0;
    display: flex;
    white-space: nowrap; /* Prevents text wrapping */
    font-size: 16px; /* Font size of marquee content */
    animation: scroll-left 100s linear infinite; /* Scroll animation */
    animation-play-state: paused; /* Initially paused */
    color: var(--primary-text-color); /* Text color */
    gap: var(--gap); /* Gap between items */
    justify-content: space-around;
    min-width: 100%;
}

/* Marquee Link Styles */
a.marquee-link:link,
a.marquee-link:visited {
    color: inherit;
    text-decoration: none; /* No underline */
}

a.marquee-link:hover,
a.marquee-link:active {
    color: inherit;
    text-decoration: none; /* No underline on hover */
}

/* Scroll Animation */
@keyframes scroll-left {
    from {
        transform: translateX(0); /* Start at 0 */
    }
    to {
        transform: translateX(calc(-100% - var(--gap))); /* Move to the left */
    }
}

/* Toggle Switch Styles */
.toggles-wrapper {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;  /* Stack the toggles vertically */
    margin-bottom: 20px;      /* Space between the two toggles */
}

/* Toggle Wrapper - Holds label and input */
.toggle-wrapper {
    display: flex;
    justify-content: right;
    margin-bottom: 10px;      /* Space between toggles */
    user-select: none; /* Prevents selection */
}

/* Label for the Mode Toggle */
.mode-label {
    margin-right: 10px; /* Space between the label and the toggle */
    font-size: 14px;
    color: var(--primary-alt-bg-color); /* Label color */
    line-height: 30px; /* Vertically center text */
}

/* Styles for the Toggle Switch */
.toggle-label {
    display: inline-block;
    width: 60px;
    height: 30px;
    background-color: var(--primary-alt-bg-color); /* Background color of the toggle */
    border-radius: 30px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s; /* Smooth transition */
}

/* Handle for the Toggle Switch */
.toggle-label::after {
    content: '';
    width: 26px;
    height: 26px;
    background-color: var(--light-search-color); /* Toggle handle color */
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s; /* Smooth slide transition */
}

/* Dark Mode Toggle - Activated */
input[type="checkbox"]:checked + .toggle-label {
    background-color: var(--secondary-alt-bg-color); /* Dark mode toggle background */
}

input[type="checkbox"]:checked + .toggle-label::after {
    transform: translateX(30px); /* Slide handle to the right */
}

/* Hide the Checkbox */
.toggle-input {
    display: none;
}

/* Light Mode Styles */
body.light-mode {
    background-color: var(--primary-bg-color); /* Light mode background */
    color: var(--secondary-bg-color); /* Light mode text color */
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: var(--secondary-bg-color); /* Dark mode background */
    color: var(--primary-bg-color); /* Dark mode text color */
}

/* Light Mode Search Bar */
body.light-mode .search-bar {
    background-color: var(--light-search-color); /* Light mode background */
    color: var(--primary-text-color); /* Light mode text color */
}

/* Dark Mode Search Bar */
body.dark-mode .search-bar {
    background-color: var(--dark-search-color); /* Dark mode background */
    color: var(--secondary-text-color); /* Dark mode text color */
}

/* Dark Mode Search Button */
body.dark-mode .search-button {
    background-color: var(--secondary-alt-bg-color); /* Dark mode button background */
    color: var(--secondary-text-color); /* Dark mode button text color */
}

/* Dark Mode Marquee Text */
body.dark-mode .marquee-content {
    color: var(--secondary-text-color); /* Dark mode marquee text color */
}

/* Dark Mode Mode Label */
body.dark-mode .mode-label {
    color: var(--secondary-alt-bg-color); /* Dark mode label color */
}
