@import '../shared.css';

/* SCR-31 현장 체크인 데스크 (M10) — 스캔 존 · 결과 카드 · 실시간 집계. visitor.css 위에 얹는 화면 전용 스타일. */

.kx-checkin__kiosk-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 6px 12px;
  font-size: var(--fs-caption);
  color: var(--color-neutral-700);
  background: var(--color-white);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.kx-checkin__kiosk-toggle.is-on {
  color: var(--color-primary-700);
  background: var(--color-primary-050);
  border-color: var(--color-primary-600);
}

/* ── 3단 레이아웃: 스캔 | 결과 | 집계 ── */
.kx-checkin__grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) minmax(280px, 1fr) minmax(260px, 0.9fr);
  gap: var(--space-4);
  align-items: start;
}
@media (max-width: 1100px) {
  .kx-checkin__grid { grid-template-columns: 1fr 1fr; }
  .kx-checkin__side { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .kx-checkin__grid { grid-template-columns: 1fr; }
}

/* 키오스크 모드 — 스캔·결과에 집중(집계 숨김·확대) */
.kx-checkin.is-kiosk .kx-checkin__side { display: none; }
.kx-checkin.is-kiosk .kx-checkin__grid { grid-template-columns: 1.2fr 1fr; }
.kx-checkin.is-kiosk .kx-checkin__frame { min-height: 300px; }
.kx-checkin.is-kiosk .kx-checkin__visitor-name { font-size: var(--fs-display); }

/* ── 스캔 존 ── */
.kx-checkin__scan {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.kx-checkin__frame {
  position: relative;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  color: var(--color-primary-600);
  background: var(--color-neutral-050);
  border-radius: var(--radius-lg);
}
.kx-checkin__frame-corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 2px solid var(--color-primary-600);
  border-radius: 2px;
}
.kx-checkin__frame-corner.tl { top: 12px; left: 12px; border-right: 0; border-bottom: 0; }
.kx-checkin__frame-corner.tr { top: 12px; right: 12px; border-left: 0; border-bottom: 0; }
.kx-checkin__frame-corner.bl { bottom: 12px; left: 12px; border-right: 0; border-top: 0; }
.kx-checkin__frame-corner.br { bottom: 12px; right: 12px; border-left: 0; border-top: 0; }
.kx-checkin__frame-hint {
  font-size: var(--fs-body);
  color: var(--color-neutral-500);
}
.kx-checkin__scanline {
  animation: kx-checkin-scan 2.2s ease-in-out infinite;
}
@keyframes kx-checkin-scan {
  0%, 100% { transform: translateY(-5px); opacity: 0.35; }
  50%      { transform: translateY(5px);  opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .kx-checkin__scanline, .kx-checkin__pulse { animation: none; }
}

/* ── 토큰 입력 · 수동 검색 ── */
.kx-checkin__label {
  display: block;
  font-size: var(--fs-caption);
  color: var(--color-neutral-700);
  margin-bottom: var(--space-1);
}
.kx-checkin__token-row {
  display: flex;
  gap: var(--space-1);
}
.kx-checkin__input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  font-size: var(--fs-body);
  font-family: var(--font-sans);
  color: var(--color-neutral-900);
  background: var(--color-white);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
}
.kx-checkin__input:focus-visible {
  outline: 2px solid var(--color-primary-600);
  outline-offset: 1px;
}
.kx-checkin__divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-neutral-500);
  font-size: var(--fs-caption);
}
.kx-checkin__divider::before,
.kx-checkin__divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border-card);
}
.kx-checkin__err {
  margin-top: var(--space-1);
  font-size: var(--fs-caption);
  color: var(--color-error);
}
.kx-checkin__empty {
  margin-top: var(--space-3);
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
}

/* 검색 결과 목록 */
.kx-checkin__results {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-height: 280px;
  overflow-y: auto;
}
.kx-checkin__result {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  background: var(--color-white);
}
.kx-checkin__result-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.kx-checkin__result-name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-body);
  color: var(--color-neutral-900);
}
.kx-checkin__result-meta {
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kx-checkin__done-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-caption);
  color: var(--color-success);
  white-space: nowrap;
}

/* ── 결과 카드 ── */
.kx-checkin__result-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 380px;
}
.kx-checkin__scan-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
  color: var(--color-error);
  font-size: var(--fs-body);
}
.kx-checkin__idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
  color: var(--color-neutral-500);
  font-size: var(--fs-body);
}
.kx-checkin__pulse {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-primary-600);
  animation: kx-checkin-pulse 1.6s ease-in-out infinite;
}
@keyframes kx-checkin-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.35); }
  70%  { box-shadow: 0 0 0 14px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.kx-checkin__visitor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
}
.kx-checkin__visitor-status { min-height: 28px; }
.kx-checkin__badge-ok,
.kx-checkin__badge-dup {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 12px;
  font-size: var(--fs-caption);
  border-radius: var(--radius-pill);
}
.kx-checkin__badge-ok {
  color: var(--color-success);
  background: rgba(3, 152, 85, 0.08);
}
.kx-checkin__badge-dup {
  color: var(--color-warning);
  background: rgba(220, 104, 3, 0.1);
}
.kx-checkin__visitor.is-dup .kx-vis__avatar { opacity: 0.6; }
.kx-checkin__visitor-name {
  font-size: var(--fs-h3);
  color: var(--color-neutral-900);
}
.kx-checkin__visitor-meta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-body);
  color: var(--color-neutral-500);
}
.kx-checkin__visitor-dl {
  width: 100%;
  max-width: 320px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.kx-checkin__visitor-dl > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-card);
  font-size: var(--fs-body);
}
.kx-checkin__visitor-dl dt { color: var(--color-neutral-500); }
.kx-checkin__visitor-dl dd { margin: 0; color: var(--color-neutral-900); }
.kx-checkin__visitor-actions {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

/* ── 우측 집계 ── */
.kx-checkin__side {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}
.kx-checkin__inside {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.kx-checkin__inside-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
}
.kx-checkin__inside-num {
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  color: var(--color-neutral-900);
}
.kx-checkin__inside-sub {
  display: flex;
  gap: var(--space-4);
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
}
.kx-checkin__inside-sub b { color: var(--color-neutral-700); font-weight: var(--fw-semibold); }
.kx-checkin__hours { min-width: 0; }
