/* WISE ERP 로그인 화면 — "로그인 페이지 목업 작업.zip" (Login to Dashboard) 시안 */

:root {
  --lg-ink: #1d2733;
  --lg-navy: #12355e;
  --lg-sub: #4a5866;
  --lg-label: #3d4a57;
  --lg-muted: #8a96a3;
  --lg-accent: #1f6fd1;
  --lg-accent-hover: #1a62bb;
  --lg-line: #d3dce7;
  --lg-danger: #e5484d;
  --lg-page: #e7eff8;
  --lg-rail-w: 56px; /* « 로 접은 대시보드 메뉴 폭 */
  --lg-card-left: 72px; /* 레일 + 16px */
  --lg-card-w: min(440px, calc(100% - 120px));
  --lg-ease: cubic-bezier(.22, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Pretendard Variable", Pretendard, system-ui, sans-serif;
  color: var(--lg-ink);
  background: var(--lg-page);
  -webkit-font-smoothing: antialiased;
}

.lg-stage {
  position: relative;
  height: 100vh;
  height: 100dvh;
  min-height: 540px;
  overflow: hidden;
  background: linear-gradient(160deg, #f7faff 0%, #e8f1fb 100%);
}

/* ── 오른쪽 일러스트 ───────────────────────────── */
.lg-art {
  position: absolute;
  inset: 0 24px 0 calc(var(--lg-card-left) + var(--lg-card-w) + 24px);
  display: grid;
  place-items: center;
  padding-right: 10%;
  pointer-events: none;
}
.lg-art-inner { position: relative; width: min(460px, 70%); }
.lg-disc, .lg-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.lg-disc { width: 130%; background: #dce9f8; }
.lg-ring { width: 165%; border: 1px solid #cfdff2; }
.lg-floor {
  position: absolute;
  left: -45%;
  right: -45%;
  bottom: 1.6%;
  height: 1.5px;
  background: var(--lg-accent);
  opacity: .3;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
  transform-origin: left;
  animation: lgLine 1.2s var(--lg-ease) both;
}
.lg-illust {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  animation: lgWipe 1.6s cubic-bezier(.65, 0, .35, 1) .5s both;
}
.lg-bubble {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid var(--lg-accent);
  opacity: 0;
  animation: lgRise 4s ease-out infinite;
}
.lg-bubble-1 { left: 20%;   top: 27%; width: 16px; height: 16px; animation-delay: 2.2s; }
.lg-bubble-2 { left: 26.5%; top: 31%; width: 10px; height: 10px; animation-delay: 3.2s; }
.lg-bubble-3 { left: 16.5%; top: 33%; width: 12px; height: 12px; animation-delay: 4s; border-color: #7fb6e6; }

@keyframes lgWipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes lgLine { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes lgRise {
  0%   { transform: translateY(0) scale(.6); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translateY(-120px) scale(1.1); opacity: 0; }
}
@keyframes lgCardIn { from { transform: translateX(calc(-100% - 100px)); opacity: 0; } }

/* ── 로그인 카드 (유리) ────────────────────────── */
.lg-card {
  position: absolute;
  z-index: 2;
  top: 11px;
  bottom: 21px;
  left: var(--lg-card-left);
  width: var(--lg-card-w);
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.6vh, 24px);
  margin: 0;
  padding: clamp(20px, 4vh, 32px) 40px clamp(16px, 3vh, 28px);
  overflow-y: auto;
  scrollbar-width: none;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, .75);
  background: rgba(255, 255, 255, .74);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  backdrop-filter: blur(24px) saturate(1.3);
  box-shadow: 0 24px 70px rgba(30, 70, 130, .22);
  animation: lgCardIn .8s var(--lg-ease) .25s both;
}
.lg-card::-webkit-scrollbar { display: none; }

.lg-brand { flex: none; display: flex; align-items: center; gap: 10px; }
.lg-brand img { display: block; width: 30px; height: auto; }
.lg-brand span { font-size: 13px; font-weight: 700; letter-spacing: .08em; color: var(--lg-navy); }

.lg-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(16px, 3vh, 28px);
}
.lg-head { display: flex; flex-direction: column; gap: 10px; }
.lg-head h1 { margin: 0; font-size: 32px; font-weight: 700; letter-spacing: -.02em; color: var(--lg-navy); }
.lg-head p { margin: 0; font-size: 15px; color: var(--lg-sub); }

.lg-fields { display: flex; flex-direction: column; gap: 12px; }
.lg-error {
  padding: 10px 14px;
  border-radius: 10px;
  background: #fdecec;
  color: #b42323;
  font-size: 13px;
}
.lg-caps { margin: -4px 0 0; font-size: 12px; color: #b4600f; }
.lg-caps[hidden] { display: none; }
.lg-field { display: flex; flex-direction: column; gap: 6px; }
.lg-field > span { font-size: 13px; font-weight: 600; color: var(--lg-label); }
.lg-in {
  height: 50px;
  padding: 0 16px;
  border: 1.5px solid var(--lg-line);
  border-radius: 12px;
  outline: 0;
  background: rgba(255, 255, 255, .9);
  font: inherit;
  font-size: 15px;
  color: var(--lg-ink);
  transition: border-color .15s;
}
.lg-in::placeholder { color: var(--lg-muted); }
.lg-in:focus { border-color: var(--lg-accent); }
.lg-in.is-invalid { border-color: var(--lg-danger); }

.lg-submit {
  height: 52px;
  border: 0;
  border-radius: 12px;
  background: var(--lg-accent);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(31, 111, 209, .28);
  transition: background .15s;
}
.lg-submit:hover { background: var(--lg-accent-hover); }
.lg-submit:focus-visible { outline: 3px solid rgba(31, 111, 209, .35); outline-offset: 2px; }
.lg-submit:disabled { cursor: progress; opacity: .85; }

/* 두 단계 (비밀번호 → 2차 인증 코드). 한 번에 하나만 보인다 */
.lg-step { display: flex; flex-direction: column; gap: clamp(16px, 3vh, 28px); }
.lg-step[hidden], .lg-qr[hidden], .lg-restart[hidden], .lg-hint[hidden] { display: none; }
.lg-qr { display: flex; align-items: center; gap: 16px; padding: 12px; border: 1px solid var(--lg-line); border-radius: 12px; background: rgba(255, 255, 255, .9); }
.lg-qr img { flex: none; display: block; width: 148px; height: 148px; image-rendering: pixelated; }
.lg-qr-key { min-width: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12px; line-height: 1.5; color: var(--lg-sub); word-break: keep-all; }
.lg-qr-key code { font: 600 13px/1.5 ui-monospace, Consolas, monospace; letter-spacing: .06em; color: var(--lg-ink); overflow-wrap: anywhere; user-select: all; }
/* 2차 인증 코드: 실제 입력칸(투명)을 여섯 칸 그림 위에 겹친다. 누르면 어디든 입력칸이 받는다 */
.lg-otp { position: relative; display: block; }
.lg-code {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%; margin: 0; padding: 0;
  border: 0; outline: 0; background: transparent;
  color: transparent; caret-color: transparent; font-size: 16px;
  cursor: text;
}
.lg-code::selection { background: transparent; color: transparent; }
.lg-otp-cells { display: flex; gap: 8px; }
.lg-otp-cell {
  flex: 1 1 0; min-width: 0; max-width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--lg-line); border-radius: 12px;
  background: rgba(255, 255, 255, .9);
  font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--lg-ink);
  transition: border-color .15s, box-shadow .15s;
}
.lg-otp-cell:nth-child(4) { margin-left: 10px; } /* 인증 앱처럼 123 456 */
.lg-code:focus ~ .lg-otp-cells .lg-otp-cell.is-active { border-color: var(--lg-accent); box-shadow: 0 0 0 3px rgba(31, 111, 209, .15); }
/* 틀린 코드: 여섯 칸 모두 빨강 (입력 중인 칸 파랑보다 앞선다). 숫자를 치면 지워진다 */
.lg-code.is-invalid ~ .lg-otp-cells .lg-otp-cell,
.lg-code.is-invalid:focus ~ .lg-otp-cells .lg-otp-cell.is-active { border-color: var(--lg-danger); }
.lg-code.is-invalid:focus ~ .lg-otp-cells .lg-otp-cell.is-active { box-shadow: 0 0 0 3px rgba(229, 72, 77, .15); }
.lg-code:disabled ~ .lg-otp-cells .lg-otp-cell { opacity: .6; }
.lg-hint { margin: 0; font-size: 12px; line-height: 1.5; color: var(--lg-sub); word-break: keep-all; }
.lg-restart { align-self: center; margin-top: -8px; padding: 4px 6px; border-radius: 4px; font-size: 13px; color: #5b6670; text-decoration: none; }
.lg-restart:hover { color: var(--lg-accent); text-decoration: underline; }
.lg-restart:focus-visible { outline: 2px solid var(--lg-accent); outline-offset: 2px; }

.lg-note { flex: none; margin: 0; word-break: keep-all; font-size: 12px; line-height: 1.6; color: #5b6670; }
/* 로그인 화면 언어 (한국어 · English): 지금 언어는 진하게 */
.lg-lang { flex: none; margin: 10px 0 0; font-size: 12px; color: #8a96a3; }
.lg-lang a { color: #5b6670; text-decoration: none; padding: 4px 2px; border-radius: 4px; }
.lg-lang a:hover { color: #1f6fd1; text-decoration: underline; }
.lg-lang a:focus-visible { outline: 2px solid #1f6fd1; outline-offset: 2px; }
.lg-lang a[aria-current] { color: #13243a; font-weight: 600; }

/* ── 왼쪽 메뉴 레일 (로그인 전: 아이콘만) ───────────
   크기·간격·색은 대시보드 메뉴(common.css 의 .sidebar · .side-item · .side-foot · .um-btn)와 같게 둔다.
   접힌 폭은 « 로 접은 메뉴(nav-min, 56px)와 같다 */
.lg-rail {
  position: absolute;
  z-index: 3;
  inset: 0 auto 0 0;
  width: var(--lg-rail-w);
  display: flex;
  flex-direction: column;
  padding: 0 10px 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, .6);
  border-right: 1px solid rgba(255, 255, 255, .7);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  color: var(--lg-sub);
  transition: width .7s var(--lg-ease), background .6s ease, border-color .6s ease;
}
.lg-rail .icon { flex: none; color: #8a96a3; transition: color .6s ease; }
.lg-rail-brand { flex: none; display: flex; align-items: center; gap: 10px; height: 56px; padding-left: 6px; margin-bottom: 4px; white-space: nowrap; } /* 로고 줄 = 상단바 높이 */
.lg-rail-brand img { flex: none; width: 24px; height: auto; margin: 0 2px; }
.lg-rail-brand .lg-rail-label { flex: 1; font-size: 15px; font-weight: 800; letter-spacing: -.01em; color: var(--lg-ink); }
.lg-rail-fold { flex: none; margin-right: 4px; color: #8a96a3; }
.lg-rail-item { flex: none; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 8px 0 10px; border-radius: 6px; white-space: nowrap; font-size: 13px; font-weight: 500; color: var(--lg-sub); transition: color .6s ease; }
.lg-rail-item .lg-rail-label { flex: 1; min-width: 0; }
.lg-rail > .lg-rail-item { margin-bottom: 1px; } /* 대시보드 메뉴 목록의 1px 간격 */
.lg-rail-kbd { margin-left: auto; font: inherit; font-size: 11px; line-height: 17px; padding: 0 5px; border: 1px solid var(--lg-line); border-radius: 4px; background: #fff; color: #7a8794; }
.lg-rail-chev { flex: none; color: #8a96a3; }
.lg-rail-chev.is-open { transform: rotate(180deg); }
.lg-rail-sub { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 4px 17px; padding-left: 10px; border-left: 1px solid #e1e8f1; }
.lg-rail-sub > span { display: flex; align-items: center; height: 30px; padding: 0 8px; white-space: nowrap; font-size: 12.5px; font-weight: 500; color: #5b6670; }
.lg-rail-sub .lg-rail-label { flex: 1; min-width: 0; }
.lg-rail-pill { flex: none; min-width: 17px; padding: 0 5px; border-radius: 8px; background: var(--lg-danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; }
.lg-rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .8); transition: border-color .6s ease; }
.lg-rail-user { display: flex; align-items: center; gap: 9px; height: 44px; padding: 0 8px 0 6px; white-space: nowrap; font-weight: 500; color: var(--lg-sub); }
.lg-rail-user .lg-rail-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13px; line-height: 1.3; }
/* 로그인 전에는 빈 동그라미, 로그인하면 대시보드처럼 이름 첫 글자(또는 사진) */
.lg-rail-avatar { flex: none; display: grid; place-items: center; width: 28px; height: 28px; overflow: hidden; border-radius: 50%; background: #d6e2f0; color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: -.04em; white-space: nowrap; transition: background .6s ease; }  /* 프로필 글자 */
.lg-rail-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lg-rail-um-chev { flex: none; color: #8a96a3; }
/* 로고·메뉴 이름·단축키·화살표는 로그인 전에는 숨겨 두고, 레일이 펼쳐질 때 나타난다 */
.lg-rail-label, .lg-rail-fold, .lg-rail-kbd, .lg-rail-chev, .lg-rail-um-chev, .lg-rail-pill { opacity: 0; transition: opacity .45s ease; }

/* ── 로그인 성공 → 대시보드로 넘어가는 모션 (시안 Login → Dashboard) ──
   카드는 왼쪽으로 빠지고, 그림은 흐려지며, 레일이 대시보드 사이드바 폭으로 펼쳐진다 */
.lg-stage.is-leaving .lg-card { animation: lgCardOut .7s var(--lg-ease) forwards; pointer-events: none; }
.lg-stage.is-leaving .lg-art { animation: lgArtOut 1s ease forwards; }
/* 폭·색은 대시보드 메뉴(common.css 의 --sidebar-w, --sidebar, --frame-line)와 맞춘다 */
.lg-stage.is-leaving .lg-rail { width: 196px; background: #fff; border-color: #e1e8f1; }
.lg-stage.is-leaving .lg-rail-foot { border-color: #edf0f4; }
.lg-stage.is-leaving .lg-rail-avatar { background: var(--lg-accent); }
.lg-stage.is-leaving .lg-rail :is(.lg-rail-label, .lg-rail-fold, .lg-rail-kbd, .lg-rail-chev, .lg-rail-um-chev, .lg-rail-pill) { opacity: 1; transition-delay: .25s; }
.lg-stage.is-leaving .lg-rail-item.is-active,
.lg-stage.is-leaving .lg-rail-item.is-active .icon { color: var(--lg-accent); font-weight: 700; }
.lg-stage.is-leaving .lg-rail-admin { animation: lgFade .45s ease .25s both; }
/* 좁은 화면(대시보드에서 메뉴가 서랍이 되는 폭)은 펼치지 않고 색만 바꾼다 */
.lg-stage.is-leaving.is-rail-min .lg-rail { width: var(--lg-rail-w); }
.lg-stage.is-leaving.is-rail-min .lg-rail :is(.lg-rail-label, .lg-rail-fold, .lg-rail-kbd, .lg-rail-chev, .lg-rail-um-chev, .lg-rail-pill) { opacity: 0; }

@keyframes lgCardOut { to { transform: translateX(calc(-100% - 100px)); opacity: 0; } }
@keyframes lgArtOut { to { transform: scale(1.04); opacity: 0; } }
@keyframes lgFade { from { opacity: 0; } }

/* ── 토스트 ────────────────────────────────────── */
.toast {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: 28px;
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  border-radius: 8px;
  background: #1f2933;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── 좁은 화면: 일러스트는 카드 뒤로 흐리게, 카드는 가운데 ── */
@media (max-width: 900px) {
  .lg-art { inset: 0 0 0 var(--lg-rail-w); padding: 0; opacity: .35; }
  .lg-card { left: calc(var(--lg-rail-w) + (100% - var(--lg-rail-w) - var(--lg-card-w)) / 2); }
}

/* ── 모바일: 레일·일러스트 없이 카드만 ─────────── */
@media (max-width: 640px) {
  .lg-stage { height: auto; min-height: 100vh; min-height: 100dvh; display: flex; padding: 16px; }
  .lg-art, .lg-rail { display: none; }
  .lg-card {
    position: relative;
    inset: auto;
    flex: 1;
    width: auto;
    padding: 28px 24px 20px;
    gap: 24px;
    overflow: visible;
  }
  .lg-head h1 { font-size: 26px; }
  .lg-qr { flex-direction: column; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .lg-card, .lg-floor, .lg-illust { animation: none; }
  .lg-bubble { display: none; }
  .toast, .lg-rail, .lg-rail *, .lg-rail .icon { transition: none; }
  .lg-rail-admin { animation: none !important; }
}
