/* ✅ Unique Chatbot Widget Styling */
#chatbot-widget {
  position: fixed;
  bottom: 160px;
  right: 20px;
  z-index: 9999;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ✅ Chat Icon */
#chat-icon {
  width: 64px;
  height: 64px;
  padding: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  position: fixed;
  bottom: 100px;
  right: 20px;
  z-index: 999;
  animation: pulse 2.5s infinite;
}

#chat-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 123, 255, 0.5);
}

/* ✅ Chat Box Container */
#chat-box {
  width: 360px;
  max-width: 95vw;
  height: 500px;
  background: #cce0ff;
  border-radius: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  position: fixed;
  bottom: 160px;
  right: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeInUp 0.3s ease-out;
  z-index: 999;
}

#chat-box.maximized {
  width: 90%;
  height: 90%;
  max-width: none;
  max-height: none;
  bottom: 5%;
  right: 5%;
  border-radius: 12px;
  position: fixed;
  z-index: 10000;
}

#chat-box.hidden {
  display: none;
}

/* ✅ Chat Header */
#chat-header {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  padding: 14px;
  font-weight: 600;
  text-align: center;
  font-size: 17px;
  letter-spacing: 0.5px;
  position: relative;
}

#maximize-btn {
  position: absolute;
  right: 10px;
  top: 8px;
  background: none;
  border: none;
  font-size: 18px;
  color: white;
  cursor: pointer;
}

#close-btn {
  position: absolute;
  right: 40px;
  top: 8px;
  background: none;
  border: none;
  font-size: 18px;
  color: white;
  cursor: pointer;
}

/* ✅ Chat Log Area */
#chat-log {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: linear-gradient(to left, #dce6f2, #6699cc);
  color: #333;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

/* ✅ Message Bubble Common */
.chat-message {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 18px;
  line-height: 1.4;
  word-wrap: break-word;
  font-size: 14px;
}

/* ✅ Bot Messages */
.bot-message {
  background: #c8d9ff;
  color: #000;
  align-self: flex-start;
  border-top-left-radius: 0;
  padding: 8px 12px;
  box-shadow: 1px 1px 5px rgba(0,0,0,0.1);
  font-size: 14px; /* Google result style */
  font-family: Arial, sans-serif;
  line-height: 1.5;
}

/* ✅ User Messages */
.user-message {
  background: #007bff;
  color: #fff;
  align-self: flex-end;
  border-top-right-radius: 0;
}

/* ✅ Formula/Code Box Styling (Gemini Answer) */
.bot-message pre,
.bot-message code {
  display: block;
  background: #f8f9fa;
  border: 1px solid #dadce0;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 8px 0;
  color: #202124;
}

/* ✅ Single-line inline code (formula parts) */
.bot-message code {
  display: inline-block;
  background: #f1f3f4;
  padding: 2px 4px;
  border-radius: 4px;
}

/* ✅ Bold text normal banado */
.bot-message strong,
.bot-message b {
  font-weight: normal;
  font-size: 14px;
  color: inherit;
}

/* ✅ Chat Input Box */
#chat-input {
  border: none;
  padding: 12px;
  border-top: 1px solid #ddd;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  transition: background-color 0.3s ease;
}

#chat-input:focus {
  background-color: #eef6ff;
}

/* ✅ Animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 12px 12px rgba(0, 123, 255, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 123, 255, 0); }
}

/* ✅ Responsive Fix */
@media (max-width: 400px) {
  #chat-box {
    width: 95vw;
    height: 90vh;
    bottom: 100px;
  }
  #chat-box.maximized {
    width: 100vw;
    height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
  #chat-icon {
    bottom: 60px;
    right: 16px;
  }
}

#chatbot-widget .input-wrapper {
  position: relative;
  padding: 10px;
}

#chatbot-widget #chat-input {
  width: 100%;
  padding: 8px;
  box-sizing: border-box;
  position: relative;
  z-index: 2;
}

#chatbot-widget .suggestion-box {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background-color: #ffffff;
  border: 1px solid #dcdcdc;
  border-top: none;
  border-radius: 0 0 6px 6px;
  z-index: 999;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  display: none;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  transition: all 0.2s ease-in-out;
}

#chatbot-widget .suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 15px;
  color: #333333;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #f0f0f0;
}

#chatbot-widget .suggestion-item:last-child {
  border-bottom: none;
}

#chatbot-widget .suggestion-item:hover {
  background-color: #f5f5f5;
}

.chatbot-icon-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

#chat-input { 
  caret-color: #000000;
  color: #000;
  background-color: #eef6ff;
  cursor: text !important;
  user-select: text !important;
}
