/* ═══ 카메라 테스트 — style.css ═══ */

:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel2: #f8f9fc;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #7c3aed;
  --accent-soft: rgba(124,58,237,.10);
  --ok: #10b981;
  --bad: #ef4444;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }
body { margin-top: 70px; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif; }

.cam-app { max-width: 100%; padding: 0 0 60px; }

/* ── 헤더 ── */
.top { padding: 24px 0 20px; }
.brand { display: flex; align-items: center; gap: 16px; }
.brand h1 { margin: 0 0 4px; font-size: 26px; font-weight: 800; }
.brand .sub { margin: 0; color: var(--muted); font-size: 15px; }

/* ── 공통 패널 ── */
.cam-panel, .cam-tester, .cam-gear-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

/* ══ 메인 프리뷰 영역 ══ */
.cam-tester {
  padding: 20px;
  margin-bottom: 16px;
}

/* 비디오 래퍼 */
.cam-preview-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111827;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 14px;
}
.cam-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 12px;
}
.cam-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}
.cam-no-signal {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #6b7280;
  background: #111827;
}
.cam-idle-icon { font-size: 52px; opacity: .4; }
.cam-no-signal p { margin: 0; font-size: 14px; }

/* 오버레이 스탯 (FPS + 해상도) */
.cam-overlay-stats {
  position: absolute;
  top: 10px;
  left: 12px;
  display: flex;
  gap: 8px;
}
.cam-overlay-stats span {
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  font-family: monospace;
}

/* 스냅샷 플래시 */
.cam-snapshot-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  border-radius: 12px;
  transition: opacity .05s;
}
.cam-snapshot-flash.flash { opacity: .8; }

/* 스냅샷 미리보기 */
.cam-snapshot-row {
  margin-bottom: 12px;
}
.cam-snapshot-preview {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cam-snapshot-preview img {
  height: 72px;
  border-radius: 8px;
  border: 2px solid var(--accent);
  object-fit: cover;
}
.cam-dl-btn {
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s;
}
.cam-dl-btn:hover { background: #6d28d9; }

/* 컨트롤 바 */
.cam-ctrl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.cam-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.cam-start-btn:hover { background: #6d28d9; }
.cam-start-btn:active { transform: scale(.97); }
.cam-start-btn.running { background: #ef4444; }
.cam-start-btn.running:hover { background: #dc2626; }

.cam-snap-btn {
  padding: 11px 20px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.cam-snap-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.cam-snap-btn:disabled { opacity: .45; cursor: not-allowed; }

.cam-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
  margin-left: auto;
}
.cam-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #d1d5db;
  flex-shrink: 0;
}
.cam-dot.active {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(16,185,129,.25);
  animation: cam-pulse 1.2s ease-in-out infinite;
}
.cam-dot.error { background: var(--bad); }
@keyframes cam-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16,185,129,.25); }
  50%       { box-shadow: 0 0 0 6px rgba(16,185,129,.10); }
}

/* ══ 기기전환 + 기술정보 2컬럼 ══ */
.cam-info-row {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.cam-panel { padding: 20px; }
.cam-panel-head { margin-bottom: 16px; }
.cam-panel-head h3 { margin: 0 0 4px; font-size: 17px; font-weight: 800; }
.cam-panel-head p  { margin: 0; font-size: 12px; color: var(--muted); }

/* 기기 목록 */
.device-list { margin-bottom: 14px; min-height: 60px; }
.no-device-msg { margin: 0; color: var(--muted); font-size: 14px; }

/* 기기 아이템: 스크린샷처럼 선택 시 보라색 풀 버튼 */
.device-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  font-size: 14px;
  font-weight: 600;
}
.device-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.device-item.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.device-item.selected .device-icon { color: #fff; }
.device-icon { font-size: 16px; flex-shrink: 0; }
.device-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-item input[type="radio"] { display: none; }

.cam-refresh-btn {
  width: 100%;
  padding: 10px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s;
}
.cam-refresh-btn:hover { border-color: var(--accent); color: var(--accent); }

/* 기술 정보 테이블 */
.tech-placeholder { color: var(--muted); font-size: 14px; margin: 0; }
.tech-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tech-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
}
.tech-table td:first-child { color: var(--muted); font-weight: 600; width: 120px; }
.tech-table td:last-child  { font-weight: 700; }

/* ══ 추천 장비 섹션 ══ */
.cam-gear-section {
  padding: 28px 24px;
  margin-bottom: 16px;
  text-align: center;
}
.cam-gear-section h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.gear-sub { margin: 0 0 24px; font-size: 14px; color: var(--muted); }
.gear-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  text-align: left;
}
.gear-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.gear-sponsored {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
}
.gear-img-wrap {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel2);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gear-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.gear-emoji { font-size: 36px; }
.gear-body { flex: 1; min-width: 0; padding-right: 48px; }
.gear-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 10px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gear-shop-btn {
  display: inline-block;
  padding: 6px 14px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(124,58,237,.25);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s;
}
.gear-shop-btn:hover { background: var(--accent); color: #fff; }

/* ══ 가이드 섹션 ══ */
.guide-section.cam-guide {
  background: rgba(246,248,255,.6);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 36px;
}
.cam-guide-block { margin-bottom: 28px; }
.cam-guide-block:last-child { margin-bottom: 0; }
.cam-guide-block h2 { font-size: 20px; font-weight: 800; margin: 0 0 10px; }
.cam-guide-block h3 { font-size: 16px; font-weight: 700; margin: 20px 0 8px; }
.cam-guide-block p  { font-size: 14px; line-height: 1.7; color: #374151; margin: 0 0 12px; }
.cam-guide-block code { background: var(--panel2); padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.cam-steps {
  padding-left: 20px;
  margin: 0;
}
.cam-steps li {
  font-size: 14px;
  line-height: 1.7;
  color: #374151;
  margin-bottom: 8px;
}
.cam-steps li em { color: var(--accent); font-style: normal; }
.cam-terms {
  padding-left: 20px;
  margin: 0;
}
.cam-terms li {
  font-size: 14px;
  line-height: 1.7;
  color: #374151;
  margin-bottom: 10px;
}
.cam-guide-hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

/* ── 반응형 ── */
@media (max-width: 768px) {
  .cam-info-row { grid-template-columns: 1fr; }
  .gear-grid    { grid-template-columns: 1fr; }
  .guide-section.cam-guide { padding: 20px 16px; }
  .cam-ctrl-row { flex-wrap: wrap; }
  .cam-status-badge { margin-left: 0; }
}
