/* ============================================================
 * tools/projection.css — /tools/projection 페이지 전용 스타일
 *  - base.html 의 body/header/footer/.topbar 등은 건드리지 않음
 *  - 색상 변수는 .system-page scope 안에서만 새로 정의
 * ============================================================ */

.system-page {
  /* archive·school 컨테이너와 동일한 폭/여백 */
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;

  /* system 페이지 전용 색상 토큰 (style.css 의 :root 와 분리) */
  --sys-card-bg: #ffffff;
  --sys-primary: #1f2937;        /* 검정 톤 (gray-800) */
  --sys-primary-hover: #111827;  /* hover (gray-900) */
  --sys-secondary: #64748b;
  --sys-text: #1e293b;
  --sys-text-muted: #64748b;
  --sys-border: #e2e8f0;
  --sys-success: #16a34a;
  --sys-error: #dc2626;
  --sys-warning: #f59e0b;

  /* 호환을 위해 기존 system.css(현 projection.css)가 사용하는 변수도 system-page scope 로만 노출 */
  --bg: #f5f6fa;
  --card-bg: var(--sys-card-bg);
  --primary: var(--sys-primary);
  --primary-hover: var(--sys-primary-hover);
  --secondary: var(--sys-secondary);
  --text: var(--sys-text);
  --text-muted: var(--sys-text-muted);
  --border: var(--sys-border);
  --success: var(--sys-success);
  --error: var(--sys-error);
  --warning: var(--sys-warning);

  color: var(--text);
}

.system-page * {
  box-sizing: border-box;
}

/* school·archive 페이지 헤더와 시각적으로 동일하게 맞춤
   (다른 페이지의 컨테이너 padding 80px + 헤더 padding 100px = 180px 누적과 동일) */
.system-page-head {
  text-align: center;
  padding: 180px 0 0 0;
  margin-bottom: 0;
}
.system-page-head .page-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 1rem;
  line-height: 1.2;
}
.system-page-head .hint {
  font-size: 1.2rem;
  color: #666;
  margin: 0 0 3rem;
  line-height: 1.5;
}

/* 탭 (archive·school·about 과 동일한 스타일) */
.tabs {
  width: 100%;
  display: flex;
  padding: 0;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 40px;
}

.tab {
  background: transparent;
  padding: 15px 30px;
  color: #666;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  margin: 0;
  border-radius: 0;
  position: relative;
}

.tab:hover {
  background: transparent;
  color: #333;
}

.tab.active {
  background: #fff;
  color: #008385;
  border: 1px solid #e0e0e0;
  border-bottom: 1px solid #fff;
  margin-bottom: -1px;
}

.tab:first-child {
  border-top-left-radius: 4px;
}

.tab:last-child {
  border-top-right-radius: 4px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* 전역 main 셀렉터는 .system-page 가 흡수했으므로 제거 (archive·school 과 동일한 main 기본 스타일 사용) */

.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card h2 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.card h3 {
  margin: 24px 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.hidden {
  display: none;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 700px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  /* 모바일에선 모든 grid 를 1 column 으로 — 시군/데이터간격, 기준/종료연도, 코호트요인법 추계설정 모두 가로로 안 들어감 */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
}

label span {
  font-weight: 500;
}

input,
select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: white;
  color: var(--text);
  transition: border-color 0.15s;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

button {
  padding: 10px 18px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

button.primary {
  background: var(--primary);
  color: white;
}

button.primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

button.secondary {
  background: var(--secondary);
  color: white;
}

button.secondary:hover:not(:disabled) {
  background: #475569;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  display: none;
}

.status.show { display: block; }
.status.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.status.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.status.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.chart-wrap {
  position: relative;
  height: 400px;
  margin: 16px 0 24px;
}

.table-scroll {
  overflow-x: auto;
  margin-bottom: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--text);
  position: sticky;
  top: 0;
}

th:first-child,
td:first-child {
  text-align: left;
}

tr.base-year {
  background: #fef9c3;
  font-weight: 600;
}

tr:hover {
  background: #f8fafc;
}

#params-table {
  font-size: 12px;
  font-family: 'Consolas', 'Monaco', monospace;
  background: #f8fafc;
  padding: 12px;
  border-radius: 6px;
  white-space: pre-wrap;
  overflow-x: auto;
  margin-bottom: 16px;
}

#validation-result {
  margin-top: 16px;
}

#validation-result table th:first-child,
#validation-result table td:first-child {
  text-align: left;
}

footer {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 12px;
}

.method-bad {
  color: var(--text-muted);
  font-style: italic;
}

.crv-box {
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 14px;
}

th.col-avg,
td.col-avg {
  background: #fee2e2 !important;
  color: #991b1b;
  font-weight: 600;
}

#validation-table {
  margin-top: 8px;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
