/* —— basic reset —— */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* —— body + fonts —— */
body {
  font-family: "Montserrat", "Arial", "Helvetica Neue", Arial, Helvetica,
    sans-serif;
  color: #231f20;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #fff 0%, #f4f4f4 100%);
}

.page-wrapper {
  width: 100%;
  max-width: 900px;
  margin: 40px 0 0 0;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 1.5px 4px rgba(0, 0, 0, 0.03);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 80vh;
  border: 1.5px solid #e5e5e5;
}

/* header */
.site-header {
  text-align: center;
  padding: 36px 0 18px 0;
  background: #fff;
  border-bottom: 2px solid #e5e5e5;
}

.site-header img {
  max-width: 170px;
  margin-bottom: 0;
  filter: grayscale(0%) brightness(0) contrast(1.2);
}

.site-header div {
  font-family: "Montserrat", "Arial", "Helvetica Neue", Arial, Helvetica,
    sans-serif;
  margin-top: 10px;
  font-size: 20px;
  font-weight: 500;
  color: #231f20;
  letter-spacing: 0.5px;
}

/* chat window */
.chatbox {
  margin: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #faf7f2;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  max-height: 600px; /* set a max height for the chat area */
}

.chat-window {
  font-family: "Montserrat", "Arial", "Helvetica Neue", Arial, Helvetica,
    sans-serif;
  height: 100%;
  max-height: 540px; /* set a max height for the scrollable area */
  border: none;
  padding: 24px 48px 16px 48px;
  font-size: 18px;
  line-height: 1.6;
  overflow-y: auto;
  background: transparent;
  white-space: pre-line;
  flex: 1 1 0%;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: #e5e5e5 #faf7f2;
}

.chat-window::-webkit-scrollbar {
  width: 8px;
  background: #faf7f2;
}
.chat-window::-webkit-scrollbar-thumb {
  background: #e5e5e5;
  border-radius: 6px;
}

/* messages */
.msg {
  font-family: "Montserrat", "Arial", "Helvetica Neue", Arial, Helvetica,
    sans-serif;
  margin-bottom: 7px;
  line-height: 1.6;
  max-width: 80%;
  padding: 13px 18px;
  border-radius: 18px;
  display: inline-block;
  clear: both;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(60, 60, 100, 0.06);
  font-size: 17px;
  position: relative;
  transition: background 0.2s;
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  animation: bubbleIn 0.35s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

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

.msg.user {
  color: #fff;
  background: linear-gradient(135deg, #231f20 60%, #bca16a 100%);
  align-self: flex-end;
  float: right;
  border-bottom-right-radius: 6px;
  border-top-right-radius: 6px;
  margin-left: 12%;
  margin-right: 0;
  text-align: right;
  font-weight: 500;
  letter-spacing: 0.2px;
  border: 1.5px solid #bca16a;
}

.msg.ai {
  color: #231f20;
  background: #fff;
  align-self: flex-start;
  float: left;
  border-bottom-left-radius: 6px;
  border-top-left-radius: 6px;
  margin-right: 12%;
  margin-left: 0;
  text-align: left;
  font-weight: 400;
  border: 1.5px solid #bca16a;
}

/* Style links and sources in AI messages */
.msg.ai a {
  color: #bca16a;
  text-decoration: underline;
  word-break: break-all;
  transition: color 0.2s;
  font-weight: 500;
}

.msg.ai a:hover {
  color: #231f20;
  text-decoration: underline;
}

.msg.ai ul,
.msg.ai ol {
  margin: 8px 0 8px 18px;
  padding: 0;
}

.msg.ai li {
  margin-bottom: 2px;
}

.msg.ai b,
.msg.ai strong {
  font-weight: bold;
  color: #bca16a;
}

.msg.ai u {
  text-decoration: underline;
}

/* input row */
.chat-form {
  display: flex;
  gap: 10px;
  padding: 14px 48px 14px 48px;
  background: #fff;
  border-top: 2px solid #e5e5e5;
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.chat-form input {
  font-family: "Montserrat", "Arial", "Helvetica Neue", Arial, Helvetica,
    sans-serif;
  flex: 1;
  padding: 13px 16px;
  border: 1.5px solid #bca16a;
  border-radius: 22px;
  font-size: 18px;
  background: #faf7f2;
  transition: border 0.2s;
  color: #231f20;
}

.chat-form input:focus {
  outline: none;
  border: 1.5px solid #231f20;
  background: #fff;
}

.chat-form button {
  font-family: "Montserrat", "Arial", "Helvetica Neue", Arial, Helvetica,
    sans-serif;
  font-size: 18px;
  background: linear-gradient(135deg, #bca16a 60%, #231f20 100%);
  color: #fff;
  border: none;
  padding: 0 0 0 2px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(60, 60, 100, 0.1);
}

.chat-form button .material-icons {
  font-size: 26px;
}

.chat-form button:hover {
  background: linear-gradient(135deg, #231f20 60%, #bca16a 100%);
  box-shadow: 0 4px 12px rgba(60, 60, 100, 0.13);
}

.chat-form button:focus {
  outline: 2px solid #bca16a;
  outline-offset: 2px;
}

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

/* footer */
.site-footer {
  font-family: "Montserrat", "Arial", "Helvetica Neue", Arial, Helvetica,
    sans-serif;
  margin: 0;
  padding: 24px 0 18px 0;
  text-align: center;
  font-size: 14px;
  color: #6d6a6a;
  background: #fff;
  border-top: 2px solid #e5e5e5;
}

.site-footer nav {
  margin-top: 12px;
}

.site-footer a {
  margin: 0 8px;
  color: #231f20;
  text-decoration: none;
  transition: color 0.2s;
  font-weight: 500;
}

.site-footer a:hover {
  color: #bca16a;
}

/* Responsive */
@media (max-width: 1000px) {
  .page-wrapper {
    max-width: 100vw;
    border-radius: 0;
    min-height: 100vh;
  }
  .chat-window {
    padding: 12px 8px 8px 8px;
  }
  .chat-form {
    padding: 8px 8px 8px 8px;
  }
}
