/* =====================================================
   Thư Viện Văn Học – Frontend CSS
   ===================================================== */

:root {
  --tvvh-primary:    #2c5f8a;
  --tvvh-secondary:  #e8a838;
  --tvvh-text:       #2d2d2d;
  --tvvh-muted:      #6b7280;
  --tvvh-bg:         #f8f6f1;
  --tvvh-card-bg:    #ffffff;
  --tvvh-border:     #e5e0d8;
  --tvvh-radius:     10px;
  --tvvh-shadow:     0 2px 12px rgba(0,0,0,.08);
}

/* ---- Grid layout ---- */
.tvvh-grid {
  display: grid;
  gap: 24px;
  margin: 24px 0;
}
.tvvh-cols-2 { grid-template-columns: repeat(2, 1fr); }
.tvvh-cols-3 { grid-template-columns: repeat(3, 1fr); }
.tvvh-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .tvvh-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .tvvh-cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .tvvh-cols-2, .tvvh-cols-3, .tvvh-cols-4 { grid-template-columns: 1fr; }
}

/* ---- Card ---- */
.tvvh-card {
  background: var(--tvvh-card-bg);
  border-radius: var(--tvvh-radius);
  box-shadow: var(--tvvh-shadow);
  border: 1px solid var(--tvvh-border);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.tvvh-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.tvvh-card-link { text-decoration: none; color: inherit; display: block; }

.tvvh-card-thumb {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--tvvh-bg);
}
.tvvh-card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}
.tvvh-card:hover .tvvh-card-thumb img { transform: scale(1.05); }

.tvvh-card-no-thumb {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, #f0eee8, #e8e4da);
}
.tvvh-badge {
  position: absolute;
  top: 10px; left: 10px;
  background: var(--tvvh-primary);
  color: #fff;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}
.tvvh-card-body { padding: 14px 16px; }
.tvvh-card-title {
  font-size: 15px; font-weight: 700;
  color: var(--tvvh-text);
  margin: 0 0 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tvvh-card-author {
  font-size: 13px; color: var(--tvvh-primary);
  margin: 0 0 4px; font-weight: 500;
}
.tvvh-card-excerpt {
  font-size: 13px; color: var(--tvvh-muted);
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tvvh-card-views { font-size: 12px; color: var(--tvvh-muted); margin: 0; }

/* ---- Tabs shortcode ---- */
.tvvh-tabs-wrapper { margin: 24px 0; }
.tvvh-tabs-nav {
  display: flex; flex-wrap: wrap;
  gap: 8px;
  border-bottom: 2px solid var(--tvvh-border);
  padding-bottom: 8px; margin-bottom: 20px;
}
.tvvh-tab-btn {
  padding: 8px 20px;
  border: 2px solid var(--tvvh-border);
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  font-size: 14px; font-weight: 600;
  color: var(--tvvh-muted);
  transition: all .2s;
}
.tvvh-tab-btn.active, .tvvh-tab-btn:hover {
  background: var(--tvvh-primary);
  border-color: var(--tvvh-primary);
  color: #fff;
}
.tvvh-tab-pane { display: none; }
.tvvh-tab-pane.active { display: block; }

/* ---- Single post ---- */
.tvvh-single-wrapper { background: var(--tvvh-bg); min-height: 70vh; }
.tvvh-single-container { max-width: 1200px; margin: 0 auto; padding: 30px 20px 60px; }

.tvvh-breadcrumb {
  font-size: 13px; color: var(--tvvh-muted);
  margin-bottom: 24px;
}
.tvvh-breadcrumb a { color: var(--tvvh-primary); text-decoration: none; }
.tvvh-breadcrumb a:hover { text-decoration: underline; }
.tvvh-sep { margin: 0 6px; }

.tvvh-single-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}
@media (max-width: 900px) { .tvvh-single-layout { grid-template-columns: 1fr; } }

.tvvh-single-main {
  background: #fff;
  border-radius: var(--tvvh-radius);
  box-shadow: var(--tvvh-shadow);
  border: 1px solid var(--tvvh-border);
  padding: 32px;
}

.tvvh-type-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 14px;
}
.tvvh-badge-loi-nhac  { background: #fef3c7; color: #d97706; }
.tvvh-badge-bai-tho   { background: #ede9fe; color: #7c3aed; }
.tvvh-badge-bai-van   { background: #dcfce7; color: #16a34a; }
.tvvh-badge-tuc-ngu   { background: #fee2e2; color: #dc2626; }

.tvvh-single-title {
  font-size: 2rem; font-weight: 800;
  color: var(--tvvh-text);
  margin: 0 0 16px;
  line-height: 1.3;
}

.tvvh-meta-row {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--tvvh-border);
}
.tvvh-meta-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 14px; color: var(--tvvh-muted);
}

.tvvh-single-image { margin-bottom: 24px; border-radius: var(--tvvh-radius); overflow: hidden; }
.tvvh-featured-image { width: 100%; height: auto; display: block; }

.tvvh-single-excerpt {
  background: var(--tvvh-bg);
  border-left: 4px solid var(--tvvh-secondary);
  padding: 14px 20px;
  border-radius: 0 var(--tvvh-radius) var(--tvvh-radius) 0;
  margin-bottom: 24px;
  font-style: italic; color: var(--tvvh-muted); font-size: 15px;
}
.tvvh-single-excerpt p { margin: 0; }

.tvvh-single-content {
  font-size: 16px; line-height: 1.85;
  color: var(--tvvh-text);
}
.tvvh-single-content p { margin-bottom: 0.6em; }
.tvvh-single-content p:empty { display: none; }

/* Tags */
.tvvh-single-tags {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--tvvh-border);
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.tvvh-tags-label { font-size: 14px; color: var(--tvvh-muted); }
.tvvh-tag {
  padding: 4px 12px;
  background: #f3f4f6;
  border-radius: 20px;
  font-size: 13px;
  color: var(--tvvh-primary);
  text-decoration: none;
  border: 1px solid var(--tvvh-border);
  transition: all .15s;
}
.tvvh-tag:hover { background: var(--tvvh-primary); color: #fff; }

/* Share */
.tvvh-share-row {
  margin-top: 20px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  font-size: 14px; color: var(--tvvh-muted);
}
.tvvh-share-btn {
  padding: 6px 14px; border-radius: 6px;
  font-size: 13px; font-weight: 600;
  text-decoration: none; border: none; cursor: pointer;
  transition: opacity .2s;
}
.tvvh-share-btn:hover { opacity: .85; }
.tvvh-fb  { background: #1877f2; color: #fff; }
.tvvh-tw  { background: #1da1f2; color: #fff; }
.tvvh-copy { background: #f3f4f6; color: var(--tvvh-text); border: 1px solid var(--tvvh-border); }

/* Sidebar */
.tvvh-single-sidebar { position: sticky; top: 20px; }
.tvvh-sidebar-box {
  background: #fff;
  border-radius: var(--tvvh-radius);
  box-shadow: var(--tvvh-shadow);
  border: 1px solid var(--tvvh-border);
  padding: 20px;
  margin-bottom: 20px;
}
.tvvh-sidebar-title {
  font-size: 15px; font-weight: 700;
  color: var(--tvvh-text);
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--tvvh-bg);
}
.tvvh-sidebar-list { list-style: none; margin: 0; padding: 0; }
.tvvh-sidebar-list li { border-bottom: 1px solid var(--tvvh-border); }
.tvvh-sidebar-list li:last-child { border: none; }
.tvvh-sidebar-list a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  color: var(--tvvh-text);
  text-decoration: none; font-size: 14px;
  transition: color .15s;
}
.tvvh-sidebar-list a:hover { color: var(--tvvh-primary); }
.tvvh-related-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }

/* Archive */
.tvvh-archive-wrapper { background: var(--tvvh-bg); min-height: 70vh; }
.tvvh-archive-container { max-width: 1200px; margin: 0 auto; padding: 30px 20px 60px; }
.tvvh-archive-header {
  text-align: center; margin-bottom: 32px;
}
.tvvh-archive-header h1 { font-size: 2rem; font-weight: 800; color: var(--tvvh-text); }
.tvvh-archive-desc { color: var(--tvvh-muted); font-size: 15px; }
.tvvh-archive-count { font-size: 14px; color: var(--tvvh-muted); }

.tvvh-filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
  margin-bottom: 28px;
}
.tvvh-filter-btn {
  padding: 6px 16px;
  border: 2px solid var(--tvvh-border);
  border-radius: 20px;
  text-decoration: none;
  font-size: 13px; font-weight: 600;
  color: var(--tvvh-muted);
  background: #fff;
  transition: all .2s;
}
.tvvh-filter-btn.active, .tvvh-filter-btn:hover {
  background: var(--tvvh-primary);
  border-color: var(--tvvh-primary);
  color: #fff;
}

/* Pagination */
.tvvh-pagination { margin-top: 40px; display: flex; justify-content: center; }
.tvvh-pagination .page-numbers {
  display: flex; gap: 6px;
}
.tvvh-pagination .page-numbers a,
.tvvh-pagination .page-numbers span {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--tvvh-border);
  font-size: 14px;
  text-decoration: none;
  color: var(--tvvh-text);
  background: #fff;
}
.tvvh-pagination .page-numbers .current {
  background: var(--tvvh-primary);
  color: #fff;
  border-color: var(--tvvh-primary);
}

/* ---- Taxonomy archive ---- */
.tvvh-taxonomy-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 10px;
}
.tvvh-tax-cat { background: #dbeafe; color: #1d4ed8; }
.tvvh-tax-tag { background: #fce7f3; color: #be185d; }

.tvvh-archive-heading {
  font-size: 2rem; font-weight: 800;
  color: var(--tvvh-text); margin: 0 0 8px;
}
.tvvh-filter-count {
  display: inline-block;
  background: rgba(0,0,0,.12);
  border-radius: 10px;
  font-size: 11px; padding: 1px 6px; margin-left: 4px;
}
.tvvh-filter-btn.active .tvvh-filter-count,
.tvvh-filter-btn:hover .tvvh-filter-count {
  background: rgba(255,255,255,.25);
}
.tvvh-year { color: var(--tvvh-muted); font-size: 12px; margin-left: 4px; }

/* Sub-terms box */
.tvvh-subterms-box {
  margin-top: 40px;
  padding: 20px 24px;
  background: #fff;
  border: 1px solid var(--tvvh-border);
  border-radius: var(--tvvh-radius);
}
.tvvh-subterms-box h4 { margin: 0 0 14px; font-size: 15px; font-weight: 700; }
.tvvh-subterms-list { display: flex; flex-wrap: wrap; gap: 10px; }
.tvvh-subterm-link {
  padding: 6px 14px;
  background: var(--tvvh-bg);
  border: 1px solid var(--tvvh-border);
  border-radius: 20px;
  font-size: 13px; font-weight: 600;
  color: var(--tvvh-primary);
  text-decoration: none;
  transition: all .2s;
}
.tvvh-subterm-link:hover { background: var(--tvvh-primary); color: #fff; border-color: var(--tvvh-primary); }

/* Empty state */
.tvvh-empty {
  text-align: center; padding: 60px 20px;
  color: var(--tvvh-muted); font-size: 16px;
}
.tvvh-btn-back {
  display: inline-block; margin-top: 14px;
  padding: 8px 20px;
  background: var(--tvvh-primary); color: #fff;
  border-radius: 6px; text-decoration: none;
  font-weight: 600;
}
