/* CRISPR Screen Guider stylesheet */
:root {
    --primary: #0279EE;
    --primary-dark: #015cb8;
    --secondary: #75A025;
    --accent: #FF9400;
    --danger: #d32f2f;
    --warning: #F9A825;
    --success: #43A047;
    --bg: #FAF9F3;
    --bg-card: #FFFFFF;
    --bg-alt: #ECE9E2;
    --text: #1a1a1a;
    --text-muted: #666;
    --border: #ddd;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --font: -apple-system, "Liberation Sans", "Segoe UI", Roboto, Arial, sans-serif;
    --mono: "SF Mono", "Fira Code", "Consolas", monospace;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Navbar */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    flex-wrap: wrap;
}
.nav-logo { text-decoration: none; color: var(--text); }
.logo-text { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.logo-tagline { display: block; font-size: 0.75rem; color: var(--text-muted); }
.nav-links { display: flex; gap: 0.35rem; align-items: center; }
.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}
.nav-links a:hover { color: var(--primary); background: var(--bg-alt); }
.nav-resources { position: relative; }
.nav-resources summary {
    list-style: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}
.nav-resources summary::-webkit-details-marker { display: none; }
.nav-resources summary:hover { color: var(--primary); background: var(--bg-alt); }
.nav-resource-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    min-width: 180px;
    padding: 0.4rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow);
}
.nav-resource-menu a { display: block; white-space: nowrap; }

/* Main */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 200px);
    min-width: 0;
}

/* Hero */
.hero {
    text-align: center;
    padding: 3rem 1rem;
}
.hero h1 {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.hero-tagline {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 1rem;
}
.hero-description {
    max-width: 700px;
    margin: 0 auto 2rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}
.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}
.hero-help { margin-top: 1.25rem; color: var(--text-muted); }
.hero-help a { color: var(--primary); font-weight: 600; }
.home-workflow { margin: 0 auto; text-align: center; }
.home-workflow p { line-height: 1.8; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: var(--font);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.content-page a.btn-primary { color: white; }
.btn-secondary { background: var(--bg-alt); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #ddd; }
.btn-tertiary { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-tertiary:hover { background: var(--primary); color: white; }
.btn-large { padding: 0.8rem 2rem; font-size: 1.1rem; }

/* Feature grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 3rem 0;
}

.analysis-figures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin: 1.25rem 0;
}

.analysis-figure {
    margin: 0;
    padding: 0.875rem;
    border: 1px solid var(--border-color, #d7e0e7);
    background: #fff;
}

.analysis-figure figcaption {
    margin-bottom: 0.6rem;
    color: var(--text-color, #0f172a);
    font-weight: 650;
}
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.feature-card h3 { color: var(--primary); margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-muted); font-size: 0.9rem; }

/* Workflow */
.workflow-overview { margin: 3rem 0; text-align: center; }
.workflow-overview h2 { margin-bottom: 1.5rem; }
.workflow-chain {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.workflow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    min-width: 100px;
}
.step-number {
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}
.step-name { font-size: 0.8rem; }
.workflow-arrow { color: var(--text-muted); font-size: 1.2rem; }
.workflow-description { max-width: 700px; margin: 0 auto; color: var(--text-muted); }

/* Forms */
.page-header { margin-bottom: 2rem; }
.page-header h1 { color: var(--primary); }
.page-header p { color: var(--text-muted); }

.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    min-width: 0;
}
.form-section h2 {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    min-width: 0;
}
.form-group { display: flex; flex-direction: column; min-width: 0; }
.form-group label { font-weight: 600; margin-bottom: 0.25rem; font-size: 0.9rem; }
.form-group input, .form-group select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: var(--font);
}
.form-group textarea { width: 100%; max-width: 100%; min-width: 0; padding: 0.5rem; border: 1px solid var(--border); border-radius: 4px; font-size: 0.9rem; font-family: var(--font); overflow-wrap: anywhere; }
.form-group small { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.25rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; min-width: 0; }
.pe-workflow-progress { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 1rem 0; }
.pe-workflow-progress span { border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted); font-size: 0.78rem; padding: 0.35rem 0.55rem; }
.pe-workflow-progress .is-complete { background: #dcecff; border-color: #8eb6e8; color: #174b82; }
.pe-workflow-progress .is-active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pe-advanced-controls { margin-top: 0.75rem; }
.pe-advanced-controls summary { color: var(--text-muted); cursor: pointer; font-size: 0.85rem; }

/* Wizard */
.wizard-container { display: grid; grid-template-columns: 280px 1fr; gap: 2rem; }
.wizard-progress { display: flex; flex-direction: column; gap: 0.25rem; }
.wizard-step {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-left: 3px solid transparent;
    cursor: pointer;
}
.wizard-step.active { color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.wizard-step.completed { color: var(--success); }
.wizard-panel { display: none; }
.wizard-panel.active { display: block; }
.info-box {
    background: var(--bg-alt);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}
.info-box h3 { color: var(--primary); font-size: 1rem; margin: 0.75rem 0 0.25rem; }
.info-box h3:first-child { margin-top: 0; }
.info-box ul { margin-left: 1.5rem; margin-top: 0.25rem; }
.info-box p { margin-bottom: 0.5rem; }
.radio-group { display: flex; flex-direction: column; gap: 0.5rem; }
.radio-group label { font-weight: normal; display: flex; align-items: center; gap: 0.5rem; }

/* Result display */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}
.feasibility-green { border-left: 4px solid var(--success); }
.feasibility-yellow { border-left: 4px solid var(--warning); }
.feasibility-red { border-left: 4px solid var(--danger); }

.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}
.result-stat {
    background: var(--bg-alt);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}
.result-stat .stat-value { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.result-stat .stat-label { font-size: 0.8rem; color: var(--text-muted); }

.stage-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.stage-table th, .stage-table td { padding: 0.5rem; border: 1px solid var(--border); text-align: left; font-size: 0.85rem; }
.stage-table th { background: var(--bg-alt); font-weight: 600; }
.stage-table .bottleneck-high { background: #ffebee; }
.stage-table .bottleneck-med { background: #fff8e1; }

.table-wrapper { max-width: 100%; overflow-x: auto; }
#analysisResults table, #peAnalysisResults table, #fastqResults table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
#analysisResults th, #analysisResults td,
#peAnalysisResults th, #peAnalysisResults td,
#fastqResults th, #fastqResults td {
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}
#analysisResults th, #peAnalysisResults th, #fastqResults th {
    background: var(--bg-alt);
    font-weight: 600;
}

.warning-box {
    background: #fff3e0;
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
}
.warning-box h4 { color: var(--warning); }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-muted);
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Examples */
.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}
.example-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}
.example-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.example-card h3 { color: var(--primary); margin-bottom: 0.5rem; }
.example-card p { color: var(--text-muted); font-size: 0.9rem; }
.vector-map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; margin: 1rem 0; }
.vector-map { margin: 0; text-align: center; color: var(--text-muted); font-size: 0.85rem; }
.vector-map svg { width: min(100%, 680px); height: auto; border: 1px solid var(--border); background: var(--bg-card); }
.pe-vector-map-grid { grid-template-columns: minmax(0, 760px); justify-content: center; }
.pe-vector-map { width: 100%; max-width: 760px; justify-self: center; }
.pe-vector-map svg { width: min(100%, 760px); }
.library-workflows { margin: 1.5rem 0; }
.workflow-group-title { color: var(--primary); font-size: 1.35rem; margin: 0 0 0.75rem; }
.pe-cloning-walkthrough { margin: 1.5rem 0; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.pe-primer-layout { margin-top: 1rem; }
.vector-map text { font-size: 12px; fill: var(--text); font-family: var(--font); font-weight: 700; }
.vector-map .map-title { font-size: 17px; fill: var(--primary); }.vector-map .map-note { font-size: 12px; fill: var(--text-muted); font-weight: 500; }
.map-backbone { fill: #f1f5f9; stroke: #94a3b8; }.map-u6 { fill: #bfdbfe; stroke: #2563eb; }.map-guide { fill: #bbf7d0; stroke: #15803d; }.map-expression { fill: #fde68a; stroke: #b45309; }.map-cas9 { fill: #fecaca; stroke: #b91c1c; }.map-puro { fill: #ddd6fe; stroke: #6d28d9; }.map-lenti { fill: #cbd5e1; stroke: #475569; }
.vector-feature-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin: 1rem 0; }.vector-feature-notes > div { border-left: 4px solid var(--primary); padding: 0.75rem 1rem; background: var(--bg-alt); }.vector-feature-notes h3 { margin: 0 0 0.35rem; font-size: 1rem; }.vector-feature-notes p { margin: 0 0 0.5rem; font-size: 0.88rem; color: var(--text-muted); }
.cloning-steps { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.cloning-step.active { background: var(--primary); color: #fff; }
.pe-cloning-step.active { background: var(--primary); color: #fff; }
.cloning-animation { display: grid; grid-template-columns: minmax(280px, 0.9fr) minmax(280px, 1.1fr); gap: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; background: var(--bg-alt); }
.cloning-schematic { min-height: 230px; display: grid; align-content: center; gap: 1.25rem; }
.cassette-visual { display: flex; min-height: 52px; align-items: stretch; border: 2px solid var(--primary); background: var(--bg-card); }
.dna-label, .guide-insert, .cut-site, .stuffer-cassette, .primer, .oligo-template { display: flex; align-items: center; justify-content: center; padding: 0.55rem; text-align: center; font-size: 0.78rem; font-weight: 600; }
.dna-label { flex: 1 1 25%; }.stuffer-cassette { flex: 1 1 34%; background: #f1f5f9; color: var(--text); border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.guide-insert { color: #fff; background: var(--secondary); animation: insertPulse 1.6s ease-in-out infinite; }
.cut-site { color: #7a3412; background: #fef3c7; border-left: 1px solid #d97706; border-right: 1px solid #d97706; }
.primer { flex: 1 1 28%; color: #075985; background: #e0f2fe; overflow-wrap: anywhere; font-family: var(--mono); font-size: 0.68rem; }.oligo-template { flex: 1 1 44%; background: #ecfdf5; color: #166534; }
.gel-label { display: flex; align-items: center; justify-content: center; width: 100%; color: var(--text-muted); font-weight: 700; font-size: 0.8rem; }
.animation-visual { min-height: 108px; border: 1px solid var(--border); background: var(--bg-card); display: flex; gap: 1rem; align-items: center; justify-content: center; padding: 1rem; }
.process-note { max-width: 42rem; color: var(--text); font-weight: 700; text-align: center; line-height: 1.5; }
.gel-visual { background: #edf2f7; padding: 0.8rem 1.2rem; }.gel-lane { position: relative; width: min(100%, 360px); height: 78px; border-left: 2px solid #64748b; border-right: 2px solid #64748b; background: #dbeafe; }.gel-band { position: absolute; left: 12%; right: 12%; height: 13px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.72rem; font-weight: 700; }.band-10 { top: 18px; background: #075985; }.band-2 { bottom: 16px; background: #b45309; }
.cloning-detail h3 { margin-top: 0; }.cloning-detail ul { margin: 0.5rem 0 0 1.1rem; }.cloning-calculator { border: 1px solid var(--border); border-top: 0; padding: 1.25rem; background: var(--bg-card); }.cloning-calculator h3 { margin-top: 0; }.metric-definitions { display: grid; grid-template-columns: minmax(180px, 0.35fr) 1fr; gap: 0.75rem 1.25rem; }.metric-definitions dt { font-weight: 700; color: var(--primary); }.metric-definitions dd { margin: 0; color: var(--text-muted); }
@keyframes insertPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
}
.badge-green { background: #e8f5e9; color: #2e7d32; }
.badge-yellow { background: #fff8e1; color: #f57f17; }
.badge-orange { background: #fff3e0; color: #e65100; }
.badge-blue { background: #e3f2fd; color: #1565c0; }

/* Glossary */
.glossary dt { font-weight: 700; color: var(--primary); margin-top: 1rem; }
.glossary dd { margin-left: 1.5rem; color: var(--text-muted); }

/* Footer */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 2rem;
    margin-top: 3rem;
}
.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}
.footer-section h4 { color: var(--primary); margin-bottom: 0.5rem; }
.footer-section p { font-size: 0.85rem; color: var(--text-muted); }
.footer-section a { display: block; font-size: 0.85rem; color: var(--text-muted); text-decoration: none; }
.footer-section a:hover { color: var(--primary); }

/* Loading */
.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Calculation trace */
.calc-trace {
    background: var(--bg-alt);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
    font-family: var(--mono);
    font-size: 0.85rem;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}

/* Content pages */
.content-page { max-width: 900px; }
.content-page h2 { color: var(--primary); margin: 1.5rem 0 0.5rem; }
.content-page h3 { color: var(--text); margin: 1rem 0 0.25rem; }
.content-page ul { margin-left: 1.5rem; margin-bottom: 1rem; }
.content-page pre {
    background: var(--bg-alt);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}
.content-page code { font-family: var(--mono); font-size: 0.9rem; }
.content-page a { color: var(--primary); }

/* Responsive */
@media (max-width: 768px) {
    .wizard-container { grid-template-columns: 1fr; }
    .wizard-progress { flex-direction: row; overflow-x: auto; }
    .nav-container { padding: 0.65rem 1rem; align-items: flex-start; }
    .nav-links { width: 100%; overflow-x: auto; padding-top: 0.5rem; }
    .nav-links a, .nav-resources summary { white-space: nowrap; }
    .nav-resource-menu { position: fixed; right: 1rem; left: 1rem; top: 5rem; }
    .hero h1 { font-size: 2rem; }
    .main-content { padding: 1rem; }.form-section { padding: 1rem; }.form-grid { grid-template-columns: minmax(0, 1fr); }.form-actions { gap: 0.5rem; }.form-actions .btn { max-width: 100%; text-align: center; }
    .cloning-animation { grid-template-columns: 1fr; }.metric-definitions { grid-template-columns: 1fr; gap: 0.2rem; }.metric-definitions dd { margin-bottom: 0.8rem; }
}
