/* ANMC chat assistant (resources/views/partials/chatbot.blade.php) */
.anmc-chat {
  --ch-navy: #0d2b5c;
  --ch-ink: #14213d;
  --ch-text: #3a4762;
  --ch-muted: #6b7690;
  --ch-line: #e3e8f1;
  --ch-soft: #f3f6fb;
  --ch-blue: #1f5fbf;
  --ch-green: #17924a;
  --ch-green-2: #2fbf5a;
  --ch-gradient: linear-gradient(135deg, #1f5fbf 0%, #1a8a8c 55%, #2fbf5a 100%);
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
}

.anmc-chat__sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Launcher ---------- */
.anmc-chat__launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  height: 58px;
  padding: 0 22px 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--ch-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(13, 43, 92, 0.32);
  transition: transform .2s ease, box-shadow .2s ease;
}
.anmc-chat__launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(13, 43, 92, 0.38); }
.anmc-chat__launcher:focus-visible,
.anmc-chat button:focus-visible,
.anmc-chat textarea:focus-visible { outline: 3px solid #ffe94f; outline-offset: 2px; }
.anmc-chat__launcher i { font-size: 22px; }
.anmc-chat__icon-close { display: none; }
.anmc-chat.is-open .anmc-chat__icon-open,
.anmc-chat.is-open .anmc-chat__launcher-label { display: none; }
.anmc-chat.is-open .anmc-chat__icon-close { display: inline-block; }
.anmc-chat.is-open .anmc-chat__launcher { width: 58px; padding: 0; justify-content: center; }

/* ---------- Panel ---------- */
.anmc-chat__panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: 380px;
  height: min(600px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(13, 43, 92, 0.28);
  overflow: hidden;
  animation: anmc-chat-in .22s ease-out;
}
.anmc-chat__panel[hidden] { display: none; }
@keyframes anmc-chat-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.anmc-chat__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 14px 16px;
  background: var(--ch-navy);
  color: #fff;
}
.anmc-chat__head img { border-radius: 50%; background: #fff; flex: none; }
.anmc-chat__head-text { flex: 1; min-width: 0; }
.anmc-chat__head h2 { margin: 0; font-size: 16px; font-weight: 700; color: #fff; line-height: 1.3; }
.anmc-chat__head p { margin: 0; font-size: 12.5px; color: #c6d3ea; line-height: 1.4; }
.anmc-chat__dot {
  display: inline-block; width: 8px; height: 8px; margin-right: 6px;
  border-radius: 50%; background: var(--ch-green-2); vertical-align: 1px;
}
.anmc-chat__icon-btn {
  flex: none;
  width: 34px; height: 34px;
  border: 0; border-radius: 50%;
  background: transparent; color: #c6d3ea;
  cursor: pointer; font-size: 15px;
}
.anmc-chat__icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }

/* ---------- Messages ---------- */
.anmc-chat__log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--ch-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overscroll-behavior: contain;
}
.anmc-chat__msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 16px;
  color: var(--ch-text);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.anmc-chat__msg p { margin: 0 0 8px; color: inherit; font-size: inherit; line-height: inherit; }
.anmc-chat__msg p:last-child, .anmc-chat__msg ul:last-child { margin-bottom: 0; }
.anmc-chat__msg ul { margin: 0 0 8px; padding-left: 18px; }
.anmc-chat__msg li { list-style: disc; margin: 2px 0; }
.anmc-chat__msg a { color: var(--ch-blue); text-decoration: underline; }
.anmc-chat__msg strong { color: var(--ch-ink); }
.anmc-chat__msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--ch-line);
  border-bottom-left-radius: 4px;
}
.anmc-chat__msg--user {
  align-self: flex-end;
  background: var(--ch-blue);
  color: #fff;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}
.anmc-chat__msg--error { background: #fdecec; border-color: #f5c2c4; color: #8a1c21; }

.anmc-chat__typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.anmc-chat__typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ch-muted);
  animation: anmc-chat-bounce 1.2s infinite ease-in-out;
}
.anmc-chat__typing span:nth-child(2) { animation-delay: .15s; }
.anmc-chat__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes anmc-chat-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-5px); opacity: 1; } }

/* ---------- Suggestions ---------- */
.anmc-chat__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px 0;
  background: var(--ch-soft);
}
.anmc-chat__suggestions[hidden] { display: none; }
.anmc-chat__chip {
  border: 1px solid #c6d3ea;
  background: #fff;
  color: var(--ch-blue);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  text-align: left;
}
.anmc-chat__chip:hover { background: #eaf1fc; border-color: var(--ch-blue); }

/* ---------- Composer ---------- */
.anmc-chat__form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 12px 6px 16px;
  border-top: 1px solid var(--ch-line);
  background: #fff;
}
.anmc-chat__form textarea {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--ch-line);
  border-radius: 12px;
  resize: none;
  font: inherit;
  color: var(--ch-ink);
  background: #fff;
}
.anmc-chat__form textarea:focus { border-color: var(--ch-blue); outline: none; box-shadow: 0 0 0 3px rgba(31, 95, 191, .15); }
.anmc-chat__send {
  flex: none;
  width: 42px; height: 42px;
  border: 0; border-radius: 12px;
  background: var(--ch-green);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
}
.anmc-chat__send:hover { background: #0f6b35; }
.anmc-chat__send:disabled { background: #b8c2d6; cursor: not-allowed; }
.anmc-chat__note {
  margin: 0;
  padding: 0 16px 10px;
  background: #fff;
  font-size: 11.5px;
  color: var(--ch-muted);
  text-align: center;
  line-height: 1.4;
}

/* ---------- Small screens ---------- */
@media (max-width: 575px) {
  .anmc-chat { right: 16px; bottom: 16px; }
  .anmc-chat__launcher { height: 54px; padding: 0 18px 0 16px; }
  .anmc-chat.is-open .anmc-chat__launcher { width: 54px; }
  .anmc-chat__panel {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 82px;
    width: auto;
    height: calc(100vh - 110px);
    height: calc(100dvh - 110px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .anmc-chat__panel, .anmc-chat__typing span { animation: none; }
  .anmc-chat__launcher { transition: none; }
}

@media print { .anmc-chat { display: none; } }

/* ---------- Tables in answers ---------- */
.anmc-chat__table { margin: 0 0 8px; overflow-x: auto; }
.anmc-chat__table table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.4; }
.anmc-chat__table th,
.anmc-chat__table td { padding: 5px 6px; border-bottom: 1px solid var(--ch-line); text-align: left; vertical-align: top; overflow-wrap: normal; word-break: normal; min-width: 4.5em; }
.anmc-chat__table th { color: var(--ch-ink); font-weight: 700; background: var(--ch-soft); }
