/* ============================================================
   광주여성민우회 후원 바자회 — Bold Editorial 디자인 시스템
   1) 디자인 토큰  2) 리셋/베이스  3) 레이아웃  4) 컴포넌트
   ============================================================ */

/* ---------- 1) 디자인 토큰 ---------- */
:root {
  /* 색 — 잉크 블랙 · 웜 아이보리 · 마젠타 · 딥플럼 */
  --ink: #14110f;
  --ink-soft: #5c554d;
  --paper: #f6f1e9;
  --paper-2: #efe8dc;
  --card: #fffdf9;
  --line: #e2d9ca;
  --line-strong: #cdc1ad;

  --magenta: #cc0066;
  --magenta-bright: #ff2d8b;
  --magenta-ink: #8a0044;
  --plum: #3d2a5c;
  --plum-soft: #efe7f6;

  /* 상태 색 */
  --st-draft: #8b8378;
  --st-onsale: #cc0066;
  --st-agreed: #3d2a5c;
  --st-waiting: #b26a00;
  --st-proof: #0e6b7a;
  --st-done: #17724a;

  --ok: #17724a;
  --warn: #b26a00;
  --danger: #b3261e;

  /* 타이포 */
  --font-display: "Gowun Batang", "Nanum Myeongjo", serif;
  --font-body: "IBM Plex Sans KR", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* 간격/모양 */
  --gap: 1rem;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(20, 17, 15, .06), 0 2px 8px rgba(20, 17, 15, .05);
  --shadow-md: 0 8px 28px rgba(20, 17, 15, .10);
  --shadow-lg: 0 20px 60px rgba(20, 17, 15, .22);
  --wrap: 1120px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- 2) 리셋 / 베이스 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
em { font-style: normal; color: var(--magenta); }

button { font-family: inherit; cursor: pointer; }
input, select, textarea, button { font-size: 1rem; }

.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--magenta); outline-offset: 2px; border-radius: 4px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 720px; }
.muted { color: var(--ink-soft); }
.empty-note { color: var(--ink-soft); padding: 40px 0; text-align: center; }

/* ---------- 3) 레이아웃 ---------- */

/* 헤더 */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(246, 241, 233, .82);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 66px; }
.brand { display: flex; flex-direction: column; line-height: 1.05; }
.brand-org { font-size: .72rem; letter-spacing: .18em; color: var(--ink-soft); text-transform: none; }
.brand-mark { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; letter-spacing: .02em; }
.brand-dot { color: var(--magenta); margin-left: 2px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.auth-info { font-size: .8rem; color: var(--ink-soft); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 히어로 */
.hero { padding: clamp(48px, 9vw, 104px) 0 clamp(36px, 6vw, 72px); position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; right: -12%; top: -20%; width: 46vw; height: 46vw; max-width: 560px; max-height: 560px;
  background: radial-gradient(circle at 30% 30%, var(--magenta-bright), var(--magenta) 45%, transparent 70%);
  opacity: .16; border-radius: 50%; pointer-events: none;
}
.hero-eyebrow { text-transform: uppercase; letter-spacing: .28em; font-size: .78rem; font-weight: 600; color: var(--magenta-ink); margin-bottom: 18px; }
.hero-title { font-size: clamp(2.4rem, 7vw, 5rem); letter-spacing: -.02em; }
.hero-lead { margin-top: 22px; font-size: clamp(1rem, 2.2vw, 1.2rem); max-width: 40ch; color: var(--ink-soft); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero-note { margin-top: 26px; font-size: .82rem; color: var(--ink-soft); border-left: 3px solid var(--magenta); padding-left: 12px; max-width: 52ch; }

/* 섹션 */
.section { padding: clamp(40px, 6vw, 76px) 0; }
.section-muted { background: var(--paper-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.section-title { font-size: clamp(1.6rem, 3.4vw, 2.4rem); }
.section-title::after { content: ""; display: block; width: 46px; height: 4px; background: var(--magenta); margin-top: 10px; border-radius: 3px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-input { width: auto; min-width: 150px; max-width: 240px; padding: 8px 13px; }

/* 상품 그리드 */
.post-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.post-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.post-thumb { aspect-ratio: 4 / 3; background: var(--paper-2); position: relative; overflow: hidden; }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-thumb-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--line-strong); font-family: var(--font-display); font-size: 2rem; }
.post-card-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-card-title { font-size: 1.12rem; line-height: 1.3; }
.post-card-price { font-weight: 600; font-size: 1.05rem; }
.post-card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* 상태 뱃지(pill) */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid currentColor; line-height: 1; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-DRAFT { color: var(--st-draft); }
.pill-ON_SALE { color: var(--st-onsale); }
.pill-AGREED { color: var(--st-agreed); }
.pill-WAITING_PAYMENT { color: var(--st-waiting); }
.pill-PROOF_PENDING { color: var(--st-proof); }
.pill-COMPLETED { color: #fff; background: var(--st-done); border-color: var(--st-done); }
.pill-COMPLETED::before { background: #fff; }

.badge-done { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; color: var(--st-done); }

/* ---------- 4) 컴포넌트 ---------- */

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px; padding: 10px 18px;
  font-weight: 600; font-size: .92rem; line-height: 1; color: var(--ink); background: transparent;
  transition: transform .12s var(--ease), background .2s, color .2s, border-color .2s, box-shadow .2s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-lg { padding: 14px 26px; font-size: 1rem; }
.btn-sm { padding: 7px 13px; font-size: .82rem; }
.btn-primary { background: var(--magenta); color: #fff; box-shadow: 0 6px 18px rgba(204, 0, 102, .28); }
.btn-primary:hover { background: var(--magenta-ink); }
.btn-plum { background: var(--plum); color: #fff; }
.btn-plum:hover { filter: brightness(1.12); }
.btn-outline { border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: var(--paper); }
.btn-ghost { color: var(--ink); border-color: var(--line-strong); background: var(--card); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-icon { position: relative; }

.noti-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--magenta); color: #fff; font-size: .68rem; font-weight: 700; }

/* 폼 */
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.counter { font-weight: 400; font-size: .72rem; color: var(--ink-soft); margin-left: 6px; }
.counter-bad { color: var(--danger); font-weight: 700; }
.field-inline { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--ink-soft); font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.field-inline select { width: auto; }
textarea { resize: vertical; min-height: 92px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--magenta); box-shadow: 0 0 0 3px rgba(204, 0, 102, .15); }
.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.checkbox input { width: auto; }

/* 업로드 파일 입력 + 미리보기 */
input[type="file"] { padding: 9px 11px; background: var(--card); cursor: pointer; }
input[type="file"]::file-selector-button { font-family: inherit; font-weight: 600; font-size: .82rem; margin-right: 12px; padding: 7px 13px; border: 1px solid var(--ink); border-radius: 999px; background: var(--ink); color: var(--paper); cursor: pointer; }
input[type="file"]::file-selector-button:hover { background: var(--magenta); border-color: var(--magenta); }
.upload-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.upload-preview:empty { display: none; }
.upload-preview img { width: 74px; height: 74px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); }

/* 이미지 미리보기 아이템 (개별 삭제 + 대표 뱃지) */
.preview-item { position: relative; width: 74px; height: 74px; }
.preview-item img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); }
.preview-remove { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: #fff; border: none; font-size: .7rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.preview-badge { position: absolute; bottom: 4px; left: 4px; background: var(--magenta); color: #fff; font-size: .58rem; font-weight: 700; padding: 2px 5px; border-radius: 4px; }

/* 스켈레톤 로딩 */
.skeleton { position: relative; overflow: hidden; background: var(--paper-2); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); animation: shimmer 1.2s infinite; }
.skel-card { height: 300px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: none; }
.skel-card:hover { transform: none; box-shadow: none; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* 상세 오버레이(드로어) */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(20, 17, 15, .5); display: flex; justify-content: flex-end; animation: fade .2s var(--ease); }
.drawer {
  width: min(560px, 100%); height: 100%; background: var(--paper); overflow-y: auto;
  box-shadow: var(--shadow-lg); padding: 22px clamp(18px, 4vw, 34px) 60px; animation: slidein .28s var(--ease);
}
.drawer-close { position: sticky; top: 0; margin-left: auto; display: flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 999px; padding: 8px 14px; font-weight: 600; color: var(--ink); float: right; }
.detail-title { font-size: clamp(1.5rem, 4vw, 2rem); margin: 6px 0 4px; clear: both; }
.detail-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.detail-price { font-weight: 700; font-size: 1.35rem; }
.detail-image { border-radius: var(--radius); border: 1px solid var(--line); margin: 14px 0; aspect-ratio: 4/3; object-fit: cover; width: 100%; background: var(--paper-2); }
.detail-desc { color: var(--ink); white-space: pre-wrap; margin: 12px 0; }
.detail-block { margin-top: 26px; }
.detail-block h4 { font-size: 1.05rem; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* 스레드(메시지) / 이력 */
.thread, .plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.msg { padding: 10px 13px; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--line); }
.msg .who { font-size: .74rem; font-weight: 600; color: var(--magenta-ink); }
.msg.mine { background: var(--plum-soft); border-color: transparent; }
.history-item { font-size: .84rem; color: var(--ink-soft); padding: 8px 0; border-bottom: 1px dashed var(--line); }
.history-item b { color: var(--ink); }

/* 통계 카드 */
.stat-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 28px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.stat-card .k { font-size: .8rem; color: var(--ink-soft); font-weight: 600; }
.stat-card .v { font-family: var(--font-display); font-size: 2rem; font-weight: 700; margin-top: 6px; }
.stat-card.accent { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.stat-card.accent .k { color: rgba(246, 241, 233, .7); }
.stat-card.accent .v { color: #fff; }

/* 관리자 */
.admin-only { display: none; }
.admin-grid { display: grid; gap: 24px; grid-template-columns: 1fr 1fr; }
.admin-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-sm); }
.admin-item .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-item .meta { font-size: .82rem; color: var(--ink-soft); }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 판매 회원 명부 */
.member-roster { margin-top: 28px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.roster-import { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; }
.member-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .86rem; }
.member-row.inactive { opacity: .5; }

/* 알림 패널 */
.noti-panel { position: fixed; top: 74px; right: 16px; z-index: 55; width: min(360px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 14px; }
.noti-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
#notification-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.noti-item { padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); font-size: .86rem; display: flex; flex-direction: column; gap: 6px; }
.noti-item.unread { border-left: 3px solid var(--magenta); background: var(--plum-soft); }
.noti-type { font-size: .7rem; font-weight: 700; letter-spacing: .05em; color: var(--magenta-ink); }

/* 토스트 */
.toast-container { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 10px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: inline-flex; align-items: center; gap: 8px; max-width: 90vw; background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow-md); font-size: .9rem; font-weight: 500; cursor: pointer; animation: toastin .25s var(--ease); }
.toast-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: rgba(255, 255, 255, .25); font-size: .72rem; font-weight: 700; flex-shrink: 0; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.err { background: var(--danger); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }

/* 모달 */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(20, 17, 15, .5); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .18s var(--ease); }
.modal { background: var(--paper); border-radius: var(--radius-lg); width: min(460px, 100%); padding: 26px; box-shadow: var(--shadow-lg); animation: pop .22s var(--ease); }
.modal h3 { font-size: 1.4rem; margin-bottom: 6px; }
.modal .modal-desc { color: var(--ink-soft); font-size: .9rem; margin-bottom: 18px; }
.modal .modal-fields { display: flex; flex-direction: column; gap: 14px; }
.modal .modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* 푸터 */
.site-footer { background: var(--ink); color: var(--paper); padding: 54px 0 40px; margin-top: 40px; }
.footer-inner { display: grid; gap: 28px; grid-template-columns: 1.4fr 1fr 1fr; }
.site-footer h4 { font-size: 1rem; margin-bottom: 10px; color: #fff; }
.site-footer p { font-size: .86rem; color: rgba(246, 241, 233, .72); }
.site-footer strong { font-family: var(--font-display); font-size: 1.2rem; }
.footer-note { margin-top: 30px; padding-top: 18px; border-top: 1px solid rgba(246, 241, 233, .16); font-size: .78rem; color: rgba(246, 241, 233, .55); }

/* 애니메이션 */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slidein { from { transform: translateX(40px); opacity: .4; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastin { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* 반응형 */
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .auth-info { display: none; }
  .drawer { width: 100%; }
  .hero-title { font-size: clamp(2.2rem, 11vw, 3rem); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
}
