/* Trang chi tiết truyện — Truyện Lưu Vân */

.detail-page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  outline: none;
}

@media (max-width: 720px) {
  .detail-page {
    padding: 1rem 0.85rem 2.5rem;
  }
}

/* ==== Hero ==== */
.detail-hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  background: linear-gradient(180deg, rgba(255, 184, 0, 0.06), transparent 60%), var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 720px) {
  .detail-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

.detail-hero__cover {
  position: relative;
}

.detail-hero__cover-img {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: #161618 center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.detail-hero__cover-img.has-img .detail-hero__cover-fallback {
  display: none;
}

.detail-hero__badges {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  right: 0.6rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.detail-hero__badge {
  background: rgba(0, 0, 0, 0.6);
  color: var(--gold);
  border: 1px solid rgba(255, 184, 0, 0.4);
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.detail-hero__info h1 {
  margin: 0 0 0.35rem;
  font-size: 2rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1.1;
}

@media (max-width: 720px) {
  .detail-hero__info h1 {
    font-size: 1.5rem;
  }
}

.detail-hero__author {
  margin: 0 0 0.85rem;
  color: var(--text);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.detail-hero__label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

@media (max-width: 720px) {
  .detail-hero__author {
    justify-content: center;
  }
}

.detail-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

@media (max-width: 720px) {
  .detail-hero__meta {
    justify-content: center;
  }
}

.detail-hero__meta strong {
  color: var(--text);
  font-weight: 600;
}

.btn-read--ghost.is-liked {
  border-color: rgba(255, 184, 0, 0.55);
  color: var(--gold, #fbbf24);
}

.detail-hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

@media (max-width: 720px) {
  .detail-hero__chips {
    justify-content: center;
  }
}

.detail-hero__chip {
  display: inline-flex;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 999px;
  font-size: 0.78rem;
}

.detail-hero__chip--accent {
  background: rgba(255, 184, 0, 0.12);
  color: var(--gold);
  border-color: rgba(255, 184, 0, 0.4);
}

.detail-hero__status {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.detail-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

@media (max-width: 720px) {
  .detail-hero__actions {
    justify-content: center;
  }
}

/* ==== Chia sẻ ==== */
.detail-hero__share {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--border);
}

.detail-hero__share-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-right: 0.15rem;
}

.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 999px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s, border-color 0.15s,
    background 0.15s, color 0.15s;
  text-decoration: none;
}

.btn-share svg {
  display: block;
}

.btn-share:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-share--fb {
  background: #1877f2;
  border-color: #1877f2;
  color: #fff;
}

.btn-share--fb:hover {
  background: #1465d0;
  border-color: #1465d0;
  color: #fff;
}

.btn-share--copy:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-share--copy.is-copied {
  border-color: #22c55e;
  color: #4ade80;
  background: rgba(34, 197, 94, 0.08);
}

@media (max-width: 720px) {
  .detail-hero__share {
    justify-content: center;
  }
}

.btn-read {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 10px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s, border-color 0.15s;
}

.btn-read:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-read--primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #121212;
}

.btn-read--primary:hover {
  filter: brightness(1.05);
  color: #121212;
  border-color: var(--gold);
}

.btn-read--ghost {
  background: transparent;
}

.btn-read[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

/* ==== Card chung ==== */
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem 1.3rem;
  margin-bottom: 1rem;
}

.detail-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.detail-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
}

.detail-card__count {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
}

.detail-card__tools {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.detail-card__tools input {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  min-width: 200px;
}

.detail-card__tools input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-muted);
}

.btn-sort {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  cursor: pointer;
}

.btn-sort:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.detail-card__blurb {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text);
}

.detail-card__blurb p {
  margin: 0 0 0.45rem;
}

.detail-card__blurb p:last-child {
  margin-bottom: 0;
}

.detail-card__blurb.is-muted {
  color: var(--muted);
  font-style: italic;
}

/* ==== Bình luận ==== */
.detail-comments__head {
  margin-bottom: 0.75rem;
}

.detail-comments__title {
  margin: 0;
}

.detail-comments__offline {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.detail-comments__online {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-comments__hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: rgba(180, 120, 60, 0.12);
  border: 1px solid rgba(180, 120, 60, 0.25);
}

.detail-comments__textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 6rem;
  padding: 0.75rem 0.9rem;
  font: inherit;
  font-size: 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}

.detail-comments__textarea::placeholder {
  color: var(--muted);
}

.detail-comments__actions {
  display: flex;
  justify-content: flex-end;
}

.comment-empty {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.75rem 0;
}

.comment-empty[hidden] {
  display: none;
}

.comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.comment-item {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
}

.comment-item__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.comment-item__author {
  font-weight: 600;
  color: var(--gold);
}

.comment-item__meta > span:last-child {
  margin-left: auto;
}

/* Badge level cạnh tên tác giả bình luận */
.comment-lvl {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.comment-lvl--mid {
  background: rgba(120, 200, 255, 0.12);
  color: #9ad7ff;
  border-color: rgba(120, 200, 255, 0.35);
}

.comment-lvl--high {
  background: rgba(255, 184, 0, 0.14);
  color: var(--gold);
  border-color: rgba(255, 184, 0, 0.4);
  text-shadow: 0 0 6px rgba(255, 184, 0, 0.4);
}

.comment-lvl--admin {
  background: rgba(99, 102, 241, 0.18);
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.45);
}

.comment-item__body {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
}

.comment-item__actions {
  margin-top: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  line-height: 1;
}

.comment-like-btn,
.comment-reply-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 0.78rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
}

.comment-like-btn:hover,
.comment-reply-btn:hover {
  color: var(--gold);
}

.comment-like-btn svg {
  display: block;
  flex-shrink: 0;
}

.comment-like-btn.is-liked {
  color: var(--gold, #fbbf24);
}

.comment-like-lbl {
  font-weight: 500;
}

.comment-like-btn.is-liked .comment-like-lbl {
  font-weight: 600;
}

.comment-like-count {
  font-variant-numeric: tabular-nums;
}

.comment-replies {
  margin-top: 0.55rem;
  margin-left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.comment-replies:empty {
  margin: 0;
}

.comment-item--reply {
  background: rgba(255, 184, 0, 0.04);
  border-color: rgba(255, 184, 0, 0.15);
}

.comment-reply-form {
  margin-top: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.comment-reply-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.comment-reply-cancel {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
}

.comment-reply-cancel:hover {
  color: var(--text);
  border-color: var(--muted);
}

/* ==== Danh sách chương ==== */
.ch-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  overflow: hidden;
}

/* Khi nhiều chương: cố định chiều cao + scroll bên trong */
.ch-list--scroll {
  max-height: 560px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 184, 0, 0.45) transparent;
}

.ch-list--scroll::-webkit-scrollbar {
  width: 8px;
}

.ch-list--scroll::-webkit-scrollbar-track {
  background: transparent;
}

.ch-list--scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 184, 0, 0.35);
  border-radius: 999px;
}

.ch-list--scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 184, 0, 0.55);
}

.ch-list__empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.5rem 1rem;
}

.ch-list > li + li {
  border-top: 1px solid var(--border);
}

.ch-list a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 1rem;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  text-decoration: none;
  border: none;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.ch-list a:hover {
  color: var(--gold);
  background: rgba(255, 184, 0, 0.08);
}

.ch-list__no {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 24px;
  padding: 0 0.55rem;
  border-radius: 6px;
  background: rgba(255, 184, 0, 0.12);
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  font-weight: 700;
}

.ch-list__title {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-list__arrow {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.ch-list__vip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border: 1px solid rgba(255, 184, 0, 0.5);
  border-radius: 999px;
  background: rgba(255, 184, 0, 0.1);
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 800;
}

.ch-list a:hover .ch-list__arrow {
  color: var(--gold);
}

@media (max-width: 600px) {
  .ch-list a {
    padding: 0.65rem 0.75rem;
    gap: 0.55rem;
    font-size: 0.85rem;
  }
  .ch-list__no {
    min-width: 40px;
    font-size: 0.68rem;
    padding: 0 0.4rem;
  }
  .ch-list--scroll {
    max-height: 480px;
  }
}

/* ==== Toast (dùng chung style với manage.css) ==== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.7rem 1.1rem;
  background: #1f1f23;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 300;
}

.toast--err {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
}

.toast--ok {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.12);
  color: #bbf7d0;
}
