/* Import fonts - mixing serif headlines with sans-serif body */
@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap");

/* CSS Variables for enhanced color management with depth and signature accent */
:root {
    /* Signature neon blue accent - electric cyan */
    --accent-neon: #00d9ff;
    --accent-neon-glow: rgba(0, 217, 255, 0.3);
    --accent-neon-dim: #00a8cc;

    /* Primary blues with temperature variation */
    --primary-blue: #4a6fa5;
    --secondary-blue: #5d7aa3;
    --hover-blue: #3a5a95;

    /* Grays with temperature shifts (warmer foreground, cooler background) */
    --dark-gray-warm: #3a3938; /* Warmer for foreground text */
    --dark-gray: #2c3e50; /* Neutral */
    --medium-gray: #5a6c7d; /* Slightly cool */
    --light-gray: #8a9ba8; /* Cooler */
    --light-gray-cool: #95a5b6; /* Even cooler for backgrounds */

    /* Backgrounds with cool tones */
    --background-gray: #e8edf3;
    --background-cool: #e2e8f0; /* Cooler background */
    --card-background: #ffffff;
    --card-background-hover: #fdfefe; /* Slightly warm on hover */

    /* Shadows with depth */
    --card-shadow: rgba(0, 0, 0, 0.06);
    --card-shadow-hover: rgba(0, 0, 0, 0.12);
    --card-shadow-neon: 0 0 20px rgba(0, 217, 255, 0.15);

    /* Text colors with warmth hierarchy */
    --text-primary: #2a2928; /* Warmer black for main text */
    --text-secondary: #677380; /* Cooler for meta */
    --text-tertiary: #8897a7; /* Even cooler for less important */

    --sidebar-width: 300px;
}

/* Base styles with improved typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overscroll-behavior-y: none;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(
            180deg,
            var(--background-cool) 0%,
            var(--background-gray) 100%
    );
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.65; /* Increased from 1.6 for better readability */
    min-height: 100vh;
    font-weight: 400;
    overscroll-behavior: none;
}

/* Enhanced post card with depth */
.post-card {
    background: linear-gradient(
            135deg,
            var(--card-background) 0%,
            var(--card-background-hover) 100%
    );
    border-radius: 12px;
    padding: 26px;
    margin-bottom: 22px;
    box-shadow: 0 2px 8px var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
}

/* Subtle accent line on hover */
.post-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-neon);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.post-card:hover::before {
    transform: translateX(0);
}

.post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px var(--card-shadow-hover), var(--card-shadow-neon);
    background: var(--card-background-hover);
}

/* Distinctive serif headlines with better weight contrast */
.post-title {
    font-family: "Lora", Georgia, serif;
    font-size: 1.35rem; /* Slightly smaller for Lora */
    font-weight: 600; /* Medium-bold for Lora */
    line-height: 1.4; /* Comfortable for readability */
    margin-bottom: 10px;
    color: var(--dark-gray-warm); /* Warmer color for foreground */
    text-decoration: none;
    display: block;
    transition: all 0.2s ease;
    cursor: pointer;
    letter-spacing: -0.01em; /* Slight tightening for Lora */
}

.post-title:hover {
    color: var(--accent-neon-dim);
    text-decoration: none; /* Remove underline */
    text-shadow: 0 0 1px var(--accent-neon-glow); /* Subtle glow effect */
}

/* Lighter weight metadata with cooler tones */
.post-meta {
    font-family: "Inter", sans-serif;
    font-size: 0.825rem; /* Slightly smaller for more contrast */
    color: var(--text-tertiary); /* Cooler, more receded color */
    margin-bottom: 14px;
    font-weight: 400; /* Regular weight for strong contrast with title */
    letter-spacing: 0.01em;
    line-height: 1.5;
}

.post-source {
    color: var(--light-gray-cool);
    font-weight: 500; /* Medium weight for source */
}

.post-date {
    color: var(--light-gray-cool);
    opacity: 0.8;
}

.post-meta-separator {
    margin: 0 10px;
    color: var(--light-gray-cool);
    opacity: 0.5;
}

/* Post description with optimal readability */
.post-description {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    font-family: "Inter", sans-serif;
    font-size: 1rem;
    line-height: 1.75; /* Increased for better readability */
    color: var(--text-primary);
    margin-top: 14px;
    font-weight: 400;
    letter-spacing: 0.005em;
}

.post-description-text {
    flex: 2;
}

.post-description-text h3 {
    text-shadow: 0 2px 4px var(--card-shadow-neon);
}

.post-description-image {
    flex: 1;
}

.post-image {
    width: 100%;
    height: auto;
    border-radius: 4px; /* Optional: rounded corners */
    object-fit: cover; /* Ensures image fits nicely */
}

.description-toggle {
    display: none;
}

.description-v2 {
    display: none;
}

/* Add classes for JavaScript to toggle */
.description-v1.hidden {
    display: none;
}

.description-v2.visible {
    display: block;
}

.toggle-label {
    background: var(--accent-neon-dim);
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.toggle-label::before {
    content: "Summarized";
    transition: content 0.2s ease;
}

/* Use data attributes or classes for the label text change */
.toggle-label.expanded::before {
    content: "Summarize";
}

.toggle-label:hover {
    background: var(--accent-neon);
    box-shadow: 0 0 15px var(--accent-neon-glow);
}

.login-reminder {
    font-family: "Inter", sans-serif;
    font-size: 0.8rem;
    line-height: 1.2; /* Increased for better readability */
    color: var(--text-primary);
}

.login-reminder-link {
    color: var(--accent-neon-dim);
    text-decoration: none;
    font-weight: 500;
}

/* Interactive elements with neon accent */
.action-btn {
    background: linear-gradient(
            135deg,
            var(--primary-blue) 0%,
            var(--secondary-blue) 100%
    );
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Neon accent for primary actions */
.action-btn.primary {
    background: var(--accent-neon-dim);
    box-shadow: 0 4px 14px var(--accent-neon-glow);
}

.action-btn.primary:hover {
    background: var(--accent-neon);
    box-shadow: 0 6px 20px var(--accent-neon-glow), var(--card-shadow-neon);
    transform: translateY(-2px);
}

.action-btn:hover {
    background: linear-gradient(
            135deg,
            var(--hover-blue) 0%,
            var(--primary-blue) 100%
    );
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 111, 165, 0.25);
}

/* Feed header with gradient depth */
.feed-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    text-align: center;
    margin-bottom: 0px;
    padding: 10px;
    background: linear-gradient(
            135deg,
            var(--primary-blue) 0%,
            var(--secondary-blue) 100%
    );
    color: white;
    border-radius: 0px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 10px rgba(74, 111, 165, 0.2);
}

.feed-header h1 {
    font-family: "Playfair Display", Georgia, serif; /* Use your existing imported font */
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 2px; /* Reduce spacing for mixed case */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Form inputs with neon focus */
.form-group input:focus {
    outline: none;
    border-color: var(--accent-neon);
    box-shadow: 0 0 0 3px var(--accent-neon-glow);
}

/* Search input with neon accent */
.search-input:focus {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 2px var(--accent-neon-glow);
    outline: none;
}

.search-button {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-button:hover {
    background: var(--accent-neon);
    box-shadow: 0 0 15px var(--accent-neon-glow);
}

.filter-container {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.react-button-pos {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: #253752;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.react-button-pos:hover {
    background: var(--accent-neon);
    box-shadow: 0 0 15px var(--accent-neon-glow);
}

.react-button-pos-active {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: #809ac0;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.react-button-neg {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: rgba(45, 32, 24, 0.7);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.react-button-neg:hover {
    background: rgba(255, 130, 38, 0.7);
    box-shadow: 0 0 15px var(--accent-neon-glow);
}

.react-button-neg-active {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 130, 38, 0.7);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upcount {
    color: var(--primary-blue);
}

.downcount {
    color: rgba(255, 130, 38, 0.7);
}

/* Direct styling for checkboxes with toggle-switch class */
input[type="checkbox"].toggle-switch {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 50px;
    height: 26px;
    background-color: #ccc;
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s ease;
    outline: none;
    border: none;
}

input[type="checkbox"].toggle-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type="checkbox"].toggle-switch:checked {
    background-color: var(--accent-neon-dim, #007bff);
}

input[type="checkbox"].toggle-switch:checked::after {
    transform: translateX(24px);
}

/* Optional: Add focus styles for accessibility */
input[type="checkbox"].toggle-switch:focus {
    box-shadow: 0 0 0 3px var(--accent-neon-glow, rgba(0, 123, 255, 0.25));
}

/* Optional: Hover effect */
input[type="checkbox"].toggle-switch:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.post-card.loading {
    animation: fadeIn 0.4s ease, neonPulse 2s ease-in-out;
}

/* Keep all other existing styles below this line */

/* Hide the checkbox */
#sidebar-toggle {
    display: none;
}

/* Sidebar styling */
.sidebar {
    position: fixed;
    top: 78px;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: #34495e;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* Show sidebar when checkbox is checked - use ~ instead of + */
#sidebar-toggle:checked ~ .sidebar {
    transform: translateX(0);
}

/* Main content container wrapper - this will slide */
.main-wrapper {
    transition: margin-left 0.3s ease;
    min-height: 100vh;
}

/* Push content when sidebar is open - but leave space for toggle button */
/* Disable page scrollbar when sidebar is active */
#sidebar-toggle:checked ~ .main-wrapper {
    margin-left: var(--sidebar-width);
    overflow: hidden; /* This disables the scrollbar */
    height: 100vh; /* Constrains the height to viewport */
}

/* Also disable body scroll when sidebar is open */
body:has(#sidebar-toggle:checked) {
    overflow: hidden;
}

.feed-container-parent {
    margin-top: 16px;
}

/* Feed container */
.feed-container {
    padding: 0px;
    max-width: 800px;
    margin: 0 auto;
}

.account-subbed-subject-select {
    max-width: 800px;
    margin: 0 auto;
}

/* Toggle button styling */
.toggle-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    transform: translateX(-50px);
    z-index: 1001;
}

.toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.toggle-btn::before {
    content: "☰";
}

/* Change toggle button icon when sidebar is open */
#sidebar-toggle:checked ~ .main-wrapper .toggle-btn::before {
    content: "✕";
}

/* Sidebar navigation */
.sidebar nav {
    padding: 0;
}

.sidebar nav ul {
    list-style: none;
}

.sidebar nav li {
    border-bottom: 1px solid #2c3e50;
}

.sidebar nav a {
    display: block;
    color: #ecf0f1;
    text-decoration: none;
    padding: 15px 20px;
    transition: background-color 0.3s ease;
}

.sidebar nav a:hover {
    color: #00d9ff;
    background-color: #2c3e50;
}

.sidebar nav a.active {
    background-color: var(--accent-neon-dim);
}

.sidebar nav select {
    display: block;
    color: #ecf0f1;
    background-color: #34495e;
    text-decoration: none;
    padding: 15px 20px;
    transition: background-color 0.3s ease;
}

.sidebar nav select:hover {
    color: #00d9ff;
    background-color: #2c3e50;
}

.sidebar nav select.active {
    background-color: var(--accent-neon-dim);
}

/* Base dropdown styles */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-toggle {
    background: linear-gradient(
            135deg,
            var(--primary-blue, #4a6fa5) 0%,
            var(--secondary-blue, #5d7aa3) 100%
    );
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-dropdown-toggle:hover {
    background: linear-gradient(
            135deg,
            var(--hover-blue, #3a5a95) 0%,
            var(--primary-blue, #4a6fa5) 100%
    );
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 111, 165, 0.25);
}

.nav-dropdown-toggle::after {
    content: "▼";
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.nav-dropdown.active .nav-dropdown-toggle::after {
    transform: rotate(180deg);
}

/* Main dropdown menu */
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--card-background, #ffffff);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.nav-dropdown.active .nav-dropdown-menu {
    max-height: 600px;
    opacity: 1;
    visibility: visible;
}

/* Menu items */
.nav-menu-item {
    position: relative;
}

.nav-menu-link {
    display: block;
    padding: 14px 20px;
    color: var(--text-primary, #2a2928);
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    cursor: pointer;
}

.nav-menu-link:hover {
    background: var(--background-cool, #e2e8f0);
    color: var(--accent-neon-dim, #00a8cc);
}

/* Submenu indicator */
.nav-menu-link.has-submenu::after {
    content: "▶";
    float: right;
    font-size: 0.8em;
    transition: transform 0.2s ease;
}

/* Submenu styles */
.nav-submenu {
    max-height: 0;
    overflow: hidden;
    background: var(--background-gray, #e8edf3);
    transition: max-height 0.3s ease;
}

.nav-menu-item:hover > .nav-submenu,
.nav-menu-item:focus-within > .nav-submenu {
    max-height: 500px;
}

.nav-submenu .nav-menu-link {
    padding-left: 35px;
    font-size: 0.95rem;
}

/* Third level submenu */
.nav-submenu .nav-submenu {
    background: var(--background-cool, #e2e8f0);
}

.nav-submenu .nav-submenu .nav-menu-link {
    padding-left: 50px;
    font-size: 0.9rem;
}

/* Checkbox list styles */
.category-list {
    padding: 12px 20px;
    max-height: 300px;
    overflow-y: auto;
}

.category-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
}

.category-item input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

.category-item label {
    cursor: pointer;
    flex: 1;
}

.source-search-container {
    padding: 12px 20px;
}

.source-search-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--light-gray-cool, #95a5b6);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.source-search-input:focus {
    outline: none;
    border-color: var(--accent-neon, #00d9ff);
    box-shadow: 0 0 0 3px var(--accent-neon-glow, rgba(0, 217, 255, 0.3));
}

.source-list {
    max-height: 250px;
    overflow-y: auto;
    margin-top: 8px;
}

.source-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-radius: 6px;
}

.source-item:hover {
    background: var(--background-cool, #e2e8f0);
    color: var(--accent-neon-dim, #00a8cc);
}

.source-item.hidden {
    display: none;
}

.category-list::-webkit-scrollbar, .source-list::-webkit-scrollbar {
    width: 8px;
}

.category-list::-webkit-scrollbar-track, .source-list::-webkit-scrollbar-track {
    background: transparent;
}

.category-list::-webkit-scrollbar-thumb, .source-list::-webkit-scrollbar-thumb {
    background: var(--light-gray, #8a9ba8);
    border-radius: 4px;
}

.category-list::-webkit-scrollbar-thumb:hover, .source-list::-webkit-scrollbar-thumb:hover {
    background: var(--medium-gray, #5a6c7d);
}

.content-section {
    background: white;
    padding: 30px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.content-section h2 {
    font-family: "Playfair Display", Georgia, serif;
    color: var(--dark-gray-warm);
    margin-bottom: 15px;
}

.content-section p {
    line-height: 1.65;
    color: var(--text-primary);
}

select {
    width: 100%;
    display: block;
    color: #ecf0f1;
    background-color: #34495e;
    text-decoration: none;
    padding: 15px 20px;
    transition: background-color 0.3s ease;
}

select:hover {
    color: #00d9ff;
    background-color: #2c3e50;
}

select option {
    background-color: #6c9bd1;
    color: white;
    padding: 8px;
    width: 50%;
}

select option:hover, select option:focus {
    background-color: #5a87c4 !important;
}

.login-container {
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 32px;
    margin: 20px 0;
    box-shadow: 0 2px 8px var(--card-shadow);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeIn 0.4s ease;
}

.login-title {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e4e6ea;
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--card-background);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.button-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.action-btn.secondary {
    background-color: transparent;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.action-btn.secondary:hover {
    background-color: var(--primary-blue);
    color: white;
}

.forgot-password {
    text-align: center;
    margin-top: 16px;
}

.forgot-password .action-btn {
    background-color: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 0.9rem;
}

.forgot-password .action-btn:hover {
    color: var(--accent-neon);
    background-color: var(--accent-neon-glow);
    transform: none;
    box-shadow: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.account-sub-header {
    text-align: center;
    align-content: center;
    margin-bottom: 5px;
    padding: 10px;
    position: sticky;
    /*top: 88px;*/
    top: 78px;
    z-index: 1000;
    background: var(--background-cool);
}

.index-subheader {
    text-align: center;
    align-content: center;
    margin-bottom: 5px;
    padding: 10px;
    position: sticky;
    /*top: 88px;*/
    top: 78px;
    z-index: 1000;
    background: var(--background-cool);
}

.feed-subheader {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 10px;
    padding: 20px;
    background: linear-gradient(
            135deg,
            var(--secondary-blue) 0%,
            var(--primary-blue) 100%
    );
    color: white;
    border-radius: 12px;
    position: relative;
}

.feed-subheader-text {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.feed-subheader-text-dropdown {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    border-radius: 12px;
    margin: 5px;
    width: calc(100%); /* Account for margin */
    max-width: calc(var(--sidebar-width) - 10px); /* Leave some breathing room */
    box-sizing: border-box;
}

.account-subs {
    padding: 1rem;
}

.sources-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    color: #ecf0f1;
    background-color: #34495e;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sources-table thead {
    background: var(--primary-blue);
    color: white;
}

.sources-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--hover-blue);
}

.sources-table tbody tr {
    border-bottom: 1px solid #e4e6ea;
    transition: background-color 0.2s ease;
}

.sources-table tbody tr:hover {
    background: #f0f2f5;
}

.sources-table td {
    padding: 0.75rem 1rem;
    color: #ecf0f1;
    background-color: #34495e;
    font-size: 1rem;
}

.sources-table td a {
    color: var(--accent-neon-dim);
    text-decoration: none;
    transition: all 0.2s ease;
}

.sources-table td a:hover {
    color: var(--accent-neon);
    text-shadow: 0 0 10px var(--accent-neon-glow);
}

.sources-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.sources-table tbody tr:nth-child(even):hover {
    background: #f0f2f5;
}

.sources-table .status-active {
    color: #42b883;
    font-weight: 600;
}

.sources-table .status-inactive {
    color: #65676b;
}

.sources-table .status-error {
    color: #e74c3c;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: var(--sidebar-width); /* Start overlay AFTER the sidebar width */
    width: calc(
            100vw - var(--sidebar-width)
    ); /* Only cover the remaining space */
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999; /* Lower than sidebar */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: pointer;
}

#sidebar-toggle:checked ~ .sidebar-overlay {
    opacity: 1;
    visibility: visible;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.popup-dialog {
    background: var(--card-background);
    border-radius: 16px;
    box-shadow: 0 20px 60px var(--card-shadow-hover), var(--card-shadow-neon);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.popup-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-header h2 {
    font-family: "Playfair Display", serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.popup-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.popup-close:hover {
    background: var(--light-gray-cool);
    color: var(--text-primary);
}

.popup-content {
    padding: 24px;
}

.popup-content p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 24px;
    text-align: center;
}

.popup-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.popup-option-btn {
    background: var(--card-background-hover);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 16px 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.popup-option-btn:hover {
    border-color: var(--accent-neon);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-neon-glow);
}

.popup-option-btn .option-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.popup-option-btn .option-desc {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.popup-footer {
    text-align: center;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 16px;
    margin-top: 8px;
}

.popup-footer small {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

/* Category Grid Styles */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.category-btn {
    background: var(--card-background-hover);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 16px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.category-btn:hover {
    border-color: var(--accent-neon);
    background: var(--accent-neon-glow);
    transform: translateY(-2px);
}

.back-btn {
    background: var(--light-gray);
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: var(--medium-gray);
    color: white;
}

/* Sources table styles */
.sources-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    color: #ecf0f1;
    background-color: #34495e;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    table-layout: fixed; /* Forces table to respect width constraints */
}

.sources-table thead {
    background: var(--primary-blue);
    color: white;
}

.sources-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--hover-blue);
    word-wrap: break-word;
}

.sources-table tbody tr {
    border-bottom: 1px solid #e4e6ea;
    transition: background-color 0.2s ease;
}

.sources-table tbody tr:hover {
    background: #f0f2f5;
}

.sources-table td {
    padding: 0.75rem 1rem;
    color: #ecf0f1;
    background-color: #34495e;
    font-size: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Specific column width control */
.sources-table th:first-child,
.sources-table td:first-child {
    width: 50%; /* Source Name column */
    min-width: 0; /* Allow shrinking below content width */
}

.sources-table th:nth-child(2),
.sources-table td:nth-child(2) {
    width: 30%; /* Subject column */
}

.sources-table th:nth-child(3),
.sources-table td:nth-child(3) {
    width: 20%; /* Subscribed column */
    text-align: center;
}

.sources-table td a {
    color: var(--accent-neon-dim);
    text-decoration: none;
    transition: all 0.2s ease;
    word-break: break-word; /* Force long URLs to break */
}

.sources-table td a:hover {
    color: var(--accent-neon);
    text-shadow: 0 0 10px var(--accent-neon-glow);
}

.sources-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.sources-table tbody tr:nth-child(even):hover {
    background: #f0f2f5;
}

.sources-table .status-active {
    color: #42b883;
    font-weight: 600;
}

.sources-table .status-inactive {
    color: #65676b;
}

.sources-table .status-error {
    color: #e74c3c;
}

/* Popup Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Loading animation with subtle neon pulse */
@keyframes neonPulse {
    0% {
        box-shadow: 0 0 3px var(--accent-neon-glow);
    }
    50% {
        box-shadow: 0 0 10px var(--accent-neon-glow),
        0 0 15px var(--accent-neon-glow);
    }
    100% {
        box-shadow: 0 0 3px var(--accent-neon-glow);
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --accent-neon: #00d9ff;
        --accent-neon-glow: rgba(0, 217, 255, 0.5);
        --accent-neon-dim: #0099bb;

        --primary-blue: #5a7fb5;
        --dark-gray-warm: #f0e6dd;
        --dark-gray: #e0e6ed;
        --medium-gray: #a0b0c0;
        --light-gray: #8090a0;
        --light-gray-cool: #7080a0;

        --background-gray: #141922; /* Very cool background */
        --background-cool: #0f1318;
        --card-background: #1e2631; /* Slightly warmer cards */
        --card-background-hover: #232b38;

        --card-shadow: rgba(0, 0, 0, 0.4);
        --card-shadow-hover: rgba(0, 0, 0, 0.6);
        --card-shadow-neon: 0 0 30px rgba(0, 217, 255, 0.2);

        --text-primary: #f0e8e0; /* Warm white */
        --text-secondary: #a0b0c0; /* Cool gray */
        --text-tertiary: #7088a0;
    }

    .popup-header {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .popup-footer {
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .popup-close:hover {
        background: var(--medium-gray);
    }

    .nav-dropdown-menu {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }

    .nav-menu-link {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

@media (max-width: 480px) {
    .feed-container {
        padding: 8px;
    }

    .post-card {
        padding: 16px;
        margin-bottom: 12px;
    }

    .post-title {
        font-size: 1.1rem;
    }

    .post-meta {
        font-size: 0.75rem;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .post-meta-separator {
        display: none;
    }

    .post-description {
        font-size: 0.875rem;
    }

    .login-container {
        padding: 20px;
    }

    .login-title {
        font-size: 1.3rem;
    }

    .sources-table {
        font-size: 0.8rem;
    }

    .sources-table th,
    .sources-table td {
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Further adjust for very small screens */
    .sources-table th:first-child,
    .sources-table td:first-child {
        width: 40%;
    }

    .sources-table th:nth-child(2),
    .sources-table td:nth-child(2) {
        width: 35%;
    }

    .sources-table th:nth-child(3),
    .sources-table td:nth-child(3) {
        width: 25%;
    }

    /* Make toggle switches smaller on very small screens */
    .sources-table input[type="checkbox"].toggle-switch {
        width: 40px;
        height: 22px;
    }

    .sources-table input[type="checkbox"].toggle-switch::after {
        width: 18px;
        height: 18px;
    }

    .sources-table input[type="checkbox"].toggle-switch:checked::after {
        transform: translateX(18px);
    }
}

@media (max-width: 600px) {
    .popup-dialog {
        width: 95%;
        margin: 10px;
    }

    .popup-header,
    .popup-content {
        padding: 16px;
    }

    .popup-options {
        gap: 8px;
    }

    .category-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 8px;
    }
}

@media (max-width: 768px) {
    /* On mobile, use overlay instead of push */
    #sidebar-toggle:checked ~ .main-wrapper {
        margin-left: 0;
    }

    /* Position toggle button fixed when sidebar is open on narrow screens */
    #sidebar-toggle:checked ~ .main-wrapper .toggle-btn {
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 1002;
        background-color: var(--secondary-blue);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Add overlay for mobile */
    #sidebar-toggle:checked + .sidebar::after {
        content: "";
        position: fixed;
        top: 0;
        left: var(--sidebar-width);
        width: calc(100vw - var(--sidebar-width));
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .post-card {
        padding: 18px;
        margin-bottom: 16px;
        border-radius: 10px;
    }

    .post-title {
        font-size: 1.2rem;
    }

    .post-meta {
        font-size: 0.8rem;
    }

    .post-description {
        font-size: 0.9375rem;
        line-height: 1.6;
        flex-direction: column;
    }

    .post-description-text,
    .post-description-image {
        flex: 1;
    }

    .feed-header {
        margin-bottom: 16px;
        padding: 16px;
    }

    .feed-header h1 {
        font-size: 1.6rem;
    }
}

/* Mobile-specific table adjustments */
@media (max-width: 768px) {
    .account-subs {
        padding: 0.5rem;
        overflow-x: auto; /* Allow horizontal scroll if absolutely needed */
    }

    .sources-table {
        font-size: 0.875rem;
        margin: 0.5rem 0;
    }

    .sources-table th,
    .sources-table td {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    /* Adjust column proportions for mobile */
    .sources-table th:first-child,
    .sources-table td:first-child {
        width: 45%;
    }

    .sources-table th:nth-child(2),
    .sources-table td:nth-child(2) {
        width: 35%;
    }

    .sources-table th:nth-child(3),
    .sources-table td:nth-child(3) {
        width: 20%;
    }
}
