#wptc-chat-widget {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 320px;
  max-height: 420px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  z-index: 10000;
  font-family: Arial, sans-serif;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  overflow: hidden;
}

#wptc-chat-widget.minimized {
  height: 40px;
  overflow: hidden;
}

#wptc-chat-widget header {
  background: #0073aa;
  color: white;
  font-weight: bold;
  text-align: left;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#wptc-chat-widget header .controls {
  display: flex;
  gap: 6px;
}

#wptc-chat-widget header button {
  background: transparent;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
}

#wptc-chat-log {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  max-height: 320px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth; /* Smooth scrolling */
  -webkit-overflow-scrolling: touch; /* Momentum scrolling on iOS/Android */
}

#wptc-chat-log .user,
#wptc-chat-log .bot {
  text-align: left;
  background: none;
  padding: 4px 0;
  border-radius: 0;
  color: #222;
}

#wptc-chat-log .bot.loading {
  font-style: italic;
  color: #555;
}

#wptc-chat-widget footer {
  padding: 8px 10px;
  border-top: 1px solid #ccc;
  display: flex;
}

#wptc-chat-input {
  flex: 1;
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#wptc-chat-send {
  background: #0073aa;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  margin-left: 6px;
  cursor: pointer;
  font-size: 18px;
  line-height: 40px;
}

#wptc-reopen-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #0073aa;
  color: white;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  text-align: center;
  line-height: 60px;
  font-size: 26px;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  display: none;
}

.katex { font-size: 1.1em; }
.katex-display { display: block; text-align: center; margin: 12px 0; padding: 6px 0; background: #fafafa; border-radius: 6px; overflow-x: auto; }
.katex-inline { padding: 0 2px; background: #fefefe; border-radius: 3px; }

@media (max-width: 480px) {
  #wptc-chat-widget {
    width: 90%;
    right: 5%;
    bottom: 80px;
  }

  #wptc-chat-log {
    max-height: 250px;
  }

  #wptc-reopen-button {
    width: 50px;
    height: 50px;
    font-size: 22px;
    line-height: 50px;
  }
}