/* 인연 — 따뜻하고 고급스러운 테마 */
:root {
  --bg: #faf5ed;
  --card: #fffdfa;
  --ink: #2e2420;
  --muted: #97816f;
  --accent: #b4502e;
  --accent-deep: #8f3a1f;
  --accent-soft: #f9e8db;
  --gold: #c39a4a;
  --gold-soft: #f7efdd;
  --line: #e9d8c3;
  --ok: #2e7d4f;
  --warn: #b7791f;
  --danger: #b3352b;
  --shadow-sm: 0 1px 3px rgba(80, 50, 30, .07);
  --shadow-md: 0 6px 20px rgba(80, 50, 30, .10);
  --radius: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Noto Sans KR", -apple-system, "Apple SD Gothic Neo",
               "Malgun Gothic", sans-serif;
  font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .brand, .hero h1 {
  font-family: "Noto Serif KR", "Noto Sans KR", serif;
  letter-spacing: -0.01em;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 상단바 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 12px 16px; background: rgba(255, 253, 250, .96);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 10;
}
.brand {
  display: inline-block;
  font-size: 1.35rem; font-weight: 700; color: var(--ink);
  letter-spacing: 0.02em; white-space: nowrap;
  padding: 10px 8px; margin: -10px -8px; /* 탭 영역 확대 (보이는 크기는 그대로) */
  touch-action: manipulation; /* 모바일에서 탭이 바로 클릭으로 인식되게 */
}
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.nav a { font-size: 0.92rem; color: var(--ink); padding: 6px 4px; font-weight: 500; }
.nav a:hover { color: var(--accent); }
.btn-small {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff !important;
  padding: 7px 14px; border-radius: 999px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(180, 80, 46, .30);
}
.btn-small:hover { text-decoration: none; filter: brightness(1.05); }

.container { max-width: 720px; margin: 0 auto; padding: 20px 16px 48px; }

/* 카드 */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card h2, .card h3 { margin-top: 0; margin-bottom: 10px; }
.muted { color: var(--muted); font-size: 0.9rem; }

/* 전체 공지 배너 (메뉴 바로 밑) */
.notice-banner {
  background: var(--gold-soft); border-bottom: 1px solid #e8d3a3; color: #7a5b13;
  padding: 10px 16px; font-size: 0.92rem; text-align: center; font-weight: 500;
}

/* 알림 메시지 */
.flashes { margin-bottom: 14px; }
.flash {
  background: var(--gold-soft); border: 1px solid #e8d3a3; color: #7a5b13;
  padding: 11px 15px; border-radius: 12px; margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}

/* 폼 */
form .field { margin-bottom: 14px; }
form label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 0.95rem; }
form input[type=text], form input[type=password], form input[type=number],
form select, form textarea {
  width: 100%; padding: 11px 13px; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  font-family: inherit; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
form input:focus, form select:focus, form textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
form textarea { min-height: 110px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* 버튼 */
.btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  border: none; border-radius: 999px; padding: 12px 26px;
  font-size: 1rem; font-weight: 700; cursor: pointer; text-align: center;
  box-shadow: 0 3px 12px rgba(180, 80, 46, .28);
  transition: transform .12s, box-shadow .12s, filter .12s;
  font-family: inherit;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-block { display: block; width: 100%; }
.btn-ghost {
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.btn-danger { background: linear-gradient(135deg, #c04538, #93301f); }
.btn-ok { background: linear-gradient(135deg, #35885a, #22633d); }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }
.inline-form { display: inline; }

/* 프로필 카드 */
.profile-card { position: relative; }
.profile-card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.tag {
  background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 4px 11px; font-size: 0.82rem; font-weight: 600;
}
.tag.gray { background: #f1ece7; color: var(--muted); }
.profile-title { font-size: 1.15rem; font-weight: 700; margin: 0 0 4px; }

/* 검색 필터 */
.filter-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filter-bar .full { grid-column: 1 / -1; }

/* 쪽지 */
.msg-list a { display: block; color: var(--ink); border-radius: 10px; }
.msg-list a:hover { text-decoration: none; background: var(--accent-soft); }
.msg-item { display: flex; justify-content: space-between; gap: 10px; padding: 12px 8px; border-bottom: 1px solid var(--line); }
.msg-item:last-child { border-bottom: none; }
/* 가입인사 답글 */
.reply-item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 8px 10px 26px; border-bottom: 1px solid var(--line); background: var(--accent-soft); border-radius: 10px; margin: 6px 0; font-size: 0.95rem; }
.reply-form { display: flex; gap: 8px; margin-top: 10px; }
.reply-form input[type="text"] { flex: 1; }
.unread-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff; border-radius: 999px;
  font-size: 0.75rem; padding: 2px 9px; font-weight: 700;
  box-shadow: 0 1px 4px rgba(180, 80, 46, .35);
}
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 16px; margin: 6px 0; word-break: break-word; line-height: 1.55; }
.bubble.mine { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #fff; margin-left: auto; border-bottom-right-radius: 5px; }
.bubble.theirs { background: #f3ede6; margin-right: auto; border-bottom-left-radius: 5px; }
.bubble .time { display: block; font-size: 0.72rem; opacity: .75; margin-top: 4px; }
.chatbox { display: flex; gap: 8px; margin-top: 12px; }
.chatbox input { flex: 1; }

/* 관리자 표 */
table.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.admin-table th, table.admin-table td {
  border-bottom: 1px solid var(--line); padding: 9px 6px; text-align: left;
  vertical-align: top;
}
table.admin-table th { color: var(--muted); font-weight: 700; font-size: 0.82rem; }
.status-pending { color: var(--warn); font-weight: 700; }
.status-approved { color: var(--ok); font-weight: 700; }
.status-rejected, .status-suspended { color: var(--danger); font-weight: 700; }

/* 첫 화면 */
.hero {
  text-align: center; padding: 44px 18px 38px;
  background: radial-gradient(ellipse at 50% 0%, #fff8ef 0%, var(--bg) 70%);
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 24px 24px;
  margin: 0 -16px 20px;
}
.hero h1 { font-size: clamp(2rem, 8vw, 2.6rem); margin: 0 0 10px; font-weight: 700; }
.hero p { color: var(--muted); margin: 0 0 4px; font-size: 1.02rem; }
.hero .cta { margin-top: 22px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.steps { counter-reset: step; padding: 0; list-style: none; margin: 6px 0 0; }
.steps li {
  counter-increment: step; padding: 12px 0 12px 46px; position: relative;
  border-bottom: 1px dashed var(--line);
}
.steps li:last-child { border-bottom: none; }
.steps li::before {
  content: counter(step); position: absolute; left: 4px; top: 12px;
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
  box-shadow: 0 2px 6px rgba(180, 80, 46, .30);
}

/* 푸터 */
.footer {
  text-align: center; color: var(--muted); font-size: 0.8rem; padding: 20px 16px 26px;
  border-top: 2px solid var(--gold); margin-top: 8px;
}
details.safety { background: var(--gold-soft); border: 1px solid #e8d3a3; border-radius: 12px; padding: 12px 15px; margin-top: 16px; }
details.safety summary { font-weight: 700; cursor: pointer; }
pre.code { background: #2b2320; color: #f5e9df; padding: 12px; border-radius: 10px; overflow-x: auto; font-size: 0.85rem; }

/* 작은 화면 다듬기 */
@media (max-width: 480px) {
  body { font-size: 15px; }
  .container { padding: 16px 12px 40px; }
  .card { padding: 16px; }
  .hero { margin: 0 -12px 16px; padding: 36px 14px 30px; }
  .row2 { grid-template-columns: 1fr; }
  .bubble { max-width: 88%; }
}
/* === 인연 메뉴 개선 — 맨 끝에 추가 (기존 .topbar/.nav 덮어씀) === */
.topbar { flex-wrap: wrap; row-gap: 10px; }
.nav {
  flex: 1 1 320px;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}
.nav-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.nav-group + .nav-group {
  padding-left: 10px;
  border-left: 1px solid var(--line);
  margin-left: 2px;
}
.nav a {
  display: inline-block;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  white-space: nowrap;
  text-decoration: none;
}
.nav a:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
  text-decoration: none;
}
.nav a.nav-cta {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(180, 80, 46, .3);
}
.nav a.nav-admin {
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--gold-soft);
}
.nav a.nav-account { color: var(--muted); }

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .brand { align-self: flex-start; }
  .nav { justify-content: flex-start; flex: none; }
  .nav-group + .nav-group {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
  }
}
/* === 회원가입 버튼 다시 보이게 — 맨 끝에 추가 === */
.nav a.btn-small,
.nav a.btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep)) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(180, 80, 46, .3);
}
/* === 메뉴 CSS만으로 정리 — base.html 안 건드림 === */
.nav a {
  background: var(--card) !important;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.nav a:hover {
  background: var(--accent-soft) !important;
  border-color: var(--accent-soft);
}
/* 프로필찾기 / 프로필등록 — 갈색 강조 버튼 */
.nav a[href*="profile"] {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep)) !important;
  color: #fff !important;
  border-color: transparent;
}
/* 관리자 링크 — 연한 작은 버튼 */
.nav a[href*="admin"] {
  background: var(--gold-soft) !important;
  color: var(--muted) !important;
  font-size: 0.82rem;
}
/* 로그아웃 / 마이페이지 — 연하게 */
.nav a[href*="logout"],
.nav a[href*="mypage"] {
  color: var(--muted) !important;
}
/* === 채팅 입력창 넓히기 === */
.chatbox {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chatbox textarea {
  flex: 1;
  width: 100%;
  min-height: 72px;
  border-radius: 12px !important;
  padding: 12px 14px;
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
}
.chatbox .btn {
  flex-shrink: 0;
  border-radius: 12px !important;
  padding: 12px 20px;
}
/* === 가입인사 답변창 넓히기 === */
.reply-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.reply-form textarea {
  flex: 1;
  width: 100%;
  min-height: 72px;
  border-radius: 12px !important;
  padding: 12px 14px;
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
}
.reply-form .btn {
  flex-shrink: 0;
  border-radius: 12px !important;
}
/* === 가입인사 답변창 넓히기 === */
.reply-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.reply-form textarea {
  flex: 1;
  width: 100%;
  min-height: 72px;
  border-radius: 12px !important;
  padding: 12px 14px;
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
}
.reply-form .btn {
  flex-shrink: 0;
  border-radius: 12px !important;
}
/* === 가입인사 답변창 넓히기 === */
.reply-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.reply-form textarea {
  flex: 1;
  width: 100%;
  min-height: 72px;
  border-radius: 12px !important;
  padding: 12px 14px;
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
}
.reply-form .btn {
  flex-shrink: 0;
  border-radius: 12px !important;
}

/* === 회원 관리 표 — 관리 열 고정 === */
.card table {
  display: block;
  overflow-x: auto;
}
.card table th:last-child,
.card table td:last-child {
  position: sticky;
  right: 0;
  background: var(--card);
  box-shadow: -4px 0 8px rgba(0,0,0,.04);
}
.guide-card a[href*="open.kakao.com"] {
  display: inline-block;
  background: #FEE500;
  color: #3C1E1E;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 20px;
  text-decoration: none;
}
