/* =====================================================
   LogiScan — 스타일시트
   TravelerCustomChecker(TCC)의 글래스모피즘 시스템을
   기반으로 LogiScan 전용 컴포넌트를 확장합니다.
   ===================================================== */

/* ─── 폰트 ─────────────────────────────────────────── */
* { font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif; }

/* ─── 스크롤바 ──────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 4px; }

/* 숫자 입력 화살표 제거 */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ─── 배경 (TCC 계승) ───────────────────────────────── */
body {
  background: #f0f4ff;
  background-image:
    radial-gradient(at 20% 10%, rgba(99,102,241,0.12) 0%, transparent 50%),
    radial-gradient(at 80% 80%, rgba(168,85,247,0.10) 0%, transparent 50%),
    radial-gradient(at 50% 50%, rgba(236,254,255,0.8) 0%, transparent 70%);
  min-height: 100vh;
}

/* ─── 헤더 (TCC 계승) ───────────────────────────────── */
.header-gradient {
  background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 45%, #4f46e5 100%);
  position: relative;
  overflow: hidden;
}
.header-gradient::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ─── 카드 (글래스모피즘 — TCC 계승) ───────────────── */
.card {
  background: rgba(255,255,255,0.90);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.80);
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(99,102,241,0.08), 0 1px 4px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s;
}
.card:hover {
  box-shadow: 0 8px 32px rgba(99,102,241,0.13), 0 2px 8px rgba(0,0,0,0.06);
}

/* ─── 섹션 타이틀 (TCC 계승) ───────────────────────── */
.section-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #1e1b4b;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ─── 입력 필드 (TCC 계승) ──────────────────────────── */
.field-focus {
  transition: all 0.18s;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
}
.field-focus:focus {
  outline: none;
  border-color: #818cf8;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

/* ─── 배지 (TCC 계승) ───────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
}

/* ─── 기본 버튼 ─────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, #1e40af 0%, #4f46e5 100%);
  box-shadow: 0 4px 20px rgba(30,64,175,0.35);
  transition: all 0.2s cubic-bezier(.4,0,.2,1);
  color: white;
  font-weight: 700;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #4338ca 100%);
  box-shadow: 0 6px 28px rgba(30,64,175,0.45);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 2px 12px rgba(30,64,175,0.3);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ─── 검색 입력 필드 ────────────────────────────────── */
.search-input {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #1e1b4b;
}
.search-input::placeholder {
  font-weight: 400;
  letter-spacing: 0;
  color: #94a3b8;
}

/* ══════════════════════════════════════════════════
   타임라인 컴포넌트 (LogiScan 신규)
   ════════════════════════════════════════════════ */

/* ─── 타임라인 컨테이너 ─────────────────────────────── */
.timeline-wrap {
  position: relative;
  padding-left: 0;
}

/* ─── 타임라인 아이템 ───────────────────────────────── */
.timeline-item {
  display: flex;
  gap: 1rem;
  padding-bottom: 1.5rem;
  position: relative;
}
.timeline-item:last-child {
  padding-bottom: 0;
}

/* ─── 세로 연결선 ───────────────────────────────────── */
.timeline-line {
  position: absolute;
  left: 19px;          /* 노드 중앙 (w-10 = 40px, 절반 = 20px, border 보정 -1px) */
  top: 40px;
  bottom: 0;
  width: 2px;
  border-radius: 1px;
}
.timeline-item:last-child .timeline-line {
  display: none;
}

/* ─── 노드 (아이콘 원) ──────────────────────────────── */
.timeline-node {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border-width: 2px;
  border-style: solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  position: relative;
  z-index: 10;
  transition: all 0.2s;
}

/* 현재 단계 — pulse 링 애니메이션 */
.timeline-node.is-current::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0.4;
  animation: timeline-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* 대기 단계 — 흐리게 */
.timeline-item.is-pending .timeline-node {
  opacity: 0.35;
}
.timeline-item.is-pending .timeline-content {
  opacity: 0.40;
}

/* ─── 타임라인 내용 영역 ────────────────────────────── */
.timeline-content {
  flex: 1;
  padding-top: 8px;
}

/* ─── 경과 시간 배지 ────────────────────────────────── */
.elapsed-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(251,191,36,0.15);
  color: #b45309;
}

/* ══════════════════════════════════════════════════
   스켈레톤 로딩 (LogiScan 신규)
   ════════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(226,232,240,0.8) 25%,
    rgba(241,245,249,0.9) 50%,
    rgba(226,232,240,0.8) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 8px;
}

/* ══════════════════════════════════════════════════
   리스크 경고 (LogiScan 신규)
   ════════════════════════════════════════════════ */
.risk-badge {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.risk-badge.risk-high {
  background: rgba(255,228,230,0.8);
  border: 1px solid rgba(251,113,133,0.3);
  color: #be123c;
}
.risk-badge.risk-medium {
  background: rgba(255,251,235,0.8);
  border: 1px solid rgba(252,211,77,0.3);
  color: #92400e;
}

/* ══════════════════════════════════════════════════
   화물 정보 카드 (LogiScan 신규)
   ════════════════════════════════════════════════ */
.info-grid-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: rgba(248,250,252,0.8);
  border-radius: 12px;
  border: 1px solid rgba(226,232,240,0.6);
}
.info-grid-label {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}
.info-grid-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1e293b;
}

/* ══════════════════════════════════════════════════
   에러 / 빈 상태 카드
   ════════════════════════════════════════════════ */
.state-card {
  text-align: center;
  padding: 2.5rem 1.5rem;
}
.state-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  display: block;
}

/* ══════════════════════════════════════════════════
   AI 리포트 영역 (Phase 2 준비 — placeholder)
   ════════════════════════════════════════════════ */
.ai-placeholder {
  background: linear-gradient(135deg, #f8f5ff 0%, #ede9fe 100%);
  border: 1.5px dashed #c4b5fd;
  border-radius: 20px;
}

/* ══════════════════════════════════════════════════
   애니메이션 (TCC 계승 + LogiScan 추가)
   ════════════════════════════════════════════════ */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeSlideIn 0.3s cubic-bezier(.4,0,.2,1); }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeSlideUp 0.4s cubic-bezier(.4,0,.2,1) both; }

@keyframes pulse-once {
  0%,100% { transform: scale(1); }
  40%     { transform: scale(1.06); }
}
.pulse-once { animation: pulse-once 0.45s ease; }

@keyframes timeline-pulse {
  0%,100% { transform: scale(1); opacity: 0.4; }
  50%     { transform: scale(1.35); opacity: 0; }
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 딜레이 유틸 */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }

/* ══════════════════════════════════════════════════
   새로고침 버튼 — Throttle 비활성화 상태
   ════════════════════════════════════════════════ */
#refreshBtn:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

/* ══════════════════════════════════════════════════
   Audit — 오차 시각화 바
   ════════════════════════════════════════════════ */
.audit-diff-bar {
  position: relative;
  height: 8px;
  border-radius: 99px;
  background: #e2e8f0;
  overflow: hidden;
}
.audit-diff-bar-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
}

/* ══════════════════════════════════════════════════
   Audit — 버튼 에메랄드 그라데이션 오버라이드
   ════════════════════════════════════════════════ */
#auditRunBtn {
  background: linear-gradient(135deg, #059669 0%, #0d9488 100%);
  box-shadow: 0 4px 20px rgba(5,150,105,0.30);
}
#auditRunBtn:hover {
  background: linear-gradient(135deg, #047857 0%, #0f766e 100%);
  box-shadow: 0 6px 28px rgba(5,150,105,0.40);
  transform: translateY(-1px);
}

/* 토스트 트랜지션 */
#throttleToast {
  transition: opacity 0.5s ease;
}
#throttleToast.opacity-0 { opacity: 0; }
