/* ============================================================================
   auth.css — NextGOAL Engineer 로그인 / 가입 화면 디자인 시스템 (Polish v2)
   ----------------------------------------------------------------------------
   사용처: login.html, signup.html, signup-user.html, signup-company.html
   브랜드 컬러: #4A9EE8 → #7F77DD 그라데이션
   ============================================================================ */

/* === 디자인 토큰 ========================================================= */
:root {
  --ng-primary: #378add;
  --ng-primary-light: #4a9ee8;
  --ng-primary-dark: #185fa5;
  --ng-accent-purple: #7f77dd;
  --ng-success: #1d9e75;
  --ng-danger: #dc2626;

  --ng-text-primary: #1a1f2e;
  --ng-text-secondary: #6b7280;
  --ng-text-tertiary: #9ca3af;

  --ng-border: rgba(0, 0, 0, 0.1);
  --ng-border-soft: rgba(0, 0, 0, 0.06);
  --ng-bg-page: #fafbfc;

  --ng-gradient-brand: linear-gradient(135deg, #4a9ee8 0%, #7f77dd 100%);
  --ng-gradient-brand-hover: linear-gradient(135deg, #3a8dd0 0%, #6f67d0 100%);

  --ng-radius-sm: 6px;
  --ng-radius-md: 8px;
  --ng-radius-lg: 12px;
  --ng-radius-xl: 16px;

  --ng-shadow-card:
    0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 20px 50px -10px rgba(40, 80, 180, 0.18),
    0 4px 12px -2px rgba(40, 80, 180, 0.08);
  --ng-shadow-btn-primary:
    0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 8px 16px -4px rgba(74, 158, 232, 0.4),
    0 2px 4px rgba(74, 158, 232, 0.15);
  --ng-shadow-btn-primary-hover:
    0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 12px 20px -4px rgba(74, 158, 232, 0.5),
    0 2px 4px rgba(74, 158, 232, 0.2);

  --ng-transition: 0.15s ease-out;
  --ng-transition-card: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* === Box-sizing 리셋 (스크롤 강제 발생 원인 차단) ====================== */
body.auth-page,
body.auth-page *,
body.auth-page *::before,
body.auth-page *::after {
  box-sizing: border-box;
}

/* === 페이지 베이스 ======================================================= */
body.auth-page {
  margin: 0;
  min-height: 100dvh;
  font-family:
    'Noto Sans JP',
    -apple-system,
    BlinkMacSystemFont,
    system-ui,
    sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ng-text-primary);
  background: var(--ng-bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* === 메시 블롭 배경 ===================================================== */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}
.bg-blob-1 {
  top: -120px;
  left: -80px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(74, 158, 232, 0.45) 0%, transparent 70%);
  filter: blur(60px);
}
.bg-blob-2 {
  bottom: -120px;
  right: -80px;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(127, 119, 221, 0.4) 0%, transparent 70%);
  filter: blur(60px);
}
.bg-blob-3 {
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(127, 119, 221, 0.18) 0%, transparent 70%);
  filter: blur(80px);
}

/* === 좌상단 로고 ======================================================== */
.auth-logo {
  position: fixed;
  top: 24px;
  left: 32px;
  z-index: 10;
  font-weight: 700;
  font-size: 16px;
  color: var(--ng-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}
.auth-logo .logo-mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--ng-gradient-brand);
  box-shadow: 0 4px 10px -2px rgba(74, 158, 232, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-logo .logo-mark svg {
  width: 14px;
  height: 14px;
  color: white;
  stroke-width: 2.5;
}
.auth-logo:hover {
  color: var(--ng-primary-dark);
}

/* === 우상단 サポート 링크 ================================================ */
.support-link {
  position: fixed;
  top: 28px;
  right: 32px;
  z-index: 10;
  font-size: 11px;
  color: var(--ng-text-tertiary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.02em;
  transition: color var(--ng-transition);
}
.support-link svg {
  width: 12px;
  height: 12px;
}
.support-link:hover {
  color: var(--ng-primary);
}

/* === 카드 컨테이너 ====================================================== */
.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 16px 64px;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--ng-radius-xl);
  border: 0.5px solid rgba(255, 255, 255, 0.9);
  padding: 28px 30px 24px;
  box-shadow: var(--ng-shadow-card);
  animation: cardEnter var(--ng-transition-card);
}
.auth-card-wide {
  max-width: 460px;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(74, 158, 232, 0.5), transparent);
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === 뒤로가기 링크 ====================================================== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ng-text-secondary);
  text-decoration: none;
  font-size: 12px;
  margin-bottom: 12px;
  transition: color var(--ng-transition);
}
.back-link:hover {
  color: var(--ng-primary);
}

/* === 브랜드 마크 (카드 안 최상단) ====================================== */
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: var(--ng-radius-lg);
  background: var(--ng-gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px -4px rgba(74, 158, 232, 0.4);
  margin: 0 auto 16px;
}
.brand-mark svg {
  color: white;
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

/* === 타이포 ============================================================= */
.auth-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0 0 4px;
  color: var(--ng-text-primary);
}
.auth-subtitle {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-align: center;
  color: var(--ng-text-secondary);
  margin: 0 0 20px;
}

/* === 진행 표시 (Stepper) =============================================== */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0 0 8px;
}
.step-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  border: 0.5px solid var(--ng-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ng-text-tertiary);
  position: relative;
  z-index: 1;
}
.step-dot.active {
  background: var(--ng-gradient-brand);
  border-color: transparent;
  color: white;
  box-shadow: 0 2px 6px rgba(55, 138, 221, 0.25);
}
.step-line {
  flex: 0 0 64px;
  height: 2px;
  background: var(--ng-border);
  margin: 0 -1px;
}
.step-line.active {
  background: var(--ng-primary);
}
.step-labels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  font-size: 11px;
  color: var(--ng-text-tertiary);
  text-align: center;
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}
.step-labels .active {
  color: var(--ng-primary);
  font-weight: 500;
}

/* === 인포 배너 ========================================================= */
.info-banner {
  background: rgba(74, 158, 232, 0.06);
  border: 0.5px solid rgba(74, 158, 232, 0.2);
  border-left: 3px solid var(--ng-primary);
  border-radius: var(--ng-radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--ng-text-secondary);
  margin-bottom: 20px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.5;
}
.info-banner svg {
  color: var(--ng-primary);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* === 라벨 행 (라벨 + 보조링크) ========================================= */
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.label-row a {
  font-size: 12px;
  color: var(--ng-primary);
  font-weight: 500;
  text-decoration: none;
}
.label-row a:hover {
  text-decoration: underline;
}

.auth-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ng-text-primary);
  display: block;
}
.req {
  color: var(--ng-danger);
  margin-left: 2px;
}

/* === 인풋 (leading / trailing 아이콘 지원) ============================== */
.input-wrapper {
  position: relative;
  margin-bottom: 12px;
}

.auth-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 0.5px solid var(--ng-border);
  border-radius: var(--ng-radius-md);
  background: white;
  font-size: 14px;
  font-family: inherit;
  color: var(--ng-text-primary);
  transition:
    border-color var(--ng-transition),
    box-shadow var(--ng-transition);
  box-sizing: border-box;
}
.auth-input::placeholder {
  color: var(--ng-text-tertiary);
}
.auth-input:hover {
  border-color: rgba(0, 0, 0, 0.2);
}
.auth-input:focus {
  outline: none;
  border-color: var(--ng-primary);
  box-shadow: 0 0 0 3px rgba(55, 138, 221, 0.12);
}
.auth-input.has-leading {
  padding-left: 40px;
}
.auth-input.has-trailing {
  padding-right: 40px;
}
.auth-input.is-error {
  border-color: var(--ng-danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.input-icon-leading,
.input-icon-trailing {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ng-text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.input-icon-leading {
  left: 14px;
  pointer-events: none;
}
.input-icon-trailing {
  right: 14px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color var(--ng-transition);
}
.input-icon-trailing:hover {
  color: var(--ng-primary);
}
.input-icon-trailing:focus-visible {
  outline: 2px solid var(--ng-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.field-hint {
  font-size: 11px;
  color: var(--ng-text-secondary);
  margin-top: -8px;
  margin-bottom: 12px;
  display: block;
  letter-spacing: 0.01em;
}

/* === 약관 인라인 동의 ================================================== */
.inline-consent {
  font-size: 11px;
  color: var(--ng-text-secondary);
  text-align: center;
  line-height: 1.6;
  margin: 2px 0 10px;
  letter-spacing: 0.01em;
}
.inline-consent a {
  color: var(--ng-primary);
  text-decoration: none;
}
.inline-consent a:hover {
  text-decoration: underline;
}

/* === Primary 버튼 (그라데이션 + 입체감) =============================== */
.btn-primary {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: var(--ng-radius-md);
  background: var(--ng-gradient-brand);
  color: white;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-family: inherit;
  cursor: pointer;
  transition:
    transform 0.1s,
    box-shadow 0.2s,
    filter 0.2s,
    background 0.2s;
  box-shadow: var(--ng-shadow-btn-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: var(--ng-shadow-btn-primary-hover);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
  filter: brightness(0.98);
}
.btn-primary:disabled {
  filter: grayscale(0.3) brightness(0.95);
  cursor: not-allowed;
}
.btn-primary:focus-visible {
  outline: 3px solid rgba(55, 138, 221, 0.5);
  outline-offset: 2px;
}

/* 로딩 스피너 */
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* === Divider ============================================================ */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 0.5px;
  background: rgba(0, 0, 0, 0.1);
}
.auth-divider span {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ng-text-tertiary);
  text-transform: none;
}

/* === OAuth 버튼 (Google) =============================================== */
.btn-oauth {
  width: 100%;
  height: 44px;
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--ng-radius-md);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: var(--ng-text-primary);
  cursor: pointer;
  transition:
    border-color var(--ng-transition),
    background var(--ng-transition);
}
.btn-oauth:hover {
  border-color: rgba(0, 0, 0, 0.25);
  background: #fafbfc;
}
.btn-oauth:focus-visible {
  outline: 2px solid var(--ng-primary);
  outline-offset: 2px;
}
.btn-oauth svg {
  width: 18px;
  height: 18px;
}

/* === Trust signal (카드 안 하단) ====================================== */
.trust-signal {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 0.5px solid var(--ng-border-soft);
  text-align: center;
  font-size: 11px;
  color: var(--ng-text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  letter-spacing: 0.01em;
}
.trust-signal svg {
  color: var(--ng-success);
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* === User count (카드 외부 페이지 하단) =============================== */
.user-count {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--ng-text-tertiary);
  letter-spacing: 0.02em;
  z-index: 1;
  white-space: nowrap;
}
.user-count strong {
  color: var(--ng-primary-dark);
  font-weight: 600;
}

/* === Footer link (카드 안 하단) ======================================= */
.auth-footer-link {
  margin: 14px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--ng-text-secondary);
}
.auth-footer-link a {
  color: var(--ng-primary);
  font-weight: 500;
  text-decoration: none;
}
.auth-footer-link a:hover {
  text-decoration: underline;
}

.auth-footer-secondary {
  margin: 6px 0 0;
  text-align: center;
  font-size: 12px;
}
.auth-footer-secondary a {
  color: var(--ng-text-tertiary);
  text-decoration: none;
}
.auth-footer-secondary a:hover {
  color: var(--ng-primary);
  text-decoration: underline;
}

/* === Form error =========================================================*/
.form-error {
  background: rgba(220, 38, 38, 0.08);
  border: 0.5px solid rgba(220, 38, 38, 0.3);
  color: var(--ng-danger);
  padding: 10px 12px;
  border-radius: var(--ng-radius-sm);
  font-size: 12px;
  margin: 0 0 8px;
  display: flex;
  gap: 6px;
  align-items: flex-start;
  line-height: 1.5;
}
.form-error[hidden] {
  display: none;
} /* display:flex 가 [hidden] UA 스타일을 덮는 문제 해결 */
.form-error svg {
  flex-shrink: 0;
  margin-top: 2px;
  width: 14px;
  height: 14px;
}

/* === Role card (signup.html 역할 선택) ================================ */
.role-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: white;
  border: 0.5px solid var(--ng-border);
  border-radius: var(--ng-radius-lg);
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
  transition:
    transform var(--ng-transition),
    border-color var(--ng-transition),
    box-shadow var(--ng-transition);
  margin-bottom: 12px;
  cursor: pointer;
}
.role-card:hover {
  transform: translateY(-2px);
  border-color: var(--ng-primary);
  box-shadow: 0 8px 16px -4px rgba(74, 158, 232, 0.15);
}
.role-card.company:hover {
  border-color: var(--ng-accent-purple);
}

.role-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--ng-radius-md);
  background: rgba(74, 158, 232, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--ng-primary);
}
.role-card.company .role-card-icon {
  background: rgba(127, 119, 221, 0.1);
  color: var(--ng-accent-purple);
}
.role-card-icon svg {
  width: 22px;
  height: 22px;
}
.role-card-body {
  flex: 1;
  min-width: 0;
}
.role-card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 2px;
  color: var(--ng-text-primary);
  letter-spacing: -0.01em;
}
.role-card-desc {
  font-size: 12px;
  color: var(--ng-text-secondary);
  line-height: 1.5;
  margin: 0;
}
.role-card-cta {
  font-size: 13px;
  font-weight: 500;
  color: var(--ng-primary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  transition: transform var(--ng-transition);
}
.role-card.company .role-card-cta {
  color: var(--ng-accent-purple);
}
.role-card:hover .role-card-cta {
  transform: translateX(3px);
}

/* === 반응형 (≤ 768px) =================================================== */
@media (max-width: 768px) {
  .bg-blob-1,
  .bg-blob-2,
  .bg-blob-3 {
    filter: blur(40px);
    opacity: 0.7;
  }
  .support-link {
    display: none;
  }
}

@media (max-width: 560px) {
  .auth-shell {
    padding: 56px 16px 56px;
  }
  .auth-card {
    padding: 24px 20px;
    max-width: 100%;
  }
  .auth-logo {
    top: 16px;
    left: 16px;
    font-size: 15px;
  }
  .auth-title {
    font-size: 20px;
  }
  .auth-input {
    font-size: 16px;
  } /* iOS auto-zoom 방지 */
  .user-count {
    position: static;
    transform: none;
    display: block;
    text-align: center;
    margin-top: 16px;
  }
}

/* === 짧은 viewport (≤ 720px) — 노트북 + 브라우저 chrome ============ */
@media (max-height: 720px) {
  .auth-shell {
    padding: 40px 16px 40px;
  }
  .auth-card {
    padding: 22px 28px 20px;
  }
  .auth-subtitle {
    margin-bottom: 14px;
  }
  .input-wrapper {
    margin-bottom: 10px;
  }
  .auth-divider {
    margin: 8px 0;
  }
  .auth-footer-link {
    margin-top: 10px;
  }
  .trust-signal {
    margin-top: 10px;
    padding-top: 10px;
  }
  .user-count {
    bottom: 12px;
  }
}

/* === Accessibility: reduced motion ==================================== */
@media (prefers-reduced-motion: reduce) {
  .auth-card {
    animation: none;
  }
  .btn-spinner {
    animation: none;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
