/* 민원게시판 전용 스타일 */
:root {
  --primary: #4F46E5;
  --primary-dark: #3730A3;
  --primary-light: #818CF8;
  --primary-bg: #EEF2FF;
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #EEEEEE;
  --gray-300: #E0E0E0;
  --gray-500: #9E9E9E;
  --gray-600: #757575;
  --gray-900: #212121;
  --danger: #E74C3C;
  --radius: 10px;
  --shadow: 0 1px 6px rgba(79,70,229,0.09);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Sans KR','맑은 고딕', -apple-system, sans-serif;
  background: #fff;
  color: var(--gray-900);
  min-height: 100vh;
}

.cp-page {
  width: 100%;
  padding-top: 8px;
}

/* ── 헤더 ──────────────────────────────────────────────── */
.cp-header {
  background: #fff;
  color: var(--gray-900);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--gray-200);
}
.cp-header h1 { font-size: 17px; font-weight: 700; flex: 1; text-align: center; }
.cp-back { background: none; border: none; color: var(--gray-900); font-size: 20px; cursor: pointer; padding: 0 4px; }
.cp-header-right { font-size: 20px; color: var(--gray-600); background: none; border: none; cursor: pointer; padding: 0 4px; }

/* ── 목록 ──────────────────────────────────────────────── */
.cp-list { padding: 8px 0; }

.cp-item {
  display: block;
  background: #fff;
  margin: 4px 0;
  border-radius: 0;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--gray-200);
  transition: background 0.12s;
}
.cp-item:hover { background: var(--gray-50); }
.cp-item-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cp-item-title {
  font-size: 15px;
  font-weight: 700;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--gray-900);
}
.cp-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
  font-weight: 500;
}
.cp-badge-reply { background: #E3F2FD; color: #1565C0; }
.cp-badge-deleted { background: #FFEBEE; color: #C62828; }
.cp-item-meta {
  font-size: 12px;
  color: var(--gray-500);
  display: flex;
  gap: 6px;
  margin-bottom: 5px;
}
.cp-item-preview {
  font-size: 13px;
  color: var(--gray-600);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 상세 - 작성자 메타 바 */
.cp-post-info-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 13px;
  color: var(--gray-600);
  background: #fff;
  flex-wrap: wrap;
}
.cp-post-info-bar .info-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cp-post-info-bar .info-item svg { flex-shrink: 0; }
.cp-post-info-bar .info-time { margin-left: auto; color: var(--gray-500); }
.cp-deleted-notice {
  font-size: 13px;
  color: var(--gray-500);
  margin: 0;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
}

/* FAB 글쓰기 버튼 */
.cp-fab {
  position: fixed;
  bottom: 24px;
  right: max(24px, calc(50% - 340px + 24px));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 26px;
  line-height: 52px;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  z-index: 200;
}
.cp-fab:hover { background: var(--primary-dark); }

/* 빈 상태 */
.cp-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}
.cp-empty .emoji { font-size: 48px; display: block; margin-bottom: 12px; }

/* ── 글쓰기 ──────────────────────────────────────────────── */
.cp-form-wrap {
  padding: 16px 14px 80px;
}
.cp-section { margin-bottom: 16px; }
.cp-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
}
.cp-input, .cp-textarea, .cp-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s;
}
.cp-input:focus, .cp-textarea:focus, .cp-select:focus {
  outline: none;
  border-color: var(--primary);
}
.cp-textarea { min-height: 140px; resize: vertical; line-height: 1.6; }
.cp-row { display: flex; gap: 8px; }
.cp-row .cp-input { flex: 1; }
.cp-input[readonly] { background: var(--gray-100); color: var(--gray-600); }

.cp-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  margin-top: 8px;
}
.cp-btn:hover { background: var(--primary-dark); }
.cp-btn:disabled { background: var(--gray-300); cursor: not-allowed; }
.cp-btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.cp-btn-outline:hover { background: var(--primary-bg); }
.cp-btn-danger {
  background: var(--danger);
}
.cp-btn-danger:hover { background: #C0392B; }
.cp-btn-gray {
  background: var(--gray-200);
  color: var(--gray-900);
}
.cp-btn-gray:hover { background: var(--gray-300); }

.cp-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 6px;
  display: none;
}

/* ── 상세 보기 ──────────────────────────────────────────────── */
.cp-post-body {
  background: #fff;
  margin: 0;
  border-radius: 0;
  padding: 18px 16px;
  border-bottom: 1px solid var(--gray-200);
}
.cp-post-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
}
.cp-post-meta {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.cp-post-writer {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
}
.cp-post-writer-name {
  font-size: 18px;
  font-weight: 500;
  color: var(--primary-dark);
}
.cp-post-writer-phone {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
}
.cp-post-content {
  font-size: 15px;
  line-height: 1.7;
  color: var(--gray-900);
  white-space: pre-wrap;
  word-break: break-word;
}
.cp-post-deleted {
  font-size: 15px;
  color: var(--danger);
  font-weight: 500;
  padding: 20px 0;
  text-align: center;
}

/* 답변 영역 */
.cp-reply-wrap {
  background: var(--primary-bg);
  margin: 0;
  border-radius: 0;
  padding: 14px 16px;
  border-left: 4px solid var(--primary);
  border-bottom: 1px solid var(--gray-200);
}
.cp-reply-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 6px;
}
.cp-reply-content {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.cp-reply-time {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 6px;
}

/* 관리자 액션 패널 */
.cp-admin-panel {
  margin: 0;
  padding: 14px 16px;
  background: #fff;
  border-radius: 0;
  border-bottom: 1px solid var(--gray-200);
}
.cp-admin-panel-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-600);
  margin-bottom: 10px;
}
.cp-admin-btns { display: flex; gap: 8px; }
.cp-admin-btns button { flex: 1; }

/* 답변 입력 폼 */
.cp-reply-form { margin-top: 10px; }
.cp-reply-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--primary);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  min-height: 90px;
  resize: vertical;
  margin-bottom: 8px;
}
.cp-reply-form textarea:focus { outline: none; }

/* 수정 모달 입력 */
.cp-write-input {
  display: block;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s;
}
.cp-write-input:focus { outline: none; border-color: var(--primary); }
.cp-write-textarea {
  display: block;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  background: #fff;
  transition: border-color 0.15s;
}
.cp-write-textarea:focus { outline: none; border-color: var(--primary); }

/* ── 모달 ──────────────────────────────────────────────── */
.cp-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 500;
}
.cp-modal {
  background: #fff;
  width: 100%;
  max-width: 680px;
  border-radius: 16px 16px 0 0;
  padding: 20px 16px 32px;
}
.cp-modal h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}
.cp-modal textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  min-height: 80px;
  resize: vertical;
  margin-bottom: 12px;
}
.cp-modal textarea:focus { outline: none; border-color: var(--primary); }
.cp-modal-btns { display: flex; gap: 8px; }
.cp-modal-btns button { flex: 1; padding: 12px; border-radius: 8px; border: none; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; }

/* ── 개인정보 동의 ──────────────────────────────────────────── */
.cp-privacy-box {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.cp-privacy-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}
.cp-privacy-table th,
.cp-privacy-table td {
  padding: 5px 6px;
  font-size: 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--gray-200);
  line-height: 1.5;
}
.cp-privacy-table th {
  width: 72px;
  color: var(--gray-600);
  font-weight: 600;
  white-space: nowrap;
}
.cp-privacy-table tr:last-child th,
.cp-privacy-table tr:last-child td { border-bottom: none; }
.cp-privacy-note {
  font-size: 11px;
  color: var(--gray-500);
  line-height: 1.5;
  margin-top: 6px;
}
.cp-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 11px 13px;
  background: #fff;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.cp-checkbox-label:hover { border-color: var(--primary); }
.cp-checkbox-label.is-checked {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.cp-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── 이미지 업로드 (작성 폼) ───────────────────────────────────────────────── */
.cp-img-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 20px 16px;
  border: 2px dashed var(--gray-300);
  border-radius: 10px;
  background: var(--gray-50);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.cp-img-upload-area:hover { border-color: var(--primary); background: var(--primary-bg); }
.cp-img-upload-icon { font-size: 28px; }
.cp-img-upload-text { font-size: 14px; font-weight: 600; color: var(--gray-600); }
.cp-img-upload-sub { font-size: 11px; color: var(--gray-500); }

.cp-img-preview-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.cp-img-preview-item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--gray-300);
}
.cp-img-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cp-img-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── 이미지 표시 (상세) ────────────────────────────────────────────────────── */
.cp-post-images {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.cp-post-images a {
  display: block;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: none;
}
.cp-post-images img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  transition: opacity 0.15s;
}
.cp-post-images a:hover img { opacity: 0.9; }

/* 토스트 */
.cp-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 1000;
}
.cp-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
