@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;900&display=swap');

:root {
  --hyundai-blue: #002C5F;
  --hyundai-light-blue: #00AAD2;
  --hyundai-sky: #E8F4FD;
  --pass: #00A86B;
  --fail: #E63946;
  --hold: #F4A261;
  --na: #8E8E93;
  --bg: #F5F7FA;
  --white: #FFFFFF;
  --border: #E2E8F0;
  --text-primary: #1A202C;
  --text-secondary: #4A5568;
  --shadow: 0 2px 12px rgba(0, 44, 95, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Noto Sans KR', sans-serif; background: var(--bg); color: var(--text-primary); min-height: 100vh; }

/* ===== 헤더 ===== */
.header {
  background: linear-gradient(135deg, var(--hyundai-blue) 0%, #004080 100%);
  color: white; padding: 22px 36px; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 44, 95, 0.3);
}
.header-inner { max-width: 1600px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
.header-left { display: flex; align-items: center; gap: 14px; }
.back-btn {
  display: flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.15); color: white; text-decoration: none;
  font-size: 20px; font-weight: 700; transition: background 0.2s; flex-shrink: 0;
}
.back-btn:hover { background: rgba(255, 255, 255, 0.3); }
.logo-badge { background: var(--hyundai-light-blue); color: white; font-weight: 700; font-size: 14px; padding: 5px 12px; border-radius: 20px; }
.header h1 { font-size: 22px; font-weight: 700; }
.header-sub { font-size: 13px; opacity: 0.75; margin-top: 3px; }
.header-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.stat-box { text-align: center; background: rgba(255, 255, 255, 0.1); border-radius: 10px; padding: 7px 14px; min-width: 65px; }
.stat-box .num { font-size: 22px; font-weight: 900; }
.stat-box .label { font-size: 12px; opacity: 0.8; margin-top: 1px; }
.stat-box.pass .num { color: #4ADE80; }
.stat-box.fail .num { color: #F87171; }
.stat-box.hold .num { color: #FBB63F; }

/* ===== 프로그레스 ===== */
.progress-bar-section { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.progress-label { font-size: 13px; font-weight: 600; color: var(--hyundai-blue); white-space: nowrap; }
.progress-bar-wrap { width: 200px; background: var(--border); border-radius: 10px; height: 8px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--hyundai-light-blue), var(--pass)); border-radius: 10px; transition: width 0.4s ease; }
.progress-pct { font-size: 14px; font-weight: 700; color: var(--hyundai-blue); white-space: nowrap; }

/* ===== 메인 컨테이너 ===== */
.main { max-width: 1600px; margin: 0 auto; padding: 24px 36px; }

/* ===== 공통 알림 ===== */
.common-notice {
  background: linear-gradient(135deg, #E8F4FD, #F0F8FF); border: 2px solid var(--hyundai-light-blue);
  border-radius: 12px; padding: 14px 20px; margin-bottom: 20px; display: flex; align-items: center; gap: 12px;
}
.common-notice .icon { font-size: 22px; }
.common-notice .text strong { color: var(--hyundai-blue); font-size: 15px; }
.common-notice .text p { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ===== 액션 바 ===== */
.action-bar { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.action-btn {
  padding: 8px 16px; border-radius: 9px; border: none; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; font-family: 'Noto Sans KR', sans-serif; display: flex; align-items: center; gap: 5px;
}
.action-btn.primary { background: var(--hyundai-blue); color: white; }
.action-btn.primary:hover { background: #003a7a; }
.action-btn.secondary { background: white; color: var(--hyundai-blue); border: 2px solid var(--hyundai-blue); }
.action-btn.secondary:hover { background: var(--hyundai-sky); }
.action-btn.danger { background: var(--fail); color: white; }
.action-btn.danger:hover { background: #c62f3b; }

/* ===== 필터 바 ===== */
.filter-bar { display: flex; gap: 7px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.filter-btn {
  padding: 6px 14px; border-radius: 20px; border: 2px solid var(--border); background: white;
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; font-family: 'Noto Sans KR', sans-serif;
}
.filter-btn:hover { border-color: var(--hyundai-light-blue); color: var(--hyundai-blue); }
.filter-btn.active { background: var(--hyundai-blue); color: white; border-color: var(--hyundai-blue); }
.filter-btn.pass-btn.active { background: var(--pass); border-color: var(--pass); }
.filter-btn.fail-btn.active { background: var(--fail); border-color: var(--fail); }
.search-input {
  margin-left: auto; padding: 7px 14px; border-radius: 20px; border: 2px solid var(--border);
  font-size: 13px; font-family: 'Noto Sans KR', sans-serif; width: 200px; outline: none; transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--hyundai-light-blue); }

/* ===== 시나리오 섹션 ===== */
.scenario-section { margin-bottom: 20px; }
.scenario-header {
  display: flex; align-items: center; gap: 9px; padding: 13px 18px;
  background: var(--hyundai-blue); border-radius: 11px 11px 0 0; cursor: pointer; user-select: none; transition: background 0.2s;
}
.scenario-header:hover { background: #003a7a; }
.scenario-num { background: var(--hyundai-light-blue); color: white; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 11px; white-space: nowrap; }
.scenario-title { color: white; font-size: 15px; font-weight: 700; flex: 1; }
.scenario-badge { background: rgba(255, 255, 255, 0.15); color: white; font-size: 12px; padding: 3px 9px; border-radius: 9px; white-space: nowrap; }
.scenario-badge.high { background: rgba(230, 57, 70, 0.5); }
.scenario-badge.medium { background: rgba(244, 162, 97, 0.5); }
.scenario-badge.low { background: rgba(0, 168, 107, 0.4); }
.scenario-toggle { color: white; font-size: 16px; transition: transform 0.3s; }
.scenario-toggle.open { transform: rotate(180deg); }
.scenario-progress-mini { font-size: 12px; color: rgba(255, 255, 255, 0.7); white-space: nowrap; }
.scenario-body { background: white; border-radius: 0 0 11px 11px; overflow: hidden; box-shadow: var(--shadow); display: block; }
.scenario-body.collapsed { display: none; }

/* ===== 테스트 테이블 ===== */
.test-table { width: 100%; border-collapse: collapse; }
.test-table thead th {
  background: #F8FAFC; color: var(--text-secondary); font-size: 13px; font-weight: 600;
  padding: 10px 12px; text-align: left; border-bottom: 2px solid var(--border); white-space: nowrap;
}
.test-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
.test-table tbody tr:hover { background: #FAFBFF; }
.test-table tbody tr:last-child { border-bottom: none; }
.test-table td { padding: 10px 12px; font-size: 13px; vertical-align: top; }
.col-no { width: 40px; text-align: center; color: var(--text-secondary); font-weight: 700; }
.col-platform { width: 80px; }
.col-scenario { width: 120px; font-weight: 600; color: var(--hyundai-blue); }
.col-steps { width: 230px; }
.col-expected { width: 220px; }
.col-note { width: 140px; }
.col-result { width: 150px; }
.col-memo { width: 280px; min-width: 280px; }

/* ===== 플랫폼 태그 ===== */
.platform-tag { display: inline-block; padding: 2px 7px; border-radius: 5px; font-size: 12px; font-weight: 600; margin: 1px; }
.platform-tag.aos { background: #E8F5E9; color: #2E7D32; }
.platform-tag.ios { background: #E3F2FD; color: #1565C0; }
.platform-tag.pc { background: #F3E5F5; color: #6A1B9A; }

/* ===== 리스트 ===== */
.steps-list, .expected-list { list-style: none; padding: 0; margin: 0; }
.steps-list li, .expected-list li { padding: 2px 0; padding-left: 14px; position: relative; font-size: 13px; line-height: 1.6; color: var(--text-secondary); }
.steps-list li::before { content: "▸"; position: absolute; left: 0; color: var(--hyundai-light-blue); font-size: 10px; top: 3px; }
.expected-list li::before { content: "✓"; position: absolute; left: 0; color: var(--pass); font-size: 11px; top: 2px; }

/* ===== 비고 ===== */
.note-tag { display: inline-block; background: #FFF3E0; color: #E65100; font-size: 12px; padding: 2px 7px; border-radius: 5px; margin-bottom: 3px; font-weight: 500; }
.note-text { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

/* ===== 결과 버튼 ===== */
.result-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.result-btn {
  padding: 5px 8px; border-radius: 6px; border: 2px solid var(--border); background: white;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: 'Noto Sans KR', sans-serif; white-space: nowrap;
}
.result-btn:hover { transform: scale(1.05); }
.result-btn.pass-btn { border-color: #C8E6C9; color: var(--pass); }
.result-btn.pass-btn.selected { background: var(--pass); color: white; border-color: var(--pass); }
.result-btn.fail-btn { border-color: #FFCDD2; color: var(--fail); }
.result-btn.fail-btn.selected { background: var(--fail); color: white; border-color: var(--fail); }
.result-btn.hold-btn { border-color: #FFE0B2; color: var(--hold); }
.result-btn.hold-btn.selected { background: var(--hold); color: white; border-color: var(--hold); }
.row-pass { background: #F0FFF4 !important; }
.row-fail { background: #FFF5F5 !important; }
.row-hold { background: #FFFAF0 !important; }

/* ===== 그룹 구분선 ===== */
.group-divider { background: #F0F4FF; padding: 7px 14px; font-size: 13px; font-weight: 700; color: var(--hyundai-blue); border-bottom: 1px solid var(--border); }

/* ===== 메모 에디터 ===== */
.memo-cell { display: flex; flex-direction: column; gap: 6px; }
.memo-editor {
  width: 100%; min-height: 80px; max-height: 200px; overflow-y: auto;
  padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 7px;
  font-size: 13px; font-family: 'Noto Sans KR', sans-serif; line-height: 1.7;
  color: var(--text-primary); outline: none; background: white; word-break: break-word;
  transition: border-color 0.2s, box-shadow 0.2s; cursor: text;
}
.memo-editor:focus { border-color: var(--hyundai-light-blue); box-shadow: 0 0 0 3px rgba(0, 170, 210, 0.12); }
.memo-editor:empty::before { content: attr(data-placeholder); color: #C0C8D4; pointer-events: none; display: block; font-size: 12px; }
.memo-editor b, .memo-editor strong { font-weight: 700; }
.memo-editor i, .memo-editor em { font-style: italic; }
.memo-editor u { text-decoration: underline; }
.memo-editor s { text-decoration: line-through; }
.memo-editor mark { background: rgba(255, 235, 59, 0.55); border-radius: 2px; padding: 0 1px; }
.memo-editor ul { padding-left: 16px; margin: 2px 0; }
.memo-editor li { margin: 1px 0; }
.memo-editor::-webkit-scrollbar { width: 4px; }
.memo-editor::-webkit-scrollbar-thumb { background: #D0D8E4; border-radius: 3px; }

.memo-save-btn {
  align-self: flex-end; padding: 4px 12px; border-radius: 6px; border: 1.5px solid var(--hyundai-light-blue);
  background: white; color: var(--hyundai-blue); font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: 'Noto Sans KR', sans-serif; transition: all 0.2s;
}
.memo-save-btn:hover { background: var(--hyundai-sky); }
.memo-save-btn.saved { background: var(--pass); color: white; border-color: var(--pass); }

/* ===== 플로팅 툴바 ===== */
#floating-toolbar {
  display: none; position: fixed; z-index: 9999; background: var(--hyundai-blue);
  border-radius: 8px; padding: 5px 7px;
  box-shadow: 0 4px 20px rgba(0, 44, 95, 0.35), 0 1px 4px rgba(0, 0, 0, 0.15);
  align-items: center; gap: 3px; user-select: none; transform: translateX(-50%);
}
#floating-toolbar::after {
  content: ''; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--hyundai-blue); border-bottom: none;
}
#floating-toolbar.visible { display: flex; }

.ft-btn {
  padding: 4px 8px; border: none; border-radius: 5px; background: transparent; color: white;
  font-size: 13px; font-weight: 700; cursor: pointer; transition: background 0.15s;
  font-family: 'Noto Sans KR', sans-serif; line-height: 1; min-width: 24px; text-align: center; white-space: nowrap;
}
.ft-btn:hover { background: rgba(255, 255, 255, 0.2); }
.ft-btn.active { background: rgba(255, 255, 255, 0.3); }
.ft-sep { width: 1px; height: 16px; background: rgba(255, 255, 255, 0.25); margin: 0 2px; flex-shrink: 0; }
.ft-btn.hl-btn { background: rgba(255, 235, 59, 0.25); color: #FFE066; }
.ft-btn.hl-btn:hover { background: rgba(255, 235, 59, 0.4); }

.ft-color-wrap { position: relative; display: flex; align-items: center; }
.ft-color-btn {
  padding: 4px 7px; border: none; border-radius: 5px; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.ft-color-btn:hover { background: rgba(255, 255, 255, 0.2); }
.ft-color-letter { font-size: 13px; font-weight: 900; color: white; line-height: 1; font-family: 'Noto Sans KR', sans-serif; }
.ft-color-bar { width: 16px; height: 3px; border-radius: 2px; background: #E63946; }
.ft-color-real { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; top: 0; left: 0; }

/* ===== 색상 팔레트 ===== */
#color-palette {
  display: none; position: fixed; z-index: 10000; background: white; border-radius: 10px; padding: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18); flex-wrap: wrap; gap: 5px; width: 178px;
}
#color-palette.visible { display: flex; }
.palette-color {
  width: 26px; height: 26px; border-radius: 5px; cursor: pointer; border: 2px solid transparent;
  transition: transform 0.1s, border-color 0.1s; flex-shrink: 0;
}
.palette-color:hover { transform: scale(1.18); border-color: #002C5F; }
.palette-title { width: 100%; font-size: 11px; font-weight: 700; color: var(--text-secondary); margin-bottom: 2px; }
.palette-divider { width: 100%; height: 1px; background: var(--border); margin: 3px 0; }
.custom-color-wrap { width: 100%; display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.custom-color-label { font-size: 11px; color: var(--text-secondary); }
.custom-color-input { flex: 1; height: 26px; border-radius: 5px; border: 1.5px solid var(--border); cursor: pointer; padding: 0 2px; }

/* ===== 모달 ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: white; border-radius: 15px; padding: 24px; max-width: 560px; width: 90%;
  max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.modal h2 { font-size: 17px; color: var(--hyundai-blue); margin-bottom: 13px; }
.modal-close { float: right; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-secondary); }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 12px; }
.summary-item { background: var(--bg); border-radius: 9px; padding: 12px; }
.summary-item .s-label { font-size: 12px; color: var(--text-secondary); }
.summary-item .s-value { font-size: 20px; font-weight: 700; margin-top: 3px; }

/* ===== 푸터 ===== */
.footer { text-align: center; padding: 22px; color: var(--text-secondary); font-size: 12px; border-top: 1px solid var(--border); margin-top: 28px; }

/* ===== 메인 페이지 (테스트 목록) ===== */
.test-list { max-width: 900px; margin: 60px auto; padding: 0 24px; }
.test-list h2 { font-size: 22px; color: var(--hyundai-blue); margin-bottom: 24px; font-weight: 700; }
.test-card {
  background: white; border-radius: 14px; padding: 24px 28px; box-shadow: var(--shadow);
  border: 2px solid transparent; cursor: pointer; transition: all 0.25s; margin-bottom: 16px;
  display: flex; align-items: center; gap: 20px;
}
.test-card:hover { border-color: var(--hyundai-light-blue); box-shadow: 0 4px 20px rgba(0, 170, 210, 0.15); transform: translateY(-2px); }
.test-card .card-icon { font-size: 36px; flex-shrink: 0; }
.test-card .card-body { flex: 1; }
.test-card .card-title { font-size: 17px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.test-card .card-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.test-card .card-arrow { font-size: 20px; color: var(--hyundai-light-blue); flex-shrink: 0; }
.test-card .card-meta { display: flex; gap: 12px; margin-top: 8px; }
.test-card .card-meta span { font-size: 11px; color: var(--text-secondary); background: var(--bg); padding: 3px 10px; border-radius: 12px; }

/* ===== 토스트 알림 ===== */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--hyundai-blue);
  color: white; padding: 12px 24px; border-radius: 10px; font-size: 13px; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2); z-index: 9999; opacity: 0; transition: opacity 0.3s;
  font-family: 'Noto Sans KR', sans-serif;
}
.toast.show { opacity: 1; }

/* ===== 반응형 ===== */
@media (max-width: 768px) {
  .header { padding: 12px 16px; }
  .main { padding: 12px 10px; }
  .test-table { display: block; overflow-x: auto; }
  .test-list { margin: 30px auto; }
}
