/* ===== Comment System v1 ===== */

/* -- Commented text highlight -- */
.cs-highlight {
  border-bottom: 2px dashed #b88494;
  cursor: pointer;
  transition: background 0.2s;
}
.cs-highlight:hover {
  background: rgba(184, 132, 148, 0.08);
}

/* -- Comment count badge -- */
.cs-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #b88494;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  margin-left: 3px;
  vertical-align: super;
  transition: background 0.2s;
}
.cs-badge:hover {
  background: #9e6d7c;
}

/* -- Floating comment marker button (on text selection) -- */
.cs-marker-btn {
  position: fixed;
  z-index: 500;
  display: none;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  white-space: nowrap;
  font-family: 'Inter', -apple-system, sans-serif;
  transition: background 0.2s, transform 0.15s;
}
.cs-marker-btn:hover {
  background: #b88494;
  transform: translateY(-1px);
}
.cs-marker-btn::before {
  content: '+';
  font-size: 17px;
  font-weight: 300;
  line-height: 1;
}

/* ===== Comment Sidebar (PC: right column) ===== */
.cs-sidebar {
  display: none;
  flex-direction: column;
  max-height: calc(100vh - 120px);
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  background: #fcfaf8;
  box-shadow: 0 2px 16px rgba(0,0,0,0.04);
  position: sticky;
  top: 100px;
  grid-column: 2;
  grid-row: 1;
}
.cs-sidebar.open {
  display: flex;
}
.cs-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}
.cs-sidebar-title {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
}
/* Shared header classes used by both sidebar (PC) and bubble (mobile) */
.cs-bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}
.cs-bubble-title {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
}
.cs-sidebar-back {
  font-size: 11px;
  font-weight: 500;
  color: #b88494;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  transition: color 0.2s;
}
.cs-sidebar-back:hover {
  color: #9e6d7c;
}

/* -- Quoted sentence preview in sidebar -- */
.cs-quote-preview {
  padding: 10px 14px;
  font-size: 12px;
  font-style: italic;
  color: #666;
  line-height: 1.6;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  background: rgba(184,132,148,0.03);
  flex-shrink: 0;
}

/* -- Comment list inside sidebar -- */
.cs-comment-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px;
}
.cs-comment-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.cs-comment-item:last-child {
  border-bottom: none;
}
.cs-comment-name {
  font-size: 11px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 3px;
}
.cs-comment-text {
  font-size: 12px;
  color: #555;
  line-height: 1.6;
}
.cs-comment-time {
  font-size: 10px;
  color: #aaa;
  margin-top: 3px;
}

/* -- Admin reply styling -- */
.cs-comment-item.cs-admin-reply {
  margin-left: 12px;
  padding-left: 12px;
  border-left: 2px solid #b88494;
  background: rgba(184,132,148,0.04);
  border-radius: 0 6px 6px 0;
  margin-top: 4px;
  margin-bottom: 4px;
}
.cs-admin-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #b88494;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid rgba(184,132,148,0.3);
  border-radius: 3px;
  vertical-align: middle;
}

/* -- Pagination -- */
.cs-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 14px 10px;
  font-size: 11px;
  color: #999;
  flex-shrink: 0;
  border-top: 1px solid rgba(0,0,0,0.04);
}
.cs-page-btn {
  padding: 3px 9px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fcfaf8;
  font-size: 11px;
  cursor: pointer;
  color: #555;
  transition: all 0.2s;
  font-family: 'Inter', -apple-system, sans-serif;
}
.cs-page-btn:hover:not(:disabled) {
  border-color: #b88494;
  color: #b88494;
}
.cs-page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* -- Comment form inside sidebar -- */
.cs-comment-form {
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(0,0,0,0.06);
  background: rgba(0,0,0,0.01);
  flex-shrink: 0;
}
.cs-form-field {
  margin-bottom: 8px;
}
.cs-form-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 3px;
}
.cs-form-input,
.cs-form-textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px;
  font-size: 12px;
  font-family: 'Inter', -apple-system, sans-serif;
  color: #1a1a1a;
  background: #fcfaf8;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.cs-form-input:focus,
.cs-form-textarea:focus {
  outline: none;
  border-color: #b88494;
}
.cs-form-textarea {
  resize: vertical;
  min-height: 65px;
  max-height: 160px;
  line-height: 1.5;
}
.cs-form-submit {
  width: 100%;
  padding: 9px 0;
  background: #b88494;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  font-family: 'Inter', -apple-system, sans-serif;
  transition: background 0.2s;
  margin-top: 4px;
}
.cs-form-submit:hover {
  background: #9e6d7c;
}
.cs-form-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.cs-form-note {
  font-size: 10px;
  color: #aaa;
  text-align: center;
  margin-top: 6px;
  line-height: 1.4;
}

/* -- Empty / loading states -- */
.cs-empty {
  text-align: center;
  padding: 24px 16px;
  font-size: 12px;
  color: #aaa;
  font-style: italic;
}

/* -- General comment form (bottom section) -- */
.cs-general-form {
 margin-top: 32px;
  padding: 24px;
  margin-bottom: 32px;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 10px;
}
.cs-general-form-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}
.cs-general-form .cs-form-input,
.cs-general-form .cs-form-textarea {
  max-width: 100%;
}

/* ===== Bottom comment threads section ===== */
.comment-threads-section {
  max-width: 1140px;
  margin: 48px auto 0;
  padding: 0 24px;
}
.comment-threads-heading {
  font-family: 'Playfair Display', serif;
  font-size: clamp(20px, 2.5vw, 26px);
  font-weight: 600;
  margin-bottom: 24px;
  padding-bottom: 12px;
}
.comment-threads-heading em {
  font-style: italic;
  color: #b88494;
}
.cs-thread-card {
  margin-bottom: 20px;
  padding: 18px 22px;
  background: #fcfaf8;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 8px;
}
.cs-thread-quote {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-style: italic;
  color: #1a1a1a;
  line-height: 1.6;
  padding-left: 14px;
  border-left: 2px solid #b88494;
  margin-bottom: 14px;
}
.cs-thread-quote[onclick] {
  cursor: pointer;
  transition: border-color 0.2s;
}
.cs-thread-quote[onclick]:hover {
  border-color: #9e6d7c;
}
.cs-thread-quote del {
  color: #aaa;
  text-decoration: line-through;
}
.cs-thread-quote .cs-orphan-note {
  display: block;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 10px;
  font-style: normal;
  color: #bbb;
  margin-top: 4px;
}
.cs-thread-comments .cs-comment-item {
  padding: 10px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.cs-thread-comments .cs-comment-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* ===== Toast notification ===== */
.cs-toast {
  position: fixed;
  bottom: 80px;
  right: 28px;
  background: #1a1a1a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  z-index: 600;
  pointer-events: none;
}
.cs-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Mobile: full-screen modal ===== */
@media (max-width: 1000px) {
  .cs-sidebar {
    display: none !important;
  }
  .cs-bubble {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 700;
    background: #fcfaf8;
    flex-direction: column;
    overflow: hidden;
  }
  .cs-bubble.open {
    display: flex;
  }
  .cs-bubble-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
  }
  .cs-bubble-title {
    font-family: 'Playfair Display', serif;
    font-size: 16px;
    font-weight: 600;
  }
  .cs-bubble-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    border-radius: 50%;
  }
  .cs-bubble-close:hover {
    color: #1a1a1a;
    background: rgba(0,0,0,0.04);
  }
  .cs-bubble .cs-quote-preview {
    flex-shrink: 0;
  }
  .cs-bubble .cs-comment-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 18px;
  }
  .cs-bubble .cs-pagination {
    flex-shrink: 0;
  }
  .cs-bubble .cs-comment-form {
    flex-shrink: 0;
    padding: 12px 18px 18px;
  }
  .cs-marker-btn {
    font-size: 11px;
    padding: 5px 12px;
  }
}
