/* ========== 헤더 검색 숨김 ========== */
.wawa-search-btn,
.wawa-search-inline {
  display: none !important;
}

/* ========== 헤더 로그인/가입 버튼 ========== */
.auth-buttons {
  display: none;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  min-width: 0;
  order: 6;
}

.auth-buttons.ready {
  display: flex;
}

.auth-buttons.ready.logged-in {
  display: none;
}

.auth-btn {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* mobile auth label override below */

.auth-btn-primary {
  background: linear-gradient(135deg, #DC2626 0%, #b91c1c 100%);
  border: none;
  color: #fff;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.auth-btn-primary:hover {
  background: linear-gradient(135deg, #ef4444 0%, #DC2626 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

/* 데스크탑: 인증 UI를 언어 선택 옆으로 */
@media (min-width: 769px) {
  .wawa-lang-dropdown {
    order: 5;
  }
}

/* ========== 로그인 후 사용자 메뉴 ========== */
.user-menu {
  display: none;
  align-items: center;
  gap: 12px;
  margin-left: 8px;
  min-width: 0;
  order: 6;
}

.user-menu.ready.logged-in {
  display: flex;
}

.user-nickname {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 10px;
  max-width: 110px;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  background: #DC2626;
  border-radius: 999px;
  line-height: 1;
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.user-logout-btn {
  padding: 8px 14px;
  background: transparent;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-logout-btn:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: #dc2626;
}

/* ========== 모달 오버레이 ========== */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none !important;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-modal.active {
  display: flex !important;
  visibility: visible;
  opacity: 1;
}

/* ========== 모달 컨텐츠 ========== */
.auth-modal-content {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(0, 0, 0, 0.05);
  position: relative;
  padding: 0;
  animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* X 닫기 버튼 */
.auth-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f3f4f6;
  border-radius: 50%;
  font-size: 18px;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.auth-modal-close:hover {
  background: #fee2e2;
  color: #DC2626;
  transform: rotate(90deg);
}

/* ========== 탭 ========== */
.auth-tabs {
  display: flex;
  background: #f3f4f6;
  border-radius: 20px 20px 0 0;
  border-bottom: 2px solid #e5e7eb;
}

.auth-tab {
  flex: 1;
  padding: 16px 20px;
  background: transparent;
  border: none;
  border-right: 1px solid #d1d5db;
  font-size: 15px;
  font-weight: 600;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.auth-tab:last-child {
  border-right: none;
}

.auth-tab.active {
  background: #ffffff;
  color: #DC2626;
}

/* 활성 탭 하단 강조선 */
.auth-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: #DC2626;
}

.auth-tab:hover:not(.active) {
  color: #6b7280;
  background: #e5e7eb;
}

/* ========== 폼 컨테이너 ========== */
.auth-form-container {
  padding: 28px 28px 32px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}

/* ========== 소셜 로그인 버튼 ========== */
.auth-social-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
}

.auth-google-btn {
  background: #ffffff;
  border: 2px solid #e5e7eb;
  color: #374151;
}

.auth-google-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ========== 구분선 ========== */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.auth-divider span {
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  color: #9ca3af;
}

.auth-form-group {
  margin-bottom: 20px;
}

.auth-form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

/* ========== 입력 필드 ========== */
.auth-form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  color: #1f2937;
  background: #f9fafb;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.auth-form-input:hover {
  border-color: #d1d5db;
  background: #ffffff;
}

.auth-form-input:focus {
  outline: none;
  border-color: #DC2626;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.auth-form-input::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

/* ========== 제출 버튼 ========== */
.auth-form-submit {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #DC2626 0%, #b91c1c 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-top: 8px;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
  letter-spacing: -0.01em;
}

.auth-form-submit:hover {
  background: linear-gradient(135deg, #ef4444 0%, #DC2626 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
}

.auth-form-submit:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

/* ========== ID/PW 찾기 링크 ========== */
.auth-helper-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #f3f4f6;
}

.auth-helper-link {
  font-size: 13px;
  font-weight: 500;
  color: #9ca3af;
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-helper-link:hover {
  color: #DC2626;
}

.auth-helper-divider {
  color: #e5e7eb;
  font-size: 12px;
}

/* ========== 메시지 ========== */
.auth-message {
  display: none;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
  text-align: center;
}

.auth-message.error {
  display: block;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #dc2626;
  border: 1px solid #fecaca;
}

.auth-message.success {
  display: block;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

/* ========== 모바일 대응 ========== */
@media (max-width: 768px) {
  .auth-buttons {
    margin-left: 8px;
  }
  
  .user-menu {
    margin-left: 8px;
    min-width: 0;
  }

  .user-nickname {
    width: 30px;
    height: 30px;
    min-width: 30px;
    max-width: 30px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    color: transparent;
    text-overflow: clip;
  }

  .user-nickname::after {
    content: attr(data-initial);
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
  }

  .auth-btn {
    padding: 7px 14px;
    font-size: 13px;
    max-width: 110px;
  }

  .auth-btn.auth-btn-primary {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    line-height: 1;
  }

  .auth-btn.auth-btn-primary::after {
    content: '';
    width: 18px;
    height: 18px;
    display: block;
    background-color: #fff;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 12c2.76 0 5-2.24 5-5S14.76 2 12 2 7 4.24 7 7s2.24 5 5 5zm0 2c-3.87 0-7 3.13-7 7h14c0-3.87-3.13-7-7-7z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 12c2.76 0 5-2.24 5-5S14.76 2 12 2 7 4.24 7 7s2.24 5 5 5zm0 2c-3.87 0-7 3.13-7 7h14c0-3.87-3.13-7-7-7z'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  .auth-modal {
    padding: 16px;
    align-items: flex-end;
  }
  
  .auth-modal-content {
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    animation: modalSlideUpMobile 0.3s ease;
  }
  
  @keyframes modalSlideUpMobile {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .auth-tabs {
    border-radius: 24px 24px 0 0;
  }
  
  .auth-form-container {
    padding: 24px 20px 32px;
  }
  
  .auth-form-input {
    padding: 16px;
    font-size: 16px; /* iOS 줌 방지 */
  }
}

/* ========== 다크모드 대응 (선택) ========== */
@media (prefers-color-scheme: dark) {
  .user-nickname {
    color: #ffffff;
    background: #DC2626;
  }
}

/* ========== Google-only 모달 (실서비스) ========== */
.auth-modal.google-only .auth-tabs,
.auth-modal.google-only #signup-form,
.auth-modal.google-only #login-form-element,
.auth-modal.google-only .auth-divider,
.auth-modal.google-only .auth-helper-links {
  display: none !important;
}

.auth-modal.google-only .auth-modal-content {
  max-width: 460px;
  border-radius: 26px;
  border: 1px solid #fee2e2;
  box-shadow:
    0 40px 80px -24px rgba(17,24,39,.32),
    0 16px 32px -22px rgba(220,38,38,.45);
}

.auth-modal.google-only .auth-modal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #DC2626 0%, #ef4444 45%, #DC2626 100%);
  z-index: 2;
}

.auth-modal.google-only .google-auth-hero {
  padding: 30px 30px 20px;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(220,38,38,.13) 0%, rgba(220,38,38,0) 68%),
    linear-gradient(135deg, #fff7f7 0%, #fffaf5 100%);
  border-bottom: 1px solid #f3f4f6;
  text-align: center;
  position: relative;
}

.auth-modal.google-only .google-auth-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  color: #991b1b;
  background: linear-gradient(180deg, #fff 0%, #fef2f2 100%);
  border: 1px solid #fca5a5;
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
  letter-spacing: .45px;
}

.auth-modal.google-only .google-auth-title {
  font-size: 28px;
  font-weight: 900;
  color: #111827;
  margin: 0 0 9px 0;
  line-height: 1.2;
}

.auth-modal.google-only .google-auth-sub {
  font-size: 15px;
  color: #6b7280;
  margin: 0;
  line-height: 1.6;
}

.auth-modal.google-only #login-form.auth-form-container {
  padding: 18px 28px 28px;
}

.auth-modal.google-only .google-cta-card {
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 8px 22px -18px rgba(17,24,39,.35);
}

.auth-modal.google-only #login-form .auth-google-btn {
  border: 2px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
  font-weight: 700;
  font-size: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
  margin-bottom: 0;
}

.auth-modal.google-only #login-form .auth-google-btn:hover {
  border-color: #fca5a5;
  box-shadow: 0 10px 20px rgba(220,38,38,.16);
}

.auth-modal.google-only .google-auth-note {
  margin-top: 12px;
  text-align: center;
  font-size: 14px;
  color: #6b7280;
  line-height: 1.55;
  font-weight: 500;
}

.auth-modal.google-only .support-card {
  margin-top: 12px;
  border: 1px solid #fee2e2;
  background: linear-gradient(180deg, #fff 0%, #fef2f2 100%);
  border-radius: 14px;
  padding: 12px 14px;
  text-align: center;
}

.auth-modal.google-only .support-title {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 6px;
  font-weight: 600;
}

.auth-modal.google-only .support-link {
  font-size: 14px;
  font-weight: 700;
  color: #DC2626;
  text-decoration: none;
}

.auth-modal.google-only .support-link:hover {
  text-decoration: underline;
}

/* ========== 닉네임 수정 모달 ========== */
.nickname-edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12000;
  padding: 16px;
}

.nickname-edit-modal {
  width: 100%;
  max-width: 430px;
  background: #fff;
  border-radius: 20px;
  border: 1px solid #fee2e2;
  box-shadow: 0 36px 70px -26px rgba(17,24,39,.36);
  padding: 0;
  overflow: hidden;
  position: relative;
}

.nickname-edit-modal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #DC2626 0%, #ef4444 45%, #DC2626 100%);
}

.nickname-edit-title {
  margin: 0;
  font-size: 21px;
  font-weight: 900;
  color: #111827;
}

.nickname-edit-desc {
  margin: 8px 0 0;
  font-size: 14px;
  color: #6b7280;
}

.nickname-edit-head {
  padding: 20px 20px 12px;
  background: linear-gradient(180deg, #fff7f7 0%, #fff 100%);
  border-bottom: 1px solid #f3f4f6;
}

.nickname-edit-body {
  padding: 14px 20px 8px;
}

.nickname-edit-input {
  width: 100%;
  border: 2px solid #fecaca;
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
  font-weight: 600;
}

.nickname-edit-input:focus {
  outline: none;
  border-color: #DC2626;
  box-shadow: 0 0 0 4px rgba(220,38,38,.12);
}

.nickname-edit-error {
  min-height: 20px;
  margin-top: 8px;
  font-size: 13px;
  color: #dc2626;
}

.nickname-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 18px;
  border-top: 1px solid #f9fafb;
}

.nickname-edit-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.nickname-edit-btn.secondary {
  background: #f3f4f6;
  color: #4b5563;
}

.nickname-edit-btn.primary {
  background: linear-gradient(135deg, #DC2626 0%, #b91c1c 100%);
  color: #fff;
}

/* ========== 이메일 인증 대기 화면 ========== */
.email-pending-view {
  display: none;
  padding: 40px 28px;
  text-align: center;
}

.pending-icon {
  font-size: 64px;
  margin-bottom: 20px;
  animation: pendingBounce 2s ease-in-out infinite;
}

@keyframes pendingBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.pending-title {
  font-size: 20px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 16px 0;
}

.pending-email {
  font-size: 15px;
  color: #4b5563;
  margin: 0 0 8px 0;
  word-break: break-all;
}

.pending-email strong {
  color: #DC2626;
  font-weight: 600;
}

.pending-instruction {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 28px 0;
  line-height: 1.5;
}

.pending-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-done {
  width: 100%;
  padding: 14px 16px;
  background: linear-gradient(135deg, #DC2626 0%, #b91c1c 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.btn-done:hover {
  background: linear-gradient(135deg, #ef4444 0%, #DC2626 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.btn-resend-secondary {
  width: 100%;
  padding: 12px 16px;
  background: #f3f4f6;
  border: none;
  border-radius: 12px;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-resend-secondary:hover {
  background: #e5e7eb;
  color: #1f2937;
}

.btn-cancel {
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cancel:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  color: #374151;
}

.resend-message {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}

.resend-message:empty {
  display: none;
}

.resend-message.success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.resend-message.error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

@media (max-width: 768px) {
  .security-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .security-grid .security-card {
    width: 100% !important;
    margin: 0 !important;
    min-width: 0 !important;
  }
}
