/* =====================================================================
 * auth.css — 공용 인증 UI 스타일
 *
 * 사용:
 *   <link rel="stylesheet" href="/lostark/auth.css" />
 *
 * 전제:
 *   ../style.css의 토큰(--ink, --bg-elev, --accent ...)이 이미 로드됨.
 * ===================================================================== */

/* ---------- 헤더 우측 인증 슬롯 ---------- */
.auth-slot {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
}

.auth-login-btn {
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-deep);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.auth-login-btn:hover {
  background: var(--accent);
  color: #fff;
}

.auth-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  transition: background .15s ease;
}
.auth-user:hover, .auth-user:focus-visible {
  background: var(--bg-tint);
}
.auth-user-icon { font-size: 14px; }
.auth-user-name {
  font-size: 13px;
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-user-caret {
  color: var(--ink-faint);
  font-size: 11px;
}

.auth-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 38px rgba(15, 23, 42, .18);
  padding: 6px;
  z-index: 9000;
  animation: auth-menu-pop .14s ease;
}
@keyframes auth-menu-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.auth-menu-head {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 4px;
}
.auth-menu-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.auth-menu-id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 2px;
}
.auth-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  border-radius: 8px;
  transition: background .12s ease;
}
.auth-menu-item:hover {
  background: var(--bg-tint);
}

/* hidden 속성은 항상 우선 적용 (display:flex 등으로 덮이지 않도록) */
.auth-modal-backdrop[hidden],
.auth-form[hidden],
.auth-menu[hidden] {
  display: none !important;
}

/* ---------- 로그인/회원가입 모달 ---------- */
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .42);
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
body.auth-modal-open { overflow: hidden; }

.auth-modal {
  width: min(440px, calc(100vw - 40px));
  max-height: calc(100vh - 60px);
  overflow: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
  padding: 0;
}

.auth-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 24px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.auth-modal-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.auth-modal-close {
  background: transparent;
  border: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .12s ease, color .12s ease;
}
.auth-modal-close:hover {
  background: var(--bg-tint);
  color: var(--ink);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px 0;
}
.auth-tab {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .12s ease, border-color .12s ease;
}
.auth-tab:hover { color: var(--ink); }
.auth-tab.active {
  color: var(--accent-deep);
  border-bottom-color: var(--accent);
}

.auth-form {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.auth-field input {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans, inherit);
  font-size: 14px;
  letter-spacing: normal;
  text-transform: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-notice {
  margin: 4px 0 0;
  padding: 8px 10px;
  background: var(--bg-tint);
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.4;
}

.auth-submit {
  height: 40px;
  margin-top: 6px;
}

.auth-error {
  margin: 0;
  min-height: 1.2em;
  color: var(--comp-danger, #ef4444);
  font-size: 12px;
}
.auth-error:empty { display: none; }

/* ---------- 모바일 ---------- */
@media (max-width: 480px) {
  .auth-modal {
    width: calc(100vw - 24px);
  }
  .auth-user-name { max-width: 80px; }
  .auth-menu {
    right: 0;
    min-width: 180px;
  }
}
