/* =========================================================================
   BIJU 웹앱 런처 — 공용 스타일
   브랜드: 오렌지 #F47920 / 딥오렌지 #EC6608 / 차콜 #58595B / 그레이 #818286
   시그니처: 육각형(hexagon) 타일 — BIJU 아이콘에서 가져온 모티프
   ========================================================================= */

@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

:root {
  --orange: #f47920;
  --orange-deep: #ec6608;
  --charcoal: #313235;
  --charcoal-soft: #58595b;
  --gray: #818286;
  --gray-light: #9e9fa3;

  --bg: #f3f4f5;
  --surface: #ffffff;
  --line: #e6e7e9;
  --line-soft: #eef0f1;

  --active: #15803d;   --active-bg: #e7f5ec;
  --dev: #2563eb;      --dev-bg: #e9eefe;
  --pending: #b45309;  --pending-bg: #fbf0e0;

  --shadow-sm: 0 1px 2px rgba(49, 50, 53, .05), 0 2px 8px rgba(49, 50, 53, .04);
  --shadow-md: 0 6px 22px rgba(49, 50, 53, .10);

  --radius: 16px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--charcoal);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

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

/* ---------- 상단바 --------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { height: 26px; width: auto; display: block; }
.brand .divider {
  width: 1px; height: 20px; background: var(--line);
}
.brand .sub {
  font-size: 14px; font-weight: 600; color: var(--gray);
  white-space: nowrap;
}
.nav { display: flex; align-items: center; gap: 6px; }
.nav a {
  font-size: 14px; font-weight: 600; color: var(--gray);
  padding: 8px 14px; border-radius: 10px; transition: .15s;
}
.nav a:hover { color: var(--charcoal); background: var(--line-soft); }
.nav a.active { color: var(--orange-deep); background: #fdf1e6; }

/* ---------- 레이아웃 -------------------------------------------------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px 72px; }

/* ---------- 히어로 ---------------------------------------------------- */
.hero {
  position: relative;
  padding: 56px 0 32px;
  overflow: hidden;
}
/* 육각형 워터마크 */
.hero::before {
  content: "";
  position: absolute;
  top: -60px; right: -40px;
  width: 320px; height: 320px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='104' viewBox='0 0 120 104'%3E%3Cpath d='M30 2 L90 2 L118 52 L90 102 L30 102 L2 52 Z' fill='none' stroke='%23f47920' stroke-width='2'/%3E%3C/svg%3E")
    repeat;
  opacity: .06;
  transform: rotate(6deg);
  pointer-events: none;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--orange-deep); text-transform: uppercase;
  margin-bottom: 14px;
}
.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--orange); box-shadow: 0 0 0 4px #fdf1e6;
}
.hero h1 {
  margin: 0;
  font-size: clamp(30px, 4.4vw, 46px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--charcoal);
}
.hero h1 .accent { color: var(--orange); }
.hero p.lead {
  margin: 16px 0 0;
  max-width: 560px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--gray);
}

/* ---------- 통계 ------------------------------------------------------ */
.stats {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 30px;
}
.stat {
  flex: 1 1 0; min-width: 120px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: .15s;
}
.stat:hover { border-color: var(--gray-light); transform: translateY(-2px); }
.stat.is-on { border-color: var(--orange); box-shadow: 0 0 0 3px #fdf1e6; }
.stat .num {
  font-size: 30px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat .lbl {
  margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--gray);
  display: flex; align-items: center; gap: 7px;
}
.stat .lbl .tick { width: 9px; height: 9px; border-radius: 3px; }
.stat[data-k="all"]     .num { color: var(--charcoal); }
.stat[data-k="active"]  .tick { background: var(--active); }
.stat[data-k="dev"]     .tick { background: var(--dev); }
.stat[data-k="pending"] .tick { background: var(--pending); }

/* ---------- 툴바 ------------------------------------------------------ */
.toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 40px 0 20px;
}
.search {
  position: relative; flex: 1 1 260px; max-width: 420px;
}
.search svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--gray-light);
}
.search input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-family: var(--font); font-size: 14.5px; color: var(--charcoal);
  transition: .15s;
}
.search input:focus {
  outline: none; border-color: var(--orange);
  box-shadow: 0 0 0 3px #fdf1e6;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--gray);
  font-family: var(--font); font-size: 13.5px; font-weight: 600;
  padding: 9px 15px; border-radius: 999px; cursor: pointer;
  transition: .15s;
}
.chip:hover { color: var(--charcoal); border-color: var(--gray-light); }
.chip.is-on {
  color: #fff; background: var(--charcoal); border-color: var(--charcoal);
}

/* ---------- 카드 그리드 ---------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.card {
  position: relative;
  display: flex; gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--orange);
}
.card:focus-visible {
  outline: 3px solid #fdf1e6; outline-offset: 2px; border-color: var(--orange);
}

/* 육각형 아이콘 타일 (시그니처) */
.hex {
  flex: none;
  width: 52px; height: 58px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 21px;
  background: linear-gradient(150deg, var(--orange) 0%, var(--orange-deep) 100%);
}
.card.s-active  .hex { background: linear-gradient(150deg, #f47920, #ec6608); }
.card.s-dev     .hex { background: linear-gradient(150deg, #6f7073, #58595b); }
.card.s-pending .hex { background: linear-gradient(150deg, #a9aaad, #818286); }

.card-body { min-width: 0; flex: 1; }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-title {
  margin: 0; font-size: 16.5px; font-weight: 700; color: var(--charcoal);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-desc {
  margin: 7px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--gray);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-url {
  margin-top: 13px;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 12px; color: var(--gray-light);
  max-width: 100%;
}
.card-url span {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-url svg { width: 13px; height: 13px; flex: none; }

.badge {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
}
.badge .d { width: 6px; height: 6px; border-radius: 50%; }
.badge.b-active  { color: var(--active);  background: var(--active-bg); }
.badge.b-active .d  { background: var(--active); }
.badge.b-dev     { color: var(--dev);     background: var(--dev-bg); }
.badge.b-dev .d     { background: var(--dev); }
.badge.b-pending { color: var(--pending); background: var(--pending-bg); }
.badge.b-pending .d { background: var(--pending); }

.card-go {
  position: absolute; top: 18px; right: 18px;
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  color: var(--gray-light); background: var(--line-soft);
  transition: .16s;
}
.card:hover .card-go {
  color: #fff; background: var(--orange); transform: translate(2px, -2px);
}
.card-go svg { width: 15px; height: 15px; }

/* ---------- 빈 상태 --------------------------------------------------- */
.empty {
  text-align: center; padding: 72px 20px; color: var(--gray);
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.empty .hexbig {
  width: 60px; height: 66px; margin: 0 auto 18px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: var(--line-soft);
}
.empty h3 { margin: 0 0 6px; color: var(--charcoal); font-size: 17px; }
.empty p { margin: 0; font-size: 14px; }
.empty a.btn { margin-top: 18px; }

/* ---------- 버튼 ------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font); font-size: 14px; font-weight: 700;
  padding: 11px 18px; border-radius: 11px; border: 1px solid transparent;
  cursor: pointer; transition: .15s;
}
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-deep); }
.btn-ghost { background: var(--surface); color: var(--charcoal); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--gray-light); }
.btn-danger { background: #fff; color: #c0392b; border-color: #f0d5d1; }
.btn-danger:hover { background: #fdecea; }

/* ---------- 관리 페이지 ---------------------------------------------- */
.admin-grid {
  display: grid; grid-template-columns: 380px 1fr; gap: 24px;
  align-items: start; margin-top: 32px;
}
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.panel-head {
  padding: 18px 22px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 800; }
.panel-head .count { font-size: 13px; font-weight: 600; color: var(--gray); }
.panel-body { padding: 22px; }

.form-sticky { position: sticky; top: 84px; }
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; font-weight: 700; color: var(--charcoal-soft);
  margin-bottom: 7px;
}
.field label .req { color: var(--orange); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; font-family: var(--font);
  font-size: 14px; color: var(--charcoal); transition: .15s;
}
.field textarea { resize: vertical; min-height: 76px; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px #fdf1e6;
}
.field .hint { margin-top: 6px; font-size: 12px; color: var(--gray-light); }

.status-pick { display: flex; gap: 8px; }
.status-pick label {
  flex: 1; margin: 0; cursor: pointer;
}
.status-pick input { display: none; }
.status-pick .opt {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 6px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 13px; font-weight: 700; color: var(--gray);
  transition: .15s;
}
.status-pick .opt .d { width: 8px; height: 8px; border-radius: 50%; }
.status-pick label:nth-child(1) .d { background: var(--active); }
.status-pick label:nth-child(2) .d { background: var(--dev); }
.status-pick label:nth-child(3) .d { background: var(--pending); }
.status-pick input:checked + .opt {
  border-color: var(--charcoal); color: var(--charcoal);
  background: var(--line-soft);
}

.form-actions { display: flex; gap: 10px; margin-top: 22px; }
.form-actions .btn { flex: 1; justify-content: center; }

/* 관리 목록 */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 22px; border-bottom: 1px solid var(--line-soft);
}
.row:last-child { border-bottom: none; }
.row .hex { width: 40px; height: 45px; font-size: 16px; }
.row .r-body { flex: 1; min-width: 0; }
.row .r-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 9px; }
.row .r-title span.name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r-url {
  font-family: var(--mono); font-size: 12px; color: var(--gray-light);
  margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row .r-actions { display: flex; gap: 8px; flex: none; }
.row .r-actions .btn { padding: 8px 12px; font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--charcoal); color: #fff; font-size: 14px; font-weight: 600;
  padding: 12px 20px; border-radius: 12px; box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transition: .25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 반응형 ---------------------------------------------------- */
@media (max-width: 860px) {
  .admin-grid { grid-template-columns: 1fr; }
  .form-sticky { position: static; }
}
@media (max-width: 560px) {
  .topbar-inner, .wrap { padding-left: 16px; padding-right: 16px; }
  .brand .sub { display: none; }
  .hero { padding-top: 40px; }
  .row { flex-wrap: wrap; }
  .row .r-actions { width: 100%; }
  .row .r-actions .btn { flex: 1; justify-content: center; }
}

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