﻿/* ==========================================================
   Box Căn cứ pháp lý & Tooltip dẫn chiếu văn bản trong bài viết
   (theo thiết kế 23.Tin-tuc-chi-tiet.html - article-tinhnang.css)
   ========================================================== */

/* ---------- Box Căn cứ pháp lý ---------- */
.legalref-box {
  border: 1px solid #dbe5ef;
  border-radius: 5px;
  margin: 16px 0;
  clear: both;
  background: #fff;
  font-size: 15px;
  line-height: 1.5;
}
.legalref-header {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-sizing: border-box;
  border-bottom: 1px solid #edf0f4;
  background: #f8fbff;
  border-radius: 5px 5px 0 0;
}
.legalref-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: bold;
  margin: 0;
}
.legalref-all {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #666;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.legalref-all:hover,
.legalref-all:focus-visible {
  color: #a67c52;
}
.legalref-item {
  padding: 8px 12px;
  box-sizing: border-box;
  border-bottom: 1px solid #edf0f4;
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
/* Item cuối không viền dưới; khi có nút Xem thêm thì viền item làm vạch ngăn với nút */
.legalref-list > .legalref-item:last-child {
  border-bottom: 0;
}
.legalref-body {
  min-width: 0;
  flex: 1;
}
.legalref-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.legalref-name {
  color: #a67c52 !important;
  font-size: 15px;
  text-decoration: none;
}
a.legalref-name:hover {
  text-decoration: underline;
}
.legalref-chevron {
  color: #687586;
  cursor: pointer;
  flex-shrink: 0;
}
.legalref-chevron:hover {
  color: #3587e5;
}
.legalref-loadmore {
  text-align: center;
  padding: 3px;
}
.btn-legalref-show {
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background: none;
  font-size: 14px;
  color: #666;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-legalref-show:hover {
  color: #a67c52;
}
.btn-legalref-show svg {
  transition: transform 0.2s ease;
}
.btn-legalref-show.is-expanded svg {
  transform: rotate(180deg);
}
.btn-legalref-show.is-busy {
  opacity: 0.6;
}

/* ---------- Chấm màu & Badge tình trạng hiệu lực ---------- */
.legalref-dot {
  height: 8px;
  width: 8px;
  border-radius: 100%;
  display: inline-flex;
  flex-shrink: 0;
}
.legalref-dot.bg-green { background: #14966a; }
.legalref-dot.bg-red { background: #d81d22; }
.legalref-dot.bg-yellow { background: #e89032; }
.legalref-dot.bg-purple { background: #7c3aed; }
.legalref-dot.bg-gray { background: #9ca3af; }

.legalref-status {
  display: inline-flex;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: normal;
  white-space: nowrap;
}
.legalref-status.text-bggreen { color: #14966a; background: #eaf8f2; }
.legalref-status.text-bgred { color: #d81d22; background: #fdecec; }
.legalref-status.text-bgorange { color: #e89032; background: #fef3e0; }
.legalref-status.text-bgpurple { color: #7c3aed; background: #f3e8ff; }
.legalref-status.text-bggray { color: #6b7280; background: #eff0f3; }

/* ---------- Cụm từ dẫn chiếu trong nội dung bài viết ---------- */
.the-article-body [data-reference-key]:not([data-role]),
.the-article-body [data-doc-id]:not([data-role]) {
  color: #a67c52;
  cursor: pointer;
}

/* ---------- Tooltip dẫn chiếu ---------- */
.adr-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99998;
  display: none;
  width: max-content;
  max-width: min(600px, calc(100vw - 16px));
  pointer-events: auto;
}
.adr-tooltip.show {
  display: block;
}
.adr-tooltip .tooltipnews-content {
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 16px;
  background-color: #fff;
  border-radius: 3px;
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.39);
  color: #222;
}
.adr-tooltip .tooltipnews-content.bg-be {
  background: #fff4e6;
}
.adr-tooltip .lv-legal-reference {
  font-size: 14px;
  line-height: 1.5;
}
.adr-tooltip .lv-legal-reference-message {
  color: #666;
  text-align: center;
}
.adr-tooltip .lv-legal-reference-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  font-weight: bold;
  font-size: 18px;
  border-bottom: 1px solid #e0e0e0;
}
.adr-tooltip .lv-legal-reference-info-title {
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: bold;
}
.adr-tooltip .lv-legal-reference-status-row {
  font-size: 13px;
  margin-bottom: 8px;
}
.adr-tooltip .lv-legal-reference-content {
  font-size: 14px;
}
.adr-tooltip .lv-legal-reference-content p {
  margin: 6px 0;
}
.adr-tooltip .table-legal-meta {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}
.adr-tooltip .table-legal-meta td {
  padding: 2px 0;
  vertical-align: top;
}
.adr-tooltip .wtd-30 {
  width: 30%;
}
.adr-tooltip .lv-legal-reference-warning {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  padding: 10px;
  border: 1px solid #efd3d3;
  border-radius: 10px;
  background: #fff4f4;
}
.adr-tooltip .lv-legal-reference-warning-icon {
  flex-shrink: 0;
}
.adr-tooltip .lv-legal-reference-warning-content {
  flex: 1;
  min-width: 0;
  font-size: 12px;
}
.adr-tooltip .lv-legal-reference-warning-content a {
  display: inline-block;
  margin-top: 4px;
  color: #1769c2;
  font-weight: bold;
  text-decoration: underline;
}
.adr-tooltip .lv-legal-reference-meta-row {
  margin-top: 8px;
  font-size: 13px;
  text-align: center;
  color: #666;
}

/* ---------- Modal Popup tổng hợp căn cứ pháp lý ---------- */
#pop_article_doc_refer .popup-wrapper.popup-900 {
  max-width: 930px;
  width: calc(100% - 32px);
}
#pop_article_doc_refer .popup-pading {
  padding: 20px;
}
.lv-legal-wrapper {
  font-size: 14px;
  line-height: 1.5;
  color: #222;
}
.lv-legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.lv-legal-title {
  font-size: 16px;
  font-weight: bold;
}
.lv-legal-tabs {
  display: flex;
  border-bottom: 1px solid #eee;
  margin-bottom: 16px;
}
.lv-legal-tab {
  position: relative;
  flex: 1;
  padding: 10px 5px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
}
.lv-legal-tab-active {
  color: #d52c25;
}
.lv-legal-tab-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: #d52c25;
}
.lv-legal-content {
  display: none;
}
.lv-legal-content.open {
  display: block;
}
.lv-legal-content.overflow-y {
  max-height: 64vh;
  overflow-y: auto;
}
.lv-legal-empty {
  padding: 24px 0;
  text-align: center;
  color: #666;
}
.lv-legal-document {
  border: 1px solid #e7e7e7;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.3s ease;
}
.lv-legal-document + .lv-legal-document {
  margin-top: 10px;
}
.lv-legal-document.is-highlight {
  box-shadow: 0 0 0 2px #a67c52;
}
.lv-legal-document-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
}
.lv-legal-document-number {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 100%;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
}
.lv-legal-document-number.bg-green { background: #14966a; }
.lv-legal-document-number.bg-red { background: #d81d22; }
.lv-legal-document-number.bg-yellow { background: #e89032; }
.lv-legal-document-number.bg-purple { background: #7c3aed; }
.lv-legal-document-number.bg-gray { background: #9ca3af; }
.lv-legal-document-main {
  min-width: 0;
  flex: 1;
}
.lv-legal-document-title {
  font-size: 16px;
  font-weight: bold;
}
.lv-legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 6px;
  font-size: 13px;
}
.lv-legal-original-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  color: #a67c52;
}
.lv-legal-original-link span {
  font-size: 16px;
}
.lv-legal-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 10px 10px;
  padding: 8px 9px;
  border: 1px solid #f0dfbd;
  border-radius: 6px;
  background: #fff7e7;
  font-size: 12px;
}
.lv-legal-warning-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f3a313;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
}
.lv-legal-clauses-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  background: #fafafa;
  font-weight: bold;
  cursor: pointer;
}
.lv-legal-chevron {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 1.5px solid #333;
  border-bottom: 1.5px solid #333;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}
.lv-legal-clauses-head[aria-expanded="false"] .lv-legal-chevron {
  transform: rotate(-45deg);
}
.lv-legal-clause-table {
  width: 100%;
  overflow-x: auto;
  display: none;
}
.lv-legal-clause-table.open {
  display: block;
}
.lv-legal-clause-table table {
  width: 100%;
  border-collapse: collapse;
}
.lv-legal-clause-table td {
  padding: 8px 10px;
  border-top: 1px solid #eee;
}
.lv-legal-clause-number {
  color: #a67c52;
}
.lv-legal-row-arrow {
  text-align: center;
  width: 30px;
}
.lv-legal-row-arrow a {
  font-size: 16px;
}
.lv-legal-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 10px;
  padding: 12px;
  border-radius: 7px;
  background: #edf4fb;
}
.lv-legal-note-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border: 1px solid #666;
  border-radius: 100%;
  font-size: 12px;
}
.lv-legal-note-content {
  color: #444;
  font-size: 12px;
}
.lv-legal-note-title {
  font-weight: bold;
}

/* Tab 2: Theo điều khoản */
.tab-legalref {
  display: flex;
  width: 100%;
  border: 1px solid #e0e0e0;
  background: #fff;
  overflow: hidden;
}
.tab-legalref-nav {
  width: 190px;
  flex-shrink: 0;
  background: #f7f7f7;
  border-right: 1px solid #e0e0e0;
  max-height: 63vh;
  overflow-y: auto;
}
.tab-legalref-item {
  padding: 12px;
  border-bottom: 1px solid #e0e0e0;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}
.tab-legalref-item:hover {
  background: #eee;
}
.tab-legalref-item.active {
  background: #fff;
  color: #a67c52;
  border-left: 3px solid #a67c52;
}
.tab-legalref-text {
  padding: 10px;
  font-size: 13px;
  color: #666;
  font-style: italic;
}
.tab-legalref-content {
  flex: 1;
  min-width: 0;
  padding: 16px;
  max-height: 63vh;
  overflow-y: auto;
}
.tab-legalref-panel {
  display: none;
  font-size: 15px;
  line-height: 1.7;
  color: #444;
}
.tab-legalref-panel.active {
  display: block;
}
.tab-legalref-panel .ndvb-head {
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 8px;
  margin-bottom: 10px;
}
.tab-legalref-panel .ndvb-title-text {
  font-size: 14px;
}
.tab-legalref-panel .ndvb-title-text a {
  color: #a67c52;
  font-weight: bold;
}
.tab-legalref-panel .ndvb-content {
  font-size: 14px;
  line-height: 1.6;
}
.lv-legal-clause-item + .lv-legal-clause-item {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #e0e0e0;
}
.lv-legal-clause-item-title {
  font-weight: bold;
  margin-bottom: 4px;
}
.lv-legal-clause-item-title a {
  color: #a67c52;
}
.lv-legal-clause-item-content p {
  margin: 6px 0;
}
.tab-legalref-mobile-select {
  display: none;
  position: relative;
  margin-bottom: 15px;
}
.tab-legalref-mobile-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  background: #fff;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}
.tab-legalref-current-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tab-legalref-mobile-list {
  display: none;
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  right: 0;
  z-index: 100;
  max-height: 410px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
}
.tab-legalref-mobile-list.open {
  display: block;
}

@media (max-width: 960px) {
  .legalref-main {
    display: flow-root;
  }
  .legalref-main .legalref-dot {
    margin-right: 6px;
    vertical-align: middle;
  }
  .legalref-main .legalref-status {
    margin-left: 6px;
  }
  .adr-tooltip .tooltipnews-content {
    max-height: 60vh;
  }
  .adr-tooltip .lv-legal-reference-meta-row {
    font-size: 12px;
  }
  #pop_article_doc_refer .popup-pading {
    padding: 16px 12px;
  }
  .tab-legalref {
    display: block;
    border: 0;
  }
  .tab-legalref-nav {
    display: none;
  }
  .tab-legalref-mobile-select {
    display: block;
  }
  .tab-legalref-content {
    padding: 0;
    max-height: none;
  }
}
