/* 청년뉴딜 콘텐츠 관리자 — 폼 기반 에디터 */
@font-face {
  font-family: "Pretendard GOV";
  font-weight: 400; font-style: normal; font-display: swap;
  src: url("../../../assets/krds/fonts/PretendardGOV-Regular.subset.woff2") format("woff2");
}
@font-face {
  font-family: "Pretendard GOV";
  font-weight: 700; font-style: normal; font-display: swap;
  src: url("../../../assets/krds/fonts/PretendardGOV-Bold.subset.woff2") format("woff2");
}

:root {
  --primary: #256ef4;
  --primary-d: #0b50d0;
  --ink: #1e2124;
  --muted: #5d636b;
  --line: #dde1e6;
  --bg: #eef1f5;
  --card: #fff;
  --danger: #d63d4a;
  --radius: 10px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Pretendard GOV", "Pretendard", -apple-system, "Malgun Gothic", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  word-break: keep-all;
}
code { background: #eaeef3; padding: 1px 6px; border-radius: 5px; font-size: 0.92em; }

/* ----- 버튼 ----- */
.btn {
  font: inherit; font-weight: 700; cursor: pointer;
  padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.btn:hover { background: #f3f5f8; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(0,0,0,0.05); }
.btn-block { width: 100%; padding: 12px; font-size: 17px; }
.btn-add { border-style: dashed; color: var(--primary); border-color: var(--primary); width: 100%; margin: 6px 0 16px; }
.btn-add:hover { background: #eef4ff; }

/* ----- 필드 공통 ----- */
.field { display: block; margin: 0 0 14px; }
.field-label { display: block; font-size: 14px; font-weight: 700; color: #353b42; margin-bottom: 5px; }
.field input[type="text"], .field input[type="password"], .field input[type="url"],
.field select, .field textarea, .with-toggle textarea, .link-box input {
  width: 100%; font: inherit; color: var(--ink);
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.field textarea, .with-toggle textarea { resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus, .link-box input:focus {
  outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary);
}
input:disabled, textarea:disabled { background: #f1f3f6; color: #9aa1a9; }
.field-hint { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: #353b42; margin: -6px 0 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; }
.link-box { border: 1px dashed var(--line); border-radius: 8px; padding: 12px 12px 0; }

/* ===== 로그인 ===== */
.login-view:not([hidden]) {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px;
  box-shadow: 0 12px 40px rgba(16,56,92,0.10);
}
.login-title { margin: 0 0 22px; font-size: 22px; }
.login-error { min-height: 18px; margin: 2px 0 10px; font-size: 13px; color: var(--danger); font-weight: 700; }

/* ===== 에디터 ===== */
.editor-view:not([hidden]) { display: flex; flex-direction: column; height: 100vh; }
.adm-header { background: #16243f; color: #fff; flex: none; }
.adm-header-in { display: flex; align-items: center; gap: 14px; max-width: 980px; margin: 0 auto; padding: 12px 20px; }
.adm-title { font-size: 17px; }
.adm-counts { font-size: 13px; color: #b8c4d6; margin-left: 4px; }
.adm-header .btn-ghost { margin-left: auto; color: #cdd6e4; }
.adm-header .btn-ghost:hover { background: rgba(255,255,255,0.12); }

.adm-warn { flex: none; background: #fff6e6; border-bottom: 1px solid #f0dcad; color: #6b4e16; font-size: 13px; padding: 9px 20px; text-align: center; }
.adm-warn code { background: #f3e6c5; }

.section-tabs { flex: none; display: flex; gap: 4px; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--line); padding: 0 16px; }
.sect-tab {
  font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
  border: 0; background: none; color: var(--muted);
  padding: 13px 14px; border-bottom: 3px solid transparent;
}
.sect-tab:hover { color: var(--ink); }
.sect-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

.editor-body { flex: 1; overflow-y: auto; padding: 22px 16px 40px; }
.editor-body > div, .card { max-width: 760px; margin-left: auto; margin-right: auto; }

.cat-head { max-width: 760px; margin: 0 auto 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .cat-head { grid-template-columns: 1fr; } }

.cat-order { max-width: 760px; margin: 0 auto 12px; display: flex; align-items: center; gap: 8px; }
.cat-order-label { font-size: 13px; font-weight: 700; color: var(--muted); margin-right: 2px; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 4px; margin-bottom: 16px;
}
.card-title { margin: 0 0 14px; font-size: 16px; }
.subtabs-card { background: #f7f9fc; }

.prog-card { padding-top: 12px; }
.prog-bar { display: flex; align-items: center; margin: -4px -4px 12px; }
.prog-idx { font-size: 13px; font-weight: 700; color: var(--muted); }
.prog-tools { margin-left: auto; display: flex; gap: 4px; }
.icon-btn { font: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 7px; width: 32px; height: 30px; line-height: 1; }
.icon-btn:hover { background: #f3f5f8; }
.icon-btn.danger { color: var(--danger); border-color: #f0c9cd; }
.icon-btn.danger:hover { background: #fdeef0; }

/* ===== 하단 툴바 ===== */
.adm-toolbar { flex: none; display: flex; align-items: center; gap: 8px; background: #fff; border-top: 1px solid var(--line); padding: 12px 20px; }
.tb-right { margin-left: auto; display: flex; gap: 8px; }
@media (max-width: 600px) { .adm-toolbar { flex-wrap: wrap; } .tb-right { width: 100%; } }

/* ===== 토스트 ===== */
.flash {
  position: fixed; left: 50%; bottom: 76px; transform: translate(-50%, 16px);
  background: #16243f; color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: 90vw;
}
.flash.show { opacity: 1; transform: translate(-50%, 0); }
