/* 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;
}

/* Dark mode with enhanced temperature contrast */
@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;
    }
}

/* Base styles with improved typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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;
}

/* 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 {
    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;
}

/* 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 {
    text-align: center;
    margin-bottom: 10px;
    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;
    position: relative;
    box-shadow: 0 2px 10px rgba(74, 111, 165, 0.2);
}

.feed-header h1 {
    font-family: 'Bebas Neue', "Sans Serif Collection", serif;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 4px;
    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);
}

.react-button-pos {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: var(--primary-blue);
    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-neg {
    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;
}

.react-button-neg:hover {
    background: rgba(45, 32, 24, 0.7);
    box-shadow: 0 0 15px var(--accent-neon-glow);
}

.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);
}

/* 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);
    }
}

.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: 71px;
    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 */
#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 */
#sidebar-toggle:checked ~ .main-wrapper {
    margin-left: var(--sidebar-width);
}

/* Feed container */
.feed-container {
    padding: 0px;
    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(-80px);
    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);
}



/* Content styling */
.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);
}

/* Form elements */
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 form container */
.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 styles */
.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 styles continued */
.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);
    }
}

/* Feed subheader */
.feed-subheader {
    text-align: center;
    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;
}

/* Account page specific styles */
.account-subs {
    padding: 1rem;
}

/* 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);
}

.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;
}

/* Responsive design for mobile and narrow screens */
@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;
    }

    .feed-container {
        padding: 12px;
    }

    .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;
    }

    .feed-header {
        margin-bottom: 24px;
        padding: 16px;
    }

    .feed-header h1 {
        font-size: 1.6rem;
    }
}

@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;
    }
}