/* SeqSentry Dashboard — matches landing page design system */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-deep: #0a0e17;
    --bg-card: #111827;
    --bg-card-hover: #151d2e;
    --accent: #00e5a0;
    --accent-dim: #00c98b;
    --accent-glow: rgba(0, 229, 160, 0.15);
    --text-primary: #f0f4f8;
    --text-secondary: #8b9cb8;
    --text-muted: #5a6a82;
    --border: rgba(255,255,255,0.06);
    --border-hover: rgba(0, 229, 160, 0.2);
    --gradient-1: linear-gradient(135deg, #00e5a0 0%, #00b4d8 100%);
    --red: #ef4444;
    --amber: #f59e0b;
    --blue: #3b82f6;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; }

.bg-grid {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 229, 160, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(0, 180, 216, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.content { position: relative; z-index: 1; }

/* === NAV === */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 48px;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    text-decoration: none;
}

.logo span { color: var(--accent); }

.nav-links { display: flex; gap: 24px; align-items: center; }

.nav-link {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--accent);
    background: var(--accent-glow);
}

/* === DASHBOARD LAYOUT === */
.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 48px 80px;
}

.section-header {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.section-sub {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* === UPLOAD ZONE === */
.upload-section {
    margin-bottom: 56px;
}

.upload-zone {
    border: 2px dashed rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 56px 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(17, 24, 39, 0.3);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.upload-icon {
    color: var(--accent);
    margin-bottom: 16px;
    opacity: 0.7;
}

.upload-zone:hover .upload-icon { opacity: 1; }

.upload-text {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-browse {
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* === PROCESSING STATE === */
.processing-state {
    margin-top: 20px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px 24px;
    border: 1px solid var(--border);
}

.processing-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}

.processing-fill {
    height: 100%;
    background: var(--gradient-1);
    border-radius: 2px;
    width: 0%;
    transition: width 0.4s ease;
    animation: pulse-bar 1.5s ease-in-out infinite;
}

@keyframes pulse-bar {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.processing-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.processing-step {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
}

.processing-file {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'Space Mono', monospace;
}

/* === RESULT FLASH === */
.result-flash {
    margin-top: 16px;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: flashIn 0.3s ease;
}

.result-flash.success {
    background: rgba(0, 229, 160, 0.12);
    border: 1px solid rgba(0, 229, 160, 0.25);
    color: var(--accent);
}

.result-flash.error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--red);
}

@keyframes flashIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === HISTORY TABLE === */
.history-section {
    margin-bottom: 56px;
}

.history-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
    padding: 4px 12px;
    border-radius: 20px;
}

.history-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.history-table thead {
    background: rgba(17, 24, 39, 0.6);
}

.history-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.history-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.history-table tbody tr {
    transition: background 0.2s ease;
}

.history-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.history-table tbody tr:last-child td {
    border-bottom: none;
}

.empty-row td {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-muted);
    font-style: italic;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.completed {
    color: var(--accent);
    background: var(--accent-glow);
}

.status-badge.processing {
    color: var(--blue);
    background: rgba(59, 130, 246, 0.12);
}

.status-badge.failed {
    color: var(--red);
    background: rgba(239, 68, 68, 0.12);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.view-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'DM Sans', sans-serif;
}

.view-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.filename-cell {
    font-family: 'Space Mono', monospace;
    font-size: 0.82rem;
    color: var(--text-primary);
}

/* === REPORT SECTION === */
.report-section {
    margin-bottom: 56px;
}

.report-header {
    margin-bottom: 32px;
}

.back-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
    margin-bottom: 16px;
    font-family: 'DM Sans', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.2s;
}

.back-btn:hover { opacity: 0.8; }

.report-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.report-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.report-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* === REPORT SUMMARY CARDS === */
.report-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 36px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.summary-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 4px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.summary-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === ORGANISMS TABLE === */
.report-organisms {
    margin-bottom: 36px;
}

.report-organisms h3, .report-chart h3, .report-amr h3 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.3px;
    margin-bottom: 16px;
}

.organisms-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.organisms-table thead {
    background: rgba(17, 24, 39, 0.6);
}

.organisms-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.organisms-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.organisms-table tbody tr:last-child td { border-bottom: none; }

.organisms-table tbody tr:hover { background: var(--bg-card-hover); }

.org-name {
    color: var(--text-primary);
    font-style: italic;
    font-weight: 500;
}

.clinical-yes {
    color: var(--accent);
    font-weight: 600;
}

.clinical-no {
    color: var(--text-muted);
}

.confidence-high { color: var(--accent); }
.confidence-med { color: var(--amber); }
.confidence-low { color: var(--red); }

/* === ABUNDANCE BARS === */
.report-chart {
    margin-bottom: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.abundance-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.abundance-row {
    display: grid;
    grid-template-columns: 200px 1fr 60px;
    gap: 16px;
    align-items: center;
}

.abundance-label {
    font-size: 0.82rem;
    color: var(--text-primary);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.abundance-track {
    height: 24px;
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.abundance-fill {
    height: 100%;
    border-radius: 6px;
    background: var(--gradient-1);
    transition: width 0.6s ease;
    min-width: 2px;
}

.abundance-pct {
    font-size: 0.82rem;
    font-family: 'Space Mono', monospace;
    color: var(--text-secondary);
    text-align: right;
}

/* === AMR SECTION === */
.report-amr {
    margin-bottom: 36px;
}

.amr-empty {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.amr-organism {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 12px;
}

.amr-org-name {
    font-size: 0.95rem;
    font-weight: 600;
    font-style: italic;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.amr-gene-row {
    display: grid;
    grid-template-columns: 120px 120px 1fr 110px 80px;
    gap: 12px;
    padding: 8px 0;
    font-size: 0.82rem;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.amr-gene-row:last-child { border-bottom: none; }

.amr-gene-name {
    font-family: 'Space Mono', monospace;
    color: var(--accent);
    font-weight: 500;
}

.amr-gene-family {
    color: var(--text-muted);
}

.amr-drug-class {
    color: var(--text-secondary);
}

.amr-resistance {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.amr-resistance.resistant {
    color: var(--red);
    background: rgba(239, 68, 68, 0.12);
}

.amr-resistance.intermediate {
    color: var(--amber);
    background: rgba(245, 158, 11, 0.12);
}

.amr-confidence {
    font-family: 'Space Mono', monospace;
    color: var(--text-muted);
    text-align: right;
}

/* === FOOTER === */
footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
}

.footer-left, .footer-right {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
    nav { padding: 20px 24px; }
    .dashboard { padding: 24px 24px 60px; }
    .report-summary { grid-template-columns: repeat(2, 1fr); }
    .abundance-row { grid-template-columns: 140px 1fr 50px; }
    .amr-gene-row { grid-template-columns: 1fr 1fr; gap: 8px; }
    footer { padding: 32px 24px; flex-direction: column; gap: 12px; }
}

@media (max-width: 600px) {
    .report-summary { grid-template-columns: 1fr; }
    .abundance-row { grid-template-columns: 1fr; gap: 4px; }
    .abundance-label { font-size: 0.75rem; }
    .section-header { flex-direction: column; gap: 4px; }
    .amr-gene-row { grid-template-columns: 1fr; }
}
