* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    scroll-behavior: smooth;
}

:root {
    /* Healthcare/Clinical palette - greens, teals, clean whites */
    --primary: #0d7377;
    --primary-light: #14a085;
    --secondary: #32e0c4;
    --accent: #4db8a8;
    --forest: #2c5f4f;
    --cream: #f8f9fa;
    --warm-white: #fefefe;
    --soft-gray: #6c757d;
    --border: #dee2e6;
    --text-dark: #212529;
    --text-medium: #495057;
    
    --font-sans: 'IBM Plex Sans', -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

body {
    max-width: 100vw;
    font-family: var(--font-sans);
    color: var(--text-dark);
    line-height: 1.6;
    background: var(--warm-white);
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-weight: 500;
    line-height: 1.3;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; margin-bottom: 1rem; }

p { margin-bottom: 1rem; }

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Navigation */
.navbar {
    background: white;
    border-bottom: 2px solid var(--border);
    padding: 1.2rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-medium);
    font-weight: 400;
    font-size: 0.95rem;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    text-decoration: none;
}

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.hero h2 {
    font-weight: 300;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    opacity: 0.95;
}

.tagline {
    font-size: 1.05rem;
    opacity: 0.9;
    max-width: 650px;
    margin: 0 auto;
    font-weight: 300;
}

/* Sections */
section {
    padding: 3.5rem 0;
}

.project-info {
    background: var(--cream);
    border-top: 1px solid var(--border);
}

.project-info p {
    font-size: 1.05rem;
    color: var(--text-medium);
    max-width: 750px;
}

/* Stats Bar */
.stats-bar {
    background: white;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.stats-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    flex: 1;
    min-width: 150px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--primary);
    font-family: var(--font-mono);
    display: block;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--soft-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.3rem;
}

/* Progress Section */
.sample-progress {
    background: var(--warm-white);
}

.progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.progress-card {
    background: white;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    padding: 1.8rem;
    border-radius: 4px;
}

.progress-card h4 {
    color: var(--text-medium);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    font-weight: 600;
}

.counter {
    font-size: 2.8rem;
    font-weight: 600;
    color: var(--primary);
    font-family: var(--font-mono);
    margin: 0.8rem 0;
}

.counter .separator {
    color: var(--soft-gray);
    margin: 0 0.3rem;
}

.counter .total {
    color: var(--soft-gray);
}

.label {
    color: var(--text-medium);
    font-size: 0.9rem;
}

.sampling-info {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--cream);
    border-left: 3px solid var(--accent);
    border-radius: 3px;
}

/* Database Access */
.database-access {
    background: var(--cream);
    text-align: center;
    border-top: 1px solid var(--border);
}

.access-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 2rem auto;
    max-width: 700px;
}

.access-option {
    background: white;
    padding: 1.5rem;
    border: 2px solid var(--primary);
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
}

.access-option:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 115, 119, 0.3);
    text-decoration: none;
}

.access-option:hover h4 {
    color: white;
}

.access-option h4 {
    color: var(--primary);
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

/* Database Access */
.database-access {
    background: var(--cream);
    text-align: center;
    border-top: 1px solid var(--border);
}

.data-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem auto;
    max-width: 900px;
    text-align: left;
}

.access-card {
    background: white;
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    padding: 1.5rem;
    border-radius: 4px;
}

.access-card h4 {
    color: var(--primary);
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.access-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.access-card li {
    padding: 0.4rem 0;
    color: var(--text-medium);
    font-size: 0.95rem;
}

.access-card li:before {
    content: "→ ";
    color: var(--primary);
    font-weight: bold;
    margin-right: 0.5rem;
}

.btn-primary {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.9rem 2rem;
    border-radius: 4px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.btn-primary:hover {
    background: var(--primary-light);
    text-decoration: none;
}

.btn-secondary {
    display: inline-block;
    background: white;
    color: var(--primary);
    padding: 0.9rem 2rem;
    border-radius: 4px;
    font-weight: 500;
    border: 2px solid var(--primary);
    cursor: pointer;
    font-size: 0.95rem;
}

.btn-secondary:hover {
    background: var(--cream);
}

/* Data Table Preview */
.data-preview {
    background: white;
    border-top: 1px solid var(--border);
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.9rem;
    border: 1px solid var(--border);
}

.preview-table th {
    background: var(--cream);
    padding: 0.8rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border);
    font-size: 0.85rem;
}

.preview-table td {
    padding: 0.8rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-medium);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.preview-table tr:hover {
    background: var(--cream);
}

.table-note {
    font-size: 0.9rem;
    color: var(--soft-gray);
    font-style: italic;
}

/* About & Contact */
.about {
    background: white;
}

.contact {
    background: var(--cream);
    border-top: 1px solid var(--border);
}

.contact p {
    color: var(--text-medium);
}

/* Footer */
footer {
    background: var(--forest);
    color: rgba(255,255,255,0.9);
    padding: 2rem 0;
    text-align: center;
    margin-top: 3rem;
}

footer p {
    margin: 0;
    font-size: 0.9rem;
}

footer a {
    color: var(--secondary);
}

/* Database Page Specific Styles */
.database-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 3rem 0;
    text-align: center;
}

.database-header h1 {
    font-size: 2.5rem;
    font-weight: 500;
}

.database-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.database-interface {
    padding: 3rem 0;
    background: var(--warm-white);
}

.query-panel {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}

.query-info {
    background: var(--cream);
    padding: 1.5rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    border-left: 3px solid var(--primary);
}

.query-info p {
    color: var(--text-dark);
    margin-bottom: 0.8rem;
}

.query-info p:last-child {
    margin-bottom: 0;
}

.query-info strong {
    color: var(--primary);
}

.query-info ul {
    margin-left: 2rem;
    margin-bottom: 0.8rem;
    color: var(--text-medium);
}

.query-info code {
    display: block;
    margin-top: 0.5rem;
    padding: 0.8rem;
    background: white;
    border-radius: 3px;
    overflow-x: auto;
    border: 1px solid var(--border);
}

.query-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.query-form label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1rem;
}

.query-form textarea {
    width: 100%;
    padding: 1rem;
    background: white;
    border: 2px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-dark);
    resize: vertical;
}

.query-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-actions {
    display: flex;
    gap: 1rem;
}

.query-examples {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.query-examples h4 {
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-size: 1rem;
}

.example-query {
    display: inline-block;
    background: var(--cream);
    color: var(--primary);
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    margin: 0.3rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

.example-query:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Results Panel */
.results-panel {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.results-panel h3 {
    margin-bottom: 1.5rem;
}

.results-container {
    min-height: 300px;
}

.placeholder,
.loading,
.no-results {
    text-align: center;
    color: var(--soft-gray);
    padding: 3rem;
    font-size: 1rem;
}

.table-wrapper {
    overflow-x: auto;
    margin-bottom: 1rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background: white;
}

.results-table th,
.results-table td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.results-table th {
    background: var(--cream);
    font-weight: 600;
    color: var(--text-dark);
    position: sticky;
    top: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-size: 0.8rem;
}

.results-table td {
    color: var(--text-medium);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.results-table tr:hover {
    background: var(--cream);
}

.result-count {
    color: var(--soft-gray);
    font-size: 0.9rem;
    font-style: italic;
    margin: 0;
    padding: 0.8rem;
}

.error-container {
    background: #fff5f5;
    border: 1px solid #fc8181;
    color: #c53030;
    padding: 1.2rem;
    border-radius: 4px;
    margin-top: 1rem;
    border-left: 3px solid #fc8181;
}

/* Database Info */
.database-info {
    background: var(--cream);
    border-top: 1px solid var(--border);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.info-card {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
}

.info-card h4 {
    color: var(--primary);
    margin-bottom: 0.8rem;
}

.info-card p {
    color: var(--text-medium);
    margin: 0;
    line-height: 1.7;
}

/* Responsive */
@media (max-width: 768px) {
    .container, .nav-container { padding: 0 1.5rem; }
    .nav-links { gap: 1.5rem; }
    .hero h1 { font-size: 2rem; }
    .hero h2 { font-size: 1.3rem; }
    .progress-grid { grid-template-columns: 1fr; }
    .stats-container { flex-direction: column; }
    .counter { font-size: 2.5rem; }
    .form-actions { flex-direction: column; }
    .btn-primary, .btn-secondary { width: 100%; }
}

/* Loading Spinner */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    flex-direction: column;
}

.spinner {
    border: 4px solid var(--cream);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: var(--soft-gray);
    font-size: 1.1rem;
}

/* Data Quality Dashboard */
.quality-dashboard {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.quality-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.quality-card {
    background: var(--cream);
    padding: 1.5rem;
    border-radius: 6px;
    border-left: 4px solid var(--primary);
}

.quality-card.warning {
    border-left-color: #ffc107;
}

.quality-card.danger {
    border-left-color: #dc3545;
}

.quality-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary);
    font-family: var(--font-mono);
}

.quality-label {
    font-size: 0.9rem;
    color: var(--text-medium);
    margin-top: 0.5rem;
}

/* Search & Filter Section */
.search-filter {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.search-box {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.search-box:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 0.7rem;
    border: 2px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
}

.filter-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Results Section */
.results-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.export-buttons {
    display: flex;
    gap: 0.5rem;
}

.export-btn {
    background: var(--accent);
    color: white;
    padding: 0.7rem 1.2rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
}

.export-btn:hover {
    opacity: 0.9;
}

.export-btn.pdf {
    background: #dc3545;
}

/* Visualizations */
.viz-section {
    margin-top: 3rem;
}

.viz-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.viz-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    height: 600px;
    display: flex;
    flex-direction: column;
}

.viz-card canvas {
    height: 500px !important;
    width: 100% !important;
}

.viz-card h4 {
    margin-bottom: 1.5rem;
    color: var(--primary);
}

/* Hide scrollbars */
body {
    max-width: 100vw;
    overflow-x: hidden;
}

@media (max-width: 1024px) {
    .viz-grid {
        grid-template-columns: 1fr;
    }
}

/* About Page Styles */
.project-overview {
    background: white;
    padding: 3.5rem 0;
}

.project-overview p {
    font-size: 1.05rem;
    color: var(--text-medium);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.database-description {
    background: var(--cream);
    padding: 3.5rem 0;
    border-top: 1px solid var(--border);
}

.data-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.data-type-card {
    background: white;
    padding: 1.8rem;
    border-radius: 4px;
    border-left: 4px solid var(--primary);
}

.data-type-card h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.data-type-card ul {
    list-style: none;
    padding: 0;
}

.data-type-card li {
    padding: 0.4rem 0;
    color: var(--text-medium);
    font-size: 0.95rem;
}

.data-type-card li:before {
    content: "•";
    color: var(--primary);
    font-weight: bold;
    margin-right: 0.8rem;
}

.study-design {
    background: white;
    padding: 3.5rem 0;
    border-top: 1px solid var(--border);
}

.study-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.study-detail {
    background: var(--cream);
    padding: 1.8rem;
    border-radius: 4px;
    border-left: 3px solid var(--accent);
}

.study-detail h4 {
    color: var(--primary);
    margin-bottom: 0.8rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.study-detail p {
    color: var(--text-medium);
    margin-bottom: 0.8rem;
}

.study-detail ul {
    margin-left: 1.5rem;
    color: var(--text-medium);
}

.study-detail li {
    margin-bottom: 0.4rem;
}

.funding {
    background: var(--cream);
    padding: 3.5rem 0;
    border-top: 1px solid var(--border);
}

.funding p {
    font-size: 1.05rem;
    color: var(--text-medium);
    line-height: 1.8;
}

.team {
    background: white;
    padding: 3.5rem 0;
    border-top: 1px solid var(--border);
}

.team-info {
    background: var(--cream);
    padding: 2rem;
    border-radius: 4px;
    border-left: 4px solid var(--primary);
    margin-top: 2rem;
}

.team-info h4 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.team-info p {
    color: var(--text-medium);
    line-height: 1.8;
}

.team-members {
    font-style: italic;
    color: var(--soft-gray);
}

.research-impact {
    background: var(--cream);
    padding: 3.5rem 0;
    border-top: 1px solid var(--border);
}

.research-impact p {
    font-size: 1.05rem;
    color: var(--text-medium);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.impact-list {
    list-style: none;
    padding: 0;
    margin-top: 2rem;
}

.impact-list li {
    background: white;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border-left: 4px solid var(--primary);
    color: var(--text-medium);
    font-size: 1rem;
}

.impact-list li:before {
    content: "→";
    color: var(--primary);
    font-weight: bold;
    margin-right: 1rem;
}