/* Cache bust: NEXT_PUBLIC_CLUB_CSS_VERSION trong .env */
/* library-detail.css — trang chi tiết thư viện (/thu-vien/[slug]) */

.library-detail {
  --library-brand: var(--brand-red-mid, #7a1519);
  --library-brand-dark: var(--brand-red-dark, #620305);
  background: var(--surface-cream);
  color: var(--text-primary);
}

.library-detail .hero {
  --hero-content-width: min(96%, 42rem);
  min-height: clamp(18rem, 36vw, 27rem);
}

.library-detail__main {
  position: relative;
  z-index: 10;
  background: var(--surface-section-white);
  margin-top: clamp(-3rem, -6vw, -4.5rem);
  padding-top: clamp(1.5rem, 3vw, 2.25rem);
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
}

.library-detail__breadcrumb {
  margin-bottom: clamp(1.25rem, 2.5vw, 2rem);
}

/* 2 cột: nội dung chính | sidebar */
.library-detail__layout {
  display: grid;
  gap: clamp(1.25rem, 2.5vw, 2rem);
  align-items: start;
}

@media (min-width: 960px) {
  .library-detail__layout {
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 19rem);
  }
}

.library-detail__primary {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(1.25rem, 2.5vw, 1.75rem);
}

/* Hàng ngang: ảnh + thông tin */
.library-detail__hero-row {
  display: grid;
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: start;
}

@media (min-width: 768px) {
  .library-detail__hero-row {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  }
}

.library-detail__preview-col {
  min-width: 0;
}

.library-detail__excerpt {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-primary);
}

/* Preview / player */
.library-player {
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--brand-gold) 22%, #ddd);
  border-radius: 0.35rem;
  overflow: hidden;
  box-shadow: 0 0.2rem 0.75rem rgba(0, 0, 0, 0.05);
}

.library-player--fullscreen {
  border-radius: 0;
  border: 0;
}

.library-player--fullscreen .library-player__stage {
  aspect-ratio: auto;
  min-height: calc(100vh - 3rem);
}

.library-player__modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem;
  background: #faf8f5;
  border-bottom: 1px solid color-mix(in srgb, var(--brand-gold) 15%, #e8e2d8);
}

.library-player__mode {
  border: 1px solid color-mix(in srgb, var(--library-brand) 25%, #ccc);
  background: #fff;
  color: var(--library-brand-dark);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.library-player__mode:hover {
  border-color: var(--library-brand);
  color: var(--library-brand);
}

.library-player__mode--active {
  background: var(--library-brand-dark);
  border-color: var(--library-brand-dark);
  color: #fff;
}

.library-player__stage {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #f3f0ea;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.library-player__embed,
.library-player__video {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  object-fit: contain;
  background: #111;
}

.library-player__image-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  transition: transform 0.15s ease;
}

.library-player__image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.library-player__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.library-player__empty i {
  font-size: 1.75rem;
  opacity: 0.45;
}

.library-player-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: 0.55rem 0.75rem;
  background: color-mix(in srgb, var(--library-brand-dark) 94%, #1a1a1a);
  color: #f5f0ea;
  font-size: 0.78rem;
}

.library-player-controls__status {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
}

.library-player-controls__type {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.library-player-controls__sep {
  opacity: 0.55;
}

.library-player-controls__meta {
  opacity: 0.9;
}

.library-player-controls__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.library-player-controls__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0.25rem 0.45rem;
  border: 1px solid color-mix(in srgb, #fff 18%, transparent);
  border-radius: 0.25rem;
  background: color-mix(in srgb, #fff 8%, transparent);
  color: inherit;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.library-player-controls__btn:hover {
  background: color-mix(in srgb, #fff 16%, transparent);
  border-color: color-mix(in srgb, #fff 35%, transparent);
}

.library-player-controls__btn--text {
  min-width: 3rem;
  font-variant-numeric: tabular-nums;
}

/* Info column */
.library-detail__info-col {
  min-width: 0;
}

.library-detail__category-label,
.library-detail__type-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--library-brand);
}

.library-detail__title {
  margin: 0 0 0.85rem;
  font-size: clamp(1.15rem, 2.4vw, 1.65rem);
  font-weight: 800;
  line-height: 1.3;
  color: var(--library-brand-dark);
}

.library-detail__meta {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.library-detail__meta li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.library-detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.25rem;
}

.library-detail__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  padding: 0.45rem 1rem;
  border-radius: 0.25rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.library-detail__btn--primary {
  border: 1px solid var(--library-brand-dark);
  background: var(--library-brand-dark);
  color: #fff;
}

.library-detail__btn--primary:hover {
  background: var(--library-brand);
  border-color: var(--library-brand);
}

.library-detail__btn--outline {
  border: 1px solid var(--library-brand-dark);
  background: #fff;
  color: var(--library-brand-dark);
}

.library-detail__btn--outline:hover {
  background: color-mix(in srgb, var(--library-brand) 8%, #fff);
}

/* Share dropdown */
.share-dropdown-wrap {
  position: relative;
}

.share-dropdown {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 30;
  min-width: 12.5rem;
  padding: 0.35rem 0;
  background: #2b2b2b;
  border-radius: 0.35rem;
  box-shadow: 0 0.45rem 1.1rem rgba(0, 0, 0, 0.22);
}

.share-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  text-align: left;
  transition: background 0.15s ease;
}

.share-item:hover,
.share-item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.share-item svg {
  margin-right: 10px;
  flex-shrink: 0;
}

.share-item span {
  color: #fff;
  display: block;
  white-space: nowrap;
}

.share-item--copy {
  background: transparent;
}

.share-toast {
  position: fixed;
  bottom: 1.75rem;
  left: 50%;
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1.15rem;
  background: #2b2b2b;
  color: #fff;
  border-radius: 0.4rem;
  box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.25);
  font-size: 0.88rem;
  font-weight: 600;
  transform: translateX(-50%);
  animation: share-toast-in 0.22s ease;
  pointer-events: none;
}

.share-toast i {
  color: #4ade80;
  font-size: 1.05rem;
}

@keyframes share-toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.library-detail__specs {
  margin: 0;
  padding: 0.85rem 1rem;
  background: #f9f5f0;
  border: 1px solid color-mix(in srgb, var(--brand-gold) 18%, #e8e2d8);
  border-radius: 0.3rem;
}

.library-detail__spec-row {
  display: grid;
  grid-template-columns: minmax(7rem, 42%) minmax(0, 1fr);
  gap: 0.35rem 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--brand-gold) 12%, #ece6dc);
  font-size: 0.84rem;
}

.library-detail__spec-row:last-child {
  border-bottom: 0;
}

.library-detail__spec-row dt {
  margin: 0;
  font-weight: 600;
  color: var(--text-muted);
}

.library-detail__spec-row dd {
  margin: 0;
  color: var(--text-primary);
}

.library-detail__section-title {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--library-brand-dark);
}

.library-detail__content-block {
  padding-top: 0.25rem;
  border-top: 1px solid color-mix(in srgb, var(--brand-gold) 18%, #e8e2d8);
}

.library-detail__content {
  font-size: 1rem;
  line-height: 1.72;
  color: var(--text-primary);
}

.library-detail__content :where(p, li, blockquote) {
  color: var(--text-primary);
}

.library-detail__content :where(p) {
  margin: 0 0 1.05em;
}

.library-detail__content :where(p:first-of-type) {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  background: #f9f5f0;
  border: 1px solid color-mix(in srgb, var(--brand-gold) 18%, #e8e2d8);
  border-radius: 0.3rem;
  font-size: 0.95rem;
  line-height: 1.65;
}

.library-detail__content :where(strong, b) {
  color: var(--brand-red-dark);
  font-weight: 700;
}

.library-detail__content :where(h1, h2, h3, h4) {
  margin-top: 1.65em;
  margin-bottom: 0.55em;
  font-weight: 800;
  line-height: 1.28;
  color: var(--library-brand-dark);
}

.library-detail__content :where(h2) {
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid color-mix(in srgb, var(--brand-gold) 55%, transparent);
}

.library-detail__content :where(h3) {
  font-size: 1.02rem;
}

.library-detail__content :where(h4) {
  font-size: 0.98rem;
}

.library-detail__content :where(ul:not([class])) {
  list-style: none;
  padding-left: 0;
}

.library-detail__content :where(ul:not([class]) > li) {
  position: relative;
  padding-left: 1.45rem;
}

.library-detail__content :where(ul:not([class]) > li)::before {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  left: 0;
  top: 0.15em;
  color: var(--brand-gold);
  font-size: 0.85em;
}

.library-detail__content :where(blockquote) {
  margin: 1.5rem 0;
  padding: 1rem 1.15rem;
  border: 1px solid color-mix(in srgb, var(--brand-red-accent) 35%, transparent);
  border-left: 4px solid var(--brand-red-accent);
  background: color-mix(in srgb, var(--brand-gold) 14%, #fff);
  border-radius: 0.25rem;
  font-style: italic;
  text-align: center;
  color: var(--library-brand-dark);
}

.library-detail__content :where(a) {
  color: var(--brand-red-accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.library-detail__content :where(a:hover) {
  color: var(--library-brand-dark);
}

.library-detail__content :where(ul, ol) {
  margin: 0 0 1.1rem;
  padding-left: 1.4rem;
}

.library-detail__content :where(li) {
  margin-bottom: 0.4rem;
}

.library-detail__content :where(figure) {
  margin: 1.5rem 0;
}

.library-detail__content :where(figcaption) {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.45rem;
  text-align: center;
}

.library-detail__content :where(img) {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 0.35rem;
  border: 1px solid color-mix(in srgb, var(--brand-gold) 22%, var(--border-ui, #ddd));
}

.library-detail__content .payload-richtext__hr {
  margin: 1.85rem 0;
  border: 0;
  border-top: 2px solid color-mix(in srgb, var(--brand-gold) 50%, var(--border-ui, #ddd));
}

.library-detail__content .border {
  border-color: color-mix(in srgb, var(--brand-gold) 40%, var(--border-ui, #ddd)) !important;
}

.library-detail__content :where(.bg-card),
.library-detail__content .my-8.w-full > .border.rounded,
.library-detail__content [class*='bg-card'],
.library-detail__content [class*='bg-error'],
.library-detail__content .border-border {
  background: #f9f5f0 !important;
  color: var(--text-primary) !important;
  border: 1px solid color-mix(in srgb, var(--brand-gold) 18%, #e8e2d8) !important;
  border-radius: 0.35rem !important;
}

.library-detail__content .my-8.w-full > .border.rounded :where(p) {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.55;
}

.library-detail__keywords {
  padding-top: 0.25rem;
}

.library-detail__keyword-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.library-detail__keyword {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--library-brand) 25%, #ddd);
  background: #fff;
  font-size: 0.78rem;
  color: var(--library-brand-dark);
}

/* Sidebar */
.library-detail__aside {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.library-detail__related-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.library-detail__related-link {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
  align-items: start;
}

.library-detail__related-link:hover .library-detail__related-title {
  color: var(--library-brand);
}

.library-detail__related-thumb {
  aspect-ratio: 4 / 3;
  border-radius: 0.25rem;
  overflow: hidden;
  background: var(--placeholder-bg-light);
}

.library-detail__related-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.library-detail__related-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.library-detail__related-title {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  max-height: 2.7em;
  overflow: hidden;
  transition: color 0.15s ease;
}

.library-detail__related-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.library-detail__related-more {
  display: block;
  margin-top: 0.85rem;
  padding: 0.55rem 0.75rem;
  text-align: center;
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--library-brand-dark);
  border: 1px solid var(--library-brand-dark);
  border-radius: 0.25rem;
  background: #fff;
}

.library-detail__related-more:hover {
  background: color-mix(in srgb, var(--library-brand) 8%, #fff);
}

@media (max-width: 767px) {
  .library-detail__aside {
    grid-column: 1 / -1;
  }
}
