/* ============================================
   구멍이 클래스 - 공용 스타일시트
   네비게이션/로그인/카드 등 모든 페이지가 공유하는 스타일
   페이지 고유 스타일은 각 파일의 <style> 태그 안에 둡니다.
   ============================================ */

:root {
  --bg: #f7f8fa; --card: #ffffff; --border: #e5e7eb;
  --ink: #111827; --ink-soft: #6b7280; --ink-faint: #9ca3af;
  --primary: #2563eb; --primary-hover: #1d4ed8; --stat-bg: #f3f4f6;
  --success-bg: #dbeafe; --success-text: #1d4ed8;
  --danger: #dc2626; --danger-bg: #fee2e2;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Pretendard', -apple-system, sans-serif; background: var(--bg); color: var(--ink);
  /* 한국어는 단어 중간에서 줄이 바뀌면 읽기 나빠집니다 (예: "들어가/면").
     keep-all 로 어절 단위로 끊고, 긴 URL·이메일만 예외로 잘리게 합니다. */
  word-break: keep-all;
  overflow-wrap: break-word;
}
a { color: inherit; text-decoration: none; }

/* ===== 헤더 / 네비게이션 ===== */
header.site-header {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 0 24px; display: flex; align-items: center; gap: 24px;
  height: 72px; position: sticky; top: 0; z-index: 50;
}
#auth-area { flex-shrink: 0; margin-left: auto; }
.logo { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.logo-icon { height: 36px; width: auto; display: block; }
.logo-wordmark { height: 29px; width: auto; display: block; }
.main-nav {
  display: flex; align-items: center; gap: 4px; height: 100%; min-width: 0;
  overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }
.nav-item { position: relative; height: 100%; display: flex; align-items: center; flex: 0 0 auto; }
.nav-link {
  display: flex; align-items: center; gap: 4px; height: 100%;
  padding: 0 12px; font-size: 17px; font-weight: 600; color: var(--ink-soft);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.nav-item.current .nav-link, .nav-link:hover { color: var(--ink); }
.nav-item.current .nav-link { border-bottom-color: var(--primary); }

/* ===== 로그인 상태 (우측 상단) ===== */
.user-menu { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--stat-bg); border: none; border-radius: 20px;
  padding: 6px 14px 6px 6px; font-size: 13px; font-weight: 500;
  font-family: inherit; color: var(--ink); cursor: pointer;
}
.user-avatar {
  width: 22px; height: 22px; border-radius: 50%; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.login-btn { min-height: 44px;
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.login-btn:hover { background: var(--primary-hover); }
.dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08); min-width: 160px; overflow: hidden;
  display: none; z-index: 30;
}
.dropdown.open { display: block; }
.dropdown-email {
  padding: 12px 14px; font-size: 12px; color: var(--ink-faint);
  border-bottom: 1px solid var(--border); word-break: break-all;
}
.dropdown button, .dropdown a {
  display: block; width: 100%; text-align: left; padding: 11px 14px; background: none; border: none;
  font-size: 14px; font-family: inherit; color: var(--ink); cursor: pointer;
}
.dropdown button:hover, .dropdown a:hover { background: var(--bg); }

/* ===== 로그인 모달 ===== */
.login-panel {
  position: fixed; inset: 0; background: rgba(17,24,39,0.45);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 40;
  /* 이메일 로그인이 열리면 카드가 길어집니다. 화면이 짧은 휴대폰에서
     위쪽(제목)이 잘리지 않도록 스크롤되게 둡니다. */
  overflow-y: auto;
}
.login-panel.open { display: flex; }
.login-card { background: var(--card); border-radius: 14px; padding: 28px; max-width: 360px; width: 100%; margin: auto; }
.login-card h2 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.login-card p { font-size: 13px; color: var(--ink-soft); margin-bottom: 20px; }
.social-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 16px; border-radius: 8px; border: none;
  font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer; margin-bottom: 10px;
}
.social-btn.kakao { background: #FEE500; color: #111827; }
.social-btn.kakao:hover { background: #f5dc00; }
.social-btn.naver { background: #03C75A; color: #fff; }
.social-btn.naver:hover { background: #02b350; }
.social-btn.google { background: #fff; color: #111827; border: 1px solid var(--border); }
.social-btn.google:hover { background: #f7f8fa; }
.login-card .cancel {
  display: block; width: 100%; text-align: center; margin-top: 12px;
  font-size: 13px; color: var(--ink-soft); background: none; border: none; cursor: pointer; font-family: inherit;
}
.login-msg { font-size: 13px; color: var(--primary); margin-top: 10px; }

/* ===== 이메일 로그인 (auth.js 가 끼워 넣습니다) ===== */
.login-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--ink-faint); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.email-toggle {
  width: 100%; padding: 12px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--ink-soft);
  font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.email-toggle:hover { background: var(--bg); }
.email-form { display: none; }
.email-form.open { display: block; }
.email-form input {
  width: 100%; padding: 12px 14px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--ink);
  font-size: 15px; font-family: inherit;
}
.email-form input:focus { outline: none; border-color: var(--primary); }
.email-form .primary {
  width: 100%; padding: 13px 16px; margin-top: 2px;
  border: none; border-radius: 8px; background: var(--primary); color: #fff;
  font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.email-form .primary:hover { background: var(--primary-hover); }
.email-form .primary:disabled { opacity: 0.6; cursor: default; }
.email-switch {
  display: block; width: 100%; text-align: center; margin-top: 10px;
  font-size: 13px; color: var(--ink-soft); background: none; border: none;
  cursor: pointer; font-family: inherit; text-decoration: underline;
}

/* ===== 회원가입 약관 동의 모달 ===== */
.consent-modal {
  position: fixed; inset: 0; background: rgba(17,24,39,0.55);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 60;
}
.consent-modal.open { display: flex; }
.consent-box { background: var(--card); border-radius: 14px; padding: 26px; max-width: 400px; width: 100%; }
.consent-box h2 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.consent-box > p { font-size: 13px; color: var(--ink-soft); margin-bottom: 18px; }
.consent-all-row {
  display: flex; align-items: center; gap: 8px; padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 700;
}
.consent-item-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 0; font-size: 13px;
}
.consent-item-row label { display: flex; align-items: center; gap: 8px; color: var(--ink); cursor: pointer; }
.consent-item-row .required { color: var(--primary); font-weight: 700; margin-right: 2px; }
.consent-item-row .optional { color: var(--ink-faint); font-weight: 700; margin-right: 2px; }
.consent-item-row a { font-size: 12px; color: var(--ink-faint); text-decoration: underline; }
.consent-box input[type="checkbox"] { width: 17px; height: 17px; cursor: pointer; accent-color: var(--primary); }
.consent-actions { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.consent-msg { font-size: 12px; color: var(--danger); min-height: 16px; margin-top: 4px; }

/* ===== 공용 레이아웃 ===== */
main { max-width: 960px; margin: 0 auto; padding: 14px 20px 32px; }
.section-title { font-size: 21px; font-weight: 700; margin-bottom: 16px; }

/* ===== 서브탭 (강의/밀착과외/운영대행, 셀러센터 4탭 등) — 알약형, 메인 네비와 구분되는 스타일 ===== */
.subtab-row {
  display: inline-flex; gap: 2px; background: var(--stat-bg); border-radius: 12px;
  padding: 4px; margin-bottom: 28px; overflow-x: auto; max-width: 100%;
}
.subtab {
  padding: 10px 18px; font-size: 15px; font-weight: 600; color: var(--ink-soft);
  border-radius: 9px; white-space: nowrap;
}
.subtab.active { color: var(--ink); background: var(--card); box-shadow: 0 1px 3px rgba(17,24,39,0.08); }
.subtab:hover { color: var(--ink); }
.subtab-row { -webkit-overflow-scrolling: touch; -ms-overflow-style: none; scrollbar-width: none; }
.subtab-row::-webkit-scrollbar { display: none; }

/* ===== 카드 목록 (강의/전자책/마이클래스 공용) ===== */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.course-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; cursor: pointer; transition: box-shadow 0.15s ease;
}
.course-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.course-thumb {
  width: 100%; aspect-ratio: 4/3; background: var(--card);
  display: flex; align-items: center; justify-content: center; color: var(--ink-faint); font-size: 13px;
}
.course-thumb img { width: 100%; height: 100%; object-fit: contain; }
.course-body { padding: 16px; }
.course-title { font-size: 17px; font-weight: 600; margin-bottom: 6px; line-height: 1.4; }
.course-desc { font-size: 15px; color: var(--ink-soft); margin-bottom: 10px; line-height: 1.4; }
.course-price { font-size: 18px; font-weight: 700; color: var(--primary); }
.badge {
  display: inline-flex; font-size: 11px; font-weight: 700; color: var(--primary);
  background: var(--stat-bg); padding: 3px 8px; border-radius: 10px;
}

.empty-state, .loading, .empty, .gate { text-align: center; padding: 40px 20px; color: var(--ink-faint); font-size: 14px; }

/* ===== 공용 버튼 ===== */
.btn { border: none; border-radius: 8px; padding: 11px 20px; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { background: var(--ink-faint); cursor: not-allowed; }

.page-desc { font-size: 16px; color: var(--ink-soft); margin-bottom: 20px; line-height: 1.6; }

/* ===== 모바일 반응형 ===== */
@media (max-width: 480px) {
  header.site-header {
    display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto;
    height: auto; padding: 12px 14px 10px; row-gap: 14px; column-gap: 0;
  }
  .logo { grid-column: 1; grid-row: 1; justify-content: flex-start; }
  .logo-icon { height: 28px; }
  .logo-wordmark { height: 22px; }
  #auth-area { grid-column: 2; grid-row: 1; margin-left: 0; align-self: center; }
  /* 네비는 2행 전체 폭을 씁니다 (예전엔 로그인 영역과 한 줄을 나눠 써서 마지막 탭이 잘렸어요) */
  .main-nav { grid-column: 1 / -1; grid-row: 2; width: 100%; height: auto; }
  .nav-item { height: auto; }
  /* 손가락으로 누르는 영역이라 최소 44px는 확보합니다.
     좌우 여백은 7px까지만 — 10px면 320px 화면에서 마지막 탭(커뮤니티)이 잘립니다. */
  .nav-link { padding: 0 7px; font-size: 15px; min-height: 44px; }
  .user-email { display: none; }
  .user-chip { padding: 6px; }

  /* 모바일에서는 옆으로 밀지 않고 두 줄로 접어서 4개 탭이 모두 보이게 합니다 */
  .subtab-row { display: flex; flex-wrap: wrap; width: 100%; overflow: visible; gap: 4px; }
  .subtab { flex: 1 1 calc(50% - 4px); text-align: center; padding: 11px 8px; font-size: 14px; }
}

/* 아주 좁은 화면(320px대)에서도 메뉴 4개가 한 줄에 모두 들어오게 조금 더 좁힙니다 */
@media (max-width: 360px) {
  .main-nav { gap: 0; }
  .nav-link { padding: 0 5px; font-size: 14px; }
}

/* ===== 구매 확인 · 결제수단 ===== */
.pc-modal {
  position: fixed; inset: 0; background: rgba(17,24,39,0.55);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 60;
}
.pc-modal.open { display: flex; }
.pc-box {
  background: var(--card); border-radius: 16px; padding: 24px 22px 18px;
  max-width: 420px; width: 100%; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column; min-height: 0;
}
/* 안내가 길어져도 결제 버튼은 항상 보이도록, 본문만 스크롤합니다 */
.pc-body { overflow-y: auto; min-height: 0; flex: 1 1 auto; }
.pc-box h2 { font-size: 17px; font-weight: 700; margin-bottom: 16px; }

.pc-item { padding-bottom: 12px; }
.pc-title { font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.45; }
.pc-qty { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.pc-qty:empty { display: none; }

.pc-total {
  display: flex; align-items: baseline; justify-content: space-between;
  border-top: 1px solid var(--border); padding-top: 12px; margin-bottom: 16px;
}
.pc-total span { font-size: 14px; color: var(--ink-soft); }
.pc-total b { font-size: 20px; font-weight: 800; color: var(--ink); }

.pc-notice { background: var(--bg); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.pc-notice-head { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 7px; }
.pc-notice ul { margin: 0; padding-left: 17px; }
.pc-notice li { font-size: 12.5px; color: var(--ink-soft); line-height: 1.65; }
.pc-seller { font-size: 12.5px; color: var(--ink-soft); margin-top: 9px; line-height: 1.5; }

.pc-agree {
  display: flex; align-items: flex-start; gap: 9px; cursor: pointer;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 11px; margin-bottom: 18px;
}
.pc-agree:hover { border-color: var(--primary); }
.pc-agree input { width: 18px; height: 18px; margin: 1px 0 0; flex-shrink: 0; cursor: pointer; accent-color: var(--primary); }
.pc-agree span { font-size: 13.5px; color: var(--ink); line-height: 1.5; }
.pc-agree em { font-style: normal; color: var(--danger); white-space: nowrap; }

.pc-method-label { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 9px; }
.pc-methods { display: flex; flex-direction: column; gap: 9px; margin-bottom: 6px; }
.pc-method {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  width: 100%; text-align: left; background: var(--card);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 16px; cursor: pointer; font-family: inherit;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.pc-method:hover { border-color: var(--primary); }
.pc-method.selected { border-color: var(--primary); background: #f5f8ff; box-shadow: inset 0 0 0 1px var(--primary); }
.pc-method .pm-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.pc-method .pm-desc { font-size: 12.5px; color: var(--ink-soft); }

/* 안내 문구가 길어지면 결제 버튼이 스크롤 아래로 밀립니다.
   결제는 가장 중요한 동작이므로 항상 보이게 바닥에 붙입니다. */
.pc-actions {
  flex: 0 0 auto; margin: 0 -22px -18px; padding: 12px 22px 18px;
  background: var(--card); border-top: 1px solid var(--border);
  border-radius: 0 0 16px 16px;
}
.pc-msg { font-size: 12.5px; color: var(--danger); min-height: 18px; margin: 0 0 4px; }
.pc-submit {
  width: 100%; background: var(--primary); color: #fff; border: none; border-radius: 12px;
  padding: 15px; font-size: 15.5px; font-weight: 700; cursor: pointer; font-family: inherit;
  transition: opacity .15s ease;
}
.pc-submit:disabled { opacity: .4; cursor: not-allowed; }
.pc-cancel {
  width: 100%; background: none; border: none; padding: 10px 10px 0;
  font-size: 14px; font-weight: 600; color: var(--ink-soft); cursor: pointer; font-family: inherit;
}

@media (max-width: 480px) {
  .pc-box { padding: 20px 18px 16px; border-radius: 14px; }
  .pc-actions { margin: 0 -18px -16px; padding: 12px 18px 16px; border-radius: 0 0 14px 14px; }
  .pc-total b { font-size: 19px; }
}

/* 사업자등록번호·전화번호처럼 중간에서 끊기면 안 되는 값 */
.nb { white-space: nowrap; }

/* ===== 사업자 정보 푸터 ===== */
.site-footer {
  border-top: 1px solid var(--border); background: var(--card);
  padding: 28px 20px; margin-top: 40px; text-align: center;
}
.site-footer .footer-inner { max-width: 720px; margin: 0 auto; }
.site-footer p {
  font-size: 12px; color: var(--ink-faint); line-height: 1.9;
}
.site-footer strong { color: var(--ink-faint); font-weight: 600; }
.site-footer .footer-copyright {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--ink-faint); letter-spacing: 0.02em;
}
