/* ================= GLOBAL ================= */
html, body {
  margin: 0;
  padding: 0;
  font-family: 'Roboto', sans-serif;
  background: #fffaf5;
  color: #333;
  overflow-x: hidden;
}

/* ================= HEADER ================= */
.site-header {
  background: #8B0000;
  text-align: center;
  padding: 20px 10px 28px;
  color: #fff;
  border-bottom: 3px solid #ffd700;
  position: relative;
}

.title-main {
  font-size: 1.8rem;
  margin: 0;
  padding: 0;
}

.title-chi {
  font-family: 'Charm', cursive;
  font-size: 5.5rem;
  margin-top: -10px;
  margin-bottom: -5px;
  color: #ffd700;
  text-shadow: 0 0 15px #fff, 0 0 40px #ffdb58;
  animation: goldPulse 3s infinite ease-in-out;
}

.title-truong {
  font-family: 'Charm', cursive;
  font-size: 1.4rem;
  margin-top: 0;
  color: #fff;
  text-shadow: 0 0 10px #fff, 0 0 25px #ffdb58;
}

@keyframes goldPulse {
  0%, 100% { text-shadow: 0 0 10px #fff4b3, 0 0 25px #ffd700; }
  50% { text-shadow: 0 0 25px #fff8d0, 0 0 50px #ffd700; }
}



/* ================= RUNNING TEXT ================= */
.running-text {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  background: #8B0000;
  padding: 8px 0;
  font-size: 15.4px;
  color: #fff;
}

.running-text span {
  display: inline-block;
  padding-left: 100%;
  animation: runText 15s linear infinite;
}

@keyframes runText {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* ================= TOOLBAR ================= */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  text-align: center;
  background: #fff8f2;
  border-bottom: 2px solid #ffd700;
  padding: 10px;
}

.toolbar select,
.toolbar button {
  margin: 4px;
  padding: 6px 10px;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #ffd700;
  cursor: pointer;
}

.btn-main {
  background: #ffd700;
  color: #8B0000;
  font-weight: bold;
}

/* ================= MAIN LAYOUT ================= */
.main-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 15px;
    flex-wrap: nowrap; /* quan trọng, không để wrap */
}


/* ==== FIX TREE PANEL HIỂN THỊ TOÀN BỘ ==== */
.tree-panel {
  overflow-x: auto;
  overflow-y: auto;
  height: auto;
  max-height: none;
  min-height: 500px; /* tăng dần nếu cần, ví dụ 600px cho đủ nhìn */
}


/* ================= INFO PANEL ================= */
.info-panel {
  flex: 0 0 35%;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(200,0,0,0.1);
  padding: 12px;
  max-height: 700px;
  overflow-y: auto;
}

.info-detail p { margin: 4px 0; line-height: 1.4; text-align: left; }
.info-detail strong { display: inline-block; width: 130px; color: #222; }
.info-detail h3 { color: #a00; margin: 4px 0 10px; }
.info-detail h4 { color: #004d00; margin-top: 10px; }

/* ================= TREE NODES ================= */
.node rect {
  fill: #fff4cc;
  stroke: #8B0000;
  stroke-width: 2;
  rx: 10;
}

.node image {
  width: 50px;
  height: 50px;
  clip-path: circle(25px at 25px 25px);
}

.node text {
  font-size: 13.5px;
  font-weight: 600;
  fill: #333;
}

/* ================= NODE CONTROLS ================= */
.node-controls {
  display: flex;
  justify-content: center;
  gap: 5px;
}

/* ================= MEDIA ================= */
.media-section {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 15px;
}

.media-box {
  flex: 1 1 48%;
  background: #fff;
  border: 1px solid #ffd700;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(255,215,0,0.25);
  padding: 10px;
  text-align: center;
}

.media-box img {
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.media-box iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: 12px;
  display: block;
  box-shadow: 0 0 10px rgba(0,0,0,0.25);
}

/* ================= MAP ================= */
.map-section {
  margin: 15px;
  background: #fff;
  border: 1px solid #ffd700;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(255,215,0,0.25);
  padding: 10px;
}

.map-section iframe {
  width: 100%;
  height: 350px;
  border-radius: 8px;
}

/* ================= CHATBOX ================= */
.chatbox {
  position: fixed;
  bottom: 15px;
  right: 20px;
  width: 400px;
  max-height: 500px;
  background: #fff;
  border: 2px solid #ffd700;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  animation: floaty 3s ease-in-out infinite;
  overflow: hidden;
}

@keyframes floaty {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.chatbox-header {
  background: #ffd700;
  color: #8B0000;
  font-weight: bold;
  padding: 6px 10px;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}

.chatbox.minimized { height: 45px !important; overflow: hidden; }

.chatbox-body {
  flex: 1;
  overflow-y: auto;
  max-height: 350px;
  padding: 8px;
  font-size: .9rem;
  background: #fffaf0;
}

.chatbox-footer {
  display: flex;
  border-top: 1px solid #ffd700;
  background: #fff;
}

.chatbox-footer input { flex: 1; padding: 8px; border: none; border-right: 1px solid #ffd700; }
.chatbox-footer button { background: #ffd700; border: none; padding: 8px 12px; font-weight: bold; color: #8B0000; cursor: pointer; }

.chatbox-body .msg { margin: 5px 0; padding: 6px 10px; border-radius: 8px; word-wrap: break-word; font-size: 0.9rem; }
.chatbox-body .msg.user { background: #d0f0fd; color: #004466; text-align: right; }
.chatbox-body .msg.bot { background: #f0f0f0; color: #222; text-align: left; }

/* ================= FOOTER ================= */
.footer {
  text-align: center;
  color: #555;
  font-size: .9rem;
  margin: 20px;
}
/* ================= Nút Admin cố định góc trái dưới ================= */
.btn-admin {
  position: fixed;
  left: 10px;
  bottom: 10px;
  background: #ffd700;
  border: none;
  border-radius: 8px;
  color: #8B0000;
  font-weight: bold;
  padding: 6px 12px;
  cursor: pointer;
  z-index: 9999; /* nổi trên chatbox */
}
/* ================= RESPONSIVE MOBILE ================= */
@media screen and (max-width: 768px) {

  body { font-size: 14px; }

  .title-main {
    font-size: 1.3rem;
    line-height: 1.2;
    white-space: nowrap;       /* giữ nguyên dòng, không xuống dòng */
    overflow-wrap: normal;     /* không tự ngắt chữ */
    text-align: center;
}

  .title-chi {
    font-size: 3.5rem;
    margin-top: -5px;
    margin-bottom: -5px;
  }

  .title-truong {
    font-size: 1rem;
  }

  .toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 8px;
  }

  .toolbar select, .toolbar button { width: auto; font-size: 0.9rem; }

  .main-row { flex-direction: column; gap: 10px; padding: 10px; }
  .tree-panel, .info-panel { flex: 1 1 100%; max-height: none; }
  .tree-panel svg { min-height: 400px; }

  .tree-panel { overflow-x: auto; overflow-y: auto; padding: 10px; }

  /* TREE NODES MOBILE */
  .node rect { width: 110px; height: 55px; rx: 8; }
  .node image { width: 40px; height: 40px; clip-path: circle(20px at 20px 20px); }
  .node text { font-size: 11px; width: 132px; white-space: normal; }

  .media-section { flex-direction: column; gap: 10px; padding: 8px 10px; }
  .media-box { flex: 1 1 100%; }
  .media-box iframe, .media-box img { height: auto; }

  .map-section iframe { height: 300px; }

  .chatbox { width: 90%; right: 5%; bottom: 80px; max-height: 60%; }

  .footer { font-size: 0.8rem; margin: 10px; text-align: center; }

}
/* ===
============== CHATBOX MOBILE FIX ================= */
@media screen and (max-width: 768px) {
  .chatbox {
    bottom: 0 !important;   /* dán sát đáy màn hình */
    width: 90%;
    right: 5%;
    max-height: 60%;
  }
}
/* MOBILE TREE PANEL FIX + NODE SPACING */
@media screen and (max-width: 768px) {
    .tree-panel {
        overflow-x: auto;  /* scroll ngang */
        overflow-y: auto;  /* scroll dọc */
        padding: 10px;
        text-align: center;
    }

    .tree-panel svg {
    width: 100%;
    min-width: 1000px; /* đủ để scroll ngang nếu cần */
    height: auto;
}

    /* NODE */
    .node rect {
        width: 160px;   /* tăng ~20% từ trước → hở ra thêm 10% giữa các node */
        height: 55px;
        rx: 8;
    }

    .node image {
        width: 40px;
        height: 40px;
        clip-path: circle(20px at 20px 20px);
    }

    .node text {
        font-size: 11px;
        width: 120px;   /* xích chữ gần ảnh, hở đủ khoảng 3 chữ cái */
        white-space: normal;
    }
}
.tree-panel {
    flex: 1 1 65%;   /* hoặc flex: 1 1 100% nếu muốn full */
    min-width: 600px; /* đảm bảo đủ rộng */
    overflow-x: auto;
    overflow-y: auto;
    max-height: none;
    height: auto;
}
