@import url("./colors.05cf69ed82f2.css");

/* ============================================================
   safe Floating Bar (V5 FINAL) - DH-7, dual-host 스펙 §5.8/§5.9
   + 로그인 IP 배지 (§5.8.3) + 랜딩 공개 변형 (§5.9.3)

   - 이 파일은 safe 분기(+ apex 랜딩)에서만 <link> 된다.
     공용 Tailwind 번들(styles.css)에 bar 클래스를 넣지 않는 이유 =
     erp 번들에 컴포넌트 클래스 0 (불변식 I2, §5.6.3 프리셋 격리).
   - 색 토큰: C12 구성 = C1 딥 네이비 베이스(slate-900/200) +
     var(--color-secure-mint) 네온 민트 액센트 (방패/펄스 점/구분 dot/포인트 한정 -
     본문 텍스트 금지: vs 흰 배경 1.3:1 WCAG 실패).
     사용자 대면 카피는 "초록색" (§5.9.1 카피-토큰 분리).
   - 프리셋 (§5.6.3 큐레이션): data-sbar-preset 속성이 토큰 스위치.
   ============================================================ */

:root {
  --sbar-h: 36px;
  --sbar-bg: var(--color-secure-navy);            /* slate-900 */
  --sbar-text: var(--color-secure-text);          /* slate-200 */
  --sbar-panel: var(--color-slate-800);         /* slate-800 */
  --sbar-divider: rgba(255, 255, 255, 0.10);
  --sbar-accent: var(--color-secure-mint);        /* 네온 민트 - 포인트 전용 */
}

/* ── 색상 프리셋 (설정 > 화면 - localStorage v1, §5.6.3) ── */
body[data-sbar-preset="c1"] {
  --sbar-accent: var(--color-emerald-400);        /* emerald-400 - C1 보수판 (무네온) */
}
body[data-sbar-preset="c3"] {
  --sbar-bg: var(--color-neutral-900);            /* neutral-900 */
  --sbar-text: var(--color-neutral-300);          /* neutral-300 */
  --sbar-panel: var(--color-ink-900);
  --sbar-accent: var(--color-blue-400);        /* blue-400 */
}
body[data-sbar-preset="g1"] {
  --sbar-bg: linear-gradient(90deg, var(--color-blue-900) 0%, var(--color-violet-700) 100%);
  --sbar-text: var(--color-surface);
  --sbar-panel: var(--color-blue-900);
  --sbar-accent: var(--color-violet-300);        /* violet-300 */
}
body[data-sbar-preset="g5"] {
  --sbar-bg: linear-gradient(90deg, var(--color-blue-800) 0%, var(--color-cyan-700) 100%);
  --sbar-text: var(--color-surface);
  --sbar-panel: var(--color-blue-800);
  --sbar-accent: var(--color-cyan-300);        /* cyan-300 */
}
body[data-sbar-preset="g10"] {
  --sbar-bg: linear-gradient(90deg, var(--color-secure-royal-start) 0%, var(--color-secure-royal-end) 100%);
  --sbar-text: var(--color-surface);
  --sbar-panel: var(--color-secure-royal-start);
  --sbar-accent: var(--color-sky-300);        /* sky-300 */
}

/* ── 본문 높이 보정 (하단 fixed bar - V5) ── */
body.sbar-active .h-screen {
  height: calc(100vh - var(--sbar-h));
}
body.sbar-active.sbar-landing {
  padding-bottom: var(--sbar-h);
}
body.sbar-active .min-h-screen {
  min-height: calc(100vh - var(--sbar-h));
}

/* ── 접힘 바 (기본 상태 - 상시 표시, role=status) ── */
.sbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;                   /* 모달/바텀시트/토스트(z-50) 위 금지 */
  height: var(--sbar-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  background: var(--sbar-bg);
  color: var(--sbar-text);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  line-height: 1.4;
  font-feature-settings: "tnum";
}
.sbar-accent { color: var(--sbar-accent); }
.sbar-dot { color: var(--sbar-accent); opacity: .75; padding: 0 2px; }
.sbar-muted { opacity: .72; }
.sbar-spacer { flex: 1; }
.sbar svg { flex-shrink: 0; }
.sbar-nowrap { white-space: nowrap; }

.sbar-pulse {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  flex-shrink: 0;
  background: var(--sbar-accent);
  box-shadow: 0 0 6px rgba(0, 255, 132, 0.55);
  animation: sbarPulse 1.8s ease-in-out infinite;
}
@keyframes sbarPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.sbar-chevron svg { transition: transform .18s ease; }
.sbar-chevron.sbar-open svg { transform: rotate(180deg); }

/* ── 펼침 상세 패널 (§5.5 펼침 계약) ── */
.sbar-panel {
  position: fixed;
  bottom: var(--sbar-h);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--sbar-panel);
  color: var(--sbar-text);
  border-top: 1px solid var(--sbar-divider);
  font-size: 12px;
  font-feature-settings: "tnum";
}
.sbar-panel[hidden] { display: none; }
.sbar-panel-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px 24px;
  padding: 16px 20px;
}
.sbar-panel-label { font-size: 11px; opacity: .6; display: flex; align-items: center; gap: 6px; }
.sbar-panel-value { margin-top: 4px; }
.sbar-panel-caption { font-size: 10.5px; opacity: .72; margin-top: 2px; }
.sbar-panel-divider { margin: 0 20px; border-top: 1px solid var(--sbar-divider); }
.sbar-history { padding: 14px 20px; }
.sbar-history-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; flex-wrap: wrap; }
.sbar-history-time { opacity: .72; width: 84px; flex-shrink: 0; }

/* ── VPN 의심 칩 (§5.8.2 - amber, red 금지) ── */
.sbar-vpn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 500;
  border-radius: 9999px;
  padding: 1px 7px;
  background: rgba(251, 191, 36, 0.16);
  color: var(--color-amber-300);
  border: 1px solid rgba(251, 191, 36, 0.4);
  cursor: help;
}

/* ── 국기 칩 (SVG - 이모지 금지) + 텍스트 fallback ── */
.sbar-flag {
  display: inline-flex;
  flex-shrink: 0;
  border-radius: 2px;
  overflow: hidden;
  outline: 1px solid rgba(255, 255, 255, 0.25);
  outline-offset: -1px;
}
.sbar-flag img { width: 18px; height: 12px; display: block; }
.sbar-flag-text {
  display: inline-flex;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 500;
  border-radius: 3px;
  padding: 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  opacity: .85;
}

/* ── Border B2 - 전화면 1px(고해상도 2px), 기본 켜짐 (§5.9.1) ── */
.sbar-frame {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;                   /* bar(z-40) 미만 */
  box-shadow: inset 0 0 0 1px var(--sbar-accent);
}
@media (min-resolution: 2dppx) {
  .sbar-frame { box-shadow: inset 0 0 0 2px var(--sbar-accent); }
}
body.sbar-frame-off .sbar-frame { display: none; }

/* ── erp 전환 확인 다이얼로그 (§5.8.1 - 앱 라이트 테마) ── */
.sbar-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(23, 23, 23, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.sbar-dialog-backdrop[hidden] { display: none; }
.sbar-dialog {
  background: var(--color-surface);
  border-radius: 12px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.sbar-dialog-body { padding: 24px 24px 8px; }
.sbar-dialog-title { font-size: 16px; font-weight: 500; color: var(--color-neutral-900); }
.sbar-dialog-text { margin-top: 12px; font-size: 13px; color: var(--color-ink-600); line-height: 1.6; }
.sbar-dialog-text p + p { margin-top: 10px; }
.sbar-dialog-actions {
  padding: 16px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--color-neutral-50);
  border-top: 1px solid var(--color-line);
  margin-top: 12px;
}

/* ── 웰컴 모먼트 (안 8 - §5.9.2 확정 카피, 3s 소멸) ── */
.sbar-welcome {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 32px;
  background: var(--sbar-bg);
  color: var(--sbar-text);
  font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: opacity .3s ease;
}
.sbar-welcome[hidden] { display: none; }
.sbar-welcome.sbar-fade { opacity: 0; }

/* ── 진입 안내 모달 (안 A - 딥네이비 + var(--color-secure-mint) 액센트, sbar 팔레트 재사용) ── */
.sbar-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;                   /* 웰컴/바(z-40) + erp 다이얼로그(z-50) 위 - 진입 최우선 안내 */
  background: rgba(2, 6, 23, 0.66);   /* slate-950 계열 반투명 (hex 아님) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.sbar-modal-backdrop[hidden] { display: none; }
.sbar-modal {
  background: var(--sbar-bg);
  color: var(--sbar-text);
  border: 1px solid var(--sbar-divider);
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  padding: 28px 24px 20px;
}
.sbar-modal-head { text-align: center; }
.sbar-modal-shield {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 9999px;
  color: var(--sbar-accent);
  background: rgba(0, 255, 132, 0.12);   /* 액센트 halo (rgba - hex 아님) */
}
.sbar-modal-title {
  margin-top: 14px;
  font-size: 18px;
  font-weight: 600;
  color: var(--sbar-text);
}
.sbar-modal-lead {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--sbar-text);
  opacity: 0.75;
}
.sbar-modal-checks {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sbar-modal-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--sbar-panel);
  border: 1px solid var(--sbar-divider);
}
.sbar-modal-num {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sbar-bg);
  background: var(--sbar-accent);
}
.sbar-modal-check-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sbar-modal-check-title { font-size: 14px; font-weight: 500; color: var(--sbar-text); }
.sbar-modal-check-desc { font-size: 12px; color: var(--sbar-text); opacity: 0.7; line-height: 1.5; }
.sbar-modal-dontshow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--sbar-text);
  opacity: 0.8;
  cursor: pointer;
}
.sbar-modal-actions { margin-top: 16px; }
/* ── 로그인 IP 배지 (§5.8.3 - 미니 칩 1줄) ── */
.sbar-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 9999px;
  padding: 6px 16px;
  background: var(--sbar-bg);
  color: var(--sbar-text);
  font-size: 11.5px;
  font-feature-settings: "tnum";
}
.sbar-badge svg { flex-shrink: 0; }

/* ── 랜딩 공개 변형 (§5.9.3 - 1줄 고정, 펼침/전환/VPN 없음) ── */
.sbar-public-device[hidden] { display: none; }

/* ── 설정 > 화면 프리셋 스와치 (§5.6.3) ── */
.sbar-preset-list { display: flex; flex-wrap: wrap; gap: 8px; }
/* ── 모바일 (V5 동작 계약 - 정보 축약 + safe-area) ── */
@media (max-width: 1023px) {
  :root { --sbar-h: calc(32px + env(safe-area-inset-bottom, 0px)); }
  .sbar {
    height: var(--sbar-h);
    padding: 0 12px env(safe-area-inset-bottom, 0px);
    gap: 6px;
    font-size: 10.5px;
  }
  /* 축약: 방패 + 문구 + IP(+VPN 칩) + 기기 아이콘만 - 나머지는 펼침에서 */
  .sbar-desktop-only { display: none; }
  .sbar-panel-grid { grid-template-columns: 1fr; gap: 10px; padding: 14px 16px; }

}
@media (min-width: 1024px) {
  .sbar-mobile-only { display: none; }
}

/* ── 인쇄 절대 미포함 (§5.5 인쇄 계약 (b) - Ctrl+P 대비 의무) ── */
@media print {
  .sbar,
  .sbar-panel,
  .sbar-frame,
  .sbar-welcome,
  .sbar-modal-backdrop,
  .sbar-dialog-backdrop,
  .sbar-badge {
    display: none !important;
  }
  body.sbar-active .h-screen { height: auto; }
}
