* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #2f6dff;
  --primary-dark: #1444b8;
  --primary-soft: rgba(231, 240, 255, 0.88);
  --secondary: #69bdfd;
  --white: #ffffff;
  --text-main: #0d2240;
  --text-soft: #46617f;
  --danger: #e5484d;
  --danger-dark: #c92a2a;
  --success: #1f9d68;

  --shadow: 0 10px 24px rgba(18, 59, 128, 0.08);
  --shadow-strong: 0 18px 42px rgba(22, 66, 145, 0.16);
  --shadow-soft: 0 6px 18px rgba(47, 109, 255, 0.08);

  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;

  /* Biến layout dùng chung để header/nav/main/content luôn neo cùng một trục khi zoom. */
  --layout-max: 1360px;
  --layout-gap: clamp(12px, 2vw, 32px);
  --sidebar-width: clamp(270px, 19vw, 320px);

  /*
    Cách tăng/giảm độ đậm nhạt các khối trắng mờ:
    - Tăng opacity => nền trắng rõ hơn.
    - Giảm opacity => nền trong hơn.
  */
  --chat-panel-opacity: 0.29;
  --chat-input-opacity: 0.75;
  --chat-bot-bubble-opacity: 0.78;
  --chat-sidebar-opacity: 0.42;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-family: "Open Sans", sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text-main);
  overflow-x: hidden;
  background:
    linear-gradient(rgba(214, 234, 255, 0.12), rgba(214, 234, 255, 0.12)),
    url("img/nen_1.webp") center/cover no-repeat;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.page-wrapper {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.background-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(239, 246, 255, 0.04) 0%,
    rgba(220, 235, 255, 0.06) 40%,
    rgba(227, 239, 255, 0.1) 100%
  );
  pointer-events: none;
}

.site-header,
.nav-card,
.top-action-row,
.main-layout,
.site-footer,
.confirm-modal {
  position: relative;
  z-index: 2;
}

/* =========================
   HEADER
========================= */
.site-header {
  width: 100%;
  margin: 0;
  padding: 14px 28px 12px;
  background: linear-gradient(90deg, #4086f7, #bbbbc4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 18px rgba(18, 59, 128, 0.08);
}

.header-top {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 18px;
  min-height: 68px;
}

.logo-link {
  display: inline-flex;
  width: fit-content;
  margin-left: 18px;
}

.logo-box {
  width: 72px;
  height: 72px;
  border-radius: 0;
  overflow: hidden;
  position: relative;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}

.logo-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.logo-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
}

.header-title-wrap h1 {
  color: #f3e9e9;
  text-align: center;
  font-size: clamp(1.5rem, 2.6vw, 2.4rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-transform: uppercase;
}

/* =========================
   NAVIGATION
========================= */
.nav-card {
  width: fit-content;
  max-width: calc(100% - 32px);
  margin: 14px auto 0;
  padding: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.46);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
}

.desktop-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.nav-link,
.mobile-nav-link {
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  padding: 11px 20px;
  border-radius: 999px;
  transition:
    background 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.nav-link:hover,
.nav-link.active,
.mobile-nav-link:hover,
.mobile-nav-link.active {
  background: linear-gradient(135deg, #17496f, #7d8993);
  color: #d9f8fc;
  box-shadow: 0 8px 18px rgba(47, 109, 255, 0.16);
  transform: translateY(-1px);
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  justify-self: end;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 999px;
}

.mobile-nav {
  display: none;
  width: calc(100% - 28px);
  padding: 12px;
  border-radius: 20px;
}

.mobile-nav-link {
  display: block;
  padding: 12px 14px;
  border-radius: 14px;
}

/* =========================
   MAIN LAYOUT
========================= */
.main-layout {
  flex: 1;
  width: min(var(--layout-max), calc(100% - (var(--layout-gap) * 2)));
  margin: 18px auto 24px;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: clamp(14px, 1.6vw, 24px);
  align-items: start;
  justify-content: center;
}

/* =========================
   SIDEBAR
========================= */
.sidebar-card {
  min-height: clamp(560px, 68vh, 720px);
  max-height: calc(100vh - 210px);
  padding: 22px 18px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, var(--chat-sidebar-opacity));
  border: 1px solid rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 22px rgba(18, 59, 128, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-top {
  margin-bottom: 18px;
}

.sidebar-top h2 {
  font-size: 1.45rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
}

.history-list::-webkit-scrollbar,
.chat-preview::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-thumb,
.chat-preview::-webkit-scrollbar-thumb {
  background: rgba(47, 109, 255, 0.22);
  border-radius: 999px;
}

.history-empty {
  padding: 16px;
  border-radius: 18px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.54);
  border: 1px dashed rgba(47, 109, 255, 0.2);
  line-height: 1.6;
  font-size: 0.94rem;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  align-items: center;
  gap: 10px;
}

.history-item {
  width: 100%;
  min-width: 0;
  text-align: left;
  border: 1px solid rgba(47, 109, 255, 0.14);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text-main);
  padding: 13px 15px;
  border-radius: 16px;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
}

.history-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-time {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6f86a3;
}

.history-row:hover .history-item,
.history-row.active .history-item {
  background: linear-gradient(
    90deg,
    rgba(47, 109, 255, 0.14),
    rgba(105, 189, 253, 0.18)
  );
  border-color: rgba(47, 109, 255, 0.22);
  transform: translateX(2px);
}

.history-delete {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(229, 72, 77, 0.14);
  border-radius: 16px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.94),
    rgba(255, 238, 238, 0.86)
  );
  color: var(--danger);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease,
    color 0.22s ease;
}

.history-delete svg,
.history-delete-icon {
  width: 22px;
  height: 22px;
}

.history-delete-icon {
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.history-delete:hover {
  background: linear-gradient(145deg, #ffefef, #ffffff);
  color: var(--danger-dark);
  box-shadow: 0 10px 20px rgba(229, 72, 77, 0.14);
  transform: translateY(-2px) scale(1.03);
}

/* =========================
   HERO / CHAT
========================= */
.hero-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.hero-card {
  width: 100%;
  min-height: clamp(520px, 58vh, 680px);
  padding: 18px 32px 24px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, var(--chat-panel-opacity));
  border: 1px solid rgba(255, 255, 255, 0.32);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  box-shadow: 0 12px 30px rgba(18, 59, 128, 0.07);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chat-welcome {
  width: 100%;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    height 0.25s ease,
    margin 0.25s ease;
}

.chat-welcome.is-hidden {
  height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-8px);
  margin: 0;
  pointer-events: none;
}

.bot-avatar {
  width: 118px;
  margin: 0 auto 12px;
  background: transparent;
  border-radius: 0;
  overflow: visible;
  position: relative;
  box-shadow: none;
}

.bot-avatar-image {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  background: transparent;
}

.bot-avatar-fallback-text {
  display: none;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.85);
  padding: 10px 12px;
  border-radius: 12px;
}

.bot-badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(47, 109, 255, 0.12);
  color: var(--primary-dark);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hero-subtitle {
  display: none;
}

.chat-preview {
  width: 100%;
  max-width: 820px;
  flex: 0 0 10px;
  min-height: 10px;
  max-height: 10px;
  overflow-y: auto;
  padding: 0 4px;
  margin-bottom: 8px;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  text-align: left;
}

.chat-preview.has-message {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: min(390px, 42vh);
  padding-top: 6px;
  margin-bottom: 16px;
}

.chat-form {
  width: 100%;
  max-width: 680px;
}

.input-group {
  width: 100%;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, var(--chat-input-opacity));
  border-radius: 999px;
  padding: 5px;
  box-shadow: 0 8px 20px rgba(22, 66, 145, 0.08);
  border: 1px solid rgba(47, 109, 255, 0.1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#chatInput {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 10px 16px;
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--text-main);
}

#chatInput::placeholder {
  color: #6f86a3;
}

.send-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #74c3ff);
  color: #fff;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(47, 109, 255, 0.18);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

.send-btn span {
  display: inline-block;
  transform: translateX(1px);
}

.send-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 24px rgba(47, 109, 255, 0.24);
}

.send-btn:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

/* =========================
   CHAT MESSAGE
========================= */
.chat-message {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  animation: messageIn 0.22s ease both;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message:last-child {
  margin-bottom: 0;
}

.chat-message.user {
  justify-content: flex-end;
}

.chat-message.user .message-content {
  align-items: flex-end;
}

.chat-message.bot {
  justify-content: flex-start;
}

.chat-message.bot .message-content {
  align-items: flex-start;
}

.message-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  flex-shrink: 0;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chat-message.user .message-avatar {
  background: linear-gradient(135deg, #dceaff, #ffffff);
  color: var(--primary-dark);
  order: 2;
}

.chat-message.bot .message-avatar {
  background: rgba(255, 255, 255, 0.78);
  color: #0f5e80;
  order: 0;
  border: 2px solid rgba(47, 109, 255, 0.12);
}

.message-content {
  max-width: min(680px, calc(100% - 56px));
  display: flex;
  flex-direction: column;
}

.message-author {
  font-size: 0.88rem;
  font-weight: 700;
  color: #034994;
  margin-bottom: 6px;
}

.message-bubble {
  padding: 14px 16px;
  border-radius: 18px;
  color: var(--text-main);
  line-height: 1.65;
  word-wrap: break-word;
  white-space: pre-wrap;
  font-size: 1rem;
  font-weight: 400;
}

.chat-message.user .message-bubble {
  background: rgba(255, 255, 255, 0.96);
  color: #01346b;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-top-right-radius: 6px;
  box-shadow: 0 10px 22px rgba(22, 66, 145, 0.08);
}

.chat-message.bot .message-bubble {
  background: rgba(255, 255, 255, var(--chat-bot-bubble-opacity));
  color: #003b7a;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-top-left-radius: 6px;
  box-shadow: 0 12px 24px rgba(22, 66, 145, 0.08);
}

.thinking-text {
  font-style: italic;
  font-weight: 700;
   font-size: 16px;
}

.thinking-text::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.15em;
  border-right: 2px solid currentColor;
  animation: caretBlink 0.75s step-end infinite;
}

@keyframes caretBlink {
  50% {
    border-color: transparent;
  }
}

/* =========================
   MESSAGE FEEDBACK
========================= */
.message-feedback {
  width: 100%;
  margin-top: 10px;
}

.feedback-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Bộ 3 câu hỏi gợi ý sau mỗi câu trả lời của chatbot */
.followup-suggestions {
  width: 100%;
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.followup-title {
  color: rgba(0, 59, 122, 0.82);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.45;
}

.followup-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.followup-question-btn {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(47, 109, 255, 0.12);
  border-radius: 18px;
  padding: 12px 16px;
  background: rgb(211 224 255 / 94%);
  color: rgb(2 41 83 / 90%);
  font-size: 0.94rem;
  font-weight: 560;
  line-height: 1.55;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(47, 109, 255, 0.06);
  transition:
    transform 0.22s ease,
    background 0.22s ease,
    color 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.followup-question-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.94);
  color: #003b7a;
  border-color: rgba(47, 109, 255, 0.2);
  box-shadow: 0 12px 24px rgba(47, 109, 255, 0.12);
}

.followup-question-btn:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.feedback-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid rgba(47, 109, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #003b7a;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(47, 109, 255, 0.06);
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease,
    color 0.22s ease,
    border-color 0.22s ease;
}

.feedback-btn:hover {
  transform: translateY(-1px);
  background: rgba(232, 244, 255, 0.96);
  border-color: rgba(47, 109, 255, 0.22);
  box-shadow: 0 10px 22px rgba(47, 109, 255, 0.12);
}

.feedback-btn:active {
  transform: translateY(0);
}

.feedback-btn:disabled {
  cursor: default;
  pointer-events: none;
}

.feedback-btn.is-hidden {
  display: none !important;
}

.feedback-btn.is-selected:disabled {
  opacity: 1;
}

.feedback-btn.is-active.like-btn,
.feedback-btn.is-selected.like-btn {
  color: #0f8a5f;
  background: rgba(229, 250, 241, 0.95);
  border-color: rgba(31, 157, 104, 0.26);
  box-shadow: 0 8px 18px rgba(31, 157, 104, 0.12);
}

.feedback-btn.is-active.dislike-btn,
.feedback-btn.is-selected.dislike-btn {
  color: #c92a2a;
  background: rgba(255, 239, 239, 0.96);
  border-color: rgba(229, 72, 77, 0.24);
  box-shadow: 0 8px 18px rgba(229, 72, 77, 0.12);
}

.feedback-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.96rem;
  line-height: 1;
}

.feedback-icon i {
  display: block;
  line-height: 1;
}

.feedback-btn-text {
  display: inline-block;
  white-space: nowrap;
  line-height: 1;
}

.feedback-status {
  display: none;
  margin-top: 8px;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.5;
}

.feedback-status.show {
  display: block;
}

.feedback-status.success {
  color: #0f8a5f;
}

.feedback-status.error {
  color: #c92a2a;
}

.feedback-form {
  display: none;
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(47, 109, 255, 0.12);
  box-shadow: 0 8px 18px rgba(22, 66, 145, 0.06);
}

.feedback-form.show {
  display: block;
}

.feedback-label {
  display: block;
  color: #003b7a;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.5;
}

.feedback-textarea {
  width: 100%;
  min-height: 86px;
  margin-top: 8px;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid rgba(47, 109, 255, 0.16);
  border-radius: 14px;
  outline: none;
  background: rgba(255, 255, 255, 0.88);
  color: #003b7a;
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.5;
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease;
}

.feedback-textarea::placeholder {
  color: #6f86a3;
}

.feedback-textarea:focus {
  background: #ffffff;
  border-color: rgba(47, 109, 255, 0.42);
  box-shadow: 0 0 0 3px rgba(47, 109, 255, 0.12);
}

.feedback-submit {
  margin-top: 10px;
  min-height: 38px;
  padding: 9px 14px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), #74c3ff);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(47, 109, 255, 0.16);
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    opacity 0.22s ease;
}

.feedback-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(47, 109, 255, 0.22);
}

.feedback-submit:active {
  transform: translateY(0);
}

/* =========================
   SUGGESTION MARQUEE
========================= */
.suggestion-section {
  width: 100%;
  max-width: 820px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    max-height 0.25s ease,
    margin 0.25s ease;
}

.suggestion-section.is-hidden {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(8px);
  pointer-events: none;
}

.suggestion-title {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 2px;
  padding: 9px 22px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(47, 109, 255, 0.2);
  color: #0077c8;
  font-size: clamp(0.95rem, 1.6vw, 1.12rem);
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 8px 20px rgba(47, 109, 255, 0.1);
  animation: suggestionTitleBlink 1.8s ease-in-out infinite;
}

.suggestion-marquee {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 2px 0;
  mask-image: linear-gradient(
    to right,
    transparent,
    #000 7%,
    #000 93%,
    transparent
  );
  -webkit-mask-image: linear-gradient(
    to right,
    transparent,
    #000 7%,
    #000 93%,
    transparent
  );
}

.suggestion-track {
  display: flex;
  width: max-content;
  gap: 12px;
  animation: slideLeftToRight 125s linear infinite;
  will-change: transform;
}

.suggestion-track-second {
  animation-delay: -18s;
}

.suggestion-track:hover {
  animation-play-state: paused;
}

.suggestion-btn {
  flex: 0 0 auto;
  border: none;
  padding: 11px 17px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--primary-dark);
  font-size: 0.92rem;
  font-weight: 610;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(47, 109, 255, 0.07);
  transition:
    transform 0.25s ease,
    background 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease;
}

.suggestion-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, var(--primary), #74c3ff);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(47, 109, 255, 0.18);
}

@keyframes slideLeftToRight {
  from {
    transform: translateX(-50%);
  }

  to {
    transform: translateX(0);
  }
}

@keyframes suggestionTitleBlink {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 8px 20px rgba(47, 109, 255, 0.1);
  }

  50% {
    opacity: 0.68;
    box-shadow: 0 10px 26px rgba(47, 109, 255, 0.2);
  }
}

/* =========================
   SIDEBAR ACTION BUTTONS
========================= */
.sidebar-actions {
  margin-top: auto;
  padding-top: 16px;
  display: grid;
  gap: 10px;
}

.sidebar-action-btn {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 13px 14px;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease,
    color 0.22s ease;
}

.sidebar-action-btn:hover {
  transform: translateY(-1px);
}

.new-chat-btn {
  background: linear-gradient(135deg, var(--primary), #565657);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(47, 109, 255, 0.16);
}

.new-chat-btn:hover {
  box-shadow: 0 14px 28px rgba(47, 109, 255, 0.24);
}

.clear-chat-btn {
  background: rgba(255, 255, 255, 0.72);
  color: var(--danger);
  border: 1px solid rgba(229, 72, 77, 0.16);
  box-shadow: 0 8px 18px rgba(229, 72, 77, 0.08);
}

.clear-chat-btn:hover {
  background: rgba(255, 239, 239, 0.9);
  color: var(--danger-dark);
  box-shadow: 0 12px 24px rgba(229, 72, 77, 0.12);
}

/* =========================
   CONTENT PAGES: GUIDE / CONTACT
========================= */
.page-section[hidden] {
  display: none !important;
}

.content-layout {
  position: relative;
  z-index: 2;
  flex: 1;
  width: min(var(--layout-max), calc(100% - (var(--layout-gap) * 2)));
  margin: 18px auto 24px;
}

.content-card {
  width: 100%;
  min-height: 608px;
  padding: 34px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, var(--chat-panel-opacity));
  border: 1px solid rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  box-shadow: 0 12px 30px rgba(18, 59, 128, 0.07);
}

.content-hero {
  max-width: 860px;
  margin: 0 auto 26px;
  text-align: center;
}

.content-badge {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(47, 109, 255, 0.12);
  color: var(--primary-dark);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.content-hero h2 {
  margin-bottom: 12px;
  color: #003b7a;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.2;
  font-weight: 700;
}

.content-hero p {
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.75;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.info-card,
.contact-item,
.contact-form,
.guide-block,
.notice-box {
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.38);
  box-shadow: 0 10px 24px rgba(22, 66, 145, 0.07);
}

.info-card {
  padding: 20px;
  border-radius: 22px;
}

.info-icon {
  width: 46px;
  height: 46px;
  margin-bottom: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), #74c3ff);
  box-shadow: 0 10px 20px rgba(47, 109, 255, 0.16);
}

.contact-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  color: #f0f8ff;
  background: linear-gradient(135deg, #194eca, #84c7fa);
  box-shadow: 0 12px 24px rgba(47, 109, 255, 0.22);
}

.contact-icon i {
  font-size: 1.25rem;
}

.contact-item:nth-child(1) .contact-icon {
  background: linear-gradient(135deg, #bfcc10, #c8caa4);
}

.contact-item:nth-child(2) .contact-icon {
  background: linear-gradient(135deg, #16a34a, #86efac);
}

.contact-item:nth-child(3) .contact-icon {
  background: linear-gradient(135deg, #f97316, #fdba74);
}

.contact-item:nth-child(4) .contact-icon {
  background: linear-gradient(135deg, #1877f2, #60a5fa);
}

.info-card h3,
.guide-block h3,
.contact-item h3,
.contact-form h3 {
  color: #003b7a;
  font-size: 1.06rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.info-card p,
.contact-item p,
.contact-form-desc,
.notice-box p {
  color: var(--text-soft);
  line-height: 1.65;
  font-size: 1rem;
}

.contact-item h3 {
  font-weight: 800;
}

.contact-item p {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.65;
}

.guide-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 16px;
  margin-bottom: 18px;
}

.guide-block {
  padding: 22px;
  border-radius: 24px;
}

.step-list {
  list-style: none;
  display: grid;
  gap: 12px;
}

.step-list li {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.step-list span {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(47, 109, 255, 0.12);
  color: var(--primary-dark);
  font-size: 0.86rem;
  font-weight: 800;
}

.step-list p {
  color: var(--text-soft);
  line-height: 1.6;
  font-size: 0.94rem;
}

.question-list {
  display: grid;
  gap: 10px;
}

.guide-question {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(47, 109, 255, 0.14);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.74);
  color: #003b7a;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease;
}

.guide-question:hover {
  transform: translateY(-1px);
  background: rgba(232, 244, 255, 0.96);
  box-shadow: 0 8px 18px rgba(47, 109, 255, 0.1);
}

.notice-box {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 16px 18px;
  border-radius: 20px;
}

.contact-item a,
.contact-item a:hover,
.contact-item a:focus {
  text-decoration: none;
  color: #2676cc;
}
.notice-box i {
  color: var(--primary);
  font-size: 1.25rem;
  margin-top: 2px;
}

.contact-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
}

.contact-info-panel {
  display: grid;
  gap: 12px;
}

.contact-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 18px;
  border-radius: 22px;
}

.contact-icon {
  margin-bottom: 0;
}

.content-link {
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s ease;
}

.content-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.contact-form {
  padding: 24px;
  border-radius: 24px;
}

.contact-form-desc {
  margin-bottom: 16px;
}

.contact-form label {
  display: block;
  margin-bottom: 14px;
  color: #003b7a;
  font-size: 0.92rem;
  font-weight: 700;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(47, 109, 255, 0.16);
  border-radius: 16px;
  outline: none;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text-main);
  font-size: 0.94rem;
  line-height: 1.5;
  resize: vertical;
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
  background: #ffffff;
  border-color: rgba(47, 109, 255, 0.42);
  box-shadow: 0 0 0 3px rgba(47, 109, 255, 0.12);
}

.contact-submit {
  width: fit-content;
  min-height: 42px;
  padding: 10px 18px;
  border: none;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), #74c3ff);
  font-size: 0.94rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(47, 109, 255, 0.18);
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease;
}

.contact-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(47, 109, 255, 0.24);
}

.contact-status {
  min-height: 22px;
  margin-top: 12px;
  color: #0f8a5f;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.5;
}

/* =========================
   CONFIRM MODAL
========================= */
.confirm-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}

.confirm-modal.show {
  display: flex;
}

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 34, 64, 0.32);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.confirm-dialog {
  position: relative;
  width: min(430px, 100%);
  padding: 30px 28px 26px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 24px 60px rgba(18, 59, 128, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  text-align: center;
  animation: modalIn 0.22s ease both;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.confirm-icon {
  width: 66px;
  height: 66px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 24px;
  color: var(--primary);
  background: linear-gradient(
    145deg,
    rgba(231, 240, 255, 0.95),
    rgba(255, 255, 255, 0.92)
  );
  border: 1px solid rgba(47, 109, 255, 0.12);
  box-shadow: 0 14px 28px rgba(47, 109, 255, 0.12);
}

.confirm-icon svg {
  width: 30px;
  height: 30px;
}

.confirm-dialog h3 {
  font-size: 1.28rem;
  margin-bottom: 10px;
  color: var(--text-main);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.confirm-dialog p {
  max-width: 330px;
  margin: 0 auto 22px;
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.65;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.confirm-btn {
  border: none;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease,
    opacity 0.22s ease;
}

.confirm-btn:hover {
  transform: translateY(-1px);
}

.confirm-btn.cancel {
  background: rgba(231, 240, 255, 0.96);
  color: var(--primary-dark);
  border: 1px solid rgba(47, 109, 255, 0.08);
}

.confirm-btn.cancel:hover {
  background: rgba(218, 234, 255, 0.98);
  box-shadow: 0 10px 22px rgba(47, 109, 255, 0.1);
}

.confirm-btn.danger {
  background: linear-gradient(135deg, #ff6b6b, #ff8f8f);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(229, 72, 77, 0.18);
}

.confirm-btn.danger:hover {
  box-shadow: 0 16px 30px rgba(229, 72, 77, 0.24);
}

/* =========================
   FOOTER
========================= */
.site-footer {
  position: relative;
  z-index: 2;
  margin-top: auto;
  background: #001d42;
  color: #ffffff;
  text-align: center;
}

.footer-top {
  width: 100%;
  padding: 22px 16px;
}

.footer-top p {
  margin: 4px 0;
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 400;
}

.email-link {
  color: #b6deff;
  text-decoration: none;
  font-weight: 500;
  transition:
    color 0.15s ease,
    text-shadow 0.15s ease;
}

.email-link:hover {
  color: #f1ffd9;
  text-shadow: 0 0 12px rgba(159, 212, 255, 0.75);
}

.email-link:focus-visible {
  outline: 2px solid rgba(159, 212, 255, 0.9);
  outline-offset: 3px;
  border-radius: 6px;
}


/* =========================
   USER AVATAR PICKER
   - Không làm thu hẹp cụm menu chính.
   - Panel avatar luôn nổi phía trên vùng chat.
========================= */
.top-action-row {
  position: relative;
  z-index: 30;
  width: min(var(--layout-max), calc(100% - (var(--layout-gap) * 2)));
  min-height: 68px;
  margin: 14px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: clamp(12px, 1.5vw, 24px);
}

.top-action-row .desktop-nav.nav-card {
  grid-column: 2;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  justify-self: center;
}

.user-avatar-picker {
  grid-column: 3;
  position: relative;
  top: auto;
  right: auto;
  z-index: 1000;
  justify-self: end;
  min-width: 0;
}

.avatar-picker-toggle {
  min-height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 999px;
  padding: 8px 16px 8px 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease;
}

.avatar-picker-toggle:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 22px rgba(47, 109, 255, 0.14);
}

.avatar-toggle-preview {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #dceaff, #ffffff);
  box-shadow: 0 6px 14px rgba(47, 109, 255, 0.12);
}

.avatar-toggle-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-toggle-text {
  white-space: nowrap;
}

.avatar-picker-panel {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 9999;
  min-width: 238px;
  padding: 10px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(47, 109, 255, 0.12);
  box-shadow: var(--shadow-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  gap: 10px;
}

.avatar-picker-panel.show {
  display: flex;
}

.avatar-option {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(47, 109, 255, 0.12);
  border-radius: 18px;
  padding: 10px 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-main);
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 7px;
  font-size: 0.86rem;
  font-weight: 700;
  transition:
    transform 0.22s ease,
    background 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.avatar-option img {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(47, 109, 255, 0.1);
}

.avatar-option:hover {
  transform: translateY(-2px);
  background: rgba(232, 244, 255, 0.96);
  border-color: rgba(47, 109, 255, 0.22);
}

.avatar-option.is-selected {
  background: linear-gradient(
    135deg,
    rgba(47, 109, 255, 0.16),
    rgba(105, 189, 253, 0.22)
  );
  border-color: rgba(47, 109, 255, 0.4);
  box-shadow: 0 8px 18px rgba(47, 109, 255, 0.14);
}

.avatar-option.is-selected::after {
  content: "Đang chọn";
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary-dark);
}

/* Màn hình trung bình: đặt avatar xuống hàng riêng để không đè menu */
@media (min-width: 992px) and (max-width: 1180px) {
  .top-action-row {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: auto;
    row-gap: 12px;
  }

  .top-action-row .desktop-nav.nav-card,
  .user-avatar-picker {
    grid-column: 1;
    justify-self: center;
  }
}

/* Mobile/tablet: menu desktop ẩn, avatar đứng giữa phía trên menu mobile */
@media (max-width: 991px) {
  .top-action-row {
    width: min(var(--layout-max), calc(100% - (var(--layout-gap) * 2)));
    min-height: 56px;
    display: flex;
    justify-content: center;
  }

  .top-action-row .desktop-nav.nav-card {
    display: none;
  }

  .user-avatar-picker {
    position: relative;
    top: auto;
    right: auto;
    width: min(100%, 420px);
  }

  .avatar-picker-toggle {
    width: 100%;
    justify-content: center;
  }

  .avatar-picker-panel {
    right: 50%;
    width: 100%;
    transform: translateX(50%);
  }
}

@media (max-width: 560px) {
  .top-action-row {
    width: calc(100% - 16px);
  }

  .avatar-picker-toggle {
    min-height: 50px;
    padding-right: 12px;
    font-size: 0.86rem;
  }

  .avatar-toggle-preview {
    width: 34px;
    height: 34px;
  }

  .avatar-picker-panel {
    min-width: 0;
  }

  .avatar-option img {
    width: 50px;
    height: 50px;
  }
}

/* =========================
   RESPONSIVE
========================= */
@media (min-width: 1600px) {
  .main-layout {
    width: min(var(--layout-max), calc(100% - 96px));
    margin-left: auto;
    margin-right: auto;
    grid-template-columns: 320px minmax(0, 1fr);
  }
}

@media (max-width: 1200px) {
  .site-header {
    padding: 14px 20px 12px;
  }

  .main-layout {
    grid-template-columns: minmax(255px, 285px) minmax(0, 1fr);
  }
}

@media (max-width: 991px) {
  .header-top {
    grid-template-columns: 90px minmax(0, 1fr) 48px;
    gap: 12px;
  }

  .logo-link {
    margin-left: 10px;
  }

  .desktop-nav {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  .mobile-nav.show {
    display: block;
  }

  .main-layout {
    width: calc(100% - 24px);
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .hero-section {
    order: 1;
    width: 100%;
    min-width: 0;
  }

  .sidebar {
    order: 2;
    width: 100%;
  }

  .hero-card,
  .sidebar-card {
    width: 100%;
    min-height: auto;
    max-height: none;
  }

  .chat-preview {
    max-height: 420px;
  }

  .content-layout {
    width: calc(100% - 24px);
  }

  .info-grid,
  .guide-panel,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .chat-preview.has-message {
    max-height: 48vh;
  }
}

@media (max-width: 768px) {
  .main-layout {
    display: grid;
    grid-template-columns: 1fr;
    width: calc(100% - 16px);
    margin: 12px auto 18px;
    gap: 14px;
  }

  .mobile-nav {
    width: calc(100% - 16px);
  }

  .site-header {
    padding: 12px 12px 10px;
  }

  .header-top {
    grid-template-columns: 74px minmax(0, 1fr) 44px;
  }

  .logo-link {
    margin-left: 6px;
  }

  .logo-box {
    width: 56px;
    height: 56px;
  }

  .logo-fallback {
    font-size: 0.75rem;
  }

  .header-title-wrap h1 {
    font-size: 1rem;
    line-height: 1.4;
  }

  .hero-card {
    padding: 24px 14px;
    border-radius: 24px;
  }

  .input-group {
    padding: 6px;
  }

  #chatInput {
    padding: 12px 14px;
    font-size: 0.95rem;
  }

  .send-btn {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .bot-avatar {
    width: 110px;
  }

  .history-row {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .history-delete {
    width: 44px;
    height: 44px;
  }

  .history-list {
    max-height: 260px;
    overflow-y: auto;
  }

  .sidebar-card {
    min-height: auto;
    max-height: none;
    padding: 18px 14px;
    border-radius: 22px;
  }

  .sidebar-actions {
    margin-top: 14px;
    padding-top: 14px;
  }

  .sidebar-action-btn {
    padding: 12px 14px;
    font-size: 0.92rem;
  }

  .message-content {
    max-width: calc(100% - 52px);
  }

  .content-layout {
    width: calc(100% - 16px);
    margin: 12px auto 18px;
  }

  .content-card {
    padding: 24px 16px;
    border-radius: 24px;
  }

  .content-hero {
    margin-bottom: 20px;
  }

  .content-hero h2 {
    font-size: 1.55rem;
  }

  .info-card,
  .guide-block,
  .contact-form,
  .contact-item {
    border-radius: 20px;
  }
}

@media (max-width: 560px) {
  .main-layout {
    width: calc(100% - 12px);
    margin-top: 12px;
    gap: 12px;
  }

  .hero-card,
  .sidebar-card {
    border-radius: 20px;
  }

  .input-group {
    border-radius: 22px;
  }

  #chatInput {
    padding: 11px 12px;
  }

  .send-btn {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
  }

  .bot-avatar {
    width: 104px;
  }

  .chat-message {
    width: 100%;
    gap: 10px;
  }

  .message-avatar {
    width: 36px;
    height: 36px;
  }

  .message-content {
    max-width: calc(100% - 46px);
  }

  .message-author {
    font-size: 0.78rem;
  }

  .message-bubble {
    padding: 12px 14px;
    font-size: 0.92rem;
    line-height: 1.58;
  }

  .suggestion-btn {
    padding: 10px 14px;
    font-size: 0.88rem;
  }

  .message-feedback {
    margin-top: 8px;
  }

  .feedback-actions {
    gap: 8px;
  }

  .feedback-btn {
    min-height: 34px;
    padding: 8px 11px;
    gap: 6px;
    font-size: 0.82rem;
  }

  .feedback-icon {
    width: 16px;
    height: 16px;
    font-size: 0.86rem;
  }

  .feedback-form {
    width: 100%;
    padding: 10px;
    border-radius: 14px;
  }

  .feedback-label {
    font-size: 0.82rem;
  }

  .feedback-textarea {
    min-height: 78px;
    font-size: 0.86rem;
  }

  .feedback-submit {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 0.84rem;
  }

  .confirm-modal {
    padding: 14px;
  }

  .confirm-dialog {
    padding: 26px 18px 20px;
    border-radius: 24px;
  }

  .confirm-icon {
    width: 58px;
    height: 58px;
    border-radius: 20px;
  }

  .confirm-dialog h3 {
    font-size: 1.12rem;
  }

  .confirm-dialog p {
    font-size: 0.9rem;
  }

  .confirm-actions {
    grid-template-columns: 1fr;
  }

  .confirm-btn {
    min-height: 44px;
  }

  .site-footer p {
    font-size: 0.84rem;
  }

  .content-card {
    padding: 20px 12px;
    border-radius: 20px;
  }

  .content-badge {
    font-size: 0.78rem;
  }

  .content-hero h2 {
    font-size: 1.36rem;
  }

  .content-hero p,
  .info-card p,
  .step-list p,
  .contact-item p,
  .contact-form-desc,
  .notice-box p {
    font-size: 0.88rem;
  }

  .step-list li,
  .contact-item,
  .notice-box {
    grid-template-columns: 1fr;
  }

  .contact-submit {
    width: 100%;
  }
}

@media (max-width: 380px) {
  .header-title-wrap h1 {
    font-size: 0.86rem;
  }

  .logo-box {
    width: 48px;
    height: 48px;
  }

  .header-top {
    grid-template-columns: 58px minmax(0, 1fr) 40px;
  }

  .menu-toggle {
    width: 40px;
    height: 40px;
  }

  .message-bubble {
    padding: 10px 12px;
  }
}

.contact-item a {
  color: #153b81; /* màu bạn muốn */
  font-weight: 700;
  text-decoration: none;
}


/* =========================
   PATCH: GHIM Ô NHẬP XUỐNG SÁT CHÂN KHUNG CHAT
   - Khi đã bắt đầu trò chuyện, vùng chat-preview sẽ chiếm toàn bộ khoảng trống còn lại.
   - Ô nhập câu hỏi luôn nằm ở đáy khung chat, sát phần chân trắng đục.
   - Nội dung chatbot và câu hỏi gợi ý sau câu trả lời vẫn cuộn xuống cuối trong chat-preview.
========================= */
.hero-card {
  height: clamp(560px, calc(100vh - 235px), 720px);
  max-height: calc(100vh - 210px);
  overflow: hidden;
}

.chat-preview {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  margin-bottom: 14px;
}

.chat-preview:not(.has-message) {
  flex: 0 0 10px;
  min-height: 10px;
  max-height: 10px;
  margin-bottom: 8px;
}

.chat-preview.has-message {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding-bottom: 8px;
}

.chat-form {
  flex: 0 0 auto;
  margin-top: auto;
  position: relative;
  z-index: 3;
}

.suggestion-section {
  flex: 0 0 auto;
}

/* Giữ layout ổn định trên tablet/mobile, tránh rule responsive cũ giới hạn max-height của chat-preview. */
@media (max-width: 991px) {
  .hero-card {
    height: min(680px, calc(100dvh - 190px));
    min-height: 560px;
    max-height: none;
  }

  .chat-preview,
  .chat-preview.has-message {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .hero-card {
    height: min(620px, calc(100dvh - 165px));
    min-height: 500px;
    padding-bottom: 14px;
  }

  .chat-preview,
  .chat-preview.has-message {
    max-height: none;
  }
}

/* =========================
   CHAT START POSITION V3
   - Trạng thái ban đầu: ô nhập nằm ngay bên dưới badge chatbot, không bị đẩy xuống đáy.
   - Trạng thái đã chat: ô nhập chuyển xuống sát đáy khung chat, vùng tin nhắn phía trên tự cuộn.
========================= */
.hero-card:not(.is-chatting) {
  justify-content: flex-start;
}

.hero-card:not(.is-chatting) .chat-preview {
  flex: 0 0 clamp(20px, 4vh, 38px);
  min-height: 0;
  max-height: clamp(20px, 4vh, 38px);
  margin-bottom: 0;
  padding: 0;
  overflow: hidden;
}

.hero-card:not(.is-chatting) .chat-form {
  margin-top: 0;
}

.hero-card.is-chatting .chat-form {
  margin-top: auto;
}

.hero-card:not(.is-chatting) .suggestion-section {
  margin-top: 14px;
}

.hero-card.is-chatting .suggestion-section.is-hidden {
  display: none;
}

@media (max-width: 560px) {
  .hero-card:not(.is-chatting) .chat-preview {
    flex-basis: 18px;
    max-height: 18px;
  }

  .hero-card:not(.is-chatting) .suggestion-section {
    margin-top: 12px;
  }
}


/* =========================
   MARKDOWN CHAT CONTENT TUNING
   - Chừa lề trái cho câu trả lời bot.
   - Giảm khoảng cách dòng/đoạn khi render Markdown.
========================= */
.chat-message.bot .message-content {
  padding-left: 8px;
}

.chat-message.bot .message-bubble {
  padding: 14px 20px 14px 22px;
  line-height: 1.46;
  font-weight: 400;
}

.message-bubble.markdown-body {
  white-space: normal;
}

.message-bubble.markdown-body p {
  margin: 0 0 0.55em;
}

.message-bubble.markdown-body p:last-child {
  margin-bottom: 0;
}

.message-bubble.markdown-body ul,
.message-bubble.markdown-body ol {
  margin: 0.45em 0 0.55em;
  padding-left: 1.25rem;
}

.message-bubble.markdown-body li {
  margin: 0.16em 0;
  padding-left: 0.12rem;
}

.message-bubble.markdown-body li + li {
  margin-top: 0.28em;
}

.message-bubble.markdown-body h1,
.message-bubble.markdown-body h2,
.message-bubble.markdown-body h3,
.message-bubble.markdown-body h4 {
  margin: 0.55em 0 0.35em;
  line-height: 1.3;
  font-weight: 600;
}

.message-bubble.markdown-body h1:first-child,
.message-bubble.markdown-body h2:first-child,
.message-bubble.markdown-body h3:first-child,
.message-bubble.markdown-body h4:first-child,
.message-bubble.markdown-body p:first-child {
  margin-top: 0;
}

.message-bubble.markdown-body strong,
.message-bubble.markdown-body b {
  font-weight: 600;
}

.message-bubble.markdown-body a {
  color: var(--primary-dark);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.message-bubble.markdown-body code {
  padding: 0.12em 0.32em;
  border-radius: 6px;
  background: rgba(47, 109, 255, 0.08);
  font-size: 0.92em;
}

.message-bubble.markdown-body pre {
  margin: 0.55em 0;
  padding: 12px;
  overflow-x: auto;
  border-radius: 12px;
  background: rgba(13, 34, 64, 0.08);
}

.followup-title {
  font-size: 0.92rem;
  font-weight: 650;
}

.followup-question-btn {
  min-height: 42px;
  padding: 10px 14px;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.43;
  border-radius: 15px;
}

.followup-draft-text {
  font-size: 0.95rem;
  line-height: 1.43;
  color: rgba(2, 41, 83, 0.72);
}
