body {
  position: relative;
  background: url('./product.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  font-family: Arial, sans-serif;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height:100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(255,255,255,0.6); /* white overlay for strong fade */
  pointer-events: none;
  opacity: 0; /* overlay hidden by default */
  transition: opacity 0.2s;
}

/* Show overlay only when chatbot is open */
body.chatbot-active::before {
  opacity: 1;
}

/* Centered, larger chatbot window */
.chatbot {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 101;
  width: 85vw;         /* increased width */
  max-width: 900px;    /* increased max width */
  height: 90vh;        /* increased height */
  max-height: 900px;   /* increased max height */
  background: #fff;
  border-radius: 18px;
  border: 2.5px solid #2F7FBE; /* thicker, colored border */
  box-shadow:
    0 8px 32px rgba(30,144,232,0.18),
    0 0 0 4px rgba(47,127,190,0.08); /* window-like shadow and outline */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.2s, transform 0.2s;
}

.chatbot.hidden {
  display: none;
}

.chat-header {
  background: #2F7FBE;
  color: #fff;
  padding: 22px 0 18px 0;
  font-weight: bold;
  text-align: center;
  font-size: 1.35rem;
  letter-spacing: 1px;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  box-shadow: 0 2px 8px rgba(30,144,232,0.08);
  position: relative;
}

.chat-body {
  flex: 1;
  padding: 24px 22px 12px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f7fbff;
}

.message-row {
  display: flex;
  align-items: center;
}

.message-row.bot {
  justify-content: flex-start;
  align-items: flex-start; /* add this line */
  flex-shrink: 0;
}

.message-row.user {
  justify-content: flex-end;
  align-items: flex-end;   /* add this line */
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: none;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  margin: 0;
}

.message {
  background: #f2f8ff;
  color: #222;
  padding: 12px 18px;
  border-radius: 16px;
  max-width: 70%;
  width: auto;
  position: relative;
  font-size: 15px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  /* white-space: pre-wrap; */
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(30,144,232,0.06);
  /* overflow-x: auto; add this line */
}


.chart-container {
  margin-top: 15px;
  width: 100%;
  max-width: 600px;
  height: 520px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.bot-content {
  display: flex;
  flex-direction: column;
  max-width: 70%;
}

.bot .message {
  border-bottom-left-radius: 4px;
  background: #f2f8ff;
  margin-right: auto; /* add this line */
}

.user .message {
  background: linear-gradient(90deg, #1e90e8 0%, #00c6fb 100%);
  color: white;
  border-bottom-right-radius: 4px;
  margin-left: auto; /* add this line */
}

.time {
  font-size: 11px;
  color: #7da7d9;
  margin-top: 3px;
  margin-left: 8px;
}

.user .time {
  margin-left: 0;
  margin-right: 8px;
  text-align: right;
  display: block;
}

.bot .time {
  margin-left: 8px;
  margin-right: 0;
  text-align: left;
  display: block;
}

.chat-input {
  padding: 16px 22px;
  display: flex;
  align-items: center;
  border-top: 1px solid #eaf6ff;
  background: #f7fbff;
}

.chat-input input {
  flex: 1;
  padding: 12px 18px;
  border-radius: 20px;
  border: 1px solid #bfe3fc;
  outline: none;
  font-size: 15px;
  background: #fff;
  color: #222;
}

.chat-input input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-input button {
  background: linear-gradient(90deg, #1e90e8 0%, #00c6fb 100%);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 12px 18px;
  margin-left: 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(30,144,232,0.08);
  transition: background 0.2s;
}

.chat-input button:disabled {
  background: #bfe3fc;
  cursor: not-allowed;
  opacity: 0.6;
}

.chat-input button:disabled:hover {
  background: #bfe3fc;
}

.chat-input button:hover {
  background: linear-gradient(90deg, #007acc 0%, #00b6e8 100%);
}

.typing-indicator {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  background: #f2f8ff;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  max-width: 75%;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1e90e8;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Markdown formatting styles */
.message h2 {
  font-size: 16px;
  font-weight: bold;
  margin: 8px 0 4px 0;
  color: inherit;
}

.message h3 {
  font-size: 15px;
  font-weight: bold;
  margin: 6px 0 3px 0;
  color: inherit;
}

.message strong {
  font-weight: bold;
}

.message em {
  font-style: italic;
}

.message code {
  background: #eaf6ff;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.message li {
  margin: 2px 0;
  padding-left: 8px;
  list-style-position: inside;
}

.message ul, .message ol {
  margin: 4px 0;
  padding-left: 0;
}

.message p {
  margin: 0;
  padding: 0;
}

.message p:not(:last-child) {
  margin-bottom: 8px;
}

.chat-body .message .table-scroll {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.chat-body .message table {
  min-width: 400px;
  width: auto;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.97em;
  background: #f7f7f7;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(30,144,232,0.04);
  table-layout: auto;
  max-width: 100%;
}

.chat-body .message th,
.chat-body .message td {
  border: 1px solid #bfe3fc;
  padding: 8px 12px;
  text-align: left;
  word-break: break-word;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-body .message th {
  background: #eaf6ff;
  font-weight: bold;
  color: #1e90e8;
}

.chat-body .message tr:nth-child(even) td {
  background: #f2f8ff;
}

.chat-body .message tr:nth-child(odd) td {
  background: #fff;
}

/* Floating chatbot icon button */
#chatbotIconBtn {
  position: fixed;
  right: 32px;
  bottom: 32px;
  z-index: 100;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 32px;
  border: none;
  outline: none;
  background:none;
}

#chatbotIconBtn:hover {
  box-shadow: 0 8px 32px rgba(30,144,232,0.28);
}
