/* ============================================================
   Canyon / Colorado 토크 사양 — 스타일시트
   ============================================================ */

:root {
  --primary:    #1F3864;
  --accent:     #2E75B6;
  --accent-lt:  #EBF3FB;
  --border:     #BDD7EE;
  --text:       #1a1a2e;
  --text-muted: #64748b;
  --bg:         #f4f6fb;
  --white:      #ffffff;
  --shadow:     0 2px 12px rgba(0, 0, 0, .08);
  --radius:     10px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "맑은 고딕", "Malgun Gothic", -apple-system, BlinkMacSystemFont,
               "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
}

/* ── 헤더 ── */
.site-header {
  background: linear-gradient(135deg, #1a1a2e 0%, var(--primary) 100%);
  color: var(--white);
  padding: 28px 24px 24px;
  text-align: center;
}
.site-header h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.5px; }
.site-header p  { margin-top: 6px; opacity: .75; font-size: .9rem; }
.header-meta {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.header-badge {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: .8rem;
}

/* ── 검색 / 컨트롤 바 ── */
.controls-bar {
  background: var(--white);
  border-bottom: 2px solid var(--border);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.controls-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* 검색창 */
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: .92rem;
  font-family: inherit;
  background: var(--white);
  outline: none;
  transition: border-color .2s;
}
.search-input:focus { border-color: var(--accent); }

/* 출력 버튼 */
.btn-print {
  padding: 9px 18px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s;
}
.btn-print:hover { background: var(--accent); }

/* ── 카테고리 탭 ── */
.cat-nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.cat-nav::-webkit-scrollbar { display: none; }
.cat-nav { -ms-overflow-style: none; }
.cat-nav-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  gap: 6px;
}
.cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  color: var(--primary);
  font-size: .82rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .18s;
}
.cat-btn:hover { border-color: var(--accent); color: var(--accent); }
.cat-btn.active {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}
.cat-count {
  background: rgba(0,0,0,.12);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: .72rem;
}
.cat-btn.active .cat-count { background: rgba(255,255,255,.25); }

/* ── 서브카테고리 필터 ── */
.sub-nav {
  max-width: 1300px;
  margin: 12px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 32px;
}
.sub-btn {
  padding: 4px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--text-muted);
  font-size: .78rem;
  font-family: inherit;
  cursor: pointer;
  transition: all .18s;
}
.sub-btn:hover { border-color: var(--accent); color: var(--accent); }
.sub-btn.active {
  background: var(--accent-lt);
  color: var(--primary);
  border-color: var(--accent);
  font-weight: 600;
}

/* ── 통계 ── */
.stats-bar {
  max-width: 1300px;
  margin: 10px auto 4px;
  padding: 0 24px;
  font-size: .83rem;
  color: var(--text-muted);
}

/* ── 테이블 래퍼 ── */
.table-wrap {
  max-width: 1300px;
  margin: 8px auto 50px;
  padding: 0 24px;
  overflow-x: auto;
}

/* ── 테이블 ── */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
thead {
  background: var(--primary);
  color: var(--white);
  position: sticky;
  top: 0; /* 컨트롤 바 아래 고정은 JS로 보정 */
}
thead th {
  padding: 13px 14px;
  text-align: left;
  font-size: .83rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
thead th:hover { background: var(--accent); }
thead th.sort-asc::after  { content: " ▲"; opacity: .8; }
thead th.sort-desc::after { content: " ▼"; opacity: .8; }

tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background .12s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f0f6ff; }

td {
  padding: 11px 14px;
  font-size: .855rem;
  vertical-align: middle;
}

/* ── 카테고리 배지 ── */
.cat-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .76rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-엔진           { background: #dbeafe; color: #1d4ed8; }
.badge-배터리전기      { background: #fef9c3; color: #92400e; }
.badge-브레이크        { background: #fee2e2; color: #b91c1c; }
.badge-서스펜션        { background: #d1fae5; color: #065f46; }
.badge-스티어링        { background: #ede9fe; color: #5b21b6; }
.badge-드라이브라인액슬 { background: #ffedd5; color: #c2410c; }
.badge-트랜스미션      { background: #fce7f3; color: #9d174d; }
.badge-공조HVAC        { background: #cffafe; color: #0e7490; }
.badge-안전장치        { background: #f0fdf4; color: #166534; }
.badge-바퀴타이어      { background: #f1f5f9; color: #334155; }

/* ── 토크 값 ── */
.torque-nm  { font-weight: 700; color: var(--primary); white-space: nowrap; }
.torque-imp { color: var(--text-muted); font-size: .82rem; white-space: nowrap; }

/* ── 서브카테고리 텍스트 ── */
.sub-text { color: var(--text-muted); font-size: .78rem; }

/* ── 영문 부품명 ── */
.en-text { color: #475569; }

/* ── 출처 ── */
.src-text { color: #94a3b8; font-size: .76rem; max-width: 200px; }

/* ── 주의사항 ── */
.note-text {
  color: #b45309;
  font-size: .76rem;
  font-style: italic;
}

/* ── 검색어 하이라이트 ── */
mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── 페이지 내비게이션 ── */
.page-nav {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.nav-link {
  display: inline-block;
  padding: 6px 18px;
  border: 1.5px solid rgba(255,255,255,.35);
  border-radius: 20px;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  font-size: .85rem;
  transition: all .2s;
}
.nav-link:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
}
.nav-link.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ── 유틸 ── */
.is-hidden { display: none !important; }
.body-noscroll { overflow: hidden; }

/* ── 결과 없음 ── */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.no-results p:first-child { font-size: 2rem; margin-bottom: 8px; }

/* ── 푸터 ── */
footer {
  text-align: center;
  padding: 20px;
  font-size: .8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--white);
}

/* ── 이미지 버튼 (테이블 셀) ── */
.th-img { width: 52px; text-align: center; cursor: default; }
.td-img { text-align: center; }

.btn-img {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--accent);
  cursor: pointer;
  transition: all .18s;
  padding: 0;
}
.btn-img:hover {
  background: var(--accent-lt);
  border-color: var(--accent);
  color: var(--primary);
}

/* ── 이미지 모달 ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .72);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  will-change: opacity;
  animation: fadeIn .15s ease;
}
.modal-overlay[hidden] { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
  max-width: 860px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  will-change: transform, opacity;
  animation: slideUp .18s ease;
  overflow: hidden;
}

@keyframes slideUp {
  from { transform: translate3d(0, 20px, 0); opacity: 0; }
  to   { transform: translate3d(0, 0, 0);    opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--primary);
  color: var(--white);
  flex-shrink: 0;
}
.modal-caption {
  font-size: .92rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-close {
  background: rgba(255,255,255,.15);
  border: none;
  color: var(--white);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.modal-close:hover { background: rgba(255,255,255,.3); }

.modal-body {
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-height: 200px;
  background: #f8fafc;
}
.modal-img {
  max-width: 100%;
  max-height: calc(90vh - 120px);
  border-radius: 6px;
  object-fit: contain;
  display: block;
}
.modal-no-img {
  color: var(--text-muted);
  font-size: .9rem;
  text-align: center;
}

/* ── 인쇄 ── */
@media print {
  .controls-bar, .cat-nav, .sub-nav, .btn-print, footer,
  .modal-overlay, .td-img, .th-img { display: none !important; }
  .table-wrap { padding: 0; margin: 0; overflow: visible; }
  table { box-shadow: none; border: 1px solid #ccc; }
  tbody tr:hover { background: none; }
  .stats-bar { margin: 8px 0; }
  body { font-size: 11px; }
}

/* ── 반응형 ── */
@media (max-width: 768px) {
  .site-header h1 { font-size: 1.25rem; }
  .controls-bar   { padding: 10px 14px; }
  .cat-nav        { padding: 8px 14px; }
  .table-wrap     { padding: 0 10px; }
  .sub-nav        { padding: 0 14px; }
  .stats-bar      { padding: 0 14px; }
  td, thead th    { padding: 9px 10px; font-size: .79rem; }
  .src-text       { display: none; }
  .note-text      { display: none; }
  .modal-box      { max-height: 95vh; }
}
