/* ===========================================================================
 * 로그인/회원가입 게이트 오버레이 스타일 (charger.html · qr.html 공용).
 *
 * 모든 선택자를 #csms-auth-overlay / .csms-auth-* 로 네임스페이스해서
 * 페이지 CSS(button{}, .card, .view, .primary, .ghost, .lang-switch, .toast 등)와
 * 절대 충돌하지 않는다. 디자인 토큰은 기존 .card/.amount-field/버튼에서 복제.
 * =========================================================================== */

#csms-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #f4f5f7;            /* 페이지 body 와 동일 → 뒤 화면 완전 차단 */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: #1f2328;
  overflow-y: auto;
}
#csms-auth-overlay.hidden { display: none; }

/* 카드 ----------------------------------------------------------------------*/
#csms-auth-overlay .csms-auth-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 24px 22px;
  box-sizing: border-box;
}

/* 로고·divider — charger 화면 .logo/.divider 와 동일 (중앙 정렬) */
#csms-auth-overlay .csms-auth-logo {
  display: block;
  margin: 0 auto 12px;
  max-width: 150px;
  width: 100%;
  height: auto;
}
#csms-auth-overlay .csms-auth-divider {
  border: 0;
  height: 1px;
  background: #e5e7eb;
  margin: 0 16px 14px;
}
#csms-auth-overlay .csms-auth-title {
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  margin: 0 0 12px;
}

/* 언어 스위치 — charger 화면 .lang-switch 와 위치·디자인 동일 (fixed 우상단 pill) */
#csms-auth-overlay .csms-auth-lang-switch {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.92);
  padding: 4px;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(6px);
  z-index: 1001;
}
#csms-auth-overlay .csms-auth-lang-switch button {
  all: unset;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  color: #6b7280;
  transition: background 0.15s ease, color 0.15s ease;
}
#csms-auth-overlay .csms-auth-lang-switch button:hover:not(.active) { color: #1f2328; }
#csms-auth-overlay .csms-auth-lang-switch button.active { background: #1f2328; color: #fff; }

/* 뷰 토글 (로그인/가입) -----------------------------------------------------*/
#csms-auth-overlay .csms-auth-view { display: none; }
#csms-auth-overlay .csms-auth-view.active { display: block; }

/* 입력 필드 (.amount-field 미감 복제) --------------------------------------*/
#csms-auth-overlay .csms-auth-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #475569;
  margin: 10px 0 4px;
}
#csms-auth-overlay .csms-auth-field {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border: 2px solid #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  transition: border-color 0.15s ease;
}
#csms-auth-overlay .csms-auth-field:focus-within { border-color: #2563eb; }
#csms-auth-overlay .csms-auth-field input {
  flex: 1;
  width: 100%;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 16px;
  color: #0f172a;
  font-family: inherit;
}
#csms-auth-overlay .csms-auth-field input::placeholder { color: #9ca3af; }

/* 비밀번호 확인 일치 시 체크 표시 */
#csms-auth-overlay .csms-auth-check {
  margin-left: 8px;
  color: #16a34a;
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
  display: none;
  flex-shrink: 0;
}
#csms-auth-overlay .csms-auth-check.show { display: inline-block; }
#csms-auth-overlay .csms-auth-field.csms-auth-field-ok { border-color: #16a34a; }
#csms-auth-overlay .csms-auth-field.csms-auth-field-err { border-color: #dc2626; }

/* 버튼 (페이지 button{} base 복제, 네임스페이스) ---------------------------*/
#csms-auth-overlay .csms-auth-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  width: 100%;
  margin-top: 14px;
  padding: 13px 18px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 12px;
  cursor: pointer;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s ease, background 0.15s ease;
}
#csms-auth-overlay .csms-auth-btn:disabled { opacity: 0.6; cursor: default; }
#csms-auth-overlay .csms-auth-btn-primary { background: #2563eb; }
#csms-auth-overlay .csms-auth-btn-primary:hover:not(:disabled) { background: #1d4ed8; }
#csms-auth-overlay .csms-auth-btn-ghost {
  background: #fff;
  color: #1f2328;
  border: 1px solid #d1d5db;
}
#csms-auth-overlay .csms-auth-btn-ghost:hover:not(:disabled) { background: #f3f4f6; }

/* 버튼 로딩 스피너 ----------------------------------------------------------*/
#csms-auth-overlay .csms-auth-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: csms-auth-spin 0.7s linear infinite;
  display: none;
  flex-shrink: 0;
}
#csms-auth-overlay .csms-auth-btn.loading .csms-auth-spinner { display: inline-block; }
@keyframes csms-auth-spin { to { transform: rotate(360deg); } }

/* 옵션 필드 2단 배치(이름/성) — 세로 길이 절약 */
#csms-auth-overlay .csms-auth-row { display: flex; gap: 10px; }
#csms-auth-overlay .csms-auth-col { flex: 1; min-width: 0; }

/* 인라인 에러 / 하단 전환 링크 ----------------------------------------------*/
#csms-auth-overlay .csms-auth-error {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #b91c1c;
  line-height: 1.4;
}
#csms-auth-overlay .csms-auth-error:empty { display: none; }  /* 비면 공간 차지 안 함 */
#csms-auth-overlay .csms-auth-switch {
  margin-top: 14px;
  text-align: center;
}
#csms-auth-overlay .csms-auth-switch-link {
  all: unset;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #2563eb;
}
#csms-auth-overlay .csms-auth-switch-link:hover { text-decoration: underline; }

#csms-auth-overlay .csms-auth-footer {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
}

/* 다크 테마 (charger 페이지 [data-theme="dark"] 대응; qr 은 light 전용) ------*/
[data-theme="dark"] #csms-auth-overlay { background: #0b0f17; color: #e5e7eb; }
[data-theme="dark"] #csms-auth-overlay .csms-auth-card {
  background: #151a23;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] #csms-auth-overlay .csms-auth-title { color: #f3f4f6; }
[data-theme="dark"] #csms-auth-overlay .csms-auth-divider { background: #2a313c; }
[data-theme="dark"] #csms-auth-overlay .csms-auth-label { color: #9ca3af; }
[data-theme="dark"] #csms-auth-overlay .csms-auth-field {
  background: #0f141c;
  border-color: #2a313c;
}
[data-theme="dark"] #csms-auth-overlay .csms-auth-field input { color: #f3f4f6; }
[data-theme="dark"] #csms-auth-overlay .csms-auth-btn-ghost {
  background: #151a23;
  color: #e5e7eb;
  border-color: #2a313c;
}
[data-theme="dark"] #csms-auth-overlay .csms-auth-btn-ghost:hover:not(:disabled) { background: #1c222c; }
[data-theme="dark"] #csms-auth-overlay .csms-auth-lang-switch {
  background: rgba(23, 26, 33, 0.92);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] #csms-auth-overlay .csms-auth-lang-switch button { color: #9ca3af; }
[data-theme="dark"] #csms-auth-overlay .csms-auth-lang-switch button:hover:not(.active) { color: #e5e7eb; }
[data-theme="dark"] #csms-auth-overlay .csms-auth-lang-switch button.active { background: #e5e7eb; color: #0f1115; }
