/**
 * 书页摘录批注：角标 + 折叠面板
 */

.quote-comment-host {
  position: relative;
  margin: 1rem 0 1.25rem;
}

.quote-annotatable {
  position: relative;
  margin: 0;
  padding: 0.85rem 1rem 0.85rem 1.1rem;
  border-left: 3px solid rgba(122, 36, 56, 0.35);
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.quote-annotatable:hover,
.quote-annotatable:focus-visible {
  background: rgba(122, 36, 56, 0.06);
  box-shadow: inset 0 0 0 1px rgba(122, 36, 56, 0.12);
  outline: none;
}

.quote-comment-host.is-open .quote-annotatable {
  background: rgba(122, 36, 56, 0.08);
}

.quote-comment-badge {
  position: absolute;
  top: -0.45rem;
  right: 0.35rem;
  z-index: 2;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 0.35rem;
  border: 1px solid rgba(122, 36, 56, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #7a2438;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.quote-comment-badge:hover,
.quote-comment-badge:focus-visible {
  transform: scale(1.06);
  background: #fff;
  outline: none;
}

.quote-comment-host.is-open .quote-comment-badge {
  background: #7a2438;
  color: #fff;
  border-color: #7a2438;
}

.quote-comment-panel {
  margin-top: 0.55rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(122, 36, 56, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  animation: quote-comment-in 0.18s ease;
}

@keyframes quote-comment-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quote-comment-label {
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0.72;
}

.quote-comment-input {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(122, 36, 56, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  color: inherit;
  font: inherit;
  line-height: 1.55;
  resize: vertical;
}

.quote-comment-input:focus {
  outline: 2px solid rgba(122, 36, 56, 0.25);
  outline-offset: 1px;
}

.quote-comment-view {
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(122, 36, 56, 0.05);
  line-height: 1.65;
  white-space: pre-wrap;
}

.quote-comment-auth {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.quote-comment-auth-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(122, 36, 56, 0.06);
  font-size: 0.9rem;
}

.quote-comment-login-hint {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  opacity: 0.72;
}

.quote-comment-composer {
  display: block;
}

.quote-comment-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  max-height: 240px;
  overflow-y: auto;
}

.quote-comment-empty {
  margin: 0;
  font-size: 0.88rem;
  opacity: 0.65;
}

.quote-comment-item {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(122, 36, 56, 0.05);
}

.quote-comment-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.quote-comment-item-nick {
  font-size: 0.88rem;
}

.quote-comment-item-time {
  font-size: 0.75rem;
  opacity: 0.6;
  white-space: nowrap;
}

.quote-comment-item-body {
  line-height: 1.6;
  white-space: pre-wrap;
}

.quote-comment-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.quote-comment-field {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(122, 36, 56, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  color: inherit;
  font: inherit;
}

.quote-comment-field:focus {
  outline: 2px solid rgba(122, 36, 56, 0.25);
  outline-offset: 1px;
}

.quote-comment-status {
  margin-bottom: 0.55rem;
  font-size: 0.85rem;
  color: #8f2f2f;
}

.quote-comment-host.is-loading .quote-comment-panel {
  opacity: 0.72;
  pointer-events: none;
}

@media screen and (max-width: 768px) {
  .quote-comment-meta {
    grid-template-columns: 1fr;
  }
}

.quote-comment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.quote-comment-btn {
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(63, 79, 99, 0.22);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.quote-comment-btn:hover,
.quote-comment-btn:focus-visible {
  background: rgba(63, 79, 99, 0.06);
  outline: none;
}

.quote-comment-btn-primary {
  border-color: rgba(122, 36, 56, 0.35);
  background: rgba(122, 36, 56, 0.92);
  color: #fff;
}

.quote-comment-btn-primary:hover,
.quote-comment-btn-primary:focus-visible {
  background: #7a2438;
}

.quote-comment-btn-danger {
  border-color: rgba(160, 48, 48, 0.28);
  color: #8f2f2f;
}

body[data-theme='dark'] .quote-annotatable {
  border-left-color: rgba(232, 160, 176, 0.45);
}

body[data-theme='dark'] .quote-annotatable:hover,
body[data-theme='dark'] .quote-annotatable:focus-visible,
body[data-theme='dark'] .quote-comment-host.is-open .quote-annotatable {
  background: rgba(232, 160, 176, 0.08);
  box-shadow: inset 0 0 0 1px rgba(232, 160, 176, 0.15);
}

body[data-theme='dark'] .quote-comment-badge {
  background: rgba(30, 30, 36, 0.95);
  color: #e8a0b0;
  border-color: rgba(232, 160, 176, 0.35);
}

body[data-theme='dark'] .quote-comment-host.is-open .quote-comment-badge {
  background: #c97888;
  color: #1a1a20;
}

body[data-theme='dark'] .quote-comment-panel {
  background: rgba(28, 28, 34, 0.96);
  border-color: rgba(232, 160, 176, 0.2);
}

body[data-theme='dark'] .quote-comment-input {
  background: rgba(20, 20, 26, 0.95);
  border-color: rgba(232, 160, 176, 0.22);
}

body[data-theme='dark'] .quote-comment-view {
  background: rgba(232, 160, 176, 0.08);
}

body[data-theme='dark'] .quote-comment-item {
  background: rgba(232, 160, 176, 0.08);
}

body[data-theme='dark'] .quote-comment-field {
  background: rgba(20, 20, 26, 0.95);
  border-color: rgba(232, 160, 176, 0.22);
}

body[data-theme='dark'] .quote-comment-status {
  color: #e8a0a0;
}

body[data-theme='dark'] .quote-comment-btn-primary {
  background: rgba(201, 120, 136, 0.92);
  color: #1a1a20;
}

@media screen and (max-width: 768px) {
  .quote-comment-badge {
    top: -0.55rem;
    right: 0.15rem;
  }
}
