/* =========================================================
   꼼꼼한 Blog Console — Shell
   사이드바 + 헤더 + 테이블 + 폼 등 공통 컴포넌트
========================================================= */

:root {
  --c-bg: #FAFAF7;
  --c-surface: #ffffff;
  --c-text: #333333;
  --c-text-muted: rgba(51, 51, 51, 0.62);
  --c-text-light: rgba(51, 51, 51, 0.45);
  --c-border: rgba(0, 0, 0, 0.08);
  --c-border-strong: rgba(0, 0, 0, 0.14);
  --c-accent: #C5E052;
  --c-accent-strong: #B5D442;
  --c-accent-dark: #8BA86E;
  --c-warn: #F5A663;
  --c-danger: #E57373;
  --c-radius: 16px;
  --c-radius-sm: 10px;
  --c-radius-pill: 999px;
  --c-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
  --c-shadow-lg: 0 15px 40px rgba(0, 0, 0, 0.08);
  --c-sidebar-w: 220px;
  --c-header-h: 56px;
}

body.gg-console-body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.gg-console-body * { box-sizing: border-box; }

.gg-console-app {
  display: grid;
  grid-template-columns: var(--c-sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.gg-console-sidebar {
  background: #fff;
  border-right: 1px solid var(--c-border);
  padding: 20px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.gg-console-brand {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--c-text);
  text-decoration: none;
}

.gg-console-brand:hover { opacity: 0.7; }

/* 메뉴 래퍼는 데스크톱에서 레이아웃에 영향 없음(투명) — 모바일에서만 드롭다운으로 전환 */
.gg-console-menu { display: contents; }
/* 햄버거 — 데스크톱 숨김, 모바일에서만 노출 */
.gg-console-burger { display: none; }

.gg-console-brand__logo {
  width: 44px;
  height: 44px;
  border-radius: 0;
  display: block;
  object-fit: contain;
}

.gg-console-brand__mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--c-text);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.gg-console-brand__name {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.01em;
  color: var(--c-text);
}

.gg-console-brand__badge {
  background: var(--c-accent);
  color: var(--c-text);
  padding: 2px 8px;
  border-radius: var(--c-radius-pill);
  font-size: 11px;
  font-weight: 600;
}

.gg-console-nav {
  padding: 12px 0;
  display: flex;
  flex-direction: column;
}

.gg-console-nav__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--c-text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.gg-console-nav__link:hover {
  background: rgba(0, 0, 0, 0.025);
  color: var(--c-text);
}

.gg-console-nav__link.is-active {
  background: rgba(197, 224, 82, 0.18);
  border-left-color: var(--c-accent-strong);
  color: var(--c-text);
  font-weight: 600;
}

.gg-console-nav__link .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
}

.gg-console-sidebar__footer {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--c-border);
  font-size: 12px;
  color: var(--c-text-light);
}

.gg-console-sidebar__footer a {
  color: var(--c-text-muted);
  text-decoration: none;
}
.gg-console-sidebar__footer a:hover {
  color: var(--c-text);
  text-decoration: underline;
}

/* ---------- Main ---------- */
.gg-console-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.gg-console-topbar {
  height: var(--c-header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: #fff;
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.gg-console-topbar__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
}

.gg-console-topbar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--c-text-muted);
}

.gg-console-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--c-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--c-text);
}

.gg-console-content {
  flex: 1;
  padding: 32px;
  min-width: 0;
}

.gg-console-page-title {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.gg-console-page-sub {
  margin: 0 0 24px;
  color: var(--c-text-muted);
  font-size: 14px;
}

/* ---------- Buttons ---------- */
.gg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--c-radius-pill);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  background: var(--c-text);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, background 0.15s;
}

.gg-btn:hover { opacity: 0.85; }

.gg-btn--primary { background: var(--c-accent); color: var(--c-text); }
.gg-btn--primary:hover { background: var(--c-accent-strong); opacity: 1; }
.gg-btn--ghost { background: transparent; color: var(--c-text-muted); border-color: var(--c-border-strong); }
.gg-btn--ghost:hover { background: rgba(0, 0, 0, 0.03); color: var(--c-text); opacity: 1; }
.gg-btn--danger { background: var(--c-danger); }
.gg-btn--sm { padding: 6px 12px; font-size: 12px; }

/* ---------- Cards ---------- */
.gg-card-block {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  padding: 24px;
  box-shadow: var(--c-shadow);
}

.gg-card-block + .gg-card-block { margin-top: 20px; }

.gg-card-block__title {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
}

/* ---------- Table ---------- */
.gg-table-wrap {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  overflow: hidden;
  box-shadow: var(--c-shadow);
}

.gg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.gg-table th,
.gg-table td {
  text-align: left;
  padding: 14px 20px;
  border-bottom: 1px solid var(--c-border);
}

.gg-table th {
  background: rgba(0, 0, 0, 0.025);
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gg-table tbody tr:last-child td { border-bottom: none; }
.gg-table tbody tr:hover { background: rgba(0, 0, 0, 0.015); }

.gg-table__title {
  font-weight: 600;
  color: var(--c-text);
  text-decoration: none;
}
.gg-table__title:hover { text-decoration: underline; }

.gg-table__meta {
  color: var(--c-text-muted);
  font-size: 13px;
}

.gg-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--c-radius-pill);
  font-size: 11px;
  font-weight: 600;
}
.gg-status--publish { background: rgba(139, 168, 110, 0.18); color: #5e7a47; }
.gg-status--draft { background: rgba(0, 0, 0, 0.06); color: var(--c-text-muted); }
.gg-status--private { background: rgba(241, 215, 166, 0.4); color: #8a6a3a; }
.gg-status--pending { background: rgba(245, 166, 99, 0.18); color: #b3672a; }

/* ---------- Form ---------- */
.gg-form-row {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gg-form-row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gg-form-row input[type="text"],
.gg-form-row input[type="password"],
.gg-form-row input[type="email"],
.gg-form-row input[type="number"],
.gg-form-row input[type="search"],
.gg-form-row textarea,
.gg-form-row select {
  padding: 10px 14px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--c-radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--c-text);
  transition: border-color 0.15s;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

.gg-form-row input:focus,
.gg-form-row textarea:focus,
.gg-form-row select:focus {
  outline: none;
  border-color: var(--c-accent-dark);
}

.gg-form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---------- Empty state ---------- */
.gg-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--c-text-muted);
}

.gg-empty-state__title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--c-text);
}

/* ---------- PCO Toast (파랑새 호환) ---------- */
.pco-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  padding: 12px 22px;
  background: var(--c-text);
  color: #fff;
  border-radius: var(--c-radius-pill);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--c-shadow-lg);
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
  pointer-events: none;
  z-index: 10100;
  max-width: 80vw;
}
.pco-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.pco-toast-success { background: var(--c-accent-dark); }
.pco-toast-error { background: var(--c-danger); }

/* ---------- pco-cat-tag (목록 카테고리 칩) ---------- */
.pco-cat-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--c-radius-pill);
  background: rgba(0, 0, 0, 0.05);
  color: var(--c-text);
  font-size: 11px;
  font-weight: 500;
  margin-right: 4px;
}

/* ---------- Toast ---------- */
.gg-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: var(--c-text);
  color: #fff;
  border-radius: var(--c-radius-pill);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--c-shadow-lg);
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
  pointer-events: none;
  z-index: 100;
}

.gg-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
  pointer-events: auto;
}

.gg-toast--success { background: var(--c-accent-dark); }
.gg-toast--error { background: var(--c-danger); }

/* ---------- Login screen ---------- */
.gg-login-stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--c-bg);
}

.gg-login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  padding: 36px 32px;
  border-radius: 24px;
  box-shadow: var(--c-shadow-lg);
}

.gg-login-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 12px;
}

.gg-login-eyebrow {
  font-size: 12px;
  color: #B16D42;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 6px;
}

.gg-login-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 20px;
}

.gg-login-error {
  margin: 12px 0 0;
  padding: 10px 14px;
  background: rgba(229, 115, 115, 0.12);
  color: #c0524e;
  border-radius: 10px;
  font-size: 13px;
}

/* ---------- Dashboard ---------- */
.gg-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.gg-stat {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  padding: 18px;
  box-shadow: var(--c-shadow);
}

.gg-stat__label {
  font-size: 12px;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.gg-stat__value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--c-text);
}

/* ---------- Responsive (모바일) ---------- */
@media (max-width: 768px) {
  .gg-console-app { grid-template-columns: 1fr; }

  /* 사이드바 → 컴팩트 상단 바(브랜드 + 햄버거). 메뉴는 탭하면 펼쳐지는 드롭다운 */
  .gg-console-sidebar {
    position: sticky;
    top: 0;
    z-index: 60;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    overflow: visible; /* 드롭다운이 바깥으로 펼쳐지도록 */
  }

  .gg-console-brand { padding: 0; border-bottom: none; flex-shrink: 0; }
  .gg-console-brand__name { font-size: 16px; }
  .gg-console-brand__mark { width: 28px; height: 28px; font-size: 14px; }

  /* 햄버거 버튼 */
  .gg-console-burger {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    margin-left: auto;
    flex-shrink: 0;
    border-radius: 8px;
    cursor: pointer;
  }
  .gg-console-burger:hover { background: rgba(0, 0, 0, 0.04); }
  .gg-console-burger span {
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: var(--c-text);
    transition: transform 0.15s, opacity 0.15s;
  }
  .gg-console-nav-toggle:checked ~ .gg-console-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .gg-console-nav-toggle:checked ~ .gg-console-burger span:nth-child(2) { opacity: 0; }
  .gg-console-nav-toggle:checked ~ .gg-console-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* 드롭다운 메뉴 패널 */
  .gg-console-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--c-border);
    box-shadow: var(--c-shadow-lg);
    padding: 8px;
    max-height: calc(100vh - 57px);
    max-height: calc(100dvh - 57px);
    overflow-y: auto;
  }
  .gg-console-nav-toggle:checked ~ .gg-console-menu { display: block; }

  .gg-console-nav { flex-direction: column; padding: 0; gap: 2px; }
  .gg-console-nav__link {
    padding: 12px 14px;
    border-left: 3px solid transparent;
    border-bottom: none;
    white-space: nowrap;
    font-size: 14px;
    border-radius: 8px;
  }
  .gg-console-nav__link.is-active {
    border-left-color: var(--c-accent-strong);
    border-bottom: none;
  }

  .gg-console-sidebar__footer {
    position: static;
    margin: 6px 0 0;
    padding: 10px 14px 4px;
    border-top: 1px solid var(--c-border);
    display: flex;
    gap: 20px;
  }
  .gg-console-sidebar__footer p { margin: 0 !important; }

  .gg-console-topbar { padding: 0 16px; }
  .gg-console-content { padding: 16px; }

  /* 표 — 가로 스크롤(좁은 화면에서 칼럼 안 깨지게) */
  .gg-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .gg-table { min-width: 600px; }
  .gg-table th, .gg-table td { padding: 12px 14px; }

  /* 카드 블록·폼 — 컨테이너 폭 안에서 */
  .gg-card-block { padding: 16px; }
}
