/* ──────────────────────────────────────────────
   Tri Thức Doanh Nghiệp — Global Styles
   /public/assets/css/kw-knowledge.css
────────────────────────────────────────────── */

/* Base */
body {
  background: #f4f6fb;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Card */
.kw-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  transition: box-shadow .2s;
}
.kw-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.11); }

/* ── YouTube-style chip bar ── */
.kw-chip-bar {
  position: sticky;
  top: 52px;      /* desktop: single-row nav */
  z-index: 90;
  background: #fff;
  border-bottom: 1px solid #e0e7ef;
}
@media (max-width: 767.98px) {
  .kw-chip-bar { top: 98px; } /* mobile: nav = 52px + search row ~46px */
}

/* Pill chips */
.kw-chip {
  display: inline-block;
  padding: .28rem .9rem;
  font-size: .82rem;
  font-weight: 500;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
  line-height: 1.4;
}
.kw-chip-on  { background: #0f0f0f; color: #fff; }
.kw-chip-off { background: #f2f2f2; color: #0f0f0f; }
.kw-chip-off:hover { background: #e5e5e5; }

/* Sort select */
.kw-sort-select {
  font-size: .78rem;
  border-radius: 20px;
  padding: .22rem .7rem;
  border: 1px solid #d5d5d5;
  background: #f2f2f2;
  color: #0f0f0f;
  width: auto;
  cursor: pointer;
  outline: none;
}
.kw-sort-select:focus { border-color: #2E83C6; box-shadow: none; }

/* Filter button */
.kw-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-weight: 500;
  padding: .22rem .85rem;
  border-radius: 20px;
  background: #f2f2f2;
  color: #0f0f0f;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.kw-filter-btn:hover { background: #e5e5e5; }

/* Hero banner */
.kw-hero {
  background: linear-gradient(135deg, #2E83C6 0%, #1a5f9a 100%);
  color: #fff;
  padding: 2rem 0 1.5rem;
}

/* Footer */
.kw-footer {
  background: #1a1a2e;
  color: #aaa;
  font-size: .85rem;
  padding: 1.5rem 0;
  margin-top: auto;  /* pushes footer to bottom when content is short */
}

/* Avatar circle */
.kw-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e0e7ef;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  color: #2E83C6;
  flex-shrink: 0;
}

/* Badge */
.badge-type {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Rank colors */
.rank-1 { color: #f5a623; }
.rank-2 { color: #9b9b9b; }
.rank-3 { color: #c47a4b; }

/* Toast container */
#kw-toast-container {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  z-index: 9999;
}

/* Article prose */
.kw-prose h1, .kw-prose h2, .kw-prose h3 {
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: .6rem;
}
.kw-prose p { line-height: 1.8; margin-bottom: 1rem; }
.kw-prose ul, .kw-prose ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.kw-prose li { line-height: 1.7; margin-bottom: .3rem; }
.kw-prose pre {
  background: #f4f6fb;
  padding: 1rem;
  border-radius: 8px;
  overflow: auto;
  font-size: .88rem;
}
.kw-prose blockquote {
  border-left: 3px solid #2E83C6;
  padding-left: 1rem;
  color: #555;
  font-style: italic;
}
.kw-prose img { max-width: 100%; border-radius: 8px; margin: .5rem 0; }

/* Star-rating buttons */
.star-btn.active {
  background-color: #ffc107;
  border-color: #ffc107;
  color: #000;
}

/* KPI stat box */
.kw-stat { text-align: center; padding: 1.2rem .5rem; }
.kw-stat .val { font-size: 2rem; font-weight: 700; color: #1a6fc4; }
.kw-stat .lbl { font-size: .78rem; color: #888; text-transform: uppercase; letter-spacing: .5px; }

/* Admin tab underline */
.admin-tab { cursor: pointer; padding: 8px 16px; color: #666; user-select: none; }
.admin-tab.active {
  border-bottom: 2px solid #1a6fc4;
  color: #1a6fc4;
  font-weight: 600;
}

/* Search highlight */
mark.kw-highlight {
  background: #fff176;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
  font-weight: 700;
}

/* ── Card thumbnail — responsive height ── */
.kw-thumb, .kw-thumb-placeholder {
  height: 160px;
  overflow: hidden;
  flex-shrink: 0;
}
@media (min-width: 992px) {
  .kw-thumb, .kw-thumb-placeholder { height: 192px; }
}

/* ── Filter bar — no scroll on desktop ── */
@media (min-width: 992px) {
  #filterBar {
    overflow-x: visible !important;
    flex-wrap: wrap !important;
    padding-right: 0 !important;
  }
  #filterHint { display: none !important; }
}

/* ── Offcanvas filter — desktop: slide from right ── */
@media (min-width: 992px) {
  #filterOffcanvas {
    top: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    right: 0 !important;
    width: 400px !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    transform: translateX(100%) !important;
  }
  #filterOffcanvas.show {
    transform: translateX(0) !important;
  }
  #filterOffcanvas.hiding {
    transform: translateX(100%) !important;
  }
}

/* ── Desktop layout: container padding ── */
.kw-main-container {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 768px) {
  .kw-main-container { padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (min-width: 992px) {
  .kw-main-container { padding-left: 2rem; padding-right: 2rem; }
}
@media (min-width: 1200px) {
  .kw-main-container { padding-left: 3rem; padding-right: 3rem; }
}
@media (min-width: 1400px) {
  .kw-main-container { padding-left: 4rem; padding-right: 4rem; }
}

/* ── Navbar desktop link hover ── */
@media (min-width: 992px) {
  nav .nav-link:hover { color: #2E83C6 !important; }
}
/* ── Icon grid picker (type modal) ── */
.kw-icon-item {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 6px;
  cursor: pointer; font-size: .95rem; color: #444;
  border: 2px solid transparent; transition: background .1s, border-color .1s;
}
.kw-icon-item:hover  { background: #e9ecef; }
.kw-icon-item.active { background: #cfe2ff; border-color: #0d6efd; color: #0d6efd; }