/* ============================================================
   cms.css — 교직원 편집 모드 UI
   공개 화면에는 아무 영향이 없습니다.
   (편집 모드가 켜졌을 때만 body에 .cms-on 클래스가 붙습니다)
   ============================================================ */

/* ---------- 상단 관리 바 ---------- */
.cms-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 56px;
  background: #0b1428;
  color: #fff;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 13px;
  box-shadow: 0 2px 18px rgba(0, 0, 0, .28);
}

.cms-bar-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 30px;
  background: #2156f5;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.cms-bar-tag i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #c8f7dd;
  font-style: normal;
}

.cms-bar-user {
  color: #93a0bb;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 210px;
}

.cms-bar-spacer { flex: 1 1 auto; }

.cms-bar button {
  flex: none;
  border: 1px solid #33405e;
  background: transparent;
  color: #dfe5f2;
  font: inherit;
  font-weight: 700;
  font-size: 12.5px;
  padding: 9px 13px;
  border-radius: 7px;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.cms-bar button:hover { background: #1a2743; border-color: #46557a; }
.cms-bar button.cms-primary {
  background: #2156f5;
  border-color: #2156f5;
  color: #fff;
  font-weight: 800;
}
.cms-bar button.cms-primary:hover { background: #1a48d6; }
.cms-bar button.cms-primary:disabled {
  background: #22304f; border-color: #22304f; color: #6a7897; cursor: default;
}
.cms-bar button.cms-on-state { background: #1f7a4d; border-color: #1f7a4d; color: #fff; }

/* 편집 모드일 때 본문을 아래로 밀어 상단 바와 겹치지 않게 */
body.cms-on { padding-top: 56px; }
body.cms-on .nav { top: 56px; }

/* ---------- 편집 가능한 영역 표시 ---------- */
body.cms-editing [data-cms] {
  outline: 1px dashed rgba(33, 86, 245, .55);
  outline-offset: 3px;
  border-radius: 2px;
  cursor: text;
  transition: outline-color .12s, background .12s;
}
body.cms-editing [data-cms]:hover {
  outline: 1px dashed rgba(33, 86, 245, .95);
  background: rgba(33, 86, 245, .05);
}
body.cms-editing [data-cms]:focus {
  outline: 2px solid #2156f5;
  background: rgba(33, 86, 245, .07);
}
/* 어두운 배경 구역에서는 점선을 밝게 */
body.cms-editing .dark [data-cms],
body.cms-editing .check-section > [data-cms],
body.cms-editing .contact [data-cms],
body.cms-editing footer [data-cms],
body.cms-editing .review-grid [data-cms] {
  outline-color: rgba(200, 247, 221, .6);
}

/* 수정된 항목 표시 */
body.cms-editing [data-cms].cms-changed {
  outline: 1px solid #e0a100;
  background: rgba(255, 196, 0, .1);
}

/* 편집 모드에서 링크 클릭 막기 안내 */
body.cms-editing a { cursor: text; }

/* ---------- 링크 주소 편집 모드 ---------- */
body.cms-linkmode a[data-cms-href] {
  outline: 2px solid #e0a100 !important;
  outline-offset: 3px;
  cursor: pointer !important;
  position: relative;
}
body.cms-linkmode a[data-cms-href]:hover { background: rgba(255, 196, 0, .18); }

/* ---------- 로그인 창 ---------- */
.cms-modal {
  position: fixed; inset: 0; z-index: 9500;
  display: grid; place-items: center;
  background: rgba(9, 16, 33, .72);
  backdrop-filter: blur(4px);
  font-family: 'Noto Sans KR', sans-serif;
  padding: 20px;
}
.cms-card {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 34px 30px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  color: #161b28;
}
.cms-card h2 {
  margin: 0 0 6px;
  font-size: 21px;
  letter-spacing: -.03em;
  color: #111c35;
}
.cms-card p.cms-sub { margin: 0 0 24px; color: #707685; font-size: 13px; line-height: 1.6; }
.cms-card label { display: block; font-size: 12px; font-weight: 800; color: #4a5262; margin-bottom: 7px; }
.cms-card input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #d7dbe4;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  margin-bottom: 16px;
  background: #fbfbfd;
}
.cms-card input:focus { outline: 2px solid #2156f5; outline-offset: -1px; border-color: #2156f5; background: #fff; }
.cms-card .cms-card-actions { display: flex; gap: 9px; margin-top: 6px; }
.cms-card button {
  flex: 1;
  border: 0;
  padding: 14px;
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}
.cms-card button.cms-primary { background: #2156f5; color: #fff; }
.cms-card button.cms-ghost { flex: 0 0 auto; background: #eef0f4; color: #555d6c; padding: 14px 18px; }
.cms-card .cms-error {
  margin: 0 0 14px;
  padding: 11px 13px;
  border-radius: 7px;
  background: #fdecec;
  color: #c22b2b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

/* ---------- 변경 이력 패널 ---------- */
.cms-panel {
  position: fixed;
  top: 56px; right: 0; bottom: 0;
  width: min(360px, 92vw);
  z-index: 9200;
  background: #fff;
  box-shadow: -14px 0 46px rgba(0, 0, 0, .2);
  padding: 24px 22px;
  overflow-y: auto;
  font-family: 'Noto Sans KR', sans-serif;
  color: #161b28;
}
.cms-panel h3 { margin: 0 0 4px; font-size: 17px; color: #111c35; }
.cms-panel > p { margin: 0 0 20px; color: #737a89; font-size: 12.5px; line-height: 1.6; }
.cms-rev {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid #eef0f3;
}
.cms-rev div { min-width: 0; }
.cms-rev b { display: block; font-size: 13px; color: #23293a; }
.cms-rev small { color: #8c93a1; font-size: 11.5px; }
.cms-rev button {
  flex: none; border: 1px solid #cdd3de; background: #fff; color: #384054;
  font: inherit; font-size: 12px; font-weight: 800;
  padding: 8px 12px; border-radius: 6px; cursor: pointer;
}
.cms-rev button:hover { border-color: #2156f5; color: #2156f5; }
.cms-panel-close {
  position: absolute; top: 16px; right: 18px;
  border: 0; background: none; font-size: 26px; line-height: 1;
  color: #99a0ae; cursor: pointer;
}

/* ---------- 알림 토스트 ---------- */
.cms-toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%) translateY(90px);
  z-index: 9600;
  background: #111c35;
  color: #fff;
  padding: 13px 22px;
  border-radius: 30px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .3);
  opacity: 0;
  transition: transform .26s cubic-bezier(.2, .9, .3, 1), opacity .26s;
  pointer-events: none;
  max-width: 88vw;
  text-align: center;
}
.cms-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.cms-toast.err { background: #b32d2d; }

/* ---------- 미리보기 모드 안내 띠 ---------- */
.cms-preview-note {
  background: #e0a100;
  color: #2c2200;
  font-weight: 800;
  font-size: 12px;
  padding: 7px 16px;
  text-align: center;
  font-family: 'Noto Sans KR', sans-serif;
}

@media (max-width: 800px) {
  .cms-bar { height: auto; flex-wrap: wrap; padding: 10px 12px; gap: 7px; }
  .cms-bar-user { display: none; }
  .cms-bar-spacer { display: none; }
  .cms-bar button { flex: 1 1 auto; font-size: 12px; padding: 9px 8px; }
  .cms-bar-tag { flex: 1 1 100%; justify-content: center; }
  body.cms-on { padding-top: 108px; }
  body.cms-on .nav { top: 108px; }
  .cms-panel { top: 108px; }
}

/* 미리보기 안내 띠가 있을 때 본문을 조금 더 내림 */
body.cms-on.cms-with-note { padding-top: 88px; }
body.cms-on.cms-with-note .nav { top: 88px; }
body.cms-on.cms-with-note .cms-panel { top: 88px; }
@media (max-width: 800px) {
  body.cms-on.cms-with-note { padding-top: 152px; }
  body.cms-on.cms-with-note .nav { top: 152px; }
  body.cms-on.cms-with-note .cms-panel { top: 152px; }
}

/* ---------- 푸터 · 교직원 로그인 링크 ---------- */
/* 학부모에게는 거의 보이지 않을 만큼 차분하게, 교직원은 위치를 알면 바로 찾도록 */
footer { position: relative; }

.cms-staff-login {
  position: absolute;
  right: 7vw;
  bottom: 11px;
  border: 0;
  background: none;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .01em;
  color: #46506b;
  padding: 6px 2px;
  cursor: pointer;
  transition: color .15s;
}
.cms-staff-login:hover { color: #97a3bd; text-decoration: underline; }
.cms-staff-login:focus-visible {
  outline: 2px solid #2156f5;
  outline-offset: 2px;
  color: #97a3bd;
}

/* 편집 중에는 숨김 (상단 바에 이미 로그아웃이 있음) */
body.cms-on .cms-staff-login { display: none; }

@media (max-width: 800px) {
  .cms-staff-login { right: 24px; bottom: 14px; }
}
