/* =====================================================
   마이리틀채터박스 — 댓글 시스템 스타일
===================================================== */

/* ── 섹션 래퍼 ── */
.cm-section {
  max-width: 780px;
  margin: 0 auto 0;
  padding: 0 24px 48px;
}

/* 자료 목록 바로 아래 이어붙이기용 구분선 */
.cm-divider {
  max-width: 780px;
  margin: 0 auto;
  border: none;
  border-top: 1px solid #EDE8E0;
  padding: 0 24px;
}

.cm-section-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-brown);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #EDE8E0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cm-section-title svg {
  width: 18px; height: 18px;
  color: var(--color-sage-dark);
}
.cm-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-sage-dark);
  background: var(--color-sage-light, #EAF3EB);
  padding: 2px 10px;
  border-radius: 999px;
}

/* ── 댓글 작성 폼 ── */
.cm-form-wrap {
  background: #fff;
  border: 1px solid #EDE8E0;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}
.cm-form-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-brown);
  margin-bottom: 16px;
}
.cm-form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.cm-form-row input {
  flex: 1;
  height: 42px;
  padding: 0 14px;
  border: 1px solid #DDD6CC;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--color-text);
  background: #FAFAF8;
  transition: border-color 0.18s;
  outline: none;
}
.cm-form-row input:focus { border-color: var(--color-sage); background: #fff; }
.cm-form-row input::placeholder { color: #B0A898; }

.cm-textarea {
  width: 100%;
  min-height: 90px;
  padding: 12px 14px;
  border: 1px solid #DDD6CC;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--color-text);
  background: #FAFAF8;
  resize: vertical;
  transition: border-color 0.18s;
  outline: none;
  margin-bottom: 10px;
}
.cm-textarea:focus { border-color: var(--color-sage); background: #fff; }
.cm-textarea::placeholder { color: #B0A898; }

.cm-form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.cm-secret-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  color: var(--color-text-light);
  cursor: pointer;
  user-select: none;
}
.cm-secret-label input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--color-sage-dark);
  cursor: pointer;
}
.cm-submit-btn {
  height: 40px;
  padding: 0 22px;
  background: linear-gradient(135deg, var(--color-sage, #7DAF82), var(--color-sage-dark, #5E8A61));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.18s, transform 0.18s;
}
.cm-submit-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.cm-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── 댓글 목록 ── */
.cm-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.cm-empty {
  text-align: center;
  padding: 40px 0;
  font-size: 0.88rem;
  color: var(--color-text-light);
  line-height: 1.8;
}

/* ── 댓글 아이템 ── */
.cm-item {
  border-bottom: 1px solid #F0EBE3;
  padding: 20px 0;
  position: relative;
  animation: cmFadeIn 0.3s ease;
}
.cm-item:last-child { border-bottom: none; }

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

/* 답글 들여쓰기 */
.cm-item.cm-reply {
  padding-left: 24px;
  margin-left: 20px;
  border-left: 2px solid #EDE8E0;
  background: transparent;
}

.cm-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.cm-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-sage-light, #EAF3EB), #D6E9D7);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700;
  color: var(--color-sage-dark, #5E8A61);
  flex-shrink: 0;
}
.cm-reply .cm-avatar {
  background: linear-gradient(135deg, #F5EFE6, #EDE8E0);
  color: var(--color-brown);
}
.cm-nickname {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-brown);
}
.cm-admin-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--color-sage-dark, #5E8A61);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}
.cm-secret-badge {
  font-size: 0.7rem;
  font-weight: 600;
  background: #F0EBE3;
  color: var(--color-text-light);
  padding: 2px 8px;
  border-radius: 999px;
  display: flex; align-items: center; gap: 3px;
}
.cm-secret-badge svg { width: 11px; height: 11px; }
.cm-date {
  font-size: 0.75rem;
  color: #B0A898;
  margin-left: auto;
}

.cm-body {
  font-size: 0.875rem;
  color: var(--color-text);
  line-height: 1.75;
  word-break: break-word;
  white-space: pre-wrap;
  margin-left: 40px;
}
.cm-body.cm-secret-content {
  color: var(--color-text-light);
  font-style: italic;
  display: flex; align-items: center; gap: 6px;
}
.cm-body.cm-secret-content svg { width: 14px; height: 14px; flex-shrink: 0; }

.cm-actions {
  display: flex;
  gap: 8px;
  margin-left: 40px;
  margin-top: 8px;
}
.cm-action-btn {
  font-size: 0.75rem;
  color: #B0A898;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-sans);
  transition: color 0.15s;
  display: flex; align-items: center; gap: 3px;
}
.cm-action-btn:hover { color: var(--color-sage-dark); }
.cm-action-btn.delete:hover { color: #C0504A; }
.cm-action-btn svg { width: 12px; height: 12px; }

/* ── 답글 작성 폼 (인라인) ── */
.cm-reply-form {
  margin-top: 12px;
  margin-left: 40px;
  background: #FAFAF8;
  border: 1px solid #EDE8E0;
  border-radius: 12px;
  padding: 16px;
  display: none;
}
.cm-reply-form.open { display: block; animation: cmFadeIn 0.2s ease; }
.cm-reply-form .cm-form-row input { background: #fff; }
.cm-reply-form .cm-textarea { background: #fff; min-height: 72px; }

/* ── 비밀번호 확인 모달 ── */
.cm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: cmFadeIn 0.2s ease;
}
.cm-modal {
  background: #fff;
  border-radius: 18px;
  padding: 32px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.cm-modal h3 {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-brown);
  margin-bottom: 6px;
}
.cm-modal p {
  font-size: 0.82rem;
  color: var(--color-text-light);
  margin-bottom: 16px;
  line-height: 1.6;
}
.cm-modal input {
  width: 100%; height: 44px;
  padding: 0 14px;
  border: 1px solid #DDD6CC;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  outline: none;
  margin-bottom: 14px;
  transition: border-color 0.18s;
}
.cm-modal input:focus { border-color: var(--color-sage); }
.cm-modal-btns {
  display: flex; gap: 8px;
}
.cm-modal-btns button {
  flex: 1; height: 42px;
  border: none; border-radius: 10px;
  font-family: var(--font-sans); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: opacity 0.18s;
}
.cm-modal-btns .cm-modal-cancel {
  background: #F0EBE3; color: var(--color-text-light);
}
.cm-modal-btns .cm-modal-confirm {
  background: linear-gradient(135deg, var(--color-sage, #7DAF82), var(--color-sage-dark, #5E8A61));
  color: #fff;
}
.cm-modal-btns button:hover { opacity: 0.85; }
.cm-modal-error {
  font-size: 0.8rem;
  color: #C0504A;
  margin-top: -8px;
  margin-bottom: 10px;
  display: none;
}

/* ── 토스트 알림 ── */
.cm-toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #2D2D2D;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: 999px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  white-space: nowrap;
}
.cm-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.cm-toast.success { background: var(--color-sage-dark, #5E8A61); }
.cm-toast.error   { background: #C0504A; }

/* ── 로딩 스피너 ── */
.cm-loading {
  text-align: center;
  padding: 32px 0;
  color: var(--color-text-light);
  font-size: 0.875rem;
}
.cm-spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 2px solid #EDE8E0;
  border-top-color: var(--color-sage-dark, #5E8A61);
  border-radius: 50%;
  animation: cmSpin 0.7s linear infinite;
  margin-bottom: 8px;
}
@keyframes cmSpin { to { transform: rotate(360deg); } }

/* ── 좋아요(하트) 버튼 ── */
.cm-like-wrap {
  display: flex;
  justify-content: center;
  margin: 28px 0 20px;
}
.cm-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 2px solid #F0EBE3;
  border-radius: 999px;
  padding: 12px 28px;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-text-light);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  user-select: none;
  position: relative;
  overflow: hidden;
}
.cm-like-btn:hover {
  border-color: #F2A8B8;
  color: #E06080;
  background: #FFF5F7;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(224,96,128,0.15);
}
.cm-like-btn.liked {
  border-color: #F2A8B8;
  background: linear-gradient(135deg, #FFF0F4, #FFE4EC);
  color: #E06080;
  box-shadow: 0 4px 16px rgba(224,96,128,0.2);
}
.cm-like-btn svg {
  width: 20px; height: 20px;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), fill 0.2s;
  flex-shrink: 0;
}
.cm-like-btn:not(.liked) svg { fill: none; stroke: currentColor; stroke-width: 2; }
.cm-like-btn.liked svg { fill: #E06080; stroke: #E06080; stroke-width: 2; }
.cm-like-btn:active svg { transform: scale(0.85); }
.cm-like-btn.liked svg { animation: heartPop 0.3s cubic-bezier(.34,1.56,.64,1); }
@keyframes heartPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}
.cm-like-count {
  font-size: 0.95rem;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
}

/* ── 댓글 섹션 힌트 배너 ── */
.cm-hint-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #EAF3EB 0%, #F5EFE6 100%);
  border: 1px solid #D4E8D5;
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  color: var(--color-sage-dark, #5E8A61);
  font-weight: 500;
  line-height: 1.5;
}
.cm-hint-banner svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
  color: var(--color-sage-dark, #5E8A61);
  opacity: 0.85;
}
.cm-hint-banner strong {
  font-weight: 700;
  color: var(--color-sage-dark, #5E8A61);
}

/* ── 이전글/다음글 네비게이션 ── */
.post-nav {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.post-nav-label { display: none; }
.post-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
  transition: background 0.15s;
}
.post-nav-item:hover { background: #F5F0EB; }
.post-nav-item.disabled {
  opacity: 0.35;
  pointer-events: none;
  cursor: default;
}
.post-nav-dir {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-text-light, #7A7A7A);
}
.post-nav-dir svg { width: 15px; height: 15px; }
.post-nav-item:hover .post-nav-dir { color: var(--color-sage-dark, #5E8A61); }
.post-nav-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.post-nav-caption {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-text-light, #7A7A7A);
  letter-spacing: 0.04em;
}
.post-nav-title {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--color-brown, #6B4F3A);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.post-nav-badge { display: none; }

/* ── 반응형 ── */
@media (max-width: 600px) {
  .post-nav { padding: 0 16px 40px; }
  .cm-section { padding: 0 16px 48px; }
  .cm-form-wrap { padding: 16px 14px; }
  .cm-form-row { flex-direction: column; }
  .cm-item.cm-reply { margin-left: 10px; padding-left: 14px; }
  .cm-body, .cm-actions, .cm-reply-form { margin-left: 0; }
  .cm-like-btn { padding: 10px 22px; font-size: 0.86rem; }
  .cm-like-wrap { margin: 20px 0 16px; }
}
