/* =============================================================================
   Sink Microbiome Project - Website Styles
   ============================================================================= */

/* CSS Variables */
:root {
    --primary-blue: #1a4b8c;
    --primary-green: #2e8b57;
    --light-blue: #6baed6;
    --accent-red: #e63946;
    --background: #f8f9fa;
    --white: #ffffff;
    --text-dark: #333333;
    --text-light: #666666;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--background);
}

/* Top Nav */
.top-nav {
    background-color: #1a3a5c;
    padding: 7px 20px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 24px;
}

.top-nav a {
    color: #cfe2f3;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s;
}

.top-nav a:hover {
    color: #ffffff;
}

.top-nav svg {
    width: 16px;
    height: 16px;
}

/* Funding statement */
.funding-text {
    font-size: 0.82rem;
    color: #ffffff;
    text-align: center;
    max-width: 800px;
    margin: 8px auto 0;
    padding: 0 20px;
}

/* Microbial community figure (shared between index and microbes pages) */
.figure-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    justify-content: center;
    align-items: flex-start;
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
}
.figure-panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
    padding: 28px 24px;
}
.figure-panel h2 {
    font-size: 1em;
    font-weight: 700;
    margin: 0 0 18px;
    text-align: center;
    letter-spacing: .02em;
}
.donut-panel { flex: 0 0 300px; }
.bar-panel    { flex: 1 1 400px; min-width: 280px; }
.donut-wrap   { position: relative; width: 200px; height: 200px; margin: 0 auto 20px; }
.donut-wrap svg { width: 100%; height: 100%; overflow: visible; }
.donut-center {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    text-align: center; pointer-events: none;
}
.donut-center .big   { font-size: 1.6em; font-weight: 700; line-height: 1; }
.donut-center .small { font-size: 0.7em; opacity: .6; }
.phylum-legend { list-style: none; margin: 0; padding: 0; }
.phylum-legend li {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.85em; padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
}
.phylum-legend li:last-child { border-bottom: none; }
.legend-dot  { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.legend-name { flex: 1; font-style: italic; }
.legend-pct  { font-weight: 600; white-space: nowrap; }
.bar-row {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 10px; font-size: 0.82em;
}
.bar-label {
    width: 140px; flex-shrink: 0;
    text-align: right; font-style: italic;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-track {
    flex: 1; background: #f0f2f5; border-radius: 4px; height: 20px;
    position: relative; overflow: hidden;
}
.bar-fill   { height: 100%; border-radius: 4px; transition: width .6s ease; }
.bar-pct {
    position: absolute; right: 6px; top: 50%;
    transform: translateY(-50%);
    font-size: 0.78em; font-weight: 600; color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.bar-pct.outside {
    position: static; transform: none;
    color: #555; text-shadow: none; flex-shrink: 0; width: 36px;
    font-size: 0.78em; font-weight: 600;
}
.figure-note {
    text-align: center; font-size: 0.75em; opacity: .5;
    margin: 0 auto 40px; max-width: 700px; padding: 0 20px;
}
.bar-desc {
    margin-left: 148px;
    font-size: 0.72em;
    color: #777;
    font-style: italic;
    margin-top: -4px;
    margin-bottom: 8px;
    line-height: 1.4;
}
@media (max-width: 600px) {
    .bar-desc { margin-left: 108px; }
}

/* Video section */
.video-section {
    text-align: left;
}
.video-section h2 {
    text-align: left;
}
.video-section p {
    text-align: left;
}
.video-embed {
    position: relative;
    aspect-ratio: 16 / 9;
    max-width: 640px;
    overflow: hidden;
    margin: 16px auto 0;
    border-radius: 10px;
    box-shadow: var(--shadow);
}
.video-embed iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
    border-radius: 10px;
}

/* Drain–countertop similarity strip chart */
.sim-chart-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}
#sim-chart {
    width: 100%;
    height: auto;
    display: block;
}
.sim-tooltip {
    position: absolute;
    background: rgba(26, 75, 140, 0.92);
    color: #fff;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    line-height: 1.4;
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Bubble map */
.map-section {
    overflow: hidden;
}
.map-container {
    position: relative;
    max-width: 860px;
    margin: 0 auto;
}
#us-bubble-map {
    width: 100%;
    height: auto;
    display: block;
}
.map-tooltip {
    position: absolute;
    background: rgba(26, 75, 140, 0.92);
    color: #fff;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
@media (max-width: 600px) {
    .bar-label { width: 100px; font-size: 0.75em; }
}

/* Header */
.main-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-green) 100%);
    color: var(--white);
    padding: 20px 0;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--white);
    padding: 5px;
}

.main-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Section Styles */
section {
    background: var(--white);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

section h2 {
    color: var(--primary-blue);
    font-size: 1.8rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--primary-green);
}

/* Project Intro */
.project-intro {
    background: linear-gradient(135deg, #e8f4f8 0%, #f0f8f0 100%);
    border-left: 5px solid var(--primary-green);
}

.intro-text {
    font-size: 1.2rem;
    color: var(--text-dark);
    line-height: 1.8;
    text-align: justify;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--light-blue) 100%);
    color: var(--white);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

/* Map Section */
.map-section {
    min-height: 400px;
}

#map-container {
    height: 350px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.map-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
    color: var(--text-light);
}

/* County Grid */
.county-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.county-card {
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.county-card:hover {
    border-color: var(--primary-green);
    box-shadow: var(--shadow-hover);
}

.county-card h3 {
    color: var(--primary-blue);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.county-stat {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.county-stat:last-child {
    border-bottom: none;
}

/* Top Taxa Section */
.taxa-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.taxa-item {
    display: flex;
    align-items: flex-start;
    background: var(--background);
    border-radius: 8px;
    padding: 15px 20px;
    transition: all 0.3s ease;
}

.taxa-item:hover {
    background: #e8f4f8;
}

.taxa-rank {
    width: 40px;
    height: 40px;
    background: var(--primary-green);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 20px;
}

.taxa-name {
    flex: 1;
    font-size: 1.1rem;
    font-style: italic;
}

.taxa-abundance {
    font-weight: 700;
    color: var(--primary-blue);
}

.taxa-description {
    font-size: 0.82rem;
    color: var(--text-light);
    font-style: normal;
    margin-top: 3px;
    margin-bottom: 4px;
}

.taxa-bar {
    height: 8px;
    background: linear-gradient(90deg, var(--primary-green) 0%, var(--light-blue) 100%);
    border-radius: 4px;
    margin-top: 6px;
}

/* Lookup Section */
.lookup-section {
    text-align: center;
}

.lookup-section h2 {
    text-align: left;
}

.lookup-form {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.lookup-form input {
    padding: 15px 20px;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    width: 250px;
    transition: border-color 0.3s ease;
}

.lookup-form input:focus {
    outline: none;
    border-color: var(--primary-green);
}

.lookup-form button,
.submit-btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    background: var(--primary-green);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lookup-form button:hover,
.submit-btn:hover {
    background: var(--primary-blue);
    transform: translateY(-2px);
}

.error-message {
    color: var(--accent-red);
    margin-top: 15px;
    font-weight: 500;
}

/* Participants Grid */
.participants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.participant-card {
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-dark);
}

.participant-card:hover {
    border-color: var(--primary-green);
    background: #e8f4f8;
    transform: translateY(-3px);
}

.participant-card .kit-id {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.participant-card .county {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 5px;
}

/* Hypothesis Section */
.hypothesis-section {
    background: linear-gradient(135deg, #f0f8f0 0%, #e8f4f8 100%);
}

.hypothesis-section h2 {
    text-align: center;
    border-bottom: none;
    color: var(--primary-green);
}

.hypothesis-form {
    max-width: 600px;
    margin: 0 auto;
}

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

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-green);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.submit-btn {
    width: 100%;
    margin-top: 10px;
}

/* Updates Notice */
.updates-notice {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-blue) 100%);
    color: var(--white);
    text-align: center;
}

.update-text {
    font-size: 1.2rem;
    font-weight: 500;
}

/* Footer */
.main-footer {
    background: var(--primary-blue);
    color: var(--white);
    text-align: center;
    padding: 30px 20px;
    margin-top: 30px;
}

.contact-text {
    font-size: 1rem;
    margin-bottom: 10px;
}

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

.contact-text a:hover {
    text-decoration: underline;
}

.last-updated {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .main-header h1 {
        font-size: 1.8rem;
    }

    .logo {
        width: 100px;
        height: 100px;
    }

    section {
        padding: 20px;
    }

    section h2 {
        font-size: 1.4rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .lookup-form {
        flex-direction: column;
        align-items: center;
    }

    .lookup-form input {
        width: 100%;
        max-width: 300px;
    }
}

/* Donate nav link (highlighted CTA) */
.top-nav a.nav-donate {
    background: var(--primary-green);
    color: #fff !important;
    padding: 4px 14px;
    border-radius: 14px;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}
.top-nav a.nav-donate:hover {
    background: #236b43;
    color: #fff !important;
}

/* Donation teaser section on index */
.donate-teaser {
    background: linear-gradient(135deg, #f0f8f0 0%, #e8f4f8 100%);
    border-left: 5px solid var(--primary-blue);
    text-align: center;
}
.donate-teaser h2 { border-bottom-color: var(--primary-blue); }
.donate-teaser p  { max-width: 680px; margin: 0 auto 20px; color: var(--text-dark); }
.donate-teaser-tiers {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
}
.teaser-tier {
    background: #fff;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 18px;
    min-width: 110px;
    text-align: center;
    font-size: 0.88rem;
}
.teaser-tier .t-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-blue);
    display: block;
}
.teaser-tier .t-label {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 2px;
    display: block;
}

/* Donate page — tier cards */
.tier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 22px;
    margin: 24px 0;
}
.tier-card {
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 24px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.25s ease;
}
.tier-card:hover {
    border-color: var(--primary-green);
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}
.tier-card.featured {
    border-color: var(--primary-blue);
    border-width: 2.5px;
    background: #fff;
}
.tier-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-blue);
    line-height: 1;
}
.tier-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}
.tier-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    flex: 1;
    line-height: 1.5;
}
.tier-desc ul {
    margin: 6px 0 0 16px;
    padding: 0;
}
.tier-desc li { margin-bottom: 3px; }
.tier-btn {
    display: block;
    text-align: center;
    padding: 10px 14px;
    background: var(--primary-green);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
    margin-top: 12px;
}
.tier-btn:hover { background: var(--primary-blue); }

/* Donation instructions numbered list */
.donate-steps {
    list-style: none;
    padding: 0;
    margin: 16px 0;
    counter-reset: dstep;
}
.donate-steps > li {
    counter-increment: dstep;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
    font-size: 0.95rem;
}
.donate-steps > li::before {
    content: counter(dstep);
    background: var(--primary-blue);
    color: #fff;
    min-width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
    flex-shrink: 0;
    margin-top: 2px;
}
.donate-steps > li > ul {
    margin: 8px 0 0 0;
    padding-left: 18px;
    font-size: 0.9rem;
}
.donate-steps > li > ul > li {
    margin-bottom: 4px;
}
.alert-box {
    background: #fff8e1;
    border-left: 4px solid #f9a825;
    border-radius: 6px;
    padding: 14px 18px;
    margin: 16px 0;
    font-size: 0.92rem;
    line-height: 1.6;
}
.alert-box strong { color: #7b5800; }
.disclaimers-list {
    list-style: disc;
    margin: 10px 0 0 20px;
    padding: 0;
}
.disclaimers-list li {
    margin-bottom: 8px;
    font-size: 0.88rem;
    color: var(--text-light);
    line-height: 1.55;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-green);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
