/* /auth.css */

body.auth-body {
  background: radial-gradient(
      1200px 480px at 80% -10%,
      rgba(59, 130, 246, 0.18),
      transparent 60%
    ),
    radial-gradient(
      900px 360px at -10% 100%,
      rgba(236, 72, 153, 0.16),
      transparent 60%
    ),
    #0b0f1a;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif;
}

/* 모바일에서 카드가 헤더(안전영역)를 침범하지 않도록 상단 여백 확보 */
@media (max-width: 480px) {
  body.auth-body {
    justify-content: flex-start;
    align-items: stretch;
    min-height: 100dvh; /* 모바일 주소창 변화 대응 */
    padding-top: calc(env(safe-area-inset-top, 0px) + 56px);
    padding-bottom: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .auth-container {
    padding-top: 0;
  }
}

.auth-container {
  width: 100%;
  max-width: 520px;
  padding: 1.5rem;
  position: relative;
  overflow: visible;
}

.auth-box {
  background: rgba(18, 24, 37, 0.95);
  backdrop-filter: blur(20px);
  padding: 2.5rem 2rem;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  text-align: left;
  border: 1px solid rgba(110, 231, 255, 0.1);
  position: relative;
  overflow: visible;
}

.auth-box .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #e8edf5;
  margin-bottom: 1.5rem;
  font-size: 1.6rem;
}

.auth-box .brand__logo {
  width: 32px;
  height: 32px;
}

.auth-box h2 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #e8edf5;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  color: #bac4d8;
  font-size: 0.95rem;
  margin-bottom: 2rem;
  line-height: 1.5;
}

.auth-box > p,
.muted {
  color: #9ca3af;
  margin-bottom: 1.25rem;
}

.auth-box .form {
  text-align: left;
}

.auth-box .form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #e8edf5;
  margin-bottom: 20px;
}

.auth-box .form label span {
  display: block;
  margin-bottom: 8px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: #bac4d8;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.label-row span {
  margin-bottom: 0;
}

.auth-box .form input {
  margin-top: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(110, 231, 255, 0.15);
  color: #e8edf5;
  padding: 14px 16px;
  width: 100%;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.auth-box .form input:focus {
  outline: none;
  border-color: #6ee7ff;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(110, 231, 255, 0.25);
}

.auth-box .form input::placeholder {
  color: #94a3b8;
}
/* Disabled inputs (이메일, OTP) */
.auth-box .form input:disabled {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  cursor: not-allowed;
}

/* 이메일 입력 그룹 */
.email-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  position: relative;
  z-index: 1;
}

.email-input-group input[type="text"] {
  flex: 1 1 50%;
  min-width: 0;
  min-height: 48px;
  box-sizing: border-box;
}

.email-at {
  color: #bac4d8;
  font-size: 1.1rem;
  font-weight: 500;
  flex-shrink: 0;
  padding: 0 4px;
  margin-bottom: 0;
}

/* 이메일 도메인 커스텀 드롭다운 */
.email-domain-wrapper {
  flex: 1 1 50%;
  min-width: 0;
  position: relative;
}

.email-domain-select-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
  overflow: hidden;
}

.email-domain-button {
  width: 100%;
  min-height: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(110, 231, 255, 0.15);
  color: #e8edf5;
  padding: 14px 16px;
  padding-right: 40px;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  font-family: inherit;
  position: relative;
  z-index: 2;
  box-sizing: border-box;
}

.email-domain-button.hidden {
  display: none;
}

.email-domain-button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(110, 231, 255, 0.25);
}

.email-domain-button:focus {
  outline: none;
  border-color: #6ee7ff;
  background-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(110, 231, 255, 0.25);
}

.email-domain-button[aria-expanded="true"] {
  border-color: #6ee7ff;
  background-color: rgba(255, 255, 255, 0.08);
}

.email-domain-button[aria-expanded="true"] .email-domain-chevron {
  top: 40%;
  transform: rotate(180deg);
}

.email-domain-chevron {
  position: absolute;
  right: 16px;
  top: 40%;
  transition: transform 0.3s ease;
  color: #bac4d8;
  pointer-events: none;
  flex-shrink: 0;
}

.email-domain-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: rgba(18, 24, 37, 0.98);
  border: 1px solid rgba(110, 231, 255, 0.2);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  overflow: hidden;
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
}

.email-domain-dropdown.hidden {
  display: none;
}

.email-domain-option {
  padding: 12px 16px;
  color: #e8edf5;
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 6px;
  font-size: 1rem;
  user-select: none;
  -webkit-user-select: none;
}

.email-domain-option:hover {
  background: rgba(110, 231, 255, 0.1);
  color: #6ee7ff;
}

.email-domain-option:active {
  background: rgba(110, 231, 255, 0.15);
}

#emailDomainText {
  margin-bottom: 0;
}

.email-custom-domain-wrapper {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.email-custom-domain-wrapper.hidden {
  display: none;
}

.email-custom-domain {
  flex: 1;
  min-width: 0;
  width: 100%;
  min-height: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(110, 231, 255, 0.15);
  color: #e8edf5;
  padding: 14px 16px;
  padding-right: 50px;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s ease;
  box-sizing: border-box;
  font-family: inherit;
}

.email-custom-domain:focus {
  outline: none;
  border-color: #6ee7ff;
  background-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(110, 231, 255, 0.25);
}

.email-custom-domain::placeholder {
  color: #94a3b8;
}

.email-cancel-custom-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  z-index: 1;
}

.email-cancel-custom-btn:hover {
  color: #6ee7ff;
  background: rgba(110, 231, 255, 0.1);
}

.email-cancel-custom-btn:active {
  background: rgba(110, 231, 255, 0.15);
}

.email-cancel-custom-btn svg {
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.email-help-text {
  display: block;
  color: #94a3b8;
  font-size: 0.8rem;
  margin-top: 6px;
  line-height: 1.4;
}

/* 모바일에서 이메일 입력 그룹 스타일 조정 */
@media (max-width: 480px) {
  .email-input-group {
    flex-direction: row;
    gap: 6px;
    align-items: center;
    position: relative;
    z-index: 1;
    overflow: visible;
  }

  .email-input-group input[type="text"] {
    flex: 1 1 50%;
    min-width: 0;
    min-height: 48px;
    box-sizing: border-box;
  }

  .email-at {
    display: inline;
    flex-shrink: 0;
    padding: 0 2px;
    font-size: 1rem;
  }

  .email-domain-wrapper {
    flex: 1 1 50%;
    min-width: 0;
  }

  .email-domain-button {
    width: 100%;
    min-height: 48px;
    height: 48px;
  }

  .email-domain-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    width: 100%;
  }

  .email-custom-domain-wrapper {
    flex: 1 1 50%;
    min-width: 0;
  }

  .email-custom-domain {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .email-cancel-custom-btn {
    right: 8px;
    padding: 6px;
  }

  .email-cancel-custom-btn svg {
    width: 18px;
    height: 18px;
  }

  .email-help-text {
    font-size: 0.75rem;
    margin-top: 4px;
  }

  /* 모바일에서 select 드롭다운이 제대로 표시되도록 */
  .auth-box .form label {
    position: static;
    z-index: 1;
    overflow: visible;
  }

  .auth-box {
    overflow: visible;
    position: relative;
    transform: none;
    -webkit-transform: none;
  }

  .auth-container {
    overflow: visible;
    position: relative;
    transform: none;
    -webkit-transform: none;
  }

  /* 모바일에서 이메일 입력 그룹 위치 조정 */
  .email-input-group {
    position: relative;
  }

  .email-domain-wrapper {
    position: relative;
  }

  .email-domain-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1000;
  }
}

/* 드롭다운 크기 확대 (50대 이상 사용자 편의) */
.email-domain-select {
  min-height: 48px;
  font-size: 1rem;
}

@media (min-width: 481px) {
  .email-domain-select {
    min-height: 50px;
  }
}

.auth-box .btn {
  margin-top: 1.5rem;
  padding: 14px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s ease;
}

/* disabled 버튼도 클릭 이벤트를 받을 수 있도록 */
.auth-box .btn:disabled {
  pointer-events: auto;
  cursor: not-allowed;
  opacity: 0.6;
}

.btn--primary {
  background: linear-gradient(135deg, #6ee7ff 0%, #22d3ee 100%);
  color: #0a0e1a;
  border: none;
  font-weight: 600;
}

.btn--primary:hover {
  background: linear-gradient(135deg, #7ef0ff 0%, #34d3ee 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(110, 231, 255, 0.4);
}

.btn--primary:active {
  transform: translateY(0);
}

.social-login {
  display: none;
  margin: 2rem 0;
  position: relative;
  border-top: 1px solid rgba(110, 231, 255, 0.15);
  padding-top: 1.5rem;
}

.social-login::before {
  content: "또는";
  position: absolute;
  top: -0.75em;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 24, 37, 0.95);
  color: #bac4d8;
  padding: 0 0.75rem;
  font-size: 0.875rem;
}

.btn--google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  color: #e8edf5;
  border: 1px solid rgba(110, 231, 255, 0.2);
  font-weight: 500;
}

.btn--google:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(110, 231, 255, 0.3);
  box-shadow: 0 2px 12px rgba(110, 231, 255, 0.15);
}

.btn--google img {
  width: 18px;
  height: 18px;
}

.auth-footer {
  margin-top: 2.5rem;
  text-align: center;
  border-top: 1px solid rgba(110, 231, 255, 0.15);
}

.auth-switch {
  margin: 3rem 0 1rem 0;
  font-size: 0.95rem;
  color: #bac4d8;
  text-align: center;
  line-height: 1.5;
}

.auth-switch--secondary {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

.auth-switch a {
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.linklike {
  appearance: none;
  background: none;
  border: 0;
  color: var(--color-primary);
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.linklike--signup {
  color: #6ee7ff;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}

.linklike--signup:hover {
  color: #22d3ee;
  text-decoration: underline;
}

.linklike--forgot {
  color: #6ee7ff;
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
}

.linklike--forgot:hover {
  color: #22d3ee;
  text-decoration: underline;
}

.linklike--secondary {
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.9em;
}

.linklike--secondary:hover {
  color: #cbd5e1;
  text-decoration: underline;
}

/* 텍스트 버튼 스타일 */
.btn--text {
  background: transparent;
  border: none;
  color: #6ee7ff;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 8px 12px;
  margin-top: 0.5rem;
}

.btn--text:hover {
  color: #22d3ee;
  text-decoration: underline;
  background: transparent;
}

.btn--text:active {
  color: #6ee7ff;
}

/* My Page Styles */
.mypage-container {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.mypage-section {
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
}

.mypage-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}

#profileView p,
#walletView p {
  margin-bottom: 1rem;
  color: #333;
}
#profileView p strong,
#walletView p strong {
  color: #000;
  margin-right: 0.5rem;
}

.mypage-actions {
  text-align: right;
}

#subTier.badge {
  display: inline-block;
  padding: 0.25em 0.6em;
  font-size: 0.9em;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25rem;
  text-transform: capitalize;
}
#subTier.free {
  color: #fff;
  background-color: #6c757d;
}
#subTier.premium {
  color: #fff;
  background-color: var(--color-primary);
}

.auth-panel {
  margin-top: 12px;
}
.auth-panel.hidden {
  display: none;
}

/* 인증 페이지 헤더 */
.auth-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 1rem 12px;
  background: rgba(11, 15, 26, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(110, 231, 255, 0.1);
  z-index: 1000;
  min-height: 56px;
}

.auth-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #e8edf5;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.auth-back-btn:hover {
  background: rgba(110, 231, 255, 0.1);
  color: #6ee7ff;
}

.auth-back-btn:active {
  background: rgba(110, 231, 255, 0.15);
}

.auth-back-btn svg {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

.auth-header-title {
  flex: 1;
  text-align: center;
  font-size: 1.125rem;
  font-weight: 600;
  color: #e8edf5;
  margin: 0;
  padding: 0 1rem;
}

.auth-header-spacer {
  width: 40px;
  flex-shrink: 0;
}

/* 데스크톱에서는 헤더 숨김 */
@media (min-width: 481px) {
  .auth-header {
    display: none;
  }
}

/* 태블릿 최적화 */
@media (min-width: 481px) and (max-width: 768px) {
  .auth-container {
    max-width: 600px;
    padding: 1.25rem;
  }
  .auth-box {
    padding: 1.75rem;
    border-radius: 14px;
  }
  .auth-box h2 {
    font-size: 1.5rem;
  }
  .step-number {
    width: 34px;
    height: 34px;
  }
  .step-line {
    min-width: 32px;
  }
  .otp-input {
    height: 50px;
    font-size: 1.3rem;
  }
}

/* 모바일 최적화(세로가 좁은 디바이스) */
@media (max-width: 420px) {
  .auth-header {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .auth-header-title {
    font-size: 1rem;
    padding: 0 0.5rem;
  }

  .auth-header-spacer {
    width: 36px;
  }

  .step-label {
    font-size: 0.72rem;
  }
}

/* 초소형 디바이스 */
@media (max-width: 360px) {
  .auth-container {
    padding: 0;
  }
  .auth-box {
    padding: 1rem 0.75rem;
    border-radius: 0;
  }
  .auth-box h2 {
    font-size: 1.2rem;
  }
  .otp-input {
    height: 42px;
    font-size: 1.05rem;
  }
  .step-number {
    width: 30px;
    height: 30px;
  }
  .step-line {
    min-width: 24px;
  }
}

/* 회원가입 단계별 UI */
.signup-steps {
  margin: 1.5rem 0 2rem;
}

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #94a3b8;
  transition: all 0.3s;
}

.step.is-active .step-number {
  background: linear-gradient(135deg, #22d3ee, #3b82f6);
  border-color: #22d3ee;
  color: #0b0f1a;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.4);
}

.step-label {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
  white-space: nowrap;
}

.step.is-active .step-label {
  color: #22d3ee;
  font-weight: 600;
}

.step-line {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  min-width: 40px;
  margin: 0 4px;
}

.signup-step {
  margin-top: 1.5rem;
}

.signup-step.hidden {
  display: none;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 1.5rem;
}

.form-actions .btn {
  flex: 1;
  margin-top: 0;
}

#emailVerificationCode {
  margin-top: 1rem;
}

#emailVerificationCode.hidden {
  display: none;
}

#nextToStep2.hidden {
  display: none;
}

.otp-container {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

.otp-label {
  display: block;
  color: #cbd5e1;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.otp-inputs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 0.75rem;
  width: 100%;
  max-width: 100%;
}

.otp-input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  height: 54px;
  font-size: 1.4rem;
  text-align: center;
  color: #f8fafc;
  font-weight: 600;
  transition: border 0.2s, box-shadow 0.2s;
}

.otp-input:focus {
  outline: none;
  border-color: #22d3ee;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.25);
  background: rgba(34, 211, 238, 0.12);
}
/* Disabled OTP inputs */
.otp-input:disabled {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
}

.otp-help {
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.otp-verify-btn {
  margin-top: 0.5rem;
}

/* 긴 폼에서도 바깥 스크롤만 사용 */
.auth-box {
  max-height: none;
  overflow: visible;
}

/* 모바일 전용 UI 최적화 */
@media (max-width: 480px) {
  .auth-container {
    max-width: 100%;
    padding: 0;
    width: 100%;
  }
  .auth-box {
    width: 100%;
    padding: 1.5rem 1rem;
    border-radius: 0;
    box-shadow: none;
    border-left: none;
    border-right: none;
    margin: 0;
  }
  .auth-box .brand {
    margin-bottom: 1.25rem;
    font-size: 1.5rem;
  }
  .auth-box h2 {
    display: none; /* 모바일에서는 헤더에 타이틀이 있으므로 숨김 */
  }
  .auth-subtitle {
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
  }
  .signup-steps {
    margin: 1rem 0 1rem;
  }
  .step-indicator {
    gap: 6px;
  }
  .step-number {
    width: 32px;
    height: 32px;
  }
  .step-line {
    min-width: 20px;
  }
  .otp-container {
    padding: 1rem;
  }
  .otp-inputs {
    gap: 8px;
  }
  .otp-input {
    height: 46px;
    font-size: 1.2rem;
  }
  .auth-box .form input {
    padding: 12px 14px;
  }
  .auth-box .btn {
    padding: 12px 20px;
    font-size: 0.95rem;
  }
}

@media (max-width: 420px) {
  .otp-inputs {
    gap: 8px;
  }
  .otp-input {
    height: 46px;
    font-size: 1.2rem;
  }
}
