@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #e8341a;
  --primary-hover: #c92d16;
  --primary-pale: #fff3f0;
  --bg: #f4f4f5;
  --white: #ffffff;
  --text: #111111;
  --text-sub: #555555;
  --text-muted: #999999;
  --border: #e4e4e7;
  --border-light: #f0f0f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 220px;
  --nav-h: 56px;
  --ease: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

/* ── NAV ── */
#navbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  box-shadow: var(--shadow-sm);
}
.nav-logo {
  font-size: 20px; font-weight: 700;
  color: var(--primary); cursor: pointer; letter-spacing: -0.5px;
}
.nav-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav-user-chip {
  font-size: 13px; color: var(--text-sub);
  background: var(--bg); border-radius: 999px;
  padding: 4px 12px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 15px; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; transition: all var(--ease);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--text-sub); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-full { width: 100%; justify-content: center; }

/* ── LAYOUT ── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  max-width: 1200px; margin: 0 auto;
  min-height: calc(100vh - var(--nav-h));
}

/* ── SIDEBAR ── */
#sidebar {
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 12px 0;
  position: sticky; top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.sidebar-item {
  display: flex; align-items: center;
  padding: 9px 18px;
  font-size: 14px; color: var(--text-sub);
  cursor: pointer; border-left: 3px solid transparent;
  transition: all var(--ease);
}
.sidebar-item:hover { background: var(--bg); color: var(--text); }
.sidebar-item.active {
  background: var(--primary-pale); color: var(--primary);
  font-weight: 600; border-left-color: var(--primary);
}
.sidebar-icon { margin-right: 8px; font-size: 15px; }
.sidebar-arrow { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.sidebar-sub { padding-left: 42px; font-size: 13px; }
.sidebar-divider { height: 1px; background: var(--border-light); margin: 8px 0; }

/* ── CONTENT ── */
#content { padding: 24px; min-height: calc(100vh - var(--nav-h)); }

/* ── FEED ── */
.feed-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.feed-title { font-size: 18px; font-weight: 700; }

/* ── CARDS ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.post-card {
  background: var(--white); border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: transform var(--ease), box-shadow var(--ease);
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.card-img-wrap { position: relative; }
.card-img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  background: var(--bg); display: block;
}
.card-placeholder {
  width: 100%; aspect-ratio: 4/3;
  background: linear-gradient(135deg, #f0f0f0, #e5e5e5);
  display: flex; align-items: center; justify-content: center;
  font-size: 42px;
}
.hot-badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
}
.card-body { padding: 13px 15px; }
.card-cat {
  font-size: 11px; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px;
}
.card-title {
  font-size: 14px; font-weight: 600; line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-desc {
  font-size: 12px; color: var(--text-sub); margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-price { font-size: 17px; font-weight: 700; color: var(--primary); margin-bottom: 10px; }
.card-meta {
  display: flex; gap: 12px; font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--border-light); padding-top: 8px;
}

/* ── POST DETAIL ── */
.post-detail { max-width: 780px; }
.detail-back { margin-bottom: 16px; display: inline-block; }
.detail-img {
  width: 100%; max-height: 400px; object-fit: cover;
  border-radius: var(--radius); background: var(--bg);
  margin-bottom: 24px; display: block;
}
.detail-img-placeholder {
  width: 100%; height: 280px; border-radius: var(--radius);
  background: linear-gradient(135deg, #f0f0f0, #e5e5e5);
  display: flex; align-items: center; justify-content: center;
  font-size: 80px; margin-bottom: 24px;
}
.detail-cat {
  font-size: 12px; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
}
.detail-title { font-size: 22px; font-weight: 700; line-height: 1.3; margin-bottom: 10px; }
.detail-price { font-size: 26px; font-weight: 700; color: var(--primary); margin-bottom: 10px; }
.detail-meta {
  display: flex; gap: 16px; font-size: 13px; color: var(--text-muted);
  padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 20px;
}
.detail-desc {
  font-size: 15px; line-height: 1.9; color: var(--text-sub);
  margin-bottom: 24px; white-space: pre-wrap;
}
.purchase-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 28px; background: var(--primary); color: #fff;
  border-radius: var(--radius); font-size: 16px; font-weight: 700;
  transition: background var(--ease); margin-bottom: 32px;
}
.purchase-btn:hover { background: var(--primary-hover); }

/* ── COMMENTS ── */
.comments-section { border-top: 1px solid var(--border); padding-top: 24px; }
.comments-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.comment-form { margin-bottom: 20px; }
.comment-input {
  width: 100%; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; resize: vertical; min-height: 76px;
  margin-bottom: 8px; transition: border-color var(--ease);
}
.comment-input:focus { outline: none; border-color: var(--primary); }
.comment-item { padding: 12px 0; border-bottom: 1px solid var(--border-light); }
.comment-author { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.comment-time { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-left: 8px; }
.comment-content { font-size: 14px; color: var(--text-sub); }

/* ── FORMS ── */
.form-group { margin-bottom: 15px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.form-input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--white); transition: border-color var(--ease);
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232,52,26,.08); }
textarea.form-input { resize: vertical; min-height: 100px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-err { font-size: 12px; color: #dc2626; margin-top: 4px; }
.form-divider {
  text-align: center; font-size: 13px; color: var(--text-muted);
  margin: 16px 0; position: relative;
}
.form-divider::before, .form-divider::after {
  content: ''; position: absolute; top: 50%; width: 42%; height: 1px;
  background: var(--border);
}
.form-divider::before { left: 0; }
.form-divider::after { right: 0; }

/* ── MODAL ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 200; backdrop-filter: blur(2px);
}
.modal-backdrop.hidden { display: none; }
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--white); border-radius: 16px; padding: 32px;
  width: 420px; max-width: calc(100vw - 28px);
  z-index: 201; box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--text-muted); line-height: 1;
}
.modal-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.modal-subtitle { font-size: 14px; color: var(--text-sub); margin-bottom: 22px; }
.modal-switch { text-align: center; font-size: 13px; color: var(--text-sub); margin-top: 16px; }
.modal-switch a { color: var(--primary); cursor: pointer; font-weight: 600; }

/* ── ADMIN ── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-header p { color: var(--text-sub); font-size: 14px; }

.admin-tabs {
  display: flex; gap: 2px; background: var(--bg);
  padding: 4px; border-radius: var(--radius); width: fit-content; margin-bottom: 22px;
}
.admin-tab {
  padding: 7px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  cursor: pointer; background: transparent; border: none;
  color: var(--text-sub); font-family: inherit; transition: all var(--ease);
}
.admin-tab.active {
  background: var(--white); color: var(--text);
  font-weight: 700; box-shadow: var(--shadow-sm);
}
.admin-table {
  width: 100%; border-collapse: collapse;
  background: var(--white); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.admin-table th {
  background: var(--bg); padding: 11px 14px;
  text-align: left; font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 11px 14px; border-bottom: 1px solid var(--border-light);
  font-size: 13px; color: var(--text-sub); vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg); }
.btn-row { display: flex; gap: 6px; }

/* ── BADGES ── */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
}
.badge-pending { background: #fef3c7; color: #d97706; }
.badge-approved { background: #d1fae5; color: #059669; }
.badge-rejected { background: #fee2e2; color: #dc2626; }

/* ── CARDS — page wrappers ── */
.form-card {
  background: var(--white); border-radius: var(--radius);
  padding: 32px; max-width: 600px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border-light);
}

/* ── STATES ── */
.empty-state {
  text-align: center; padding: 56px 24px; color: var(--text-muted);
}
.empty-emoji { font-size: 48px; margin-bottom: 14px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-sub); margin-bottom: 6px; }
.empty-state p { font-size: 14px; }

.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 56px; color: var(--text-muted); gap: 10px;
}
.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── DEMO BANNER ── */
.demo-banner {
  background: #fef3c7; border: 1px solid #fde68a;
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 13px; color: #92400e; margin-bottom: 18px;
}

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1a1a1a; color: #fff;
  padding: 11px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 500;
  z-index: 999; transition: transform .3s ease; white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  #sidebar { display: none; }
  #content { padding: 16px; }
  .cards-grid { grid-template-columns: 1fr 1fr; }
  .modal { padding: 24px 20px; }
}
@media (max-width: 480px) {
  .cards-grid { grid-template-columns: 1fr; }
}
