/* Research Backlog — Blue/Purple gradient with neon accents */

:root {
    --bg-primary: #fafafa;
    --bg-secondary: #f3f1f9;
    --bg-card: #ffffff;
    
    --text-primary: #1a1a2e;
    --text-secondary: #3d3d5c;
    --text-muted: #6b6b8d;
    
    --blue: #4361ee;
    --blue-light: #5a7cf7;
    --blue-subtle: rgba(67, 97, 238, 0.08);
    --purple: #7c3aed;
    --purple-light: #9b6bf7;
    --purple-subtle: rgba(124, 58, 237, 0.08);
    --neon-blue: #00d4ff;
    --neon-purple: #b14aed;
    --neon-pink: #f472b6;
    --green: #10b981;
    --green-subtle: rgba(16, 185, 129, 0.1);
    --amber: #f59e0b;
    --amber-subtle: rgba(245, 158, 11, 0.1);
    --red: #ef4444;
    
    --border: rgba(124, 58, 237, 0.12);
    --border-light: rgba(67, 97, 238, 0.08);
    --shadow: rgba(67, 97, 238, 0.08);
    --shadow-glow: rgba(124, 58, 237, 0.15);
    
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
    --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
    
    --max-width: 1100px;
    --transition-fast: 0.15s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text-primary);
    background: var(--bg-primary);
    position: relative;
    overflow-x: hidden;
}

/* Animated blue/purple mesh gradient */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse 80% 60% at 10% 15%, rgba(67, 97, 238, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse 70% 50% at 90% 10%, rgba(124, 58, 237, 0.15) 0%, transparent 55%),
        radial-gradient(ellipse 60% 70% at 55% 85%, rgba(67, 97, 238, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 30% 55%, rgba(124, 58, 237, 0.10) 0%, transparent 50%),
        radial-gradient(ellipse 60% 50% at 80% 45%, rgba(0, 212, 255, 0.06) 0%, transparent 55%),
        linear-gradient(135deg, #fafafe 0%, #f0ecf9 25%, #eaf0ff 50%, #f0ecf9 75%, #fafafe 100%);
    background-size: 200% 200%;
    animation: meshGradient 20s ease infinite;
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle 700px at 15% 75%, rgba(124, 58, 237, 0.08) 0%, transparent 65%),
        radial-gradient(circle 600px at 80% 25%, rgba(67, 97, 238, 0.10) 0%, transparent 65%),
        radial-gradient(circle 400px at 50% 50%, rgba(0, 212, 255, 0.04) 0%, transparent 50%);
    background-size: 150% 150%;
    animation: meshGradient2 28s ease infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes meshGradient {
    0%, 100% { background-position: 0% 0%; }
    25% { background-position: 40% 20%; }
    50% { background-position: 100% 50%; }
    75% { background-position: 20% 80%; }
}

@keyframes meshGradient2 {
    0%, 100% { background-position: 100% 0%; }
    33% { background-position: 0% 60%; }
    66% { background-position: 60% 100%; }
}

body > * {
    position: relative;
    z-index: 1;
}

a {
    color: var(--blue);
    text-decoration: none;
    transition: all var(--transition-fast);
}

a:hover {
    color: var(--purple);
}

/* Header — left-aligned */
header {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 3rem 1.5rem 1.5rem;
    text-align: left;
}

h1 {
    font-family: var(--font-sans);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.site-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.65;
    max-width: 720px;
    margin: 0.5rem 0 0;
}

.header-actions {
    margin-top: 1.5rem;
    display: flex;
}

.btn-large {
    padding: 0.85rem 2rem;
    font-size: 1rem;
}

/* Tab Toggle */
.tab-toggle {
    max-width: var(--max-width);
    margin: 0 auto 1.5rem;
    display: flex;
    gap: 0;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    border-radius: 10px;
    padding: 4px;
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    font-family: var(--font-mono);
    font-weight: 500;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(124, 58, 237, 0.04);
}

.tab-btn.active {
    background: var(--bg-card);
    color: var(--purple);
    box-shadow: 0 2px 8px var(--shadow-glow), 0 0 0 1px rgba(124, 58, 237, 0.08);
    font-weight: 600;
}

/* Main Container */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

/* Controls Section */
.controls {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px var(--shadow);
}

.search-container {
    margin-bottom: 1.25rem;
}

#search {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: var(--font-sans);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    transition: all var(--transition-fast);
}

#search:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12), 0 0 20px rgba(124, 58, 237, 0.06);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: var(--font-mono);
}

.filter-group select {
    padding: 0.6rem 2rem 0.6rem 0.75rem;
    font-size: 0.9rem;
    font-family: var(--font-sans);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b8d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: all var(--transition-fast);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-primary,
.btn-secondary {
    padding: 0.6rem 1.25rem;
    font-size: 0.875rem;
    font-family: var(--font-mono);
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-smooth);
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
    color: #fff;
    border: none;
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35), 0 0 30px rgba(0, 212, 255, 0.1);
    color: #fff;
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.7);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.9);
    border-color: var(--purple);
    color: var(--purple);
}

/* Results Info */
.results-info {
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.last-updated {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Project Grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

/* Project Card — glass morphism */
.project-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-left: 3px solid var(--blue);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px var(--shadow);
    transition: all var(--transition-smooth);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    box-shadow: 0 8px 30px var(--shadow-glow), 0 0 40px rgba(0, 212, 255, 0.05);
    transform: translateY(-3px);
    border-color: rgba(124, 58, 237, 0.25);
}

.project-card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    color: var(--text-primary);
}

.project-card h2 a {
    color: var(--text-primary);
    text-decoration: none;
}

.project-card h2 a:hover {
    color: var(--purple);
}

.project-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.6;
    flex-grow: 1;
}

/* Project Metadata Grid */
.project-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.meta-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.meta-icon {
    font-size: 1rem;
    line-height: 1;
}

.meta-content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.meta-label {
    font-size: 0.6rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.meta-value {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    line-height: 1.2;
    word-break: break-word;
}

.meta-value.data-yes {
    color: var(--green);
    font-weight: 500;
}

.meta-value.data-partial {
    color: var(--amber);
}

.meta-value.data-no {
    color: var(--text-muted);
}

/* Info Sections */
.info-section {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.info-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.info-header .meta-icon {
    font-size: 1rem;
}

.info-header .meta-label {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.info-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.info-tag {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-family: var(--font-sans);
    font-weight: 500;
    line-height: 1.3;
}

.help-tag {
    background: var(--green-subtle);
    color: var(--green);
}

.audience-tag {
    background: var(--purple-subtle);
    color: var(--purple);
}

.journal-tag {
    background: var(--blue-subtle);
    color: var(--blue);
}

.keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.keyword {
    background: var(--blue-subtle);
    color: var(--blue);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    font-weight: 500;
}

.project-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

.contact-label {
    color: var(--text-muted);
    font-weight: 500;
}

.contact-link {
    color: var(--blue);
    text-decoration: none;
}

.contact-link:hover {
    color: var(--purple);
}

.date-added {
    color: var(--text-muted);
}

/* Status badges — neon glow accents */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
}

.status-idea {
    background: var(--green-subtle);
    color: var(--green);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
}

.status-data {
    background: var(--blue-subtle);
    color: var(--blue);
    box-shadow: 0 0 8px rgba(67, 97, 238, 0.15);
}

.status-draft {
    background: var(--amber-subtle);
    color: var(--amber);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.15);
}

.status-outline {
    background: var(--purple-subtle);
    color: var(--purple);
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.15);
}

.status-stalled {
    background: rgba(239, 68, 68, 0.08);
    color: var(--red);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.12);
}

/* Grant type badges */
.grant-type-revival {
    background: var(--amber-subtle);
    color: var(--amber);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.15);
}

.grant-type-new {
    background: var(--green-subtle);
    color: var(--green);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
}

/* Grant Card — left accent with neon glow */
.grant-card {
    border-left: 3px solid var(--purple);
    box-shadow: 0 4px 20px var(--shadow), -2px 0 10px rgba(124, 58, 237, 0.06);
}

.grant-card:hover {
    border-left-color: var(--neon-purple);
    box-shadow: 0 8px 30px var(--shadow-glow), -2px 0 20px rgba(124, 58, 237, 0.12);
}

/* Loading & Error States */
.loading,
.error {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.error {
    color: var(--red);
}

/* Footer */
footer {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

footer p {
    font-family: var(--font-sans);
}

footer a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    color: var(--purple);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    grid-column: 1 / -1;
    font-family: var(--font-mono);
}

/* Password Overlay */
#password-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f0ecf9 0%, #eaf0ff 50%, #f0ecf9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.password-modal {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    text-align: center;
    box-shadow: 0 8px 40px var(--shadow-glow);
    max-width: 360px;
    width: 90%;
}

.password-modal h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.password-modal p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.password-modal input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: var(--font-sans);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.8);
}

.password-modal input:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12), 0 0 20px rgba(124, 58, 237, 0.06);
}

.password-modal button {
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-family: var(--font-mono);
    font-weight: 500;
    background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-smooth);
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.25);
}

.password-modal button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35);
}

#password-error {
    color: var(--red);
    font-size: 0.85rem;
    margin-top: 1rem;
    margin-bottom: 0;
    min-height: 1.2em;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 2rem 1rem 1.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    main {
        padding: 0 1rem 2rem;
    }

    .controls {
        padding: 1rem;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .filters {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
        min-width: unset;
    }

    .filter-group select {
        width: 100%;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-primary,
    .btn-secondary {
        text-align: center;
        width: 100%;
    }
    
    .tab-toggle {
        margin-left: 1rem;
        margin-right: 1rem;
    }
}
