:root {
  --cn-navy: #0A2D64;
  --cn-teal: #1CA7A3;
  --cn-text: #233854;
  --cn-muted: #6b7f99;
  --cn-border: rgba(10, 45, 100, 0.10);
  --cn-border-strong: rgba(10, 45, 100, 0.16);
  --cn-soft-bg: #f8fbff;
  --cn-danger: #c62828;
  --cn-danger-soft: rgba(198, 40, 40, 0.08);
}

input::placeholder,
textarea::placeholder {
  color: rgba(61, 60, 60, 0.72);
}

.hidden {
  display: none !important;
}

.post-detail-wrapper {
  width: 100%;
  max-width: 90%;
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem;
  margin-bottom: 4rem;
}

.post-detail-card {
  margin-bottom: 2rem;
  background: #fff;
  border: 1px solid var(--cn-border);
  border-radius: 22px;
  padding: 1.4rem;
  box-shadow: 0 10px 28px rgba(10, 45, 100, 0.05);
}

.post-detail-header {
  margin-bottom: 1rem;
}

.post-detail-title-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.65rem;
}

.post-detail-back {
  color: var(--cn-muted);
  text-decoration: none;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.post-detail-back i {
  color: var(--cn-navy);
}

.post-detail-back:hover {
  color: var(--cn-navy);
}

.post-detail-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--cn-navy);
}

.post-detail-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  font-size: 0.9rem;
  color: var(--cn-muted);
  margin-bottom: 1.1rem;
}

.post-detail-author {
  font-weight: 700;
  color: var(--cn-navy);
}

.post-detail-dot,
.post-comment-dot {
  color: #a0a0a0;
}

.post-detail-comments-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.2rem;
  color: var(--cn-navy);
}

.post-detail-comments-meta i {
  color: var(--cn-muted);
  font-size: 0.9rem;
}

.post-detail-body p {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.75;
  color: var(--cn-text);
  max-width: 900px;
  white-space: pre-wrap;
}

.feed-post-tag {
  flex-shrink: 0;
  min-width: 140px;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
  line-height: 1;
  margin-top: 0.2rem;
}

/* -------------------------------------------------------------------------------------------------
   Main Comment Composer
------------------------------------------------------------------------------------------------- */
.comment-input-section {
  margin: 2rem 0 2.25rem;
}

.comment-input-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.comment-input-wrapper {
  position: relative;
  flex: 1;
}

.comment-input {
  width: 100%;
  min-height: 118px;
  max-height: 240px;
  resize: vertical;
  border: 1px solid var(--cn-border-strong);
  border-radius: 20px;
  padding: 1rem 2.8rem 1rem 1rem;
  font-size: 1rem;
  outline: none;
  background: #fff;
  box-sizing: border-box;
  line-height: 1.6;
  overflow-y: auto;
  color: var(--cn-navy);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.comment-input:focus {
  border-color: var(--cn-teal);
  box-shadow: 0 0 0 4px rgba(28, 167, 163, 0.10);
}

.comment-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.comment-submit-btn,
.comment-cancel-btn {
  min-width: 110px;
  min-height: 44px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.comment-cancel-btn {
  background: #dde6f0;
  color: var(--cn-navy);
}

.comment-submit-btn {
  background: var(--cn-navy);
  color: #fff;
}

.comment-cancel-btn:hover,
.comment-submit-btn:hover {
  opacity: 0.94;
}

.comment-clear-btn {
  position: absolute;
  top: 18px;
  right: 16px;
  border: none;
  background: none;
  font-size: 18px;
  color: #9aa7b8;
  cursor: pointer;
  display: none;
  padding: 0;
  line-height: 1;
}

.comment-clear-btn:hover {
  color: #555;
  background: none;
  box-shadow: none;
}

/* -------------------------------------------------------------------------------------------------
   Comments List
------------------------------------------------------------------------------------------------- */
.post-comments-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-comments-empty {
  color: var(--cn-muted);
  font-size: 0.98rem;
  padding: 0.5rem 0;
}

.post-comment-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: #fff;
  border: 1px solid var(--cn-border);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: 0 8px 22px rgba(10, 45, 100, 0.04);
}

.post-comment-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--cn-navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.post-comment-avatar.small {
  width: 34px;
  height: 34px;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.post-comment-content {
  flex: 1;
  min-width: 0;
}

.post-comment-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  color: var(--cn-muted);
}

.post-comment-author {
  color: var(--cn-navy);
  font-weight: 700;
}

.post-comment-body {
  margin-top: 0.25rem;
}

.post-comment-body p {
  margin: 0;
  color: var(--cn-text);
  font-size: 0.97rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.deleted-comment {
  color: #888;
  font-style: italic;
}

/* -------------------------------------------------------------------------------------------------
   Actions
------------------------------------------------------------------------------------------------- */
.post-comment-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.55rem;
  flex-wrap: wrap;
}

.post-comment-actions button {
  background: none;
  transform: none;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  margin-right: 0;
}

.action-item {
  font-size: 0.85rem;
  color: var(--cn-muted);
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.action-item i {
  color: var(--cn-teal);
  font-size: 0.84rem;
}

.action-item:hover {
  background: rgba(10, 45, 100, 0.04);
  color: var(--cn-navy);
}

/* -------------------------------------------------------------------------------------------------
   Replies Container
------------------------------------------------------------------------------------------------- */
.post-comment-replies {
  position: relative;
  padding-left: 16px;
  margin-top: 12px;
}

.post-comment-replies::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 0;
  width: 2px;
  background-color: var(--cn-teal);
  opacity: 0.22;
  border-radius: 2px;
}

.post-comment-reply {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.replying-to,
.replying-to-label {
  font-size: 0.84rem;
  color: var(--cn-muted);
  margin: 4px 0 6px;
  font-weight: 500;
}

.toggle-replies-btn {
  margin-top: 4px;
  margin-left: 44px;
  background: none;
  border: none;
  color: var(--cn-teal);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.toggle-replies-btn:hover {
  text-decoration: underline;
  background: none;
  transform: none;
}

/* -------------------------------------------------------------------------------------------------
   Reply Form
------------------------------------------------------------------------------------------------- */
.reply-cmt-form {
  margin-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.95rem;
  border: 1px solid var(--cn-border);
  border-radius: 18px;
  background: var(--cn-soft-bg);
}

.reply-input-wrapper {
  position: relative;
}

.reply-cmt-input {
  width: 100%;
  min-height: 125px;
  max-height: 220px;
  padding: 1rem 2.4rem 1rem 1rem;
  border: 1px solid var(--cn-border-strong);
  border-radius: 18px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--cn-navy);
  resize: vertical;
  overflow-y: auto;
  box-sizing: border-box;
  background: #fff;
}

.reply-cmt-input:focus {
  outline: none;
  border-color: var(--cn-teal);
  box-shadow: 0 0 0 4px rgba(28, 167, 163, 0.10);
}

.clear-reply-input {
  position: absolute;
  right: 14px;
  top: 14px;
  border: none;
  background: none;
  cursor: pointer;
  color: #9ca3af;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
 padding-top: 0.5rem;
}

.clear-reply-input:hover {
  background: none;
  box-shadow: none;
  color: #555;
  transform: none !important;
}

.reply-cmt-submit-btn {
  align-self: flex-end;
  min-width: 110px;
  min-height: 44px;
  padding: 0.78rem 1rem;
  border-radius: 12px;
  border: none;
  background-color: var(--cn-navy);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.reply-cmt-submit-btn:hover {
  opacity: 0.94;
}

/* -------------------------------------------------------------------------------------------------
   Report Form
------------------------------------------------------------------------------------------------- */
.report-reason-input-container {
  margin-top: 0.85rem;
  padding: 0.95rem;
  border-radius: 16px;
  background: var(--cn-soft-bg);
  border: 1px solid var(--cn-border);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.report-reason-dropdown {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--cn-border-strong);
  border-radius: 12px;
  padding: 0 12px;
  font-size: 0.95rem;
  background: #fff;
  outline: none;
  color: var(--cn-navy);
}

.report-reason-dropdown:focus {
  border-color: var(--cn-teal);
  box-shadow: 0 0 0 4px rgba(28, 167, 163, 0.10);
}

.reason-input {
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--cn-border-strong);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  background: #fff;
  box-sizing: border-box;
  color: var(--cn-navy);
}

.reason-input:focus {
  border-color: var(--cn-teal);
  box-shadow: 0 0 0 4px rgba(28, 167, 163, 0.10);
}

.reason-submit-btn {
  align-self: flex-end;
  min-width: 110px;
  min-height: 44px;
  padding: 0.78rem 1rem;
  border-radius: 12px;
  border: none;
  background: var(--cn-navy);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.reason-submit-btn:hover {
  background: #082654;
}

.reason-submit-btn:active {
  transform: scale(0.98);
}

.reason-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* -------------------------------------------------------------------------------------------------
   Edit Form
------------------------------------------------------------------------------------------------- */
.edit-cmt-form {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.95rem;
  border: 1px solid var(--cn-border);
  border-radius: 16px;
  background: #f9fbff;
}

.edit-cmt-form.hidden {
  display: none;
}

.edit-cmt-input {
  width: 100%;
  min-height: 115px;
  max-height: 240px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--cn-border-strong);
  border-radius: 14px;
  font-size: 1rem;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  background: #fff;
  box-sizing: border-box;
  color: var(--cn-navy);
}

.edit-cmt-input:focus {
  border-color: var(--cn-teal);
  box-shadow: 0 0 0 4px rgba(28, 167, 163, 0.10);
}

.edit-cmt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.edit-cmt-save-btn,
.edit-cmt-cancel-btn {
  min-width: 92px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: none;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.edit-cmt-save-btn {
  background: var(--cn-navy);
  color: #fff;
}

.edit-cmt-cancel-btn {
  background: #eef2f7;
  color: #374151;
}

.edit-cmt-feedback {
  font-size: 0.85rem;
}

.edit-cmt-feedback.error {
  color: var(--cn-danger);
}

.edit-cmt-feedback.success {
  color: var(--cn-teal);
}

/* -------------------------------------------------------------------------------------------------
   Tablet
------------------------------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .main-view-container {
    margin-left: 0;
    margin-top: 0;
    gap: 2rem;
    padding: 0.9rem;
  }

  .post-detail-wrapper {
    padding: 1.25rem 1.25rem 2.25rem;
    max-width: 100%;
  }

  .post-detail-title {
    font-size: 1.65rem;
  }

  .post-detail-body p {
    font-size: 1rem;
  }
}

/* -------------------------------------------------------------------------------------------------
   Mobile
------------------------------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .post-detail-wrapper {
    max-width: 100%;
    padding: 1rem 0.85rem calc(2rem + env(safe-area-inset-bottom));
  }

  .post-detail-card {
    padding: 1rem;
    border-radius: 18px;
  }

  .post-detail-title {
    font-size: 1.22rem;
  }

  .post-detail-meta-row {
    font-size: 0.8rem;
    gap: 0.3rem 0.5rem;
  }

  .post-detail-body p {
    font-size: 0.96rem;
    line-height: 1.65;
  }

  /* Main composer gets more room */
  .comment-input {
    min-height: 140px;
    max-height: 260px;
    padding: 1rem 2.6rem 1rem 1rem;
    font-size: 16px;
    border-radius: 18px;
  }

  .comment-form-actions {
    justify-content: stretch;
  }

  .comment-submit-btn {
    width: 100%;
    min-height: 48px;
  }

  .post-comment-card {
    gap: 0.75rem;
    padding: 0.95rem;
    border-radius: 16px;
  }

  .post-comment-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }

  .post-comment-body p {
    font-size: 0.93rem;
  }

  .toggle-replies-btn:hover {
    text-decoration: none;
  }

  /* Nested replies should not feel squeezed */
  .post-comment-replies {
    padding-left: 25px;
    margin-top: 12px;
    margin-left: 25px;
  }

  .post-comment-reply {
    gap: 8px;
  }

  /* Reply form gets real typing space */
  .reply-cmt-form {
    padding: 0.9rem;
    border-radius: 16px;
  }

  .reply-cmt-input {
    min-height: 145px;
    max-height: 260px;
    font-size: 16px;
    padding: 1rem 2.3rem 1rem 1rem;
    border-radius: 18px;
  }

  .reply-cmt-submit-btn {
    width: 100%;
    min-height: 48px;
    align-self: stretch;
  }

  /* Report form gets better mobile comfort */
  .report-reason-input-container {
    padding: 0.9rem;
    gap: 0.85rem;
    border-radius: 16px;
  }

  .report-reason-dropdown {
    min-height: 50px;
    font-size: 16px;
  }

  .reason-input {
    min-height: 140px;
    font-size: 16px;
    border-radius: 16px;
  }

  .reason-submit-btn {
    width: 100%;
    min-height: 48px;
    align-self: stretch;
  }

  /* Edit form also needs parity */
  .edit-cmt-input {
    min-height: 135px;
    font-size: 16px;
    border-radius: 16px;
  }

  .edit-cmt-actions {
    flex-direction: column-reverse;
  }

  .edit-cmt-save-btn,
  .edit-cmt-cancel-btn {
    width: 100%;
    min-height: 46px;
  }
}

/* -------------------------------------------------------------------------------------------------
   Small Mobile
------------------------------------------------------------------------------------------------- */
@media (max-width: 390px) {
  .post-detail-wrapper {
    padding: 0.9rem 0.75rem calc(1.75rem + env(safe-area-inset-bottom));
  }

  .post-detail-title {
    font-size: 1.08rem;
  }

  .comment-input,
  .reply-cmt-input,
  .reason-input,
  .edit-cmt-input {
    min-height: 135px;
  }
}