/* =========================================================================
   auth.css - 로그인(login.php) / 회원가입(register.php) / 계정찾기(find_account.php)
              공용 토스 스타일 CSS
   ※ Tailwind 없이 이 파일 하나로 동작합니다.
   ========================================================================= */

:root {
  --bg: #F2F4F6;
  --card: #FFFFFF;
  --line: #E5E8EB;
  --text: #191F28;
  --text-sub: #4E5968;
  --text-muted: #6B7684;
  --text-faint: #8B95A1;
  --text-placeholder: #B0B8C1;
  --gray: #F2F4F6;
  --gray-hover: #E5E8EB;
  --blue: #3182F6;
  --blue-dark: #1B64DA;
  --blue-soft: #E8F3FF;
  --blue-soft-hover: #D0E6FF;
  --green: #00C471;
  --green-soft: #E8FAF0;
  --red: #F04452;
  --red-soft: #FFF0F1;
  --red-line: #FFD6DA;
}

* { box-sizing: border-box; }

body.auth-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 애니메이션 ---------- */
@keyframes cardUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes logoPop { 0% { opacity: 0; transform: scale(0.6) rotate(-8deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes popIn { 0% { opacity: 0; transform: scale(0.5); } 100% { opacity: 1; transform: scale(1); } }
@keyframes dlgFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dlgPop { from { opacity: 0; transform: translateY(14px) scale(0.94); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes checkDraw { to { stroke-dashoffset: 0; } }

/* ---------- 레이아웃 ---------- */
.auth-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  padding-top: max(40px, env(safe-area-inset-top));
  padding-bottom: max(40px, env(safe-area-inset-bottom));
}
.auth-wrap { width: 100%; max-width: 440px; }

.auth-head { text-align: center; margin-bottom: 28px; }
.auth-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 72px; height: 72px; margin-bottom: 20px;
  border-radius: 24px; background: #fff; border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(49, 130, 246, 0.16);
  animation: logoPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.auth-logo img { width: 48px; height: 48px; object-fit: contain; }
.auth-badge {
  display: inline-block; margin-bottom: 8px; padding: 4px 10px; border-radius: 999px;
  background: var(--blue-soft); color: var(--blue);
  font-size: 11px; font-weight: 900; letter-spacing: 0.06em;
}
.auth-title { margin: 0; font-size: 1.65rem; font-weight: 900; letter-spacing: -0.02em; line-height: 1.25; }
.auth-sub { margin: 8px 0 0; font-size: 0.875rem; font-weight: 500; color: var(--text-muted); line-height: 1.5; }

.auth-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 28px;
  box-shadow: 0 12px 40px rgba(25, 31, 40, 0.06);
  padding: 28px;
  animation: cardUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.auth-card--center { text-align: center; padding: 32px 28px; }
@media (max-width: 480px) {
  .auth-card { padding: 24px 20px; }
  .auth-card--center { padding: 28px 20px; }
}

.auth-foot { text-align: center; margin-top: 24px; }
.ghost-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: var(--text-muted); text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.ghost-link:hover { background: #fff; color: var(--text); }
.ghost-link svg { width: 16px; height: 16px; }

/* ---------- 오류 알림 박스 ---------- */
.auth-alert {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 20px; padding: 14px 16px;
  border-radius: 16px; background: var(--red-soft); border: 1px solid var(--red-line); color: var(--red);
  animation: shake 0.45s ease;
}
.auth-alert svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.auth-alert span { font-size: 0.875rem; font-weight: 800; line-height: 1.4; }

/* ---------- 입력 폼 ---------- */
.field { margin-bottom: 16px; }
.field-label { display: block; margin: 0 0 6px; padding: 0 4px; font-size: 0.75rem; font-weight: 800; color: var(--text-sub); }
.field-row { display: flex; gap: 8px; }
.field-wrap { position: relative; flex: 1; min-width: 0; }
.field-ico {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: var(--text-placeholder); pointer-events: none; transition: color 0.15s ease;
}
.field-input {
  width: 100%; height: 56px; padding: 0 16px 0 46px;
  border-radius: 16px; border: 2px solid transparent; background: var(--gray);
  font-family: inherit; font-size: 0.9375rem; font-weight: 600; color: var(--text); outline: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.field-input::placeholder { color: var(--text-placeholder); font-weight: 500; }
.field-input:focus { background: #fff; border-color: var(--blue); }
.field-wrap:focus-within .field-ico { color: var(--blue); }
.field-input.has-eye { padding-right: 52px; }
.field-input.has-timer { padding-right: 72px; }

.field-eye {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border: 0; border-radius: 12px; background: transparent; color: var(--text-faint);
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background-color 0.15s ease;
}
.field-eye:hover { background: var(--gray); }
.field-eye svg { width: 20px; height: 20px; }
.field-timer {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-size: 13px; font-weight: 900; color: var(--red); font-variant-numeric: tabular-nums;
}

/* 힌트 문구 */
.hint { display: block; margin: 8px 4px 0; font-size: 0.78rem; font-weight: 700; line-height: 1.4; }
.hint--normal { color: var(--text-faint); }
.hint--valid { color: var(--green); }
.hint--invalid { color: var(--red); }
.hint a { text-decoration: underline; color: inherit; }

/* 체크박스 / 한 줄 정렬 */
.row-between { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 20px; }
.chk { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13px; font-weight: 700; color: var(--text-sub); position: relative; }
.chk input { position: absolute; opacity: 0; width: 0; height: 0; }
.chk-box {
  width: 20px; height: 20px; border-radius: 7px; border: 2px solid #D1D6DB; background: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.15s ease;
}
.chk-box svg { width: 12px; height: 12px; color: #fff; opacity: 0; transform: scale(0.6); transition: all 0.15s ease; }
.chk input:checked + .chk-box { background: var(--blue); border-color: var(--blue); }
.chk input:checked + .chk-box svg { opacity: 1; transform: scale(1); }
.chk input:focus-visible + .chk-box { outline: 3px solid rgba(49, 130, 246, 0.35); outline-offset: 2px; }
.link-blue { font-size: 13px; font-weight: 800; color: var(--blue); text-decoration: none; transition: color 0.15s ease; }
.link-blue:hover { color: var(--blue-dark); }

/* 구분선 */
.divider { display: flex; align-items: center; gap: 12px; margin: 24px 0 16px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--gray); }
.divider span { font-size: 12px; font-weight: 700; color: var(--text-placeholder); }

/* ---------- 버튼 ---------- */
.btn-main {
  flex: 1; height: 56px; padding: 0 16px; border-radius: 16px; border: 0;
  background: var(--blue); color: #fff; font-family: inherit; font-size: 0.9375rem; font-weight: 900; text-decoration: none;
  display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.btn-main:hover { background: var(--blue-dark); }
.btn-main:active { transform: scale(0.99); }
.btn-main:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; flex: none; }
.btn-spin { width: 18px; height: 18px; animation: spin 0.8s linear infinite; }

.btn-prev {
  width: 96px; height: 56px; border-radius: 16px; border: 0; flex-shrink: 0;
  background: var(--gray); color: var(--text-sub); font-family: inherit; font-size: 0.9375rem; font-weight: 800; cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.btn-prev:hover { background: var(--gray-hover); }
.btn-prev:active { transform: scale(0.97); }

.btn-soft {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 56px; border-radius: 16px;
  background: var(--blue-soft); color: var(--blue); font-size: 0.9375rem; font-weight: 900; text-decoration: none;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.btn-soft:hover { background: var(--blue-soft-hover); }
.btn-soft:active { transform: scale(0.99); }

.btn-row { display: flex; gap: 10px; margin-top: 24px; }

.btn-inline {
  height: 56px; padding: 0 16px; border-radius: 16px; border: 0; flex-shrink: 0; white-space: nowrap;
  background: var(--blue-soft); color: var(--blue); font-family: inherit; font-size: 0.875rem; font-weight: 800; cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.btn-inline:hover { background: var(--blue-soft-hover); }
.btn-inline:active { transform: scale(0.97); }
.btn-inline:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-inline.is-verified { background: var(--green-soft); color: var(--green); }

/* ---------- 회원가입: 진행바 / 슬라이더 ---------- */
.reg-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.reg-step-label { font-size: 0.75rem; font-weight: 800; color: var(--blue); }
.reg-step-name { font-size: 0.75rem; font-weight: 700; color: var(--text-placeholder); }
.pbars { display: flex; gap: 6px; margin-bottom: 24px; }
.pbar { flex: 1; height: 6px; border-radius: 999px; background: var(--line); transition: background-color 0.3s ease; }
.pbar.is-active { background: var(--blue); }

.step-title { margin: 0; font-size: 1.2rem; font-weight: 900; line-height: 1.35; }
.step-desc { margin: 6px 0 20px; font-size: 13px; font-weight: 500; color: var(--text-muted); }

.reg-slider-wrap { overflow: hidden; margin: -6px; padding: 6px; transition: height 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
.reg-track { display: flex; align-items: flex-start; width: 300%; transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.reg-step { width: 33.3333%; flex-shrink: 0; padding: 0 6px; visibility: hidden; transition: visibility 0s 0.4s; }
.reg-step.is-current { visibility: visible; transition-delay: 0s; }

/* 선택(바텀시트/모달) 트리거 */
.select-trigger {
  width: 100%; height: 56px; padding: 0 16px; border-radius: 16px; border: 2px solid transparent;
  background: var(--gray); display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer;
  font-family: inherit; font-size: 0.9375rem; font-weight: 700; color: var(--text);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.select-trigger:hover { background: var(--gray-hover); }
.select-trigger.is-placeholder { color: var(--text-placeholder); font-weight: 500; }
.select-trigger svg { width: 18px; height: 18px; color: var(--text-faint); flex-shrink: 0; }

/* ---------- 바텀시트(모바일) / 가운데 모달(PC) ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; display: none; }
.sheet.is-open { display: block; }
.sheet__dim { position: absolute; inset: 0; background: rgba(25, 31, 40, 0.5); animation: dlgFade 0.2s ease both; }
.sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; width: 100%; max-width: 440px;
  max-height: 82vh; overflow-y: auto; background: #fff; border-radius: 28px 28px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  animation: sheetUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.sheet__grip { width: 40px; height: 4px; border-radius: 999px; background: var(--line); margin: 0 auto 14px; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet__title { margin: 0; font-size: 1.125rem; font-weight: 900; }
.sheet__close { width: 34px; height: 34px; border: 0; border-radius: 999px; background: var(--gray); color: var(--text-muted); cursor: pointer; font-size: 0.85rem; }

.opt-row {
  width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 15px 16px; margin-bottom: 4px;
  border: 0; border-radius: 16px; background: transparent; color: #333D4B;
  font-family: inherit; font-size: 0.9375rem; font-weight: 700; text-align: left; cursor: pointer; transition: background-color 0.12s ease;
}
.opt-row:hover { background: var(--gray); }
.opt-row.is-selected { background: var(--blue-soft); color: var(--blue); font-weight: 800; }
.opt-row .opt-check { display: none; font-weight: 900; }
.opt-row.is-selected .opt-check { display: inline; }
.opt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.opt-chip {
  height: 48px; border: 0; border-radius: 14px; background: var(--gray); color: #333D4B;
  font-family: inherit; font-size: 0.9375rem; font-weight: 700; cursor: pointer; transition: background-color 0.12s ease, color 0.12s ease;
}
.opt-chip:hover { background: var(--gray-hover); }
.opt-chip.is-selected { background: var(--blue); color: #fff; font-weight: 800; }

/* PC(768px 이상): 아래에서 올라오는 바텀시트 대신 화면 가운데 모달 */
@media (min-width: 768px) {
  .sheet { padding: 24px; align-items: center; justify-content: center; }
  .sheet.is-open { display: flex; }
  .sheet__panel {
    position: relative; left: auto; right: auto; bottom: auto; margin: 0;
    width: 100%; max-width: 440px; max-height: 80vh;
    border-radius: 28px; padding: 26px 26px 24px;
    box-shadow: 0 24px 64px rgba(25, 31, 40, 0.3);
    animation: dlgPop 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .sheet__grip { display: none; }
  .sheet__title { font-size: 1.25rem; }
  .opt-grid { grid-template-columns: repeat(4, 1fr); }
  .opt-row { padding: 14px 16px; }
}

/* ---------- 알림 다이얼로그 (기본 alert 대체) ---------- */
#appDialogOverlay { position: fixed; inset: 0; z-index: 100000; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(25, 31, 40, 0.5); }
#appDialogOverlay.is-open { display: flex; animation: dlgFade 0.18s ease forwards; }
.app-dialog { width: 100%; max-width: 340px; background: #fff; border-radius: 28px; padding: 28px 22px 18px; text-align: center; box-shadow: 0 20px 60px rgba(25, 31, 40, 0.3); animation: dlgPop 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.app-dialog__icon { width: 52px; height: 52px; border-radius: 999px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; }
.app-dialog__icon svg { width: 26px; height: 26px; }
.app-dialog__icon.is-info { background: var(--blue-soft); color: var(--blue); }
.app-dialog__icon.is-danger { background: var(--red-soft); color: var(--red); }
.app-dialog__icon.is-success { background: var(--green-soft); color: var(--green); }
.app-dialog__title { margin: 0; font-size: 1.125rem; font-weight: 800; line-height: 1.4; word-break: keep-all; }
.app-dialog__msg { margin: 8px 0 0; font-size: 0.875rem; font-weight: 500; color: var(--text-muted); line-height: 1.6; white-space: pre-line; word-break: keep-all; }
.app-dialog__btn { width: 100%; height: 50px; margin-top: 22px; border: 0; border-radius: 16px; background: var(--blue); color: #fff; font-family: inherit; font-size: 0.9375rem; font-weight: 800; cursor: pointer; transition: background-color 0.15s ease, transform 0.1s ease; }
.app-dialog__btn:hover { background: var(--blue-dark); }
.app-dialog__btn:active { transform: scale(0.97); }

/* ---------- 완료 화면 (회원가입 / 비밀번호 변경) ---------- */
.done-circle {
  width: 80px; height: 80px; margin: 0 auto 20px; border-radius: 50%;
  background: var(--green-soft); color: var(--green); display: flex; align-items: center; justify-content: center;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.done-circle svg { width: 40px; height: 40px; }
.done-check { stroke-dasharray: 30; stroke-dashoffset: 30; animation: checkDraw 0.5s 0.35s ease forwards; }
.done-title { margin: 0; font-size: 1.25rem; font-weight: 900; }
.done-desc { margin: 8px 0 24px; font-size: 0.875rem; font-weight: 500; color: var(--text-muted); line-height: 1.6; }

/* ---------- 계정 찾기 ---------- */
.find-intro { margin: 0 0 20px; text-align: center; font-size: 0.875rem; font-weight: 500; color: var(--text-muted); line-height: 1.6; }
.found-box {
  margin-bottom: 22px; padding: 18px 16px; border-radius: 20px; text-align: center;
  background: var(--blue-soft); border: 1px solid var(--blue-soft-hover);
}
.found-box__label { display: block; margin-bottom: 6px; font-size: 0.78rem; font-weight: 700; color: var(--text-muted); }
.found-box__val { font-size: 1.45rem; font-weight: 900; color: var(--blue); letter-spacing: 0.02em; word-break: break-all; }