/* ===== RESET & BASE ===== */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
body{
  font-family:'Inter',system-ui,-apple-system,sans-serif;
  background:#f8fafc;
  color:#1e293b;
  min-height:100vh;
  display:flex;
  flex-direction:column;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
}

/* ===== NAV ===== */
#topnav{
  position:sticky;top:0;z-index:100;
  background:rgba(255,255,255,0.92);
  backdrop-filter:blur(12px);
  border-bottom:1px solid #e2e8f0;
  padding:0 1rem;
}
.nav-inner{
  max-width:1100px;margin:0 auto;
  display:flex;align-items:center;justify-content:space-between;
  height:56px;
}
.nav-brand{
  font-size:1rem;font-weight:700;color:#0f172a;text-decoration:none;
  letter-spacing:-0.01em;
}
.nav-brand:hover{color:#1d4ed8}
.nav-right{display:flex;align-items:center;gap:1.25rem}
.nav-link{font-size:0.8rem;color:#64748b;text-decoration:none;font-weight:500}
.nav-link:hover{color:#1d4ed8}

/* Toggle Switch */
.mode-toggle{display:flex;align-items:center;gap:0.5rem;cursor:pointer;user-select:none}
.mode-toggle input{display:none}
.toggle-slider{
  width:36px;height:20px;background:#cbd5e1;border-radius:10px;
  position:relative;transition:background 0.2s;flex-shrink:0;
}
.toggle-slider::after{
  content:'';position:absolute;top:2px;left:2px;
  width:16px;height:16px;background:#fff;border-radius:50%;
  transition:transform 0.2s;box-shadow:0 1px 2px rgba(0,0,0,0.15);
}
.mode-toggle input:checked+.toggle-slider{background:#1d4ed8}
.mode-toggle input:checked+.toggle-slider::after{transform:translateX(16px)}
.toggle-label{font-size:0.75rem;color:#64748b;font-weight:500;white-space:nowrap}

/* ===== MAIN CONTENT CONTAINER ===== */
#app{flex:1;max-width:1100px;margin:0 auto;padding:1.5rem 1rem 3rem;width:100%}

/* ===== HOME PAGE ===== */
.hero{text-align:center;padding:2.5rem 0 2rem}
.hero h1{
  font-size:2rem;font-weight:800;color:#0f172a;margin-bottom:0.5rem;
  letter-spacing:-0.02em;
}
.hero p{font-size:1rem;color:#475569;max-width:640px;margin:0 auto;line-height:1.6}
.hero .hero-stats{
  display:flex;justify-content:center;gap:2rem;margin-top:1.25rem;flex-wrap:wrap;
}
.hero .stat{text-align:center}
.hero .stat-num{font-size:1.5rem;font-weight:800;color:#1d4ed8}
.hero .stat-label{font-size:0.75rem;color:#64748b;font-weight:500}

/* Search */
.search-wrap{max-width:480px;margin:1.5rem auto;position:relative}
.search-wrap input{
  width:100%;padding:0.65rem 1rem 0.65rem 2.5rem;
  border:1px solid #e2e8f0;border-radius:8px;
  font-size:0.9rem;background:#fff;color:#1e293b;
  transition:border-color 0.15s,box-shadow 0.15s;
}
.search-wrap input:focus{outline:none;border-color:#1d4ed8;box-shadow:0 0 0 3px rgba(29,78,216,0.1)}
.search-wrap input::placeholder{color:#94a3b8}
.search-icon{
  position:absolute;left:0.75rem;top:50%;transform:translateY(-50%);
  color:#94a3b8;font-size:0.9rem;pointer-events:none;
}

/* Category Tabs */
.cat-tabs{
  display:flex;justify-content:center;gap:0.5rem;margin-bottom:1.5rem;flex-wrap:wrap;
}
.cat-tab{
  padding:0.4rem 0.9rem;border-radius:6px;font-size:0.8rem;font-weight:600;
  border:1px solid #e2e8f0;background:#fff;color:#475569;cursor:pointer;
  transition:all 0.15s;white-space:nowrap;
}
.cat-tab:hover{border-color:#1d4ed8;color:#1d4ed8}
.cat-tab.active{background:#1d4ed8;color:#fff;border-color:#1d4ed8}

/* Cancer Cards Grid */
.cancer-grid{
  display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
  gap:0.75rem;
}
.cancer-card{
  padding:1rem 1.1rem;
  border:1px solid #e2e8f0;border-radius:10px;background:#fff;
  cursor:pointer;transition:all 0.15s;text-decoration:none;color:inherit;
  display:flex;align-items:flex-start;gap:0.75rem;
}
.cancer-card:hover{border-color:#93c5fd;box-shadow:0 2px 12px rgba(29,78,216,0.08);transform:translateY(-1px)}
.card-icon{
  font-size:1.5rem;flex-shrink:0;width:40px;height:40px;
  display:flex;align-items:center;justify-content:center;
  background:#eff6ff;border-radius:8px;
}
.card-body{flex:1;min-width:0}
.card-title{font-size:0.95rem;font-weight:700;color:#0f172a;margin-bottom:0.15rem}
.card-stat{font-size:0.75rem;font-weight:600;color:#1d4ed8;margin-bottom:0.25rem}
.card-desc{font-size:0.8rem;color:#64748b;line-height:1.4;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}

/* ===== CANCER DETAIL PAGE ===== */
.detail-page{display:flex;gap:2rem;align-items:flex-start}
.detail-sidebar{
  position:sticky;top:72px;width:220px;flex-shrink:0;
  padding:0.75rem 0;
}
.detail-sidebar a{
  display:block;padding:0.35rem 0.75rem;font-size:0.8rem;color:#64748b;
  text-decoration:none;border-left:2px solid transparent;
  transition:all 0.1s;font-weight:500;border-radius:0 4px 4px 0;
}
.detail-sidebar a:hover{color:#1d4ed8;background:#eff6ff;border-left-color:#1d4ed8}
.detail-sidebar a.active{color:#1d4ed8;border-left-color:#1d4ed8;font-weight:600;background:#eff6ff}
.detail-main{flex:1;min-width:0}

/* Breadcrumb */
.breadcrumb{font-size:0.8rem;color:#94a3b8;margin-bottom:1rem}
.breadcrumb a{color:#64748b;text-decoration:none}
.breadcrumb a:hover{color:#1d4ed8}

/* Detail Hero */
.detail-hero{margin-bottom:2rem;padding-bottom:1.5rem;border-bottom:1px solid #e2e8f0}
.detail-hero h1{font-size:1.75rem;font-weight:800;color:#0f172a;margin-bottom:0.35rem;letter-spacing:-0.02em}
.detail-hero .tagline{font-size:1rem;color:#475569;margin-bottom:1rem}
.detail-stats{display:flex;gap:1.25rem;flex-wrap:wrap}
.detail-stat{
  padding:0.6rem 1rem;border-radius:8px;background:#eff6ff;
  text-align:center;min-width:120px;
}
.detail-stat .num{font-size:1.25rem;font-weight:800;color:#1d4ed8;display:block}
.detail-stat .lbl{font-size:0.7rem;color:#64748b;font-weight:500}

/* Sections */
.section{margin-bottom:2rem}
.section-head{
  font-size:1.1rem;font-weight:700;color:#0f172a;
  padding-bottom:0.5rem;margin-bottom:0.75rem;
  border-bottom:2px solid #e2e8f0;
  scroll-margin-top:72px;
}
.section p,.section li{font-size:0.9rem;line-height:1.65;color:#334155}
.section ul,.section ol{padding-left:1.25rem;margin:0.5rem 0}
.section li{margin-bottom:0.35rem}
.section strong{color:#0f172a}
.section a{color:#1d4ed8;text-decoration:none}
.section a:hover{text-decoration:underline}

/* Tables */
.table-wrap{overflow-x:auto;margin:0.75rem 0}
.table-wrap table{
  width:100%;border-collapse:collapse;font-size:0.85rem;
}
.table-wrap th{
  text-align:left;padding:0.5rem 0.75rem;background:#f1f5f9;
  font-weight:600;color:#1e293b;border-bottom:2px solid #e2e8f0;
  white-space:nowrap;
}
.table-wrap td{
  padding:0.5rem 0.75rem;border-bottom:1px solid #f1f5f9;color:#334155;
  vertical-align:top;
}
.table-wrap tr:hover td{background:#f8fafc}

/* Warning Signs Box */
.warning-box{
  background:#fef2f2;border:1px solid #fecaca;border-radius:8px;
  padding:0.75rem 1rem;margin:0.75rem 0;
}
.warning-box p{color:#991b1b;font-size:0.85rem;font-weight:500}
.warning-box strong{color:#7f1d1d}

/* Info Box */
.info-box{
  background:#eff6ff;border:1px solid #bfdbfe;border-radius:8px;
  padding:0.75rem 1rem;margin:0.75rem 0;
}
.info-box p{color:#1e40af;font-size:0.85rem}

/* Success Box */
.success-box{
  background:#f0fdf4;border:1px solid #bbf7d0;border-radius:8px;
  padding:0.75rem 1rem;margin:0.75rem 0;
}
.success-box p{color:#166534;font-size:0.85rem}

/* Clinical/Professional Detail Block */
.pro-detail{
  margin:0.75rem 0;padding:0.85rem 1rem;
  background:#f8fafc;border-left:3px solid #1d4ed8;border-radius:0 6px 6px 0;
  display:none;
}
body.pro-mode .pro-detail{display:block}
.pro-detail-header{
  font-size:0.8rem;font-weight:600;color:#1d4ed8;
  text-transform:uppercase;letter-spacing:0.04em;margin-bottom:0.35rem;
}
.pro-detail p,.pro-detail li{font-size:0.85rem;color:#475569;line-height:1.55}

/* Expand/collapse toggle for individual sections */
.expand-btn{
  display:inline-flex;align-items:center;gap:0.3rem;
  padding:0.3rem 0.7rem;margin:0.5rem 0;
  font-size:0.78rem;font-weight:600;color:#1d4ed8;
  background:#eff6ff;border:1px solid #bfdbfe;border-radius:5px;
  cursor:pointer;transition:all 0.15s;
}
.expand-btn:hover{background:#dbeafe}
.expand-btn .arrow{transition:transform 0.2s;font-size:0.65rem}
.expand-btn.open .arrow{transform:rotate(90deg)}
body.pro-mode .expand-btn{display:none}

/* Severity Meter */
.severity-meter{
  display:flex;gap:2px;margin:0.5rem 0 0.75rem;height:8px;border-radius:4px;overflow:hidden;
}
.severity-bar{flex:1;transition:opacity 0.2s}
.severity-bar.s1{background:#22c55e}
.severity-bar.s2{background:#84cc16}
.severity-bar.s3{background:#eab308}
.severity-bar.s4{background:#f97316}
.severity-bar.s5{background:#ef4444}
.severity-labels{display:flex;justify-content:space-between;font-size:0.7rem;color:#64748b;margin-bottom:0.5rem}

/* Treatment Timeline */
.timeline{position:relative;padding-left:1.5rem;margin:0.75rem 0}
.timeline::before{
  content:'';position:absolute;left:0.4rem;top:0;bottom:0;
  width:2px;background:#e2e8f0;
}
.timeline-item{position:relative;margin-bottom:1.25rem;padding-bottom:0.5rem}
.timeline-dot{
  position:absolute;left:-1.25rem;top:0.25rem;
  width:12px;height:12px;border-radius:50%;border:2px solid #fff;
}
.timeline-dot.past{background:#94a3b8}
.timeline-dot.current{background:#1d4ed8}
.timeline-dot.future{background:#22c55e}
.timeline-era{font-size:0.72rem;font-weight:600;color:#64748b;text-transform:uppercase;letter-spacing:0.03em}
.timeline-title{font-size:0.9rem;font-weight:700;color:#0f172a;margin:0.15rem 0}
.timeline-desc{font-size:0.85rem;color:#475569;line-height:1.5}

/* Back to Top / Home */
.back-top{
  position:fixed;bottom:1.5rem;right:1.5rem;
  width:40px;height:40px;border-radius:50%;
  background:#1d4ed8;color:#fff;border:none;
  cursor:pointer;font-size:1.1rem;display:none;
  align-items:center;justify-content:center;
  box-shadow:0 2px 8px rgba(29,78,216,0.3);
  transition:transform 0.15s,opacity 0.15s;z-index:50;
}
.back-top:hover{transform:scale(1.1)}
.back-top.show{display:flex}

/* ===== FOOTER ===== */
footer{
  background:#f1f5f9;border-top:1px solid #e2e8f0;
  padding:1.5rem 1rem;margin-top:auto;
}
.footer-inner{max-width:1100px;margin:0 auto;text-align:center}
.disclaimer{font-size:0.78rem;color:#64748b;margin-bottom:0.5rem;max-width:700px;margin-left:auto;margin-right:auto;line-height:1.5}
.footer-sources{font-size:0.72rem;color:#94a3b8;margin-bottom:0.5rem}
.footer-brand{font-size:0.75rem}
.footer-brand a{color:#1d4ed8;text-decoration:none;font-weight:600}

/* ===== RESPONSIVE ===== */
@media(max-width:768px){
  .detail-page{flex-direction:column}
  .detail-sidebar{
    position:static;width:100%;
    display:flex;gap:0.25rem;flex-wrap:wrap;
    padding:0.5rem 0;border-bottom:1px solid #e2e8f0;margin-bottom:1rem;
  }
  .detail-sidebar a{
    border-left:none;border-radius:5px;padding:0.3rem 0.6rem;
    font-size:0.75rem;border:1px solid #e2e8f0;
  }
  .detail-sidebar a.active,.detail-sidebar a:hover{border-color:#1d4ed8}
  .hero h1{font-size:1.5rem}
  .cancer-grid{grid-template-columns:1fr}
  .nav-right{gap:0.75rem}
  .toggle-label{display:none}
  .detail-stats{gap:0.5rem}
  .detail-stat{min-width:90px;padding:0.5rem 0.6rem}
  .detail-stat .num{font-size:1rem}
}

/* ===== PRINT ===== */
@media print{
  #topnav,.mode-toggle,.back-top,.expand-btn,.detail-sidebar,.cat-tabs,.search-wrap{display:none!important}
  .pro-detail{display:block!important;border-left:1px solid #999}
  body{background:#fff;color:#000}
  .cancer-card{break-inside:avoid}
  footer{border-top:1px solid #999}
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
.fade-in{animation:fadeIn 0.25s ease-out}
