/* ===== NPSC - Thư viện văn bản điện tử: giao diện cổng tra cứu ===== */
:root {
  --npsc-blue: #0a3d8f;
  --npsc-blue-2: #1259c3;
  --npsc-blue-3: #e8f0fc;
  --npsc-sky: #f4f7fc;
  --npsc-accent: #f5b301;
  --npsc-text: #1d2733;
  --npsc-muted: #637083;
  --npsc-border: #dde5f0;
  --bs-primary: #0a4fb5;
  --bs-primary-rgb: 10, 79, 181;
  --bs-link-color: #0a4fb5;
  --bs-link-color-rgb: 10, 79, 181;
  --bs-body-font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}
body { color: var(--npsc-text); background: var(--npsc-sky); font-size: 15px; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.btn-primary { --bs-btn-bg: #0a4fb5; --bs-btn-border-color: #0a4fb5; --bs-btn-hover-bg: #083f92; --bs-btn-hover-border-color: #083f92; --bs-btn-active-bg: #07357b; }
.btn-outline-primary { --bs-btn-color: #0a4fb5; --bs-btn-border-color: #0a4fb5; --bs-btn-hover-bg: #0a4fb5; --bs-btn-hover-border-color: #0a4fb5; }
.btn-warning { --bs-btn-bg: var(--npsc-accent); --bs-btn-border-color: var(--npsc-accent); --bs-btn-color: #1d2733; }
.btn:hover { text-decoration: none; }

/* Thanh trên cùng + header */
.topbar { background: #072c68; color: #dbe6f7; font-size: 13px; padding: 6px 0; }
.site-header { background: #fff; border-bottom: 1px solid var(--npsc-border); }
.brand-mark { width: 52px; height: 52px; border-radius: 12px; background: linear-gradient(135deg, var(--npsc-blue), var(--npsc-blue-2)); color: var(--npsc-accent);
  display: inline-flex; align-items: center; justify-content: center; font-size: 28px; flex: 0 0 auto; box-shadow: 0 4px 10px rgba(10,61,143,.25); }
.brand-logo { height: 56px; width: auto; }
.brand-org { color: var(--npsc-blue); font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand-name { color: #c4161c; font-weight: 700; font-size: 20px; line-height: 1.2; }
.brand:hover { text-decoration: none; }
.main-nav { background: linear-gradient(90deg, var(--npsc-blue), var(--npsc-blue-2)); padding: 0; }
.main-nav .nav-link { color: rgba(255,255,255,.92) !important; font-weight: 500; padding: 12px 14px !important; font-size: 14.5px; }
.main-nav .nav-link:hover, .main-nav .nav-link.active { background: rgba(255,255,255,.14); text-decoration: none; }
.main-nav .dropdown-menu { border: 0; border-top: 3px solid var(--npsc-accent); border-radius: 0 0 8px 8px; }
@media (max-width: 991px) { .brand-name { font-size: 16px; } .brand-org { font-size: 12.5px; } .brand-mark { width: 44px; height: 44px; font-size: 22px; } }

/* Hero tìm kiếm */
.hero { background: radial-gradient(1200px 400px at 85% -10%, rgba(245,179,1,.18), transparent 60%),
  linear-gradient(135deg, #0a3d8f 0%, #0d4fae 55%, #1565c0 100%); color: #fff; padding: 48px 0 36px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 36px 36px; pointer-events: none; }
.hero-inner { max-width: 880px; margin: 0 auto; text-align: center; position: relative; z-index: 1; }
.hero-title { font-size: clamp(24px, 3.4vw, 34px); font-weight: 700; margin-bottom: 8px; }
.hero-sub { opacity: .88; margin-bottom: 24px; }
.search-box { display: flex; background: #fff; border-radius: 12px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.18); align-items: center; }
.search-box .form-control { border: 0; box-shadow: none !important; padding-left: 42px; font-size: 16.5px; }
.search-box .search-ico { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: #8a96a8; font-size: 18px; z-index: 2; }
.search-box .btn { border-radius: 9px; white-space: nowrap; }
.search-form .search-box { box-shadow: none; border: 2px solid var(--npsc-border); }
.hero-options { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px; font-size: 13.5px; text-align: left; }
.hero-options label { cursor: pointer; opacity: .92; }
.hero-options a { color: #ffe08a; }
.hero-stats { display: flex; justify-content: center; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.hero-stats > div { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); border-radius: 10px; padding: 8px 18px; min-width: 120px; }
.hero-stats b { display: block; font-size: 22px; }
.hero-stats span { font-size: 12.5px; opacity: .85; }
.suggest-box { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border-radius: 10px; z-index: 50; text-align: left; display: none; overflow: hidden; }
.suggest-box.show { display: block; }
.suggest-box a { display: block; padding: 9px 16px; color: var(--npsc-text); border-bottom: 1px solid #f0f3f8; }
.suggest-box a:hover, .suggest-box a.active { background: var(--npsc-blue-3); text-decoration: none; }
.suggest-box small { color: var(--npsc-muted); display: block; }

/* Panel */
.panel { background: #fff; border: 1px solid var(--npsc-border); border-radius: 10px; overflow: hidden; }
.panel-head { padding: 12px 16px; font-weight: 700; color: var(--npsc-blue); border-bottom: 2px solid var(--npsc-blue-3); background: #fbfcfe; }
.panel-head i { color: var(--npsc-blue-2); }
.panel-body { padding: 16px; }

/* Cây danh mục */
.cat-tree { list-style: none; margin: 0; padding: 0; }
.cat-tree.nested { padding-left: 18px; border-left: 1px dashed #cfd9e8; margin-left: 12px; }
.cat-row { display: flex; align-items: center; gap: 2px; border-radius: 6px; }
.cat-row:hover { background: var(--npsc-blue-3); }
.cat-tree li.active > .cat-row { background: var(--npsc-blue); }
.cat-tree li.active > .cat-row a, .cat-tree li.active > .cat-row .cat-toggle, .cat-tree li.active > .cat-row .cat-count { color: #fff; }
.cat-row a { flex: 1; display: flex; align-items: center; gap: 8px; padding: 7px 4px; color: var(--npsc-text); font-size: 14px; line-height: 1.3; }
.cat-row a:hover { text-decoration: none; }
.cat-ico { color: var(--npsc-blue-2); font-size: 16px; width: 18px; text-align: center; }
.cat-toggle { border: 0; background: none; width: 24px; height: 24px; color: var(--npsc-muted); padding: 0; flex: 0 0 auto; }
.cat-toggle i { display: inline-block; transition: transform .15s; }
.cat-toggle:not(.collapsed) i { transform: rotate(90deg); }
.cat-toggle-spacer { width: 24px; flex: 0 0 auto; }
.cat-count { font-size: 12px; color: var(--npsc-muted); background: #eef2f8; padding: 1px 8px; border-radius: 10px; margin-right: 6px; }
.cat-tree li.active > .cat-row .cat-count { background: rgba(255,255,255,.2); }

/* Thẻ danh mục nhanh */
.quick-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.quick-cat { background: #fff; border: 1px solid var(--npsc-border); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 4px; color: var(--npsc-text);
  transition: all .15s; border-left: 4px solid var(--npsc-blue-2); }
.quick-cat:hover { box-shadow: 0 6px 18px rgba(10,61,143,.12); transform: translateY(-2px); text-decoration: none; border-left-color: var(--npsc-accent); }
.quick-cat i { font-size: 24px; color: var(--npsc-blue-2); }
.quick-cat span { font-weight: 600; font-size: 14px; line-height: 1.3; }
.quick-cat small { color: var(--npsc-muted); }

/* Danh sách văn bản */
.doc-item { display: flex; gap: 14px; padding: 16px; border-bottom: 1px solid #edf1f7; align-items: flex-start; }
.doc-item:last-child { border-bottom: 0; }
.doc-item:hover { background: #fafcff; }
.doc-icon { width: 42px; height: 52px; border-radius: 6px; background: #fdecec; color: #d32f2f; display: flex; align-items: center; justify-content: center; font-size: 24px; flex: 0 0 auto; }
.doc-body { flex: 1; min-width: 0; }
.doc-meta-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.doc-number { font-weight: 700; color: #c4161c; font-size: 13.5px; background: #fff3f3; border: 1px solid #f6d3d3; padding: 1px 8px; border-radius: 4px; }
.doc-type { font-size: 12.5px; color: var(--npsc-blue); background: var(--npsc-blue-3); padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.doc-title { font-size: 16px; font-weight: 600; margin: 2px 0 6px; line-height: 1.4; }
.doc-title a { color: #0b2f6b; }
.doc-summary, .doc-snippet { color: #4a5668; font-size: 14px; margin-bottom: 6px; }
.doc-snippet { background: #fffbea; border-left: 3px solid var(--npsc-accent); padding: 6px 10px; border-radius: 0 6px 6px 0; font-size: 13.5px; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--npsc-muted); }
.doc-actions { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
mark { background: #ffe58a; padding: 0 1px; border-radius: 2px; }
.badge-public { background: #e3f5e9; color: #1b7a3d; font-weight: 600; }
.badge-internal { background: #fff1db; color: #a35a00; font-weight: 600; }
@media (max-width: 576px) {
  .doc-item { flex-wrap: wrap; padding: 14px 12px; }
  .doc-icon { display: none; }
  .doc-actions { flex-direction: row; width: 100%; }
  .doc-actions .btn { flex: 1; }
}

/* Chips & danh sách xếp hạng */
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; background: var(--npsc-blue-3); color: var(--npsc-blue); border-radius: 20px; font-size: 13px; }
.chip b { background: #fff; border-radius: 10px; padding: 0 6px; font-size: 11.5px; }
.chip:hover { background: var(--npsc-blue); color: #fff; text-decoration: none; }
.chip-alt { background: #fff6dd; color: #8a5b00; }
.rank-list { margin: 0; padding: 8px 16px 8px 36px; }
.rank-list.plain { list-style: none; padding-left: 16px; }
.rank-list li { padding: 8px 0; border-bottom: 1px dashed #e5ebf3; }
.rank-list li:last-child { border-bottom: 0; }
.rank-list li::marker { color: var(--npsc-blue-2); font-weight: 700; }
.rank-list a { color: #0b2f6b; font-weight: 500; display: block; line-height: 1.35; }
.rank-list small { color: var(--npsc-muted); }

/* Tiêu đề trang */
.page-head { background: linear-gradient(135deg, #0a3d8f, #1259c3); color: #fff; padding: 18px 0 22px; }
.page-head .breadcrumb { --bs-breadcrumb-divider-color: rgba(255,255,255,.6); --bs-breadcrumb-item-active-color: rgba(255,255,255,.85); margin-bottom: 6px; font-size: 13px; }
.page-head .breadcrumb a { color: #fff; }
.page-title { font-size: clamp(20px, 2.6vw, 26px); font-weight: 700; margin: 0; }
.page-desc { opacity: .88; margin: 6px 0 0; }
.subcats { display: flex; flex-wrap: wrap; gap: 8px; }
.subcat { background: #fff; border: 1px solid var(--npsc-border); border-radius: 8px; padding: 8px 14px; color: var(--npsc-text); font-size: 14px; }
.subcat span { color: var(--npsc-muted); font-size: 12px; margin-left: 4px; }
.subcat:hover { border-color: var(--npsc-blue-2); text-decoration: none; color: var(--npsc-blue); }
.empty-state { text-align: center; padding: 48px 16px; color: var(--npsc-muted); }
.empty-state > i { font-size: 44px; opacity: .5; }

/* Chi tiết văn bản */
.doc-detail-title { font-size: clamp(20px, 2.4vw, 25px); font-weight: 700; color: #0b2f6b; line-height: 1.35; }
.doc-abstract { background: var(--npsc-blue-3); border-radius: 8px; padding: 12px 16px; margin-top: 12px; }
.doc-abstract .label { font-size: 12px; text-transform: uppercase; color: var(--npsc-blue); font-weight: 700; margin-bottom: 2px; }
.section-title { font-size: 15px; text-transform: uppercase; color: var(--npsc-blue); font-weight: 700; border-bottom: 2px solid var(--npsc-blue-3); padding-bottom: 6px; margin: 8px 0 0; }
.meta-table th { width: 34%; color: var(--npsc-muted); font-weight: 500; background: #fbfcfe; }
.meta-table td, .meta-table th { padding: 10px 12px; font-size: 14.5px; }
.file-card { display: flex; gap: 12px; align-items: center; }
.file-card > i { font-size: 40px; color: #d32f2f; }
.perm-list li { padding: 2px 0; }
.version-list { list-style: none; padding: 8px 16px; margin: 0; font-size: 13.5px; }
.version-list li { padding: 8px 0 8px 14px; border-left: 2px solid var(--npsc-border); position: relative; }
.version-list li::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: #c4d1e4; }
.version-list li.current::before { background: var(--npsc-blue-2); }

/* Đăng nhập */
.login-card { max-width: 420px; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 12px 40px rgba(10,61,143,.15); border: 1px solid var(--npsc-border); }
.login-head { background: linear-gradient(135deg, #0a3d8f, #1259c3); color: #fff; padding: 20px 24px; display: flex; gap: 14px; align-items: center; }
.error-code { font-size: 96px; font-weight: 800; color: var(--npsc-blue); opacity: .2; line-height: 1; }

.site-footer { background: #072c68; color: #dbe6f7; }
.site-main { min-height: 50vh; }
@media (min-width: 992px) { .main-nav .nav-link, .main-nav .btn { white-space: nowrap; } }
