/* ==========================================================================
   Cheongeum Site Policies & Colophon Management Styles
   - 운영 원칙, 제보자 보호 정책, 정정·반론 안내, 운영·개인정보 안내
   - 문의처 정보 및 하단 제호 관리
   - 반규현 편집장 전용 권한 배지 및 에디터 UI
   - 데스크탑 / 모바일 완벽 반응형 & 다크 모드 지원
   ========================================================================== */

/* --- 관리자 전용 수정 툴바 & 배지 --- */
.cg-admin-policy-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #1e3a8a;
  border-radius: 4px;
  padding: 10px 16px;
  margin-bottom: 24px;
  gap: 12px;
  box-sizing: border-box;
}

.cg-admin-policy-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cg-admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #1e3a8a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}

.cg-admin-desc {
  font-size: 12.5px;
  color: #475569;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cg-admin-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #0f172a;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.cg-admin-edit-btn:hover {
  background: #1e3a8a;
  border-color: #1e3a8a;
}

/* 푸터 내 미니 수정 버튼 */
.cg-footer-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(30, 58, 138, 0.1);
  color: #1e3a8a;
  border: 1px solid rgba(30, 58, 138, 0.25);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  cursor: pointer;
  margin-left: 8px;
  vertical-align: middle;
  transition: all 0.15s ease;
}

.cg-footer-edit-btn:hover {
  background: #1e3a8a;
  color: #ffffff;
}

/* --- 정책 페이지 서브탭 (운영원칙 / 제보자보호 / 정정반론) --- */
.cg-policy-nav-tabs {
  display: flex;
  align-items: center;
  border-bottom: 2px solid #0f172a;
  margin-bottom: 24px;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.cg-policy-nav-tabs::-webkit-scrollbar {
  display: none;
}

.cg-policy-tab-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: all 0.15s ease;
  outline: none;
}

.cg-policy-tab-btn:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.cg-policy-tab-btn.active {
  color: #0f172a;
  font-weight: 800;
  background: #f8fafc;
  border-top: 2px solid #1e3a8a;
  border-left: 1px solid #cbd5e1;
  border-right: 1px solid #cbd5e1;
  margin-bottom: -2px;
  border-bottom: 2px solid #f8fafc;
}

/* 정책 상세 본문 포맷팅 */
.cg-policy-content-block {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 24px 28px;
  margin-bottom: 24px;
  line-height: 1.7;
  color: #1e293b;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.cg-policy-content-block h4 {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid #0f172a;
}

.cg-policy-content-block p {
  margin: 0 0 14px;
  color: #334155;
  font-size: 14.5px;
}

.cg-policy-content-block ol,
.cg-policy-content-block ul {
  margin: 0 0 14px;
  padding-left: 20px;
}

.cg-policy-content-block li {
  margin-bottom: 6px;
  color: #334155;
  font-size: 14px;
}

/* --- 모달 편집 창 (In-Page Modal) --- */
.cg-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.cg-modal-card {
  background: #ffffff;
  border-radius: 8px;
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid #cbd5e1;
  overflow: hidden;
  box-sizing: border-box;
}

.cg-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.cg-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
}

.cg-modal-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.cg-modal-close-btn:hover {
  color: #0f172a;
  background: #e2e8f0;
}

.cg-modal-tabs {
  display: flex;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.cg-modal-tabs::-webkit-scrollbar {
  display: none;
}

.cg-modal-tab-btn {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.cg-modal-tab-btn:hover {
  color: #0f172a;
}

.cg-modal-tab-btn.active {
  color: #1e3a8a;
  font-weight: 800;
  border-bottom: 2px solid #1e3a8a;
  background: #ffffff;
}

.cg-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.cg-form-section {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.cg-form-section.active {
  display: flex;
}

.cg-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cg-form-group label {
  font-size: 13.5px;
  font-weight: 700;
  color: #1e293b;
}

.cg-form-group .cg-hint {
  font-size: 12px;
  color: #64748b;
  margin-top: -2px;
}

.cg-form-input,
.cg-form-textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cg-form-input:focus,
.cg-form-textarea:focus {
  outline: none;
  border-color: #1e3a8a;
  box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.15);
}

.cg-form-textarea {
  min-height: 160px;
  line-height: 1.6;
  resize: vertical;
}

.cg-form-textarea.cg-large {
  min-height: 280px;
}

.cg-grid-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.cg-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  gap: 12px;
  flex-wrap: wrap;
}

.cg-foot-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cg-foot-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cg-btn-reset {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cg-btn-reset:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.cg-btn-cancel {
  background: none;
  border: 1px solid transparent;
  color: #64748b;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cg-btn-cancel:hover {
  color: #0f172a;
  background: #e2e8f0;
}

.cg-btn-save {
  background: #1e3a8a;
  border: 1px solid #1e3a8a;
  color: #ffffff;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cg-btn-save:hover {
  background: #172554;
}

.cg-btn-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 상태 토스트 메시지 */
.cg-policy-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: cgFadeIn 0.25s ease-out;
}

.cg-policy-toast.error {
  background: #b91c1c;
}

@keyframes cgFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- 다크 모드 스타일 --- */
html[data-theme="dark"] .cg-admin-policy-bar {
  background: #1e293b;
  border-color: #334155;
  border-left-color: #60a5fa;
}
html[data-theme="dark"] .cg-admin-desc {
  color: #94a3b8;
}
html[data-theme="dark"] .cg-admin-edit-btn {
  background: #334155;
  border-color: #475569;
}
html[data-theme="dark"] .cg-admin-edit-btn:hover {
  background: #1e3a8a;
}
html[data-theme="dark"] .cg-footer-edit-btn {
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.3);
}
html[data-theme="dark"] .cg-policy-nav-tabs {
  border-bottom-color: #334155;
}
html[data-theme="dark"] .cg-policy-tab-btn {
  color: #94a3b8;
}
html[data-theme="dark"] .cg-policy-tab-btn:hover {
  color: #f8fafc;
  background: #1e293b;
}
html[data-theme="dark"] .cg-policy-tab-btn.active {
  color: #f8fafc;
  background: #0f172a;
  border-top-color: #60a5fa;
  border-left-color: #334155;
  border-right-color: #334155;
  border-bottom-color: #0f172a;
}
html[data-theme="dark"] .cg-policy-content-block {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}
html[data-theme="dark"] .cg-policy-content-block h4 {
  color: #f8fafc;
  border-bottom-color: #475569;
}
html[data-theme="dark"] .cg-policy-content-block p,
html[data-theme="dark"] .cg-policy-content-block li {
  color: #cbd5e1;
}
html[data-theme="dark"] .cg-modal-card {
  background: #0f172a;
  border-color: #334155;
}
html[data-theme="dark"] .cg-modal-head {
  background: #1e293b;
  border-bottom-color: #334155;
}
html[data-theme="dark"] .cg-modal-title {
  color: #f8fafc;
}
html[data-theme="dark"] .cg-modal-tabs {
  background: #1e293b;
  border-bottom-color: #334155;
}
html[data-theme="dark"] .cg-modal-tab-btn {
  color: #94a3b8;
}
html[data-theme="dark"] .cg-modal-tab-btn:hover {
  color: #f8fafc;
}
html[data-theme="dark"] .cg-modal-tab-btn.active {
  color: #60a5fa;
  background: #0f172a;
  border-bottom-color: #60a5fa;
}
html[data-theme="dark"] .cg-form-group label {
  color: #f1f5f9;
}
html[data-theme="dark"] .cg-form-group .cg-hint {
  color: #94a3b8;
}
html[data-theme="dark"] .cg-form-input,
html[data-theme="dark"] .cg-form-textarea {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}
html[data-theme="dark"] .cg-modal-foot {
  background: #1e293b;
  border-top-color: #334155;
}
html[data-theme="dark"] .cg-btn-reset {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}
html[data-theme="dark"] .cg-btn-cancel {
  color: #94a3b8;
}

/* --- 겸직 설정 툴 박스 & 프리셋 --- */
.cg-dual-role-box {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #2563eb;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 20px;
}
.cg-dual-role-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 10px;
}
.cg-dual-role-head strong {
  font-size: 13.5px;
  color: #0f172a;
}
.cg-dual-role-head span {
  font-size: 12px;
  color: #475569;
}
.cg-dual-role-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cg-dual-role-buttons button {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.cg-dual-role-buttons button:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

/* --- 수정 권한 설정 카드 & 체크박스 그리드 --- */
.cg-perm-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 16px;
}
.cg-perm-head {
  margin-bottom: 16px;
}
.cg-perm-head h4 {
  margin: 0 0 4px 0;
  font-size: 15px;
  color: #0f172a;
}
.cg-perm-roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
  margin-top: 6px;
}
.cg-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: #1e293b;
  cursor: pointer;
  user-select: none;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 8px 12px;
  border-radius: 4px;
  font-weight: 500;
}
.cg-checkbox-label input[type="checkbox"] {
  cursor: pointer;
  width: 15px;
  height: 15px;
}
.cg-perm-notice {
  margin-top: 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  font-size: 12px;
  line-height: 1.5;
  padding: 9px 12px;
  border-radius: 4px;
}

/* --- 조직도 겸직 카드 스타일링 --- */
.cg-org-chief--dual .cg-org-tag,
.cg-org-chief--triple .cg-org-tag {
  background: #1e3a8a;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.cg-org-chief--triple {
  border-color: #1e3a8a !important;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.12);
}
.cg-org-leaders--single {
  justify-content: center !important;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}
.ce103-team-org-section {
  margin-top: 48px;
  padding-top: 36px;
  border-top: 1px solid #e2e8f0;
}

html[data-theme="dark"] .cg-dual-role-box {
  background: #1e293b;
  border-color: #334155;
  border-left-color: #3b82f6;
}
html[data-theme="dark"] .cg-dual-role-head strong {
  color: #f8fafc;
}
html[data-theme="dark"] .cg-dual-role-head span {
  color: #94a3b8;
}
html[data-theme="dark"] .cg-dual-role-buttons button {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}
html[data-theme="dark"] .cg-dual-role-buttons button:hover {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
}
html[data-theme="dark"] .cg-perm-card {
  background: #1e293b;
  border-color: #334155;
}
html[data-theme="dark"] .cg-perm-head h4 {
  color: #f8fafc;
}
html[data-theme="dark"] .cg-checkbox-label {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}
html[data-theme="dark"] .cg-perm-notice {
  background: #1e3a8a33;
  border-color: #1e3a8a;
  color: #93c5fd;
}

/* --- 모바일 미디어 쿼리 --- */
@media (max-width: 640px) {
  .cg-admin-policy-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
  }
  .cg-admin-edit-btn {
    width: 100%;
    justify-content: center;
  }
  .cg-grid-2col {
    grid-template-columns: 1fr;
  }
  .cg-modal-card {
    max-height: 96vh;
  }
  .cg-modal-head {
    padding: 12px 16px;
  }
  .cg-modal-body {
    padding: 14px 16px;
  }
  .cg-modal-foot {
    padding: 12px 16px;
  }
  .cg-policy-nav-tabs {
    font-size: 13.5px;
  }
  .cg-policy-tab-btn {
    padding: 8px 12px;
    font-size: 13.5px;
  }
}
