#maxkb-chatbox-window {
  width: 75vw;
  max-width: 900px;
  min-width: 340px;
  min-height: 500px;
  height: 70vh;
  margin: 30px auto 0 auto;
  box-shadow: 0 8px 36px rgba(0, 80, 140, 0.15);
  border-radius: 18px;
  background: #f9fbfd;
  display: flex;
  flex-direction: column;
  position: relative;
}

.maxkb-header {
  background: #04709f;
  color: #fff;
  font-weight: 700;
  font-size: 1.3rem;
  border-radius: 18px 18px 0 0;
  padding: 18px 18px 12px 18px;
  letter-spacing: 0.01em;
}

.maxkb-body {
  flex: 1 1 0;
  padding: 18px 18px 18px 18px;
  overflow-y: auto;
  background: #f6fafd;
  border-bottom: 1px solid #e6ecf4;
}
h1 {
  margin: 10px auto 20px auto;

  width: fit-content;
  font-size: 30px;
  line-height: 35px;

  color: black;
  border-radius: 20px;

  font-family: "Segoe UI", "Roboto", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 8px rgba(0, 115, 170, 0.1);
  text-align: center;
  transition: background 0.3s;
}

.maxkb-input-area {
  display: flex;
  gap: 10px;
  padding: 14px 18px 14px 18px;
  background: #f7f9fb;
  border-radius: 0 0 18px 18px;
}

#maxkb-user-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #c7d6e5;
  border-radius: 6px;
  font-size: 1rem;
  background: #fff;
}

#maxkb-send-btn {
  background: #04709f;
  color: #fff;
  font-size: 1rem;
  padding: 8px 28px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.16s;
}
#maxkb-send-btn:hover {
  background: #00577c;
}

/* === Chat message bubbles === */
.maxkb-msg {
  margin: 0 0 20px 0;
  padding: 16px 20px 16px 18px;
  max-width: 70%;
  word-break: break-word;
  line-height: 1.6;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(3, 60, 140, 0.07);
  font-size: 1.09rem;
  position: relative;
  clear: both;
  transition: background 0.16s;
}

/* User (left, gray) */
.maxkb-msg.me {
  background: #f2f6fa;
  border: 1px solid #c7d6e5;
  color: #003355;
  align-self: flex-start;
}

/* Bot (left, blueish) */
.maxkb-msg.bot {
  background: #e7eef6;
  border: 1px solid #b2c6db;
  color: #084875;
  align-self: flex-start;
}

/* AIbot (right, cream, AGENT) */
.maxkb-msg.aibot {
  background: #f5f5ea;
  color: #222;
  margin-left: auto;
  margin-right: 0;
  align-self: flex-end;
  text-align: left;
  border: none;
  box-shadow: 0 2px 14px rgba(4, 112, 159, 0.1);
}

.maxkb-msg-label {
  font-size: 0.92em;
  opacity: 0.6;
  font-weight: 600;
  margin-right: 10px;
  letter-spacing: 0.02em;
}

.maxkb-msg.aibot .maxkb-msg-label {
  color: #493939;
  opacity: 0.82;
}

/* Markdown link styling: underline, color, bigger, nice */
.maxkb-msg a {
  color: #1a4de1;
  font-weight: 600;
  text-decoration: underline;
  word-break: break-all;
  transition: color 0.15s;
  font-size: 1.08em;
}
.maxkb-msg a:hover,
.maxkb-msg a:focus {
  color: #f6931a;
  background: #f0f6ff;
  text-decoration: underline;
  border-radius: 5px;
  outline: none;
}
.maxkb-msg.aitest a {
  color: #1872c1;
}

/* Markdown lists */
.maxkb-msg ul,
.maxkb-msg ol {
  margin: 8px 0 8px 24px !important;
  padding-left: 1.3em !important;
  font-size: 1.05em;
}
.maxkb-msg ul li,
.maxkb-msg ol li {
  margin: 5px 0 !important;
  padding-left: 2px !important;
}

.maxkb-msg p {
  margin: 6px 0 !important;
}

.maxkb-msg .hidden {
  display: none !important;
}

@media (max-width: 600px) {
  #maxkb-chatbox-window {
    width: 99vw;
    min-width: 0;
  }
  .maxkb-msg {
    max-width: 97vw;
  }
}

.lds-ellipsis {
  display: inline-block;
  position: relative;
  width: 64px;
  height: 16px;
}
.lds-ellipsis div {
  position: absolute;
  top: 0;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--main-color, #0073aa);
  animation-timing-function: cubic-bezier(0, 1, 1, 0);
}
.lds-ellipsis div:nth-child(1) {
  left: 6px;
  animation: lds-ellipsis1 0.6s infinite;
}
.lds-ellipsis div:nth-child(2) {
  left: 6px;
  animation: lds-ellipsis2 0.6s infinite;
}
.lds-ellipsis div:nth-child(3) {
  left: 26px;
  animation: lds-ellipsis2 0.6s infinite;
}
.lds-ellipsis div:nth-child(4) {
  left: 45px;
  animation: lds-ellipsis3 0.6s infinite;
}
@keyframes lds-ellipsis1 {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes lds-ellipsis3 {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(0);
  }
}
@keyframes lds-ellipsis2 {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(19px, 0);
  }
}

/* --- Language & message style select styling --- */
label[for="lang"],
label[for="mess-style"] {
  font-size: 1rem;
  margin: 0 6px 0 12px;
  font-weight: 500;
  color: #184a77;
  vertical-align: middle;
}
#lang,
#mess-style {
  margin: 12px 0 0 0;
  padding: 7px 18px 7px 12px;
  font-size: 1.08em;
  border-radius: 8px;
  border: 1px solid #b6cbe1;
  background: #f7fafb;
  color: #184a77;
  outline: none;
  box-shadow: 0 2px 7px rgba(3, 60, 140, 0.08);
  appearance: none;
  transition: border-color 0.18s;
}
#lang:focus,
#mess-style:focus {
  border-color: #04709f;
  background: #eef4fa;
}

.maxkb-btn-disabled,
button:disabled {
  opacity: 0.55 !important;
  filter: grayscale(0.35);
  cursor: not-allowed !important;
  pointer-events: none;
}
