/* ==========================================================================
   Trolysme Hub — mirror.css
   Style cho Tài liệu (docs.js: tiền tố .dc-) và Telegram Mirror (mirror.js: tiền tố .mr-)
   Không dùng @import hay url(). Sử dụng biến màu có sẵn của hệ thống.
   ========================================================================== */

/* ---------- 1. Giao diện Tài liệu & Kỹ năng (.dc-) ---------- */
.dc-wrap {
  display: flex;
  height: 100%;
  min-height: 0;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* Cột trái: Thanh bên */
.dc-side {
  width: 320px;
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.dc-side-header {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel2);
}

.dc-side-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
  text-transform: none;
}

.dc-search {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.dc-search:focus {
  border-color: var(--acc);
}

.dc-search::placeholder {
  color: var(--mute);
  opacity: 0.7;
}

.dc-net-warn {
  padding: 4px 8px;
  border-radius: 6px;
  background: #f8717122;
  color: #fca5a5;
  border: 1px solid #f8717155;
  font-size: 11px;
  text-align: center;
}

/* Cây danh sách tệp & nhóm */
.dc-tree {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dc-group {
  margin-bottom: 6px;
}

.dc-group-sum {
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--mute);
  user-select: none;
  outline: none;
  transition: background 0.12s;
}

.dc-group-sum:hover {
  background: #ffffff08;
  color: var(--text);
}

.dc-group-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dc-badge {
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--mute);
  font-size: 11px;
  white-space: nowrap;
  font-weight: normal;
}

/* Mục tài liệu */
.dc-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 10px;
  margin: 2px 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text);
  font: inherit;
  transition: background 0.12s, border-color 0.12s;
}

.dc-item:hover {
  background: #ffffff08;
}

.dc-item.dc-active {
  background: var(--panel2);
  border-color: var(--line);
  border-left: 3px solid var(--acc);
}

.dc-item-title {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dc-item-path {
  font-size: 11px;
  color: var(--mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Nhóm kỹ năng */
.dc-skill-card {
  margin: 4px 0;
  border-radius: 6px;
  background: #ffffff04;
  border: 1px solid var(--line);
  overflow: hidden;
}

.dc-skill-main {
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.12s;
}

.dc-skill-main:hover {
  background: #ffffff0a;
}

.dc-skill-main.dc-active {
  background: var(--panel2);
  border-left: 3px solid var(--acc);
}

.dc-skill-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.dc-skill-desc {
  font-size: 12px;
  color: var(--mute);
  margin-top: 3px;
  line-height: 1.35;
}

.dc-skill-files {
  border-top: 1px solid var(--line);
  background: #0000001a;
  padding: 4px 6px;
}

.dc-skill-files-sum {
  cursor: pointer;
  font-size: 11px;
  color: var(--mute);
  padding: 3px 6px;
  user-select: none;
  outline: none;
}

.dc-skill-files-sum:hover {
  color: var(--acc);
}

.dc-subfile-list {
  padding-left: 6px;
  margin-top: 3px;
}

.dc-subfile-item {
  padding: 4px 8px;
}

/* Cột phải: Nội dung tài liệu */
.dc-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

.dc-main-top {
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.dc-back-btn {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  display: none;
  white-space: nowrap;
}

.dc-back-btn:hover {
  border-color: var(--acc);
}

.dc-path-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.dc-path-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dc-ro-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--mute);
  white-space: nowrap;
}

.dc-trunc-warn {
  padding: 6px 14px;
  background: #fbbf2415;
  border-bottom: 1px solid #fbbf2433;
  color: var(--warn);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dc-main-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
}

/* Khối Markdown của docs */
.dc-markdown {
  max-width: 900px;
  margin: 0 auto;
  line-height: 1.6;
  font-size: 14px;
  color: var(--text);
}

.dc-h1, .dc-h2, .dc-h3, .dc-h4 {
  color: #fff;
  font-weight: 700;
  line-height: 1.3;
}

.dc-h1 {
  font-size: 22px;
  margin: 24px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.dc-h1:first-child {
  margin-top: 0;
}

.dc-h2 {
  font-size: 18px;
  margin: 20px 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.dc-h3 {
  font-size: 15px;
  margin: 16px 0 8px;
}

.dc-h4 {
  font-size: 14px;
  margin: 14px 0 6px;
  color: var(--mute);
}

.dc-p {
  margin: 0 0 12px;
}

.dc-ul, .dc-ol {
  margin: 6px 0 14px;
  padding-left: 24px;
}

.dc-li {
  margin: 3px 0;
}

.dc-pre {
  background: #090e17;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin: 12px 0;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.dc-code-block {
  font-family: inherit;
  color: #d1d5db;
}

.dc-code-inline {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #7dd3fc;
}

.dc-quote {
  border-left: 3px solid var(--acc);
  background: #38bdf80d;
  padding: 6px 14px;
  margin: 12px 0;
  border-radius: 0 8px 8px 0;
  color: #cfe3ff;
}

.dc-quote .dc-p {
  margin-bottom: 4px;
}

.dc-hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}

.dc-table-wrap {
  overflow-x: auto;
  margin: 14px 0;
}

.dc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dc-table th {
  background: var(--panel2);
  color: var(--mute);
  font-weight: 600;
  padding: 8px 12px;
  border: 1px solid var(--line);
  text-align: left;
}

.dc-table td {
  padding: 8px 12px;
  border: 1px solid var(--line);
}

.dc-table tr:nth-child(even) {
  background: #ffffff05;
}

.dc-link {
  color: var(--acc);
  text-decoration: none;
}

.dc-link:hover {
  text-decoration: underline;
}

.dc-plain-link {
  color: var(--text);
}

.dc-url-sub {
  color: var(--mute);
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.dc-loading, .dc-empty, .dc-err-box {
  padding: 24px;
  text-align: center;
  color: var(--mute);
}

.dc-err-box {
  color: var(--bad);
  background: #f8717112;
  border: 1px solid #f8717133;
  border-radius: 8px;
  margin: 20px auto;
  max-width: 480px;
}

/* ---------- 2. Giao diện Telegram Mirror (.mr-) ---------- */
.mr-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  width: 100%;
  background: #0e1621;
  color: var(--text);
  position: relative;
  overflow: hidden;
}

/* Thanh trên */
.mr-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: #17212b;
  border-bottom: 1px solid #0b121a;
  flex: none;
  flex-wrap: wrap;
  z-index: 2;
}

.mr-top-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.mr-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mr-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.mr-dot-idle {
  background: #6b7280;
}

.mr-dot-run {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: mr-pulse 1.3s infinite ease-in-out;
}

@keyframes mr-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(1.2);
  }
}

.mr-status-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.mr-session-title {
  font-size: 13px;
  color: var(--mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mr-pill {
  padding: 2px 8px;
  border-radius: 99px;
  background: #243447;
  color: var(--mute);
  font-size: 11px;
  white-space: nowrap;
}

.mr-net-err {
  padding: 4px 12px;
  background: #f8717122;
  border-bottom: 1px solid #f8717144;
  color: #fca5a5;
  font-size: 12px;
  text-align: center;
}

/* Khung tin nhắn */
.mr-msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #0e1621;
}

.mr-msg {
  max-width: 84%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mr-msg.me {
  align-self: flex-end;
  align-items: flex-end;
}

.mr-msg.bot {
  align-self: flex-start;
  align-items: flex-start;
}

.mr-bub {
  padding: 8px 12px;
  border-radius: 14px;
  line-height: 1.5;
  word-break: break-word;
  font-size: 14px;
}

.mr-msg.me .mr-bub {
  background: #2b5278;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.mr-msg.bot .mr-bub {
  background: #182533;
  color: #e6edf7;
  border-bottom-left-radius: 4px;
}

.mr-bub p {
  margin: 0 0 6px;
}

.mr-bub p:last-child {
  margin-bottom: 0;
}

.mr-ts {
  font-size: 11px;
  color: #8b98a8;
  margin-top: 3px;
  text-align: right;
  display: block;
}

.mr-msg.me .mr-ts {
  color: #a5c7eb;
}

/* Dòng note ở giữa */
.mr-note-row {
  align-self: center;
  margin: 4px 0;
  text-align: center;
  max-width: 90%;
}

.mr-note-bub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #16222f80;
  border: 1px solid #233446;
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--mute);
}

.mr-note-time {
  font-size: 10px;
  color: #728396;
}

/* Khối công cụ */
.mr-acts-wrap {
  align-self: flex-start;
  max-width: 90%;
  width: 100%;
}

.mr-acts {
  background: #131d29;
  border: 1px solid #1f2d3d;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  color: #9da5b4;
}

.mr-acts-sum {
  cursor: pointer;
  font-weight: 600;
  color: #a9b8d3;
  user-select: none;
  outline: none;
}

.mr-acts-body {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mr-act {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 12px;
  word-break: break-word;
}

.mr-act.ok {
  color: #7ee2a8;
}

.mr-act.err {
  color: #f08a8a;
  background: #f8717112;
}

.mr-act.run {
  color: #f0c674;
  background: #fbbf2415;
  animation: mr-glow 1.4s infinite ease-in-out;
}

@keyframes mr-glow {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

.mr-act-time {
  font-size: 10px;
  color: #728396;
  flex-shrink: 0;
}

/* Đang gõ ba chấm */
.mr-typing-row {
  margin-top: 2px;
}

.mr-typing-bub {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
}

.mr-dots {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.mr-dots i {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6ab3f3;
  animation: mr-bl 1.2s infinite;
}

.mr-dots i:nth-child(2) {
  animation-delay: 0.2s;
}

.mr-dots i:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes mr-bl {
  0%, 80%, 100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

.mr-typing-label {
  font-size: 12px;
  color: #9da5b4;
}

/* Nút cuộn xuống */
.mr-btn-scroll {
  position: absolute;
  bottom: 58px;
  right: 20px;
  background: #1c2b3d;
  color: #fff;
  border: 1px solid #38bdf866;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px #0008;
  z-index: 5;
  transition: background 0.15s, border-color 0.15s;
}

.mr-btn-scroll:hover {
  background: #273c54;
  border-color: #38bdf8;
}

/* Chân trang */
.mr-footer {
  background: #17212b;
  border-top: 1px solid #0e1621;
  padding: 10px 14px;
  flex: none;
  text-align: center;
}

.mr-footer-note {
  font-size: 12px;
  color: var(--mute);
}

.mr-pre {
  background: #0b121a;
  border: 1px solid #243447;
  border-radius: 8px;
  padding: 8px;
  overflow-x: auto;
  margin: 6px 0;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.mr-code-inline {
  background: #0b121a;
  padding: 1px 5px;
  border-radius: 4px;
  font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.mr-link {
  color: #6ab3f3;
  text-decoration: none;
}

.mr-link:hover {
  text-decoration: underline;
}

.mr-list {
  margin: 4px 0;
  padding-left: 20px;
}

.mr-p {
  margin: 0 0 6px;
}

.mr-p:last-child {
  margin-bottom: 0;
}

.mr-empty {
  margin: auto;
  text-align: center;
  color: var(--mute);
  padding: 20px;
  font-size: 13px;
}

/* ---------- 3. Responsive (<860px) ---------- */
@media (max-width: 859px) {
  /* Docs view responsive */
  .dc-wrap[data-view="list"] .dc-side {
    display: flex;
    width: 100%;
    flex: 1;
    border-right: none;
  }

  .dc-wrap[data-view="list"] .dc-main {
    display: none;
  }

  .dc-wrap[data-view="doc"] .dc-side {
    display: none;
  }

  .dc-wrap[data-view="doc"] .dc-main {
    display: flex;
    width: 100%;
    flex: 1;
  }

  .dc-back-btn {
    display: inline-flex;
    align-items: center;
  }

  .dc-main-body {
    padding: 14px 16px;
  }

  /* Mirror view responsive */
  .mr-top {
    padding: 6px 10px;
  }

  .mr-msg {
    max-width: 92%;
  }

  .mr-acts-wrap {
    max-width: 100%;
  }
}

@media (min-width: 860px) {
  .dc-side {
    display: flex !important;
  }

  .dc-main {
    display: flex !important;
  }

  .dc-back-btn {
    display: none !important;
  }
}

/* sửa: thuộc tính hidden phải luôn ẩn; thanh cuộn tối */
.ws [hidden]{display:none !important}
.ws *{scrollbar-color:#4a4a4a #1b1b1b;scrollbar-width:thin}
