/* Reset and base styles */
body {
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

/* Common components */
.main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  /* border-radius: 0.25rem; */
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s, color 0.2s;
}

.btn-primary {
  /* background-color: #1e1e1e; */
  background-color: var(--text);
  /* color: white; */
  color: var(--card);
}

.btn-primary:hover {
  background-color: #2c2c2c;
}

.btn-block {
  display: block;
  width: 100%;
  padding: 0.75rem;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--card);
  color: var(--text);
  border: 1px solid #d9d9d9;
}

.btn-google:hover {
  background-color: #f5f5f5 !important;
  color: #21272a !important;
}

.btn-kakao {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: #fee500;
  color: #3a1d1d;
  border: 1px solid #e6cf00;
  margin-top: 0.75rem;
}

.btn-kakao svg path { fill: #3a1d1d !important; }

.btn-kakao:hover {
  background-color: #f6dc00 !important;
  /* color: #fff !important; */
}

.btn-kakao:hover svg path {
  fill: #3a1d1d !important; 
}

.btn-naver {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: #03C75A;
  color: var(--text);
  border: 1px solid #03C75A;
  margin-top: 0.75rem;
}

.btn-naver svg path { fill: #fff; } 

.btn-naver:hover {
  background-color: #02a84d; /* 더 진한 초록 */
  /* color: #fff; */
  border-color: #02a84d;
}

/* 다크모드 */
.theme-btn {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.3); /* 기본(라이트) 반투명 */
  color: var(--text);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2000;
  font-size: 1.8rem;
  transition:
    transform 0.25s ease,
    box-shadow 0.3s ease,
    background 0.3s ease,
    color 0.3s ease;
}

/* 🖱️ Hover / Active 기본 효과 */
.theme-btn:hover {
  transform: scale(1.05);
  background: rgba(0, 0, 0, 1);
  color: white;
}
.theme-btn:active {
  transform: scale(0.95);
}

/* 🌙 시스템 다크모드 기본 대응 */
@media (prefers-color-scheme: dark) {
  .theme-btn {
    background: rgba(0, 0, 0, 0.35);
  }
}

/* 🌚 JS 토글 다크모드: data-theme="dark" */
[data-theme="dark"] .theme-btn {
  background: gray;
  color: white;
}

/* ✅ 다크모드에서 hover 시 반전 */
[data-theme="dark"] .theme-btn:hover {
  background: white;
  color: black;
}

/* 📱 모바일 크기 조정 */
@media (max-width: 768px) {
  .theme-btn {
    width: 35px;
    height: 35px;
    bottom: 70px;
    right: 6px;
    border-radius: 12px;
    font-size: 1.2rem;
  }
}

/* Form elements */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d9d9d9;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.form-input:focus {
  outline: none;
  /* border-color: #0f62fe; */
  border-color: var(--brand);
  /* box-shadow: 0 0 0 2px rgb(15 98 254 / 10%); */
  box-shadow: 0 0 0 2px rgb(16, 185, 129 / 25%);
}

.checkbox-group {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.checkbox {
  margin-right: 0.5rem;
}

.checkbox-label {
  font-size: 0.75rem;
  /* color: #697077; */
  color: var(--muted);
}

/* Auth forms */
.auth-container {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
}

.auth-form {
  /* background-color: white; */
  background-color: var(--card);
  padding: 2rem;
  /* border-radius: 0.5rem; */
  border-radius: var(--radius);
  /* box-shadow: 0 1px 3px rgb(0 0 0 / 10%); */
  box-shadow: var(--shadow);
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.auth-link {
  font-size: 0.75rem;
  text-align: center;
  /* color: #697077; */
  color: var(--muted);
  margin-top: 1rem;
}

.link {
  /* color: #0f62fe; */
  color: var(--brand);
}

.divider {
  position: relative;
  margin: 1.5rem 0;
  text-align: center;
}

.divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background-color: #d9d9d9;
}

.divider span {
  position: relative;
  display: inline-block;
  padding: 0 0.5rem;
  /* background-color: white; */
  background-color: var(--card);
  font-size: 0.75rem;
  /* color: #697077; */
  color: var(--muted);
}

/* 메시지 스타일 */
.error-message,
.success-message {
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.error-message {
  background-color: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.success-message {
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

/* Responsive utilities */
@media (max-width: 768px) {
  .auth-form {
    padding: 1.5rem;
  }
}

/* 약관 모달 스타일 */
.modal {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgb(0 0 0 / 50%);
}

.modal.hidden {
  display: none;
}

.modal-content {
  /* background-color: white; */
  background-color: var(--card);
  padding: 2rem;
  border-radius: 1rem;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgb(0 0 0 / 30%);
  position: relative;
}

.close-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body h2, .modal-body h3 {
  /* color: #53B2AC; */
  color: var(--brand);
  margin-top: 1rem;
}

.modal-body ul {
  padding-left: 1.2rem;  /* 기본값보다 줄이거나 조절 */
  margin-left: 0;
}

.modal-body li {
  margin-bottom: 0.5rem;
}

/* ============================
페이지 전환 페이드 효과 (전역)
============================ */
body {
  opacity: 0;
  transition: opacity 0.5s ease;
}

body.fade-in {
  opacity: 1;
}

body.fade-out {
  opacity: 0;
  transition: opacity 0.5s ease;
}

/* 공통 전환용 링크 스타일 */
.fade-link {
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity 0.3s ease, transform 0.2s ease;
}

.fade-link:hover {
  transform: translateY(-2px);
  opacity: 0.8;
}


/* ===== Alert 모달 공통 ===== */
.alert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65); /* 슬레이트 계열 반투명 */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.alert-overlay.alert-show {
  opacity: 1;
  pointer-events: auto;
}

.alert-overlay.alert-hide {
  opacity: 0;
  pointer-events: none;
}

.alert-dialog {
  position: relative;
  width: 90%;
  max-width: 360px;
  /* background: #0b1120; */
  background: var(--card); 
  color: #e5e7eb;
  border-radius: 18px;
  padding: 18px 18px 14px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.6);
  transform: translateY(8px) scale(0.96);
  transition: transform 0.2s ease;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-column-gap: 12px;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--card), var(--card)) padding-box,                  /* 내부 배경 */
    linear-gradient(135deg, #22c55e, #0ea5e9) border-box; 
}

.alert-overlay.alert-show .alert-dialog {
  transform: translateY(0) scale(1);
}

.alert-dialog.alert-error {
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    linear-gradient(135deg, #f97316, #ef4444) border-box;
}

.alert-dialog.alert-warning {
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    linear-gradient(135deg, #facc15, #f97316) border-box;
}

/* 아이콘, 텍스트 */
.alert-icon {
  font-size: 1.8rem;
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
}

.alert-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alert-title {
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
}

.alert-message {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-line;
}

/* 버튼 영역 */
.alert-actions {
  grid-column: 1 / -1;
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.alert-confirm-btn {
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  background: #22c55e;
  color: #052e16;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.15s ease;
}

.alert-error .alert-confirm-btn {
  background: #ef4444;
  color: #fef2f2;
}

.alert-warning .alert-confirm-btn {
  background: #f97316;
  color: #fff7ed;
}

.alert-confirm-btn:hover {
  transform: translateY(-1px);
}

.alert-confirm-btn:active {
  transform: translateY(0);
  opacity: 0.9;
}

.alert-cancel-btn {
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.7); /* slate-400 정도 */
  background: rgba(15, 23, 42, 0.9);          /* 다크 배경과 자연스럽게 */
  color: #e5e7eb;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.alert-cancel-btn:hover {
  background: rgba(30, 64, 175, 0.6);         /* 살짝 블루기 있는 hover */
  border-color: rgba(191, 219, 254, 0.8);
  transform: translateY(-1px);
}

.alert-cancel-btn:active {
  transform: translateY(0);
  opacity: 0.9;
}

/* notify.js prompt/password modal extra */
.alert-form { margin-top: 10px; display: grid; gap: 12px; }

.alert-field { display: grid; gap: 6px; }

.alert-label {
  font-size: 0.9rem;
  font-weight: 900;
  opacity: 0.9;
  color: var(--text);
}

.alert-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-input {
  flex: 1;
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  outline: none;
  font-weight: 900;
}

.alert-input:focus {
  border-color: rgba(16, 185, 129, 0.55); /* brand 계열 */
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}

.alert-eye {
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.10);
  padding: 10px 10px;
  border-radius: 12px;
  font-weight: 900;
  cursor: pointer;
  color: var(--text);
}

.alert-error {
  min-height: 16px;
  font-size: 0.85rem;
  font-weight: 900;
  color: #ef4444; /* red */
}

.alert-error-global {
  margin-top: 2px;
}

.alert-input-invalid {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.10);
}

.alert-btn-loading {
  opacity: 0.85;
  cursor: progress;
}

/* ===== Withdraw Password Modal (wd-*) (notify.js) ===== */
.wd-form {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.wd-label {
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--text);
  opacity: 0.9;
}

.wd-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wd-input {
  flex: 1;
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  outline: none;
  font-weight: 900;
}

.wd-input:focus {
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}

.wd-eye-btn {
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.10);
  padding: 10px 10px;
  border-radius: 12px;
  font-weight: 900;
  cursor: pointer;
  color: var(--text);
}

.wd-error {
  min-height: 16px;
  font-size: 0.85rem;
  font-weight: 900;
  color: #ef4444;
}

.wd-error.hidden {
  display: none;
}

.wd-input-invalid {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.10);
}


/* ============================
  토스트 메시지
============================ */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: rgba(40, 40, 40, 0.9);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  white-space: pre-line;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 색상 타입 */
.toast-success { background: #10b981; }
.toast-error { background: #ef4444; }
.toast-info { background: #3b82f6; }
.toast-warning { background: #f97316 }

/* 모달 닫힐 때 부드럽게 */
.modal.closing .modal-content {
  animation: fadeOutModal 0.4s ease forwards;
}

@keyframes fadeOutModal {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.95); }
}