/* ==========================================================
   p53 유전자 돌연변이 분석 시스템 - NCBI 참고 스타일
   ========================================================== */

:root {
  /* NCBI 색상 팔레트 참고 */
  --ncbi-blue: #205493;
  --ncbi-blue-dark: #14315c;
  --ncbi-blue-light: #e8f0fa;
  --ncbi-gray-bg: #f5f6f7;
  --ncbi-border: #d1d5da;
  --text-main: #212121;
  --text-sub: #5b616b;

  /* 염기별 색상 (빨간색은 돌연변이 전용) */
  --color-A: #1a9850;   /* 아데닌 - 초록 */
  --color-T: #e69f00;   /* 티민   - 주황 */
  --color-G: #7b3fa0;   /* 구아닌 - 보라 */
  --color-C: #0072b2;   /* 사이토신 - 파랑 */
  --color-mut: #d32f2f; /* 돌연변이 - 빨강 */
}

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

body {
  font-family: "Malgun Gothic", "맑은 고딕", "Segoe UI", Arial, sans-serif;
  background: var(--ncbi-gray-bg);
  color: var(--text-main);
  line-height: 1.6;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---------------- 헤더 (NCBI 상단 바 스타일) ---------------- */
.ncbi-header {
  background: linear-gradient(180deg, var(--ncbi-blue) 0%, var(--ncbi-blue-dark) 100%);
  color: #fff;
  border-bottom: 4px solid #0b1f3a;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; padding: 14px 16px;
}
.logo-area { display: flex; align-items: center; gap: 14px; }
.dna-logo {
  font-size: 34px; background: rgba(255,255,255,.15);
  border-radius: 8px; padding: 6px 10px;
}
.ncbi-header h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.5px; }
.subtitle { font-size: 12.5px; color: #cfe0f5; }
.header-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.header-nav a {
  color: #eaf2fc; text-decoration: none; font-size: 13.5px;
  padding: 7px 12px; border-radius: 4px; transition: background .15s;
}
.header-nav a:hover { background: rgba(255,255,255,.18); }

/* ---------------- 검색바 영역 (NCBI 회색 보조 바) ---------------- */
.ncbi-searchbar { background: #e9edf2; border-bottom: 1px solid var(--ncbi-border); }
.searchbar-inner {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px; padding: 8px 16px; font-size: 13px;
}
.db-label { color: var(--ncbi-blue-dark); font-weight: 600; }
.server-status { color: var(--text-sub); }
.server-status.ok { color: #1a7f37; font-weight: 600; }
.server-status.fail { color: var(--color-mut); font-weight: 600; }

/* ---------------- 패널 공통 ---------------- */
.panel {
  background: #fff; border: 1px solid var(--ncbi-border);
  border-radius: 6px; margin: 18px 0; padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 6px;
  border-bottom: 2px solid var(--ncbi-blue-light);
  padding-bottom: 10px; margin-bottom: 14px;
}
.panel-head h2 { font-size: 17px; color: var(--ncbi-blue-dark); }
.panel-note { font-size: 12.5px; color: var(--text-sub); }
.sub-title { font-size: 15px; color: var(--ncbi-blue-dark); margin: 14px 0 8px; }

/* ---------------- 샘플 카드 ---------------- */
.sample-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 12px;
}
.sample-card {
  border: 1px solid var(--ncbi-border); border-radius: 6px;
  padding: 12px 14px; cursor: pointer; background: #fbfcfd;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.sample-card:hover {
  border-color: var(--ncbi-blue); box-shadow: 0 2px 8px rgba(32,84,147,.18);
  transform: translateY(-2px);
}
.sample-card.active { border-color: var(--ncbi-blue); background: var(--ncbi-blue-light); }
.sample-gene { font-weight: 700; color: var(--ncbi-blue); font-size: 14.5px; }
.sample-refseq {
  font-family: Consolas, monospace; font-size: 11.5px; color: var(--text-sub);
  background: #eef1f4; border-radius: 3px; padding: 1px 6px; display: inline-block; margin: 4px 0;
}
.sample-desc { font-size: 12px; color: var(--text-sub); line-height: 1.45; }
.loading { color: var(--text-sub); font-size: 13.5px; }

/* ---------------- 입력 영역 ---------------- */
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .input-grid { grid-template-columns: 1fr; } }
.input-block label {
  display: block; font-weight: 700; font-size: 13.5px;
  color: var(--ncbi-blue-dark); margin-bottom: 6px;
}
.input-block textarea {
  width: 100%; height: 96px; resize: vertical;
  font-family: Consolas, "Courier New", monospace; font-size: 14px;
  letter-spacing: 1px; padding: 10px 12px;
  border: 1px solid var(--ncbi-border); border-radius: 5px;
  outline: none; transition: border-color .15s, box-shadow .15s;
  text-transform: uppercase;
}
.input-block textarea:focus {
  border-color: var(--ncbi-blue); box-shadow: 0 0 0 3px rgba(32,84,147,.15);
}
.input-meta { text-align: right; font-size: 12px; color: var(--text-sub); margin-top: 4px; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn {
  border: none; border-radius: 5px; padding: 10px 20px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  font-family: inherit; transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ncbi-blue); color: #fff; }
.btn-secondary { background: #e8f0fa; color: var(--ncbi-blue-dark); border: 1px solid #b7cbe4; }
.btn-ghost { background: transparent; color: var(--text-sub); border: 1px solid var(--ncbi-border); }

/* ---------------- 염기 색상 ---------------- */
.legend-panel { padding: 12px 20px; }
.legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.legend-title { font-weight: 700; color: var(--ncbi-blue-dark); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.red-text { color: var(--color-mut); }

.base {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 26px; border-radius: 4px;
  font-family: Consolas, "Courier New", monospace;
  font-weight: 700; font-size: 15px; color: #fff;
}
.base-A { background: var(--color-A); }
.base-T { background: var(--color-T); }
.base-G { background: var(--color-G); }
.base-C { background: var(--color-C); }
.base-N { background: #9aa0a6; }
.base-mut {
  background: var(--color-mut);
  box-shadow: 0 0 0 2px #ffd7d7;
  animation: mut-pulse 1.6s ease-in-out infinite;
}
@keyframes mut-pulse {
  0%, 100% { box-shadow: 0 0 0 2px #ffd7d7; }
  50%       { box-shadow: 0 0 0 4px #ffb3b3; }
}
.base-hotspot-mark { background: #fff3cd; color: #8a6d00; box-shadow: 0 0 0 1px #e0c869; }

/* ---------------- DNA 이중나선 3D ---------------- */
.helix-info {
  background: var(--ncbi-blue-light); border: 1px solid #b7cbe4;
  border-radius: 5px; padding: 10px 14px; margin-bottom: 14px;
  font-size: 13px; color: var(--ncbi-blue-dark); line-height: 1.55;
}
.helix-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
@media (max-width: 760px) { .helix-grid { grid-template-columns: 1fr; } }
.helix-box {
  border: 1px solid var(--ncbi-border); border-radius: 6px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef3fa 100%);
  overflow: hidden;
}
.helix-title {
  text-align: center; font-weight: 700; font-size: 14px;
  padding: 8px; border-bottom: 1px solid var(--ncbi-border); background: #fff;
}
.helix-title.title-normal { color: var(--ncbi-blue); }
.helix-title.title-mutant { color: #a04000; }
.helix-box canvas {
  display: block; width: 100%; height: 460px;
  cursor: grab; touch-action: none;
}
.helix-box canvas:active { cursor: grabbing; }

/* ---------------- 서열 비교 뷰 ---------------- */
.compare-view { overflow-x: auto; }
.seq-row-group {
  border: 1px solid var(--ncbi-border); border-radius: 6px;
  padding: 10px 14px; margin-bottom: 12px; background: #fbfcfd;
}
.seq-line { display: flex; align-items: center; gap: 3px; margin: 3px 0; white-space: nowrap; }
.seq-label {
  width: 74px; min-width: 74px; font-size: 12px; font-weight: 700;
  color: var(--text-sub);
}
.seq-label.normal-label { color: var(--ncbi-blue); }
.seq-label.mutant-label { color: #a04000; }
.pos-ruler {
  display: flex; gap: 3px; margin-left: 77px; margin-bottom: 2px;
}
.pos-cell {
  width: 24px; min-width: 24px; text-align: center;
  font-size: 10px; color: var(--text-sub);
  font-family: Consolas, monospace;
}
.pos-cell.hotspot-pos { color: #8a6d00; font-weight: 700; }
.match-line { margin-left: 77px; display: flex; gap: 3px; }
.match-cell {
  width: 24px; min-width: 24px; text-align: center;
  font-size: 12px; color: #b0b6bc; font-family: Consolas, monospace;
}
.match-cell.mismatch { color: var(--color-mut); font-weight: 700; }

/* ---------------- 결과 카드 ---------------- */
.result-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.stat-card {
  border: 1px solid var(--ncbi-border); border-left: 4px solid var(--ncbi-blue);
  border-radius: 6px; padding: 12px 16px; background: #fbfcfd;
}
.stat-label { font-size: 12.5px; color: var(--text-sub); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--ncbi-blue-dark); }
.stat-value.danger { color: var(--color-mut); }
.stat-value.warn { color: #b45f06; }
.stat-value.safe { color: #1a7f37; }

.risk-bar {
  height: 8px; background: #e6e9ec; border-radius: 4px; margin-top: 8px; overflow: hidden;
}
.risk-fill {
  height: 100%; width: 0; border-radius: 4px;
  background: linear-gradient(90deg, #1a9850, #e69f00, #d32f2f);
  transition: width .8s ease;
}

.two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* ---------------- 테이블 (NCBI 스타일) ---------------- */
.ncbi-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ncbi-table th {
  background: var(--ncbi-blue-light); color: var(--ncbi-blue-dark);
  text-align: left; padding: 8px 10px; border: 1px solid var(--ncbi-border);
}
.ncbi-table td { padding: 7px 10px; border: 1px solid var(--ncbi-border); }
.ncbi-table tbody tr:nth-child(even) { background: #f7f9fb; }
.ncbi-table.small td { font-size: 12.5px; }
.arrow-cell { color: var(--text-sub); font-weight: 700; text-align: center; }
.hotspot-badge {
  background: #fff3cd; color: #8a6d00; border: 1px solid #e0c869;
  border-radius: 10px; font-size: 11.5px; padding: 1px 8px; font-weight: 700;
}

/* ---------------- 임상 정보 카드 ---------------- */
.clinical-card {
  border: 1px solid #b7cbe4; border-left: 4px solid var(--ncbi-blue);
  border-radius: 6px; background: #f6faff;
  padding: 14px 16px; margin-bottom: 18px;
}
.clinical-variant {
  font-weight: 700; font-size: 14.5px; color: var(--ncbi-blue-dark);
  margin-bottom: 6px;
}
.clinical-variant .detected-badge {
  background: #d32f2f; color: #fff; border-radius: 10px;
  font-size: 11.5px; padding: 2px 9px; margin-left: 8px; vertical-align: middle;
}
.clinical-summary { font-size: 13px; color: #333; margin-bottom: 10px; line-height: 1.55; }
.clinical-table { background: #fff; margin-bottom: 10px; }
.clinical-table .th-cell {
  background: var(--ncbi-blue-light); font-weight: 700;
  color: var(--ncbi-blue-dark); width: 110px; white-space: nowrap;
}
.clinical-sources { font-size: 12.5px; }
.clinical-sources a {
  color: var(--ncbi-blue); margin-right: 14px; text-decoration: none;
}
.clinical-sources a:hover { text-decoration: underline; }

.approach-list { padding-left: 20px; font-size: 13.5px; }
.approach-list li { margin-bottom: 7px; }
.approach-list .approach-name { font-weight: 700; color: var(--ncbi-blue-dark); }
.approach-list .approach-desc { color: var(--text-sub); font-size: 12.5px; }

.ok-text { color: #1a7f37; font-weight: 700; font-size: 14px; margin-top: 8px; }

/* ---------------- 경고 박스 ---------------- */
.warning-box {
  background: #fff8e6; border: 1px solid #e0c869; border-left: 4px solid #d4a017;
  border-radius: 5px; padding: 10px 14px; margin-bottom: 12px;
  font-size: 13px; color: #6d5400;
}
.error-box {
  background: #fdecea; border: 1px solid #f0b3ae; border-left: 4px solid var(--color-mut);
  border-radius: 5px; padding: 10px 14px; margin-bottom: 12px;
  font-size: 13px; color: #8f1f1a;
}
.hotspot-alert {
  background: #fff3cd; border: 1px solid #e0c869; border-radius: 5px;
  padding: 10px 14px; margin-bottom: 12px; font-size: 13.5px; color: #6d5400;
  font-weight: 600;
}

/* ---------------- 푸터 ---------------- */
.ncbi-footer {
  background: var(--ncbi-blue-dark); color: #cfe0f5;
  font-size: 12.5px; padding: 18px 0; margin-top: 30px; text-align: center;
}
.ncbi-footer a { color: #9ec5f0; }
